From 4f4c5fcfdfe7d1eadce22a68929c82b6cb324075 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 16 Oct 2022 01:24:34 +0200 Subject: [PATCH] Use nullptr instead of NULL in the code and documentation This is a combination of running clang-tidy with modernize-use-nullptr check for some ports (GTK, X11, OSX) and manual changes to the ports for which it couldn't be used easily (MSW, DFB) and also manually updating the docs. Also replace NULL with null or nullptr in the comments as this is more consistent with the use of nullptr in the code and makes it simpler to grep for the remaining occurrences of NULL itself. And also use null in the assert messages. Only a few occurrences of "NULL" are still left in non-C files, mostly corresponding to unclear comments or string output which it might not be safe to change. --- build/bakefiles/wxpresets/sample/minimal.cpp | 2 +- demos/bombs/bombs.cpp | 10 +- demos/bombs/game.h | 2 +- demos/forty/game.cpp | 2 +- demos/forty/pile.cpp | 10 +- demos/fractal/fractal.cpp | 6 +- demos/life/dialogs.cpp | 2 +- demos/life/game.cpp | 28 +- demos/life/life.cpp | 8 +- demos/poem/wxpoem.cpp | 22 +- distrib/autopackage/sample/minimal.cpp | 2 +- .../how-to-add-class-documentation.md | 2 +- docs/doxygen/Doxyfile | 2 +- docs/doxygen/mainpages/samples.h | 2 +- docs/doxygen/overviews/app.h | 2 +- docs/doxygen/overviews/archive.h | 16 +- docs/doxygen/overviews/debugging.h | 4 +- docs/doxygen/overviews/helloworld.h | 4 +- docs/doxygen/overviews/ipc.h | 2 +- docs/doxygen/overviews/propgrid.h | 4 +- docs/doxygen/overviews/string.h | 10 +- docs/doxygen/overviews/xrc.h | 8 +- docs/qt/architecture.md | 2 +- include/wx/aboutdlg.h | 2 +- include/wx/accel.h | 8 +- include/wx/access.h | 6 +- include/wx/addremovectrl.h | 2 +- include/wx/affinematrix2dbase.h | 4 +- include/wx/any.h | 12 +- include/wx/anystr.h | 18 +- include/wx/app.h | 22 +- include/wx/appprogress.h | 2 +- include/wx/apptrait.h | 18 +- include/wx/archive.h | 18 +- include/wx/arrstr.h | 12 +- include/wx/artprov.h | 4 +- include/wx/aui/auibar.h | 6 +- include/wx/aui/auibook.h | 10 +- include/wx/aui/framemanager.h | 18 +- include/wx/aui/tabart.h | 6 +- include/wx/base64.h | 12 +- include/wx/bitmap.h | 4 +- include/wx/bmpbndl.h | 2 +- include/wx/bookctrl.h | 18 +- include/wx/buffer.h | 22 +- include/wx/busyinfo.h | 2 +- include/wx/button.h | 4 +- include/wx/calctrl.h | 8 +- include/wx/caret.h | 2 +- include/wx/clipbrd.h | 2 +- include/wx/clntdata.h | 8 +- include/wx/cmdargs.h | 8 +- include/wx/cmdline.h | 4 +- include/wx/cmdproc.h | 2 +- include/wx/colordlg.h | 4 +- include/wx/colour.h | 4 +- include/wx/combo.h | 10 +- include/wx/compositewin.h | 4 +- include/wx/confbase.h | 2 +- include/wx/containr.h | 4 +- include/wx/control.h | 4 +- include/wx/convauto.h | 4 +- include/wx/cpp.h | 4 +- include/wx/cshelp.h | 6 +- include/wx/ctrlsub.h | 8 +- include/wx/dataobj.h | 2 +- include/wx/dataview.h | 44 +- include/wx/datetime.h | 6 +- include/wx/dc.h | 34 +- include/wx/dcbuffer.h | 8 +- include/wx/dcgraph.h | 6 +- include/wx/dcmirror.h | 8 +- include/wx/dcscreen.h | 2 +- include/wx/dcsvg.h | 8 +- include/wx/debug.h | 28 +- include/wx/defs.h | 28 +- include/wx/dfb/bitmap.h | 2 +- include/wx/dfb/dc.h | 10 +- include/wx/dfb/dcclient.h | 2 +- include/wx/dfb/dfbptr.h | 6 +- include/wx/dfb/window.h | 10 +- include/wx/dfb/wrapdfb.h | 26 +- include/wx/dialog.h | 12 +- include/wx/dir.h | 4 +- include/wx/dirdlg.h | 2 +- include/wx/display.h | 2 +- include/wx/dlist.h | 68 ++-- include/wx/dnd.h | 4 +- include/wx/docview.h | 36 +- include/wx/dvrenderers.h | 2 +- include/wx/dynarray.h | 4 +- include/wx/dynlib.h | 34 +- include/wx/dynload.h | 12 +- include/wx/editlbox.h | 4 +- include/wx/event.h | 128 +++--- include/wx/eventfilter.h | 2 +- include/wx/evtloop.h | 10 +- include/wx/fdrepdlg.h | 2 +- include/wx/ffile.h | 8 +- include/wx/fileconf.h | 2 +- include/wx/filedlg.h | 14 +- include/wx/filename.h | 14 +- include/wx/filepicker.h | 2 +- include/wx/filesys.h | 8 +- include/wx/fontdlg.h | 4 +- include/wx/fontmap.h | 4 +- include/wx/fontutil.h | 2 +- include/wx/frame.h | 4 +- include/wx/gauge.h | 2 +- include/wx/gbsizer.h | 44 +- include/wx/gdiobj.h | 4 +- include/wx/generic/aboutdlgg.h | 8 +- include/wx/generic/activityindicator.h | 4 +- include/wx/generic/bmpcbox.h | 2 +- include/wx/generic/busyinfo.h | 2 +- include/wx/generic/calctrlg.h | 8 +- include/wx/generic/choicdgg.h | 40 +- include/wx/generic/collpaneg.h | 2 +- include/wx/generic/colrdlgg.h | 4 +- include/wx/generic/combo.h | 4 +- include/wx/generic/ctrlsub.h | 4 +- include/wx/generic/dataview.h | 4 +- include/wx/generic/dcpsg.h | 8 +- include/wx/generic/dirctrlg.h | 4 +- include/wx/generic/dragimgg.h | 6 +- include/wx/generic/grid.h | 60 +-- include/wx/generic/grideditors.h | 4 +- include/wx/generic/headerctrlg.h | 2 +- include/wx/generic/helpext.h | 10 +- include/wx/generic/laywin.h | 10 +- include/wx/generic/listctrl.h | 4 +- include/wx/generic/logg.h | 2 +- include/wx/generic/mdig.h | 4 +- include/wx/generic/msgdlgg.h | 2 +- include/wx/generic/notifmsg.h | 2 +- include/wx/generic/numdlgg.h | 2 +- include/wx/generic/printps.h | 6 +- include/wx/generic/private/animate.h | 4 +- include/wx/generic/private/grid.h | 4 +- include/wx/generic/private/listctrl.h | 12 +- include/wx/generic/private/markuptext.h | 2 +- include/wx/generic/private/richtooltip.h | 2 +- include/wx/generic/private/textmeasure.h | 8 +- include/wx/generic/prntdlgg.h | 6 +- include/wx/generic/progdlgg.h | 18 +- include/wx/generic/richmsgdlgg.h | 4 +- include/wx/generic/splitter.h | 8 +- include/wx/generic/srchctlg.h | 2 +- include/wx/generic/statline.h | 2 +- include/wx/generic/stattextg.h | 4 +- include/wx/generic/tabg.h | 4 +- include/wx/generic/textdlgg.h | 6 +- include/wx/generic/treectlg.h | 6 +- include/wx/generic/wizard.h | 8 +- include/wx/glcanvas.h | 8 +- include/wx/graphics.h | 14 +- include/wx/gtk/app.h | 2 +- include/wx/gtk/bitmap.h | 6 +- include/wx/gtk/bmpcbox.h | 2 +- include/wx/gtk/checklst.h | 2 +- include/wx/gtk/choice.h | 4 +- include/wx/gtk/clipbrd.h | 2 +- include/wx/gtk/clrpicker.h | 4 +- include/wx/gtk/colordlg.h | 4 +- include/wx/gtk/combobox.h | 4 +- include/wx/gtk/cursor.h | 4 +- include/wx/gtk/dataobj2.h | 2 +- include/wx/gtk/dataview.h | 6 +- include/wx/gtk/dc.h | 2 +- include/wx/gtk/dcclient.h | 6 +- include/wx/gtk/dnd.h | 4 +- include/wx/gtk/dvrenderer.h | 4 +- include/wx/gtk/filepicker.h | 16 +- include/wx/gtk/glcanvas.h | 4 +- include/wx/gtk/infobar.h | 2 +- include/wx/gtk/listbox.h | 4 +- include/wx/gtk/menu.h | 2 +- include/wx/gtk/menuitem.h | 4 +- include/wx/gtk/nonownedwnd.h | 4 +- include/wx/gtk/notebook.h | 2 +- include/wx/gtk/print.h | 24 +- include/wx/gtk/private/animate.h | 4 +- include/wx/gtk/private/error.h | 4 +- include/wx/gtk/private/eventsdisabler.h | 2 +- include/wx/gtk/private/gtk2-compat.h | 14 +- include/wx/gtk/private/gtk3-compat.h | 2 +- include/wx/gtk/private/image.h | 2 +- include/wx/gtk/private/log.h | 2 +- include/wx/gtk/private/mediactrl.h | 2 +- include/wx/gtk/private/stylecontext.h | 4 +- include/wx/gtk/private/textmeasure.h | 8 +- include/wx/gtk/private/treeview.h | 4 +- include/wx/gtk/private/webkit.h | 2 +- include/wx/gtk/radiobox.h | 4 +- include/wx/gtk/srchctrl.h | 2 +- include/wx/gtk/statbox.h | 4 +- include/wx/gtk/toolbar.h | 2 +- include/wx/gtk/toplevel.h | 4 +- include/wx/gtk/webview_webkit.h | 4 +- include/wx/gtk/window.h | 24 +- include/wx/hash.h | 2 +- include/wx/hashmap.h | 22 +- include/wx/headerctrl.h | 2 +- include/wx/helpbase.h | 10 +- include/wx/html/helpctrl.h | 8 +- include/wx/html/helpdata.h | 2 +- include/wx/html/helpdlg.h | 6 +- include/wx/html/helpfrm.h | 10 +- include/wx/html/helpwnd.h | 6 +- include/wx/html/htmlcell.h | 30 +- include/wx/html/htmlpars.h | 2 +- include/wx/html/htmltag.h | 2 +- include/wx/html/htmlwin.h | 8 +- include/wx/html/htmprint.h | 8 +- include/wx/html/winpars.h | 6 +- include/wx/htmllbox.h | 4 +- include/wx/image.h | 10 +- include/wx/imaggif.h | 2 +- include/wx/intl.h | 8 +- include/wx/ipcbase.h | 8 +- include/wx/itemid.h | 6 +- include/wx/list.h | 56 +-- include/wx/listbase.h | 18 +- include/wx/listbook.h | 2 +- include/wx/log.h | 26 +- include/wx/mdi.h | 24 +- include/wx/mediactrl.h | 18 +- include/wx/memory.h | 6 +- include/wx/menu.h | 36 +- include/wx/menuitem.h | 18 +- include/wx/mimetype.h | 15 +- include/wx/module.h | 2 +- include/wx/mousemanager.h | 2 +- include/wx/msgdlg.h | 2 +- include/wx/msgout.h | 2 +- include/wx/mstream.h | 4 +- include/wx/msw/anybutton.h | 6 +- include/wx/msw/app.h | 4 +- include/wx/msw/appprogress.h | 2 +- include/wx/msw/apptrait.h | 28 +- include/wx/msw/bitmap.h | 6 +- include/wx/msw/bmpcbox.h | 2 +- include/wx/msw/calctrl.h | 4 +- include/wx/msw/checkbox.h | 2 +- include/wx/msw/checklst.h | 4 +- include/wx/msw/choice.h | 4 +- include/wx/msw/colordlg.h | 4 +- include/wx/msw/combo.h | 2 +- include/wx/msw/combobox.h | 6 +- include/wx/msw/crashrpt.h | 6 +- include/wx/msw/custombgwin.h | 4 +- include/wx/msw/dc.h | 22 +- include/wx/msw/dcclient.h | 2 +- include/wx/msw/dcmemory.h | 4 +- include/wx/msw/dde.h | 4 +- include/wx/msw/debughlp.h | 2 +- include/wx/msw/dialog.h | 6 +- include/wx/msw/dib.h | 20 +- include/wx/msw/dragimag.h | 6 +- include/wx/msw/enhmeta.h | 6 +- include/wx/msw/evtloop.h | 6 +- include/wx/msw/font.h | 4 +- include/wx/msw/frame.h | 4 +- include/wx/msw/gdiimage.h | 10 +- include/wx/msw/glcanvas.h | 12 +- include/wx/msw/helpbest.h | 10 +- include/wx/msw/helpchm.h | 8 +- include/wx/msw/helpwin.h | 2 +- include/wx/msw/imaglist.h | 8 +- include/wx/msw/init.h | 8 +- include/wx/msw/listbox.h | 4 +- include/wx/msw/listctrl.h | 8 +- include/wx/msw/mdi.h | 4 +- include/wx/msw/menu.h | 8 +- include/wx/msw/menuitem.h | 4 +- include/wx/msw/metafile.h | 6 +- include/wx/msw/mfc.h | 4 +- include/wx/msw/msgdlg.h | 2 +- include/wx/msw/notebook.h | 4 +- include/wx/msw/ole/access.h | 2 +- include/wx/msw/ole/activex.h | 20 +- include/wx/msw/ole/automtn.h | 10 +- include/wx/msw/ole/comimpl.h | 10 +- include/wx/msw/ole/dataobj2.h | 2 +- include/wx/msw/ole/dropsrc.h | 4 +- include/wx/msw/ole/droptgt.h | 2 +- include/wx/msw/ole/oleutils.h | 10 +- include/wx/msw/ole/safearray.h | 8 +- include/wx/msw/ole/uuid.h | 2 +- include/wx/msw/ownerdrawnbutton.h | 2 +- include/wx/msw/popupwin.h | 2 +- include/wx/msw/printdlg.h | 10 +- include/wx/msw/printwin.h | 6 +- include/wx/msw/private.h | 42 +- include/wx/msw/private/comptr.h | 4 +- include/wx/msw/private/comstream.h | 2 +- include/wx/msw/private/cotaskmemptr.h | 6 +- include/wx/msw/private/customdraw.h | 2 +- include/wx/msw/private/event.h | 4 +- include/wx/msw/private/filedialog.h | 2 +- include/wx/msw/private/fswatcher.h | 16 +- include/wx/msw/private/hiddenwin.h | 2 +- include/wx/msw/private/keyboard.h | 4 +- include/wx/msw/private/msgdlg.h | 2 +- include/wx/msw/private/textmeasure.h | 8 +- include/wx/msw/private/webview_ie.h | 2 +- include/wx/msw/progdlg.h | 6 +- include/wx/msw/radiobox.h | 6 +- include/wx/msw/registry.h | 6 +- include/wx/msw/slider.h | 6 +- include/wx/msw/sound.h | 4 +- include/wx/msw/spinctrl.h | 4 +- include/wx/msw/stackwalk.h | 2 +- include/wx/msw/stattext.h | 2 +- include/wx/msw/statusbar.h | 6 +- include/wx/msw/subwin.h | 8 +- include/wx/msw/textentry.h | 2 +- include/wx/msw/tglbtn.h | 2 +- include/wx/msw/toolbar.h | 6 +- include/wx/msw/tooltip.h | 2 +- include/wx/msw/toplevel.h | 6 +- include/wx/msw/treectrl.h | 4 +- include/wx/msw/uxtheme.h | 2 +- include/wx/msw/webview_edge.h | 4 +- include/wx/msw/webview_ie.h | 2 +- include/wx/msw/window.h | 44 +- include/wx/msw/wrl/event.h | 2 +- include/wx/notebook.h | 2 +- include/wx/notifmsg.h | 10 +- include/wx/numformatter.h | 2 +- include/wx/object.h | 22 +- include/wx/odcombo.h | 2 +- include/wx/osx/appprogress.h | 2 +- include/wx/osx/bitmap.h | 4 +- include/wx/osx/checklst.h | 4 +- include/wx/osx/choice.h | 4 +- include/wx/osx/cocoa/dataview.h | 12 +- include/wx/osx/cocoa/private.h | 6 +- include/wx/osx/cocoa/private/markuptoattr.h | 2 +- include/wx/osx/colordlg.h | 4 +- include/wx/osx/combobox.h | 4 +- include/wx/osx/core/cfdataref.h | 4 +- include/wx/osx/core/cfdictionary.h | 2 +- include/wx/osx/core/cfref.h | 40 +- include/wx/osx/core/cfstring.h | 4 +- include/wx/osx/core/cftype.h | 4 +- include/wx/osx/core/dataview.h | 4 +- include/wx/osx/core/hid.h | 2 +- include/wx/osx/core/private.h | 20 +- include/wx/osx/dataview.h | 4 +- include/wx/osx/dcmemory.h | 2 +- include/wx/osx/dnd.h | 4 +- include/wx/osx/evtloopsrc.h | 2 +- include/wx/osx/glcanvas.h | 12 +- include/wx/osx/iphone/private.h | 4 +- include/wx/osx/listbox.h | 4 +- include/wx/osx/menu.h | 6 +- include/wx/osx/menuitem.h | 4 +- include/wx/osx/notebook.h | 2 +- include/wx/osx/printdlg.h | 8 +- include/wx/osx/printmac.h | 6 +- .../wx/osx/private/webrequest_urlsession.h | 2 +- include/wx/osx/radiobox.h | 4 +- include/wx/osx/radiobut.h | 2 +- include/wx/osx/sound.h | 2 +- include/wx/osx/statline.h | 4 +- include/wx/osx/textentry.h | 2 +- include/wx/osx/toolbar.h | 2 +- include/wx/osx/webview_webkit.h | 2 +- include/wx/osx/window.h | 14 +- include/wx/peninfobase.h | 2 +- include/wx/persist.h | 2 +- include/wx/persist/dataview.h | 6 +- include/wx/pickerbase.h | 6 +- include/wx/popupwin.h | 12 +- include/wx/printdlg.h | 4 +- include/wx/private/addremovectrl.h | 2 +- include/wx/private/display.h | 4 +- include/wx/private/extfield.h | 2 +- include/wx/private/fdiodispatcher.h | 6 +- include/wx/private/fileback.h | 4 +- include/wx/private/filename.h | 4 +- include/wx/private/fontmgr.h | 2 +- include/wx/private/graphics.h | 4 +- include/wx/private/localeset.h | 2 +- include/wx/private/markupparserattr.h | 2 +- include/wx/private/notifmsg.h | 2 +- include/wx/private/richtooltip.h | 2 +- include/wx/private/sckaddr.h | 6 +- include/wx/private/socket.h | 6 +- include/wx/private/streamtempinput.h | 8 +- include/wx/private/textmeasure.h | 24 +- include/wx/private/threadinfo.h | 4 +- include/wx/private/uilocale.h | 8 +- include/wx/private/wxprintf.h | 2 +- include/wx/prntbase.h | 30 +- include/wx/process.h | 8 +- include/wx/progdlg.h | 2 +- include/wx/propgrid/advprops.h | 2 +- include/wx/propgrid/editors.h | 10 +- include/wx/propgrid/manager.h | 12 +- include/wx/propgrid/property.h | 64 +-- include/wx/propgrid/propgrid.h | 62 +-- include/wx/propgrid/propgridiface.h | 54 +-- include/wx/propgrid/propgridpagestate.h | 26 +- include/wx/propgrid/props.h | 20 +- include/wx/protocol/protocol.h | 6 +- include/wx/qt/bitmap.h | 2 +- include/wx/qt/calctrl.h | 2 +- include/wx/qt/checklst.h | 4 +- include/wx/qt/choice.h | 4 +- include/wx/qt/colordlg.h | 4 +- include/wx/qt/combobox.h | 4 +- include/wx/qt/dataview.h | 4 +- include/wx/qt/dc.h | 6 +- include/wx/qt/dcprint.h | 6 +- include/wx/qt/dnd.h | 4 +- include/wx/qt/frame.h | 2 +- include/wx/qt/glcanvas.h | 8 +- include/wx/qt/listbox.h | 4 +- include/wx/qt/listctrl.h | 2 +- include/wx/qt/menuitem.h | 4 +- include/wx/qt/printdlg.h | 4 +- include/wx/qt/printqt.h | 6 +- include/wx/qt/private/pointer.h | 2 +- include/wx/qt/private/treeitemdelegate.h | 8 +- include/wx/qt/private/treeitemfactory.h | 6 +- include/wx/qt/private/winevent.h | 4 +- include/wx/qt/radiobox.h | 4 +- include/wx/qt/statusbar.h | 2 +- include/wx/qt/toolbar.h | 2 +- include/wx/qt/treectrl.h | 4 +- include/wx/qt/window.h | 16 +- include/wx/quantize.h | 4 +- include/wx/radiobox.h | 12 +- include/wx/rawbmp.h | 16 +- include/wx/rearrangectrl.h | 2 +- include/wx/regex.h | 2 +- include/wx/renderer.h | 14 +- include/wx/ribbon/bar.h | 4 +- include/wx/ribbon/buttonbar.h | 4 +- include/wx/ribbon/control.h | 2 +- include/wx/ribbon/gallery.h | 4 +- include/wx/ribbon/panel.h | 2 +- include/wx/ribbon/toolbar.h | 6 +- include/wx/richtext/richtextbuffer.h | 120 +++--- include/wx/richtext/richtextctrl.h | 62 +-- include/wx/richtext/richtextformatdlg.h | 4 +- include/wx/richtext/richtextprint.h | 2 +- include/wx/richtext/richtextstyledlg.h | 2 +- include/wx/richtext/richtextstyles.h | 18 +- include/wx/richtext/richtextuicustomization.h | 4 +- include/wx/richtooltip.h | 2 +- include/wx/rtti.h | 14 +- include/wx/sckipc.h | 4 +- include/wx/scopedarray.h | 12 +- include/wx/scopedptr.h | 22 +- include/wx/scopeguard.h | 2 +- include/wx/scrolwin.h | 6 +- include/wx/secretstore.h | 6 +- include/wx/selstore.h | 2 +- include/wx/settings.h | 4 +- include/wx/sharedptr.h | 22 +- include/wx/sizer.h | 40 +- include/wx/snglinst.h | 4 +- include/wx/socket.h | 2 +- include/wx/sstream.h | 2 +- include/wx/stackwalk.h | 4 +- include/wx/statusbr.h | 2 +- include/wx/stc/stc.h | 80 ++-- include/wx/strconv.h | 24 +- include/wx/stream.h | 12 +- include/wx/string.h | 84 ++-- include/wx/stringimpl.h | 2 +- include/wx/strvararg.h | 24 +- include/wx/tarstrm.h | 2 +- include/wx/taskbar.h | 4 +- include/wx/taskbarbutton.h | 8 +- include/wx/tbarbase.h | 34 +- include/wx/testing.h | 4 +- include/wx/textctrl.h | 6 +- include/wx/textentry.h | 4 +- include/wx/thread.h | 22 +- include/wx/thrimpl.cpp | 12 +- include/wx/time.h | 2 +- include/wx/timectrl.h | 4 +- include/wx/timer.h | 2 +- include/wx/tipwin.h | 8 +- include/wx/tls.h | 6 +- include/wx/toolbook.h | 2 +- include/wx/toplevel.h | 8 +- include/wx/tracker.h | 8 +- include/wx/translation.h | 22 +- include/wx/treebook.h | 6 +- include/wx/treectrl.h | 18 +- include/wx/treelist.h | 12 +- include/wx/uilocale.h | 8 +- include/wx/unichar.h | 2 +- include/wx/univ/anybutton.h | 2 +- include/wx/univ/checklst.h | 4 +- include/wx/univ/choice.h | 4 +- include/wx/univ/combobox.h | 4 +- include/wx/univ/inpcons.h | 6 +- include/wx/univ/listbox.h | 4 +- include/wx/univ/menu.h | 18 +- include/wx/univ/menuitem.h | 4 +- include/wx/univ/notebook.h | 2 +- include/wx/univ/radiobox.h | 4 +- include/wx/univ/renderer.h | 30 +- include/wx/univ/scrolbar.h | 2 +- include/wx/univ/scrthumb.h | 2 +- include/wx/univ/slider.h | 2 +- include/wx/univ/statusbr.h | 2 +- include/wx/univ/stdrend.h | 10 +- include/wx/univ/textctrl.h | 4 +- include/wx/univ/theme.h | 6 +- include/wx/univ/window.h | 16 +- include/wx/unix/apptbase.h | 2 +- include/wx/unix/apptrait.h | 6 +- include/wx/unix/evtloop.h | 2 +- include/wx/unix/fontutil.h | 2 +- include/wx/unix/glegl.h | 8 +- include/wx/unix/glx11.h | 4 +- include/wx/unix/private/displayx11.h | 2 +- include/wx/unix/private/epolldispatcher.h | 2 +- include/wx/unix/private/execute.h | 6 +- include/wx/unix/private/executeiohandler.h | 2 +- include/wx/unix/private/sockunix.h | 2 +- include/wx/unix/private/timer.h | 2 +- include/wx/unix/private/uilocale.h | 2 +- include/wx/unix/sound.h | 2 +- include/wx/unix/stackwalk.h | 4 +- include/wx/unix/utilsx11.h | 4 +- include/wx/utils.h | 52 +-- include/wx/valgen.h | 2 +- include/wx/validate.h | 4 +- include/wx/valnum.h | 8 +- include/wx/valtext.h | 4 +- include/wx/variant.h | 8 +- include/wx/variantbase.h | 12 +- include/wx/vlbox.h | 6 +- include/wx/weakref.h | 26 +- include/wx/webrequest.h | 6 +- include/wx/webview.h | 6 +- include/wx/window.h | 90 ++--- include/wx/windowptr.h | 2 +- include/wx/withimages.h | 10 +- include/wx/wizard.h | 24 +- include/wx/wupdlock.h | 2 +- include/wx/wxcrt.h | 46 +-- include/wx/wxcrtbase.h | 6 +- include/wx/x11/app.h | 2 +- include/wx/x11/bitmap.h | 2 +- include/wx/x11/dataobj2.h | 2 +- include/wx/x11/dcclient.h | 6 +- include/wx/x11/font.h | 4 +- include/wx/x11/glcanvas.h | 4 +- include/wx/x11/palette.h | 2 +- include/wx/x11/print.h | 4 +- include/wx/x11/window.h | 10 +- include/wx/xlocale.h | 8 +- include/wx/xml/xml.h | 16 +- include/wx/xrc/xh_bmpbt.h | 2 +- include/wx/xrc/xmlres.h | 58 +-- include/wx/xrc/xmlreshandler.h | 36 +- include/wx/xti.h | 66 +-- include/wx/xti2.h | 68 ++-- include/wx/xtictor.h | 168 ++++---- include/wx/xtihandler.h | 4 +- include/wx/xtiprop.h | 46 +-- include/wx/xtitypes.h | 38 +- include/wx/zipstrm.h | 6 +- interface/wx/aboutdlg.h | 4 +- interface/wx/accel.h | 4 +- interface/wx/access.h | 2 +- interface/wx/addremovectrl.h | 2 +- interface/wx/affinematrix2d.h | 2 +- interface/wx/affinematrix2dbase.h | 2 +- interface/wx/animate.h | 4 +- interface/wx/any.h | 2 +- interface/wx/app.h | 10 +- interface/wx/appprogress.h | 4 +- interface/wx/apptrait.h | 6 +- interface/wx/archive.h | 2 +- interface/wx/arrstr.h | 4 +- interface/wx/artprov.h | 4 +- interface/wx/aui/auibar.h | 2 +- interface/wx/aui/auibook.h | 8 +- interface/wx/aui/framemanager.h | 2 +- interface/wx/base64.h | 10 +- interface/wx/bitmap.h | 6 +- interface/wx/bmpbuttn.h | 4 +- interface/wx/bmpcbox.h | 2 +- interface/wx/bookctrl.h | 4 +- interface/wx/brush.h | 2 +- interface/wx/buffer.h | 10 +- interface/wx/busyinfo.h | 2 +- interface/wx/button.h | 2 +- interface/wx/calctrl.h | 8 +- interface/wx/checklst.h | 4 +- interface/wx/choicdlg.h | 32 +- interface/wx/choice.h | 4 +- interface/wx/clrpicker.h | 2 +- interface/wx/cmdline.h | 2 +- interface/wx/collpane.h | 2 +- interface/wx/colordlg.h | 6 +- interface/wx/combo.h | 4 +- interface/wx/combobox.h | 4 +- interface/wx/convauto.h | 4 +- interface/wx/cshelp.h | 4 +- interface/wx/cursor.h | 2 +- interface/wx/dataview.h | 44 +- interface/wx/datectrl.h | 2 +- interface/wx/datetime.h | 2 +- interface/wx/dc.h | 24 +- interface/wx/dcscreen.h | 2 +- interface/wx/dcsvg.h | 2 +- interface/wx/dialog.h | 2 +- interface/wx/dir.h | 2 +- interface/wx/dirdlg.h | 4 +- interface/wx/dnd.h | 10 +- interface/wx/docview.h | 10 +- interface/wx/dragimag.h | 4 +- interface/wx/dynlib.h | 2 +- interface/wx/event.h | 58 +-- interface/wx/fdrepdlg.h | 4 +- interface/wx/filectrl.h | 2 +- interface/wx/filedlg.h | 10 +- interface/wx/filedlgcustomize.h | 4 +- interface/wx/filefn.h | 6 +- interface/wx/filename.h | 6 +- interface/wx/filepicker.h | 4 +- interface/wx/fontpicker.h | 2 +- interface/wx/frame.h | 6 +- interface/wx/gbsizer.h | 16 +- interface/wx/generic/aboutdlgg.h | 6 +- interface/wx/generic/helpext.h | 8 +- interface/wx/glcanvas.h | 6 +- interface/wx/graphics.h | 8 +- interface/wx/grid.h | 36 +- interface/wx/hashmap.h | 2 +- interface/wx/help.h | 10 +- interface/wx/html/helpctrl.h | 6 +- interface/wx/html/helpdlg.h | 4 +- interface/wx/html/helpfrm.h | 8 +- interface/wx/html/helpwnd.h | 4 +- interface/wx/html/htmlcell.h | 4 +- interface/wx/html/htmltag.h | 2 +- interface/wx/html/htmlwin.h | 6 +- interface/wx/html/htmprint.h | 8 +- interface/wx/html/winpars.h | 4 +- interface/wx/htmllbox.h | 8 +- interface/wx/image.h | 6 +- interface/wx/init.h | 8 +- interface/wx/intl.h | 2 +- interface/wx/laywin.h | 8 +- interface/wx/listbox.h | 4 +- interface/wx/listctrl.h | 4 +- interface/wx/log.h | 6 +- interface/wx/mdi.h | 2 +- interface/wx/menu.h | 12 +- interface/wx/menuitem.h | 10 +- interface/wx/mimetype.h | 4 +- interface/wx/minifram.h | 2 +- interface/wx/msgdlg.h | 2 +- interface/wx/mstream.h | 2 +- interface/wx/msw/ole/activex.h | 4 +- interface/wx/msw/ole/automtn.h | 4 +- interface/wx/msw/ole/oleutils.h | 2 +- interface/wx/msw/ole/safearray.h | 2 +- interface/wx/nativewin.h | 2 +- interface/wx/notebook.h | 2 +- interface/wx/notifmsg.h | 4 +- interface/wx/numdlg.h | 2 +- interface/wx/object.h | 10 +- interface/wx/odcombo.h | 2 +- interface/wx/popupwin.h | 4 +- interface/wx/print.h | 8 +- interface/wx/printdlg.h | 4 +- interface/wx/process.h | 2 +- interface/wx/progdlg.h | 8 +- interface/wx/propgrid/advprops.h | 2 +- interface/wx/propgrid/editors.h | 2 +- interface/wx/propgrid/manager.h | 4 +- interface/wx/propgrid/property.h | 24 +- interface/wx/propgrid/propgrid.h | 4 +- interface/wx/propgrid/propgridiface.h | 8 +- interface/wx/propgrid/propgridpagestate.h | 6 +- interface/wx/propgrid/props.h | 8 +- interface/wx/protocol/protocol.h | 2 +- interface/wx/radiobox.h | 4 +- interface/wx/rearrangectrl.h | 4 +- interface/wx/renderer.h | 8 +- interface/wx/ribbon/art.h | 12 +- interface/wx/ribbon/bar.h | 4 +- interface/wx/ribbon/buttonbar.h | 10 +- interface/wx/ribbon/control.h | 6 +- interface/wx/ribbon/gallery.h | 16 +- interface/wx/ribbon/panel.h | 6 +- interface/wx/ribbon/toolbar.h | 12 +- interface/wx/richtext/richtextbuffer.h | 115 +++--- interface/wx/richtext/richtextctrl.h | 14 +- interface/wx/richtext/richtextprint.h | 2 +- interface/wx/richtext/richtextstyledlg.h | 2 +- interface/wx/richtext/richtextstyles.h | 6 +- interface/wx/richtooltip.h | 4 +- interface/wx/scopedarray.h | 10 +- interface/wx/scopedptr.h | 8 +- interface/wx/scopeguard.h | 6 +- interface/wx/scrolbar.h | 2 +- interface/wx/secretstore.h | 2 +- interface/wx/settings.h | 2 +- interface/wx/sharedptr.h | 4 +- interface/wx/sizer.h | 24 +- interface/wx/snglinst.h | 2 +- interface/wx/splash.h | 2 +- interface/wx/splitter.h | 6 +- interface/wx/sstream.h | 4 +- interface/wx/stackwalk.h | 2 +- interface/wx/statusbr.h | 2 +- interface/wx/stc/stc.h | 6 +- interface/wx/strconv.h | 20 +- interface/wx/stream.h | 8 +- interface/wx/string.h | 14 +- interface/wx/tarstrm.h | 2 +- interface/wx/taskbar.h | 2 +- interface/wx/taskbarbutton.h | 10 +- interface/wx/textctrl.h | 4 +- interface/wx/textdlg.h | 4 +- interface/wx/textentry.h | 2 +- interface/wx/textwrapper.h | 2 +- interface/wx/thread.h | 10 +- interface/wx/timectrl.h | 4 +- interface/wx/timer.h | 2 +- interface/wx/tipwin.h | 8 +- interface/wx/toolbar.h | 14 +- interface/wx/toplevel.h | 4 +- interface/wx/translation.h | 8 +- interface/wx/treebook.h | 2 +- interface/wx/treectrl.h | 10 +- interface/wx/treelist.h | 14 +- interface/wx/unichar.h | 2 +- interface/wx/utils.h | 44 +- interface/wx/valnum.h | 6 +- interface/wx/valtext.h | 2 +- interface/wx/weakref.h | 4 +- interface/wx/webrequest.h | 2 +- interface/wx/webview.h | 8 +- interface/wx/window.h | 36 +- interface/wx/windowptr.h | 2 +- interface/wx/withimages.h | 2 +- interface/wx/wizard.h | 12 +- interface/wx/wupdlock.h | 2 +- interface/wx/xml/xml.h | 10 +- interface/wx/xrc/xmlres.h | 10 +- interface/wx/zipstrm.h | 2 +- misc/languages/genlang.py | 4 +- samples/access/accesstest.cpp | 36 +- samples/animate/anitest.cpp | 2 +- samples/archive/archive.cpp | 6 +- samples/artprov/arttest.cpp | 2 +- samples/aui/auidemo.cpp | 10 +- samples/calendar/calendar.cpp | 14 +- samples/caret/caret.cpp | 4 +- samples/clipboard/clipboard.cpp | 2 +- samples/collpane/collpane.cpp | 2 +- samples/combo/combo.cpp | 4 +- samples/config/conftest.cpp | 10 +- samples/dataview/dataview.cpp | 20 +- samples/dataview/mymodels.cpp | 14 +- samples/debugrpt/debugrpt.cpp | 2 +- samples/dialogs/dialogs.cpp | 38 +- samples/dialup/nettest.cpp | 2 +- samples/display/display.cpp | 2 +- samples/dll/my_dll.cpp | 16 +- samples/dll/sdk_exe.cpp | 12 +- samples/dll/wx_exe.cpp | 2 +- samples/dnd/d_and_d.txt | 2 +- samples/dnd/dnd.cpp | 34 +- samples/docview/doc.cpp | 2 +- samples/docview/doc.h | 2 +- samples/docview/docview.cpp | 16 +- samples/docview/docview.h | 4 +- samples/docview/view.cpp | 12 +- samples/docview/view.h | 16 +- samples/dragimag/dragimag.cpp | 18 +- samples/drawing/drawing.cpp | 32 +- samples/erase/erase.cpp | 2 +- samples/event/event.cpp | 6 +- samples/event/gestures.cpp | 4 +- samples/except/except.cpp | 2 +- samples/exec/exec.cpp | 12 +- samples/font/font.cpp | 2 +- samples/fswatcher/fswatcher.cpp | 4 +- samples/grid/griddemo.cpp | 24 +- samples/help/demo.cpp | 4 +- samples/htlbox/htlbox.cpp | 6 +- samples/html/about/about.cpp | 2 +- samples/html/help/help.cpp | 6 +- samples/html/helpview/helpview.cpp | 2 +- samples/html/printing/printing.cpp | 2 +- samples/html/test/test.cpp | 4 +- samples/html/virtual/virtual.cpp | 2 +- samples/html/widget/widget.cpp | 2 +- samples/html/zip/zip.cpp | 2 +- samples/image/canvas.cpp | 2 +- samples/image/image.cpp | 6 +- samples/internat/internat.cpp | 4 +- samples/ipc/baseclient.cpp | 8 +- samples/ipc/baseserver.cpp | 8 +- samples/ipc/client.cpp | 30 +- samples/ipc/client.h | 4 +- samples/ipc/server.cpp | 14 +- samples/ipc/server.h | 2 +- samples/joytest/joytest.cpp | 4 +- samples/keyboard/keyboard.cpp | 6 +- samples/layout/expt.cpp | 6 +- samples/layout/layout.cpp | 2 +- samples/listctrl/listtest.cpp | 8 +- samples/mdi/mdi.cpp | 4 +- samples/mediaplayer/mediaplayer.cpp | 2 +- samples/memcheck/memcheck.cpp | 2 +- samples/menu/menu.cpp | 20 +- samples/mfc/mfctest.cpp | 8 +- samples/nativdlg/nativdlg.cpp | 4 +- samples/notebook/notebook.cpp | 14 +- samples/oleauto/oleauto.cpp | 2 +- samples/opengl/cube/cube.cpp | 4 +- samples/opengl/cube/cube.h | 4 +- samples/opengl/isosurf/isosurf.cpp | 6 +- samples/opengl/isosurf/isosurf.h | 2 +- samples/opengl/penguin/penguin.cpp | 4 +- samples/opengl/pyramid/oglpfuncs.cpp | 66 +-- samples/opengl/pyramid/oglstuff.cpp | 26 +- samples/opengl/pyramid/oglstuff.h | 4 +- samples/opengl/pyramid/pyramid.cpp | 26 +- samples/opengl/pyramid/pyramid.h | 2 +- samples/ownerdrw/ownerdrw.cpp | 2 +- samples/popup/popup.cpp | 10 +- samples/power/power.cpp | 4 +- samples/preferences/preferences.cpp | 2 +- samples/printing/printing.cpp | 8 +- samples/propgrid/propgrid.cpp | 14 +- samples/propgrid/propgrid_minimal.cpp | 2 +- samples/propgrid/sampleprops.cpp | 2 +- samples/propgrid/tests.cpp | 14 +- samples/regtest/regtest.cpp | 46 +-- samples/render/renddll.cpp | 2 +- samples/render/render.cpp | 12 +- samples/ribbon/ribbondemo.cpp | 28 +- samples/richtext/richtext.cpp | 24 +- samples/sashtest/sashtest.cpp | 6 +- samples/scroll/scroll.cpp | 20 +- samples/shaped/shaped.cpp | 2 +- samples/sockets/baseclient.cpp | 4 +- samples/sockets/baseserver.cpp | 10 +- samples/sockets/client.cpp | 4 +- samples/sockets/server.cpp | 2 +- samples/sound/sound.cpp | 6 +- samples/splash/splash.cpp | 2 +- samples/splitter/splitter.cpp | 14 +- samples/statbar/statbar.cpp | 22 +- samples/stc/edit.cpp | 4 +- samples/stc/prefs.cpp | 182 ++++----- samples/stc/stctest.cpp | 14 +- samples/svg/svgtest.cpp | 2 +- samples/taborder/taborder.cpp | 4 +- samples/taskbar/tbtest.cpp | 4 +- samples/taskbarbutton/taskbarbutton.cpp | 8 +- samples/text/text.cpp | 8 +- samples/thread/thread.cpp | 20 +- samples/toolbar/toolbar.cpp | 20 +- samples/treectrl/treetest.cpp | 18 +- samples/treelist/treelist.cpp | 2 +- samples/typetest/typetest.cpp | 2 +- samples/typetest/typetest.h | 2 +- samples/uiaction/uiaction.cpp | 2 +- samples/validate/validate.cpp | 2 +- samples/vscroll/vstest.cpp | 4 +- samples/webrequest/webrequest.cpp | 2 +- samples/webview/webview.cpp | 2 +- samples/widgets/activityindicator.cpp | 4 +- samples/widgets/bmpcombobox.cpp | 14 +- samples/widgets/button.cpp | 20 +- samples/widgets/choice.cpp | 8 +- samples/widgets/clrpicker.cpp | 2 +- samples/widgets/combobox.cpp | 8 +- samples/widgets/dirctrl.cpp | 2 +- samples/widgets/dirpicker.cpp | 2 +- samples/widgets/filepicker.cpp | 2 +- samples/widgets/fontpicker.cpp | 2 +- samples/widgets/gauge.cpp | 8 +- samples/widgets/headerctrl.cpp | 4 +- samples/widgets/listbox.cpp | 14 +- samples/widgets/native.cpp | 4 +- samples/widgets/notebook.cpp | 12 +- samples/widgets/odcombobox.cpp | 12 +- samples/widgets/radiobox.cpp | 12 +- samples/widgets/searchctrl.cpp | 4 +- samples/widgets/slider.cpp | 8 +- samples/widgets/spinbtn.cpp | 20 +- samples/widgets/statbmp.cpp | 2 +- samples/widgets/static.cpp | 16 +- samples/widgets/textctrl.cpp | 12 +- samples/widgets/toggle.cpp | 14 +- samples/widgets/widgets.cpp | 28 +- samples/widgets/widgets.h | 12 +- samples/wizard/wizard.cpp | 2 +- samples/wrapsizer/wrapsizer.cpp | 2 +- samples/xrc/custclas.h | 2 +- samples/xrc/myframe.cpp | 8 +- samples/xrc/myframe.h | 2 +- samples/xrc/xrcdemo.cpp | 4 +- samples/xti/classlist.cpp | 16 +- samples/xti/xti.cpp | 16 +- src/aui/auibar.cpp | 104 ++--- src/aui/auibook.cpp | 78 ++-- src/aui/barartmsw.cpp | 30 +- src/aui/dockart.cpp | 18 +- src/aui/floatpane.cpp | 2 +- src/aui/framemanager.cpp | 108 ++--- src/aui/tabart.cpp | 8 +- src/aui/tabartgtk.cpp | 24 +- src/aui/tabartmsw.cpp | 22 +- src/aui/tabmdi.cpp | 46 +-- src/common/accelcmn.cpp | 6 +- src/common/animatecmn.cpp | 6 +- src/common/any.cpp | 6 +- src/common/appbase.cpp | 38 +- src/common/appcmn.cpp | 18 +- src/common/arcfind.cpp | 2 +- src/common/archive.cpp | 4 +- src/common/arrstr.cpp | 8 +- src/common/artprov.cpp | 4 +- src/common/base64.cpp | 6 +- src/common/bmpbase.cpp | 8 +- src/common/bmpbndl.cpp | 16 +- src/common/bookctrl.cpp | 14 +- src/common/btncmn.cpp | 2 +- src/common/cairo.cpp | 62 +-- src/common/clipcmn.cpp | 2 +- src/common/clntdata.cpp | 10 +- src/common/cmdline.cpp | 14 +- src/common/cmdproc.cpp | 8 +- src/common/cmndata.cpp | 14 +- src/common/colourcmn.cpp | 2 +- src/common/combocmn.cpp | 34 +- src/common/config.cpp | 20 +- src/common/containr.cpp | 28 +- src/common/convauto.cpp | 10 +- src/common/cshelp.cpp | 12 +- src/common/ctrlsub.cpp | 12 +- src/common/datavcmn.cpp | 88 ++-- src/common/datetime.cpp | 8 +- src/common/datetimefmt.cpp | 26 +- src/common/datstrm.cpp | 2 +- src/common/dcbase.cpp | 16 +- src/common/dcbufcmn.cpp | 4 +- src/common/dcgraph.cpp | 30 +- src/common/dcsvg.cpp | 10 +- src/common/debugrpt.cpp | 2 +- src/common/dircmn.cpp | 2 +- src/common/dlgcmn.cpp | 30 +- src/common/dobjcmn.cpp | 40 +- src/common/docview.cpp | 92 ++--- src/common/dpycmn.cpp | 8 +- src/common/dynlib.cpp | 10 +- src/common/dynload.cpp | 18 +- src/common/encconv.cpp | 30 +- src/common/event.cpp | 74 ++-- src/common/evtloopcmn.cpp | 6 +- src/common/fdiodispatcher.cpp | 8 +- src/common/ffile.cpp | 4 +- src/common/file.cpp | 6 +- src/common/fileback.cpp | 4 +- src/common/fileconf.cpp | 106 ++--- src/common/filefn.cpp | 42 +- src/common/filename.cpp | 62 +-- src/common/filesys.cpp | 20 +- src/common/filtfind.cpp | 2 +- src/common/fldlgcmn.cpp | 20 +- src/common/fmapbase.cpp | 182 ++++----- src/common/fontcmn.cpp | 2 +- src/common/fontmap.cpp | 6 +- src/common/fontmgrcmn.cpp | 14 +- src/common/framecmn.cpp | 32 +- src/common/fs_arc.cpp | 48 +-- src/common/fs_filter.cpp | 10 +- src/common/fs_inet.cpp | 6 +- src/common/fs_mem.cpp | 2 +- src/common/fswatchercmn.cpp | 4 +- src/common/ftp.cpp | 24 +- src/common/gaugecmn.cpp | 4 +- src/common/gbsizer.cpp | 44 +- src/common/gdicmn.cpp | 18 +- src/common/gifdecod.cpp | 4 +- src/common/graphcmn.cpp | 8 +- src/common/hash.cpp | 50 +-- src/common/http.cpp | 10 +- src/common/iconbndl.cpp | 2 +- src/common/imagbmp.cpp | 10 +- src/common/image.cpp | 80 ++-- src/common/imagiff.cpp | 14 +- src/common/imagjpeg.cpp | 10 +- src/common/imagpcx.cpp | 4 +- src/common/imagpng.cpp | 46 +-- src/common/imagtga.cpp | 2 +- src/common/imagtiff.cpp | 4 +- src/common/init.cpp | 30 +- src/common/intl.cpp | 24 +- src/common/ipcbase.cpp | 6 +- src/common/languageinfo.cpp | 4 +- src/common/layout.cpp | 4 +- src/common/list.cpp | 48 +-- src/common/listctrlcmn.cpp | 8 +- src/common/log.cpp | 12 +- src/common/lzmastream.cpp | 8 +- src/common/mediactrlcmn.cpp | 14 +- src/common/memory.cpp | 28 +- src/common/menucmn.cpp | 74 ++-- src/common/mimecmn.cpp | 20 +- src/common/mousemanager.cpp | 2 +- src/common/msgout.cpp | 4 +- src/common/mstream.cpp | 4 +- src/common/object.cpp | 32 +- src/common/overlaycmn.cpp | 4 +- src/common/paper.cpp | 10 +- src/common/persist.cpp | 4 +- src/common/pickerbase.cpp | 4 +- src/common/popupcmn.cpp | 24 +- src/common/preferencescmn.cpp | 2 +- src/common/prntbase.cpp | 62 +-- src/common/process.cpp | 10 +- src/common/protocol.cpp | 8 +- src/common/quantize.cpp | 28 +- src/common/radiobtncmn.cpp | 16 +- src/common/rearrangectrl.cpp | 4 +- src/common/regex.cpp | 20 +- src/common/rendcmn.cpp | 12 +- src/common/sckaddr.cpp | 20 +- src/common/sckfile.cpp | 4 +- src/common/sckipc.cpp | 42 +- src/common/secretstore.cpp | 4 +- src/common/selectdispatcher.cpp | 4 +- src/common/sizer.cpp | 78 ++-- src/common/socket.cpp | 44 +- src/common/socketiohandler.cpp | 2 +- src/common/sstream.cpp | 4 +- src/common/statbar.cpp | 6 +- src/common/statboxcmn.cpp | 2 +- src/common/stdstream.cpp | 8 +- src/common/strconv.cpp | 92 ++--- src/common/stream.cpp | 42 +- src/common/string.cpp | 42 +- src/common/stringimpl.cpp | 12 +- src/common/stringops.cpp | 8 +- src/common/strvararg.cpp | 14 +- src/common/tarstrm.cpp | 28 +- src/common/tbarbase.cpp | 32 +- src/common/textentrycmn.cpp | 4 +- src/common/textmeasurecmn.cpp | 6 +- src/common/threadinfo.cpp | 2 +- src/common/time.cpp | 8 +- src/common/timercmn.cpp | 4 +- src/common/timerimpl.cpp | 2 +- src/common/toplvcmn.cpp | 8 +- src/common/translation.cpp | 164 ++++---- src/common/treebase.cpp | 2 +- src/common/txtstrm.cpp | 2 +- src/common/uiactioncmn.cpp | 2 +- src/common/uilocale.cpp | 18 +- src/common/unictabl.inc | 2 +- src/common/url.cpp | 22 +- src/common/utilscmn.cpp | 34 +- src/common/valgen.cpp | 16 +- src/common/validate.cpp | 2 +- src/common/valnum.cpp | 2 +- src/common/valtext.cpp | 2 +- src/common/variant.cpp | 8 +- src/common/webrequest.cpp | 14 +- src/common/webrequest_curl.cpp | 22 +- src/common/webview.cpp | 6 +- src/common/webviewarchivehandler.cpp | 6 +- src/common/wfstream.cpp | 8 +- src/common/wincmn.cpp | 150 +++---- src/common/windowid.cpp | 2 +- src/common/wrapsizer.cpp | 16 +- src/common/wxcrt.cpp | 42 +- src/common/wxprintf.cpp | 2 +- src/common/xlocale.cpp | 22 +- src/common/xpmdecod.cpp | 18 +- src/common/xti.cpp | 44 +- src/common/xtistrm.cpp | 36 +- src/common/xtixml.cpp | 8 +- src/common/zipstrm.cpp | 94 ++--- src/common/zstream.cpp | 20 +- src/dfb/app.cpp | 2 +- src/dfb/bitmap.cpp | 46 +-- src/dfb/dc.cpp | 12 +- src/dfb/dcclient.cpp | 2 +- src/dfb/dcmemory.cpp | 2 +- src/dfb/font.cpp | 4 +- src/dfb/fontmgr.cpp | 2 +- src/dfb/nonownedwnd.cpp | 10 +- src/dfb/overlay.cpp | 10 +- src/dfb/pen.cpp | 8 +- src/dfb/region.cpp | 4 +- src/dfb/settings.cpp | 4 +- src/dfb/window.cpp | 26 +- src/dfb/wrapdfb.cpp | 16 +- src/generic/aboutdlgg.cpp | 2 +- src/generic/accel.cpp | 8 +- src/generic/animateg.cpp | 6 +- src/generic/bmpcboxg.cpp | 2 +- src/generic/busyinfo.cpp | 2 +- src/generic/buttonbar.cpp | 16 +- src/generic/calctrlg.cpp | 24 +- src/generic/caret.cpp | 8 +- src/generic/choicdgg.cpp | 4 +- src/generic/collpaneg.cpp | 8 +- src/generic/colrdlgg.cpp | 6 +- src/generic/combog.cpp | 2 +- src/generic/datavgen.cpp | 184 ++++----- src/generic/datectlg.cpp | 10 +- src/generic/dbgrptg.cpp | 5 +- src/generic/dcpsg.cpp | 22 +- src/generic/dirctrlg.cpp | 16 +- src/generic/dirdlgg.cpp | 4 +- src/generic/dragimgg.cpp | 16 +- src/generic/fdrepdlg.cpp | 8 +- src/generic/filectrlg.cpp | 2 +- src/generic/filedlgg.cpp | 8 +- src/generic/fontdlgg.cpp | 6 +- src/generic/graphicc.cpp | 130 +++--- src/generic/grid.cpp | 204 +++++----- src/generic/grideditors.cpp | 12 +- src/generic/helpext.cpp | 2 +- src/generic/htmllbox.cpp | 18 +- src/generic/imaglist.cpp | 2 +- src/generic/infobar.cpp | 6 +- src/generic/laywin.cpp | 10 +- src/generic/listctrl.cpp | 64 +-- src/generic/logg.cpp | 20 +- src/generic/markuptext.cpp | 2 +- src/generic/mdig.cpp | 24 +- src/generic/msgdlgg.cpp | 2 +- src/generic/notebook.cpp | 8 +- src/generic/notifmsgg.cpp | 6 +- src/generic/odcombo.cpp | 12 +- src/generic/paletteg.cpp | 4 +- src/generic/preferencesg.cpp | 8 +- src/generic/printps.cpp | 6 +- src/generic/prntdlgg.cpp | 10 +- src/generic/progdlgg.cpp | 20 +- src/generic/propdlg.cpp | 6 +- src/generic/regiong.cpp | 18 +- src/generic/renderg.cpp | 6 +- src/generic/richtooltipg.cpp | 2 +- src/generic/rowheightcache.cpp | 2 +- src/generic/sashwin.cpp | 4 +- src/generic/scrlwing.cpp | 14 +- src/generic/selstore.cpp | 10 +- src/generic/spinctlg.cpp | 12 +- src/generic/splash.cpp | 2 +- src/generic/splitter.cpp | 20 +- src/generic/srchctlg.cpp | 10 +- src/generic/statline.cpp | 2 +- src/generic/stattextg.cpp | 2 +- src/generic/statusbr.cpp | 10 +- src/generic/tabg.cpp | 28 +- src/generic/timectrlg.cpp | 4 +- src/generic/timer.cpp | 16 +- src/generic/tipwin.cpp | 6 +- src/generic/treebkg.cpp | 4 +- src/generic/treectlg.cpp | 118 +++--- src/generic/treelist.cpp | 46 +-- src/generic/vlbox.cpp | 2 +- src/generic/vscroll.cpp | 6 +- src/generic/wizard.cpp | 18 +- src/gtk/aboutdlg.cpp | 34 +- src/gtk/activityindicator.cpp | 4 +- src/gtk/animate.cpp | 40 +- src/gtk/anybutton.cpp | 6 +- src/gtk/app.cpp | 30 +- src/gtk/artgtk.cpp | 8 +- src/gtk/assertdlg_gtk.cpp | 48 +-- src/gtk/bitmap.cpp | 132 +++--- src/gtk/bmpcbox.cpp | 4 +- src/gtk/brush.cpp | 2 +- src/gtk/button.cpp | 20 +- src/gtk/calctrl.cpp | 6 +- src/gtk/checkbox.cpp | 10 +- src/gtk/checklst.cpp | 16 +- src/gtk/choice.cpp | 34 +- src/gtk/clipbrd.cpp | 22 +- src/gtk/clrpicker.cpp | 2 +- src/gtk/collpane.cpp | 2 +- src/gtk/colordlg.cpp | 6 +- src/gtk/colour.cpp | 8 +- src/gtk/combobox.cpp | 6 +- src/gtk/control.cpp | 20 +- src/gtk/cursor.cpp | 16 +- src/gtk/dataobj.cpp | 22 +- src/gtk/dataview.cpp | 320 +++++++-------- src/gtk/dc.cpp | 30 +- src/gtk/dcclient.cpp | 114 +++--- src/gtk/dcmemory.cpp | 2 +- src/gtk/dialog.cpp | 4 +- src/gtk/dirdlg.cpp | 4 +- src/gtk/display.cpp | 4 +- src/gtk/dnd.cpp | 52 +-- src/gtk/evtloop.cpp | 8 +- src/gtk/filectrl.cpp | 4 +- src/gtk/filedlg.cpp | 10 +- src/gtk/filehistory.cpp | 2 +- src/gtk/filepicker.cpp | 14 +- src/gtk/font.cpp | 10 +- src/gtk/fontdlg.cpp | 8 +- src/gtk/frame.cpp | 22 +- src/gtk/glcanvas.cpp | 2 +- src/gtk/gnome/gvfs.cpp | 2 +- src/gtk/hyperlink.cpp | 8 +- src/gtk/image_gtk.cpp | 14 +- src/gtk/infobar.cpp | 12 +- src/gtk/listbox.cpp | 62 +-- src/gtk/mdi.cpp | 30 +- src/gtk/menu.cpp | 50 +-- src/gtk/minifram.cpp | 12 +- src/gtk/msgdlg.cpp | 6 +- src/gtk/nativewin.cpp | 10 +- src/gtk/nonownedwnd.cpp | 10 +- src/gtk/notebook.cpp | 38 +- src/gtk/notifmsg.cpp | 4 +- src/gtk/overlay.cpp | 22 +- src/gtk/pen.cpp | 6 +- src/gtk/popupwin.cpp | 4 +- src/gtk/print.cpp | 56 +-- src/gtk/private.cpp | 32 +- src/gtk/radiobox.cpp | 32 +- src/gtk/radiobut.cpp | 10 +- src/gtk/region.cpp | 30 +- src/gtk/renderer.cpp | 90 ++--- src/gtk/scrolbar.cpp | 4 +- src/gtk/scrolwin.cpp | 10 +- src/gtk/settings.cpp | 122 +++--- src/gtk/slider.cpp | 20 +- src/gtk/spinbutt.cpp | 20 +- src/gtk/spinctrl.cpp | 32 +- src/gtk/srchctrl.cpp | 12 +- src/gtk/statbox.cpp | 12 +- src/gtk/stattext.cpp | 8 +- src/gtk/taskbar.cpp | 30 +- src/gtk/textctrl.cpp | 120 +++--- src/gtk/textentry.cpp | 34 +- src/gtk/textmeasure.cpp | 12 +- src/gtk/tglbtn.cpp | 8 +- src/gtk/toolbar.cpp | 34 +- src/gtk/tooltip.cpp | 10 +- src/gtk/toplevel.cpp | 62 +-- src/gtk/utilsgtk.cpp | 12 +- src/gtk/webview_webkit.cpp | 22 +- src/gtk/webview_webkit2.cpp | 68 ++-- src/gtk/webview_webkit2_extension.cpp | 38 +- src/gtk/win_gtk.cpp | 20 +- src/gtk/window.cpp | 328 +++++++-------- src/html/chm.cpp | 38 +- src/html/helpctrl.cpp | 38 +- src/html/helpdata.cpp | 40 +- src/html/helpdlg.cpp | 4 +- src/html/helpfrm.cpp | 4 +- src/html/helpwnd.cpp | 86 ++-- src/html/htmlcell.cpp | 50 +-- src/html/htmlfilt.cpp | 4 +- src/html/htmlpars.cpp | 40 +- src/html/htmltag.cpp | 12 +- src/html/htmlwin.cpp | 70 ++-- src/html/htmprint.cpp | 14 +- src/html/m_dflist.cpp | 4 +- src/html/m_image.cpp | 24 +- src/html/m_layout.cpp | 12 +- src/html/m_list.cpp | 8 +- src/html/m_tables.cpp | 10 +- src/html/winpars.cpp | 32 +- src/msw/anybutton.cpp | 22 +- src/msw/app.cpp | 14 +- src/msw/appprogress.cpp | 2 +- src/msw/artmsw.cpp | 8 +- src/msw/basemsw.cpp | 6 +- src/msw/bitmap.cpp | 72 ++-- src/msw/bmpbndl.cpp | 4 +- src/msw/bmpcbox.cpp | 2 +- src/msw/brush.cpp | 10 +- src/msw/button.cpp | 10 +- src/msw/calctrl.cpp | 4 +- src/msw/checklst.cpp | 2 +- src/msw/choice.cpp | 6 +- src/msw/clipbrd.cpp | 26 +- src/msw/colordlg.cpp | 4 +- src/msw/combo.cpp | 8 +- src/msw/combobox.cpp | 6 +- src/msw/control.cpp | 2 +- src/msw/crashrpt.cpp | 12 +- src/msw/cursor.cpp | 12 +- src/msw/datetimectrl.cpp | 6 +- src/msw/dc.cpp | 64 +-- src/msw/dcclient.cpp | 6 +- src/msw/dcmemory.cpp | 14 +- src/msw/dcprint.cpp | 30 +- src/msw/dcscreen.cpp | 2 +- src/msw/dde.cpp | 78 ++-- src/msw/debughlp.cpp | 14 +- src/msw/dialog.cpp | 6 +- src/msw/dialup.cpp | 40 +- src/msw/dib.cpp | 28 +- src/msw/dir.cpp | 8 +- src/msw/dirdlg.cpp | 10 +- src/msw/display.cpp | 32 +- src/msw/dlmsw.cpp | 14 +- src/msw/dragimag.cpp | 6 +- src/msw/enhmeta.cpp | 24 +- src/msw/evtloop.cpp | 8 +- src/msw/evtloopconsole.cpp | 2 +- src/msw/fdrepdlg.cpp | 8 +- src/msw/filedlg.cpp | 26 +- src/msw/font.cpp | 12 +- src/msw/fontdlg.cpp | 2 +- src/msw/fontenum.cpp | 4 +- src/msw/fontutil.cpp | 2 +- src/msw/frame.cpp | 16 +- src/msw/fswatcher.cpp | 8 +- src/msw/gdiimage.cpp | 30 +- src/msw/gdiplus.cpp | 6 +- src/msw/glcanvas.cpp | 28 +- src/msw/graphics.cpp | 104 ++--- src/msw/graphicsd2d.cpp | 184 ++++----- src/msw/headerctrl.cpp | 18 +- src/msw/helpbest.cpp | 4 +- src/msw/helpchm.cpp | 20 +- src/msw/icon.cpp | 4 +- src/msw/imaglist.cpp | 6 +- src/msw/iniconf.cpp | 24 +- src/msw/joystick.cpp | 8 +- src/msw/listbox.cpp | 12 +- src/msw/listctrl.cpp | 38 +- src/msw/main.cpp | 12 +- src/msw/mdi.cpp | 54 +-- src/msw/mediactrl_am.cpp | 24 +- src/msw/mediactrl_qt.cpp | 34 +- src/msw/mediactrl_wmp10.cpp | 22 +- src/msw/menu.cpp | 24 +- src/msw/menuitem.cpp | 66 +-- src/msw/metafile.cpp | 16 +- src/msw/mimetype.cpp | 12 +- src/msw/msgdlg.cpp | 20 +- src/msw/nativdlg.cpp | 10 +- src/msw/nonownedwnd.cpp | 12 +- src/msw/notebook.cpp | 24 +- src/msw/notifmsg.cpp | 8 +- src/msw/ole/access.cpp | 106 ++--- src/msw/ole/activex.cpp | 68 ++-- src/msw/ole/automtn.cpp | 42 +- src/msw/ole/dataobj.cpp | 46 +-- src/msw/ole/dropsrc.cpp | 4 +- src/msw/ole/droptgt.cpp | 24 +- src/msw/ole/oleutils.cpp | 10 +- src/msw/ole/safearray.cpp | 6 +- src/msw/ole/uuid.cpp | 2 +- src/msw/ownerdrw.cpp | 6 +- src/msw/palette.cpp | 2 +- src/msw/pen.cpp | 12 +- src/msw/popupwin.cpp | 8 +- src/msw/printdlg.cpp | 122 +++--- src/msw/printwin.cpp | 8 +- src/msw/progdlg.cpp | 14 +- src/msw/radiobox.cpp | 14 +- src/msw/regconf.cpp | 2 +- src/msw/region.cpp | 14 +- src/msw/registry.cpp | 36 +- src/msw/renderer.cpp | 40 +- src/msw/richmsgdlg.cpp | 2 +- src/msw/rt/notifmsgrt.cpp | 14 +- src/msw/rt/utilsrt.cpp | 2 +- src/msw/scrolbar.cpp | 2 +- src/msw/secretstore.cpp | 2 +- src/msw/settings.cpp | 4 +- src/msw/slider.cpp | 14 +- src/msw/snglinst.cpp | 6 +- src/msw/sockmsw.cpp | 10 +- src/msw/sound.cpp | 8 +- src/msw/spinbutt.cpp | 2 +- src/msw/spinctrl.cpp | 10 +- src/msw/stackwalk.cpp | 4 +- src/msw/statbox.cpp | 4 +- src/msw/statusbar.cpp | 18 +- src/msw/stdpaths.cpp | 10 +- src/msw/systhemectrl.cpp | 4 +- src/msw/taskbar.cpp | 6 +- src/msw/taskbarbutton.cpp | 68 ++-- src/msw/textctrl.cpp | 32 +- src/msw/textentry.cpp | 38 +- src/msw/textmeasure.cpp | 8 +- src/msw/thread.cpp | 32 +- src/msw/timer.cpp | 12 +- src/msw/toolbar.cpp | 22 +- src/msw/tooltip.cpp | 24 +- src/msw/toplevel.cpp | 34 +- src/msw/treectrl.cpp | 32 +- src/msw/uilocale.cpp | 26 +- src/msw/urlmsw.cpp | 14 +- src/msw/utils.cpp | 54 +-- src/msw/utilsexc.cpp | 42 +- src/msw/utilsgui.cpp | 4 +- src/msw/volume.cpp | 2 +- src/msw/webrequest_winhttp.cpp | 30 +- src/msw/webview_edge.cpp | 30 +- src/msw/webview_ie.cpp | 36 +- src/msw/window.cpp | 136 +++---- src/osx/accel.cpp | 4 +- src/osx/brush.cpp | 2 +- src/osx/carbon/app.cpp | 22 +- src/osx/carbon/clipbrd.cpp | 4 +- src/osx/carbon/colordlgosx.mm | 2 +- src/osx/carbon/control.cpp | 2 +- src/osx/carbon/cursor.cpp | 10 +- src/osx/carbon/dataobj.cpp | 40 +- src/osx/carbon/dcclient.cpp | 2 +- src/osx/carbon/dcprint.cpp | 10 +- src/osx/carbon/dcscreen.cpp | 2 +- src/osx/carbon/font.cpp | 44 +- src/osx/carbon/fontdlg.cpp | 22 +- src/osx/carbon/frame.cpp | 8 +- src/osx/carbon/gdiobj.cpp | 2 +- src/osx/carbon/graphics.cpp | 116 +++--- src/osx/carbon/mdi.cpp | 20 +- src/osx/carbon/metafile.cpp | 16 +- src/osx/carbon/region.cpp | 28 +- src/osx/carbon/renderer.cpp | 4 +- src/osx/carbon/sound.cpp | 18 +- src/osx/carbon/statbrma.cpp | 8 +- src/osx/carbon/utilscocoa.mm | 26 +- src/osx/choice_osx.cpp | 6 +- src/osx/cocoa/aboutdlg.mm | 2 +- src/osx/cocoa/activityindicator.mm | 2 +- src/osx/cocoa/colour.mm | 6 +- src/osx/cocoa/combobox.mm | 2 +- src/osx/cocoa/dataview.mm | 48 +-- src/osx/cocoa/dirdlg.mm | 2 +- src/osx/cocoa/dnd.mm | 22 +- src/osx/cocoa/evtloop.mm | 24 +- src/osx/cocoa/filedlg.mm | 18 +- src/osx/cocoa/glcanvas.mm | 2 +- src/osx/cocoa/listbox.mm | 10 +- src/osx/cocoa/mediactrl.mm | 2 +- src/osx/cocoa/menu.mm | 8 +- src/osx/cocoa/menuitem.mm | 8 +- src/osx/cocoa/msgdlg.mm | 10 +- src/osx/cocoa/nativewin.mm | 2 +- src/osx/cocoa/nonownedwnd.mm | 80 ++-- src/osx/cocoa/notebook.mm | 4 +- src/osx/cocoa/notifmsg.mm | 2 +- src/osx/cocoa/overlay.mm | 26 +- src/osx/cocoa/preferences.mm | 10 +- src/osx/cocoa/settings.mm | 4 +- src/osx/cocoa/srchctrl.mm | 2 +- src/osx/cocoa/taskbar.mm | 10 +- src/osx/cocoa/textctrl.mm | 36 +- src/osx/cocoa/toolbar.mm | 108 ++--- src/osx/cocoa/tooltip.mm | 2 +- src/osx/cocoa/utils.mm | 16 +- src/osx/cocoa/utils_base.mm | 14 +- src/osx/cocoa/window.mm | 102 ++--- src/osx/combobox_osx.cpp | 8 +- src/osx/core/bitmap.cpp | 148 +++---- src/osx/core/bmpbndl.mm | 16 +- src/osx/core/cfstring.cpp | 4 +- src/osx/core/colour.cpp | 14 +- src/osx/core/dcmemory.cpp | 8 +- src/osx/core/display.cpp | 26 +- src/osx/core/evtloop_cf.cpp | 4 +- src/osx/core/fontenum.cpp | 2 +- src/osx/core/hid.cpp | 14 +- src/osx/core/hidjoystick.cpp | 26 +- src/osx/core/mimetype.cpp | 20 +- src/osx/core/printmac.cpp | 16 +- src/osx/core/secretstore.cpp | 40 +- src/osx/core/sockosx.cpp | 32 +- src/osx/core/sound.cpp | 2 +- src/osx/core/strconv_cf.cpp | 30 +- src/osx/core/timer.cpp | 8 +- src/osx/core/uilocale.mm | 6 +- src/osx/core/utilsexc_cf.cpp | 8 +- src/osx/dataview_osx.cpp | 50 +-- src/osx/dialog_osx.cpp | 4 +- src/osx/dnd_osx.cpp | 10 +- src/osx/fswatcher_fsevents.cpp | 8 +- src/osx/glcanvas_osx.cpp | 14 +- src/osx/iphone/evtloop.mm | 6 +- src/osx/iphone/glcanvas.mm | 4 +- src/osx/iphone/menu.mm | 8 +- src/osx/iphone/menuitem.mm | 6 +- src/osx/iphone/msgdlg.mm | 2 +- src/osx/iphone/nonownedwnd.mm | 10 +- src/osx/iphone/settings.mm | 4 +- src/osx/iphone/textctrl.mm | 32 +- src/osx/iphone/toolbar.mm | 14 +- src/osx/iphone/utils.mm | 8 +- src/osx/iphone/window.mm | 28 +- src/osx/listbox_osx.cpp | 6 +- src/osx/menu_osx.cpp | 58 +-- src/osx/menuitem_osx.cpp | 12 +- src/osx/nonownedwnd_osx.cpp | 32 +- src/osx/notebook_osx.cpp | 2 +- src/osx/palette.cpp | 2 +- src/osx/pen.cpp | 4 +- src/osx/printdlg_osx.cpp | 12 +- src/osx/radiobox_osx.cpp | 12 +- src/osx/radiobut_osx.cpp | 12 +- src/osx/slider_osx.cpp | 12 +- src/osx/sound_osx.cpp | 2 +- src/osx/srchctrl_osx.cpp | 4 +- src/osx/textctrl_osx.cpp | 4 +- src/osx/textentry_osx.cpp | 4 +- src/osx/toplevel_osx.cpp | 4 +- src/osx/uiaction_osx.cpp | 12 +- src/osx/utils_osx.cpp | 8 +- src/osx/webrequest_urlsession.mm | 2 +- src/osx/webview_webkit.mm | 4 +- src/osx/window_osx.cpp | 92 ++--- src/propgrid/advprops.cpp | 24 +- src/propgrid/editors.cpp | 48 +-- src/propgrid/manager.cpp | 40 +- src/propgrid/property.cpp | 76 ++-- src/propgrid/propgrid.cpp | 188 ++++----- src/propgrid/propgridiface.cpp | 24 +- src/propgrid/propgridpagestate.cpp | 60 +-- src/propgrid/props.cpp | 40 +- src/qt/accel.cpp | 2 +- src/qt/anybutton.cpp | 4 +- src/qt/app.cpp | 4 +- src/qt/bitmap.cpp | 36 +- src/qt/brush.cpp | 4 +- src/qt/calctrl.cpp | 6 +- src/qt/checkbox.cpp | 2 +- src/qt/checklst.cpp | 4 +- src/qt/choice.cpp | 4 +- src/qt/combobox.cpp | 6 +- src/qt/cursor.cpp | 2 +- src/qt/dataview.cpp | 4 +- src/qt/dc.cpp | 22 +- src/qt/dcclient.cpp | 14 +- src/qt/dialog.cpp | 6 +- src/qt/dnd.cpp | 22 +- src/qt/dvrenderers.cpp | 4 +- src/qt/evtloop.cpp | 8 +- src/qt/frame.cpp | 12 +- src/qt/gauge.cpp | 2 +- src/qt/graphics.cpp | 4 +- src/qt/listbox.cpp | 6 +- src/qt/listctrl.cpp | 26 +- src/qt/menu.cpp | 30 +- src/qt/menuitem.cpp | 2 +- src/qt/notebook.cpp | 2 +- src/qt/palette.cpp | 4 +- src/qt/pen.cpp | 4 +- src/qt/printdlg.cpp | 2 +- src/qt/printqt.cpp | 2 +- src/qt/radiobox.cpp | 16 +- src/qt/radiobut.cpp | 4 +- src/qt/region.cpp | 22 +- src/qt/scrolbar.cpp | 2 +- src/qt/slider.cpp | 2 +- src/qt/spinbutt.cpp | 2 +- src/qt/spinctrl.cpp | 6 +- src/qt/statbmp.cpp | 6 +- src/qt/statbox.cpp | 2 +- src/qt/statline.cpp | 2 +- src/qt/stattext.cpp | 2 +- src/qt/statusbar.cpp | 2 +- src/qt/textctrl.cpp | 6 +- src/qt/textentry.cpp | 2 +- src/qt/toolbar.cpp | 18 +- src/qt/tooltip.cpp | 4 +- src/qt/treectrl.cpp | 34 +- src/qt/uiaction.cpp | 8 +- src/qt/utils.cpp | 2 +- src/qt/window.cpp | 80 ++-- src/ribbon/art_aui.cpp | 14 +- src/ribbon/art_msw.cpp | 48 +-- src/ribbon/bar.cpp | 14 +- src/ribbon/buttonbar.cpp | 74 ++-- src/ribbon/control.cpp | 2 +- src/ribbon/gallery.cpp | 64 +-- src/ribbon/page.cpp | 40 +- src/ribbon/panel.cpp | 82 ++-- src/ribbon/toolbar.cpp | 78 ++-- src/richtext/richtextbackgroundpage.cpp | 48 +-- src/richtext/richtextborderspage.cpp | 108 ++--- src/richtext/richtextbuffer.cpp | 380 +++++++++--------- src/richtext/richtextbulletspage.cpp | 20 +- src/richtext/richtextctrl.cpp | 88 ++-- src/richtext/richtextfontpage.cpp | 48 +-- src/richtext/richtextformatdlg.cpp | 26 +- src/richtext/richtexthtml.cpp | 10 +- src/richtext/richtextindentspage.cpp | 28 +- src/richtext/richtextliststylepage.cpp | 44 +- src/richtext/richtextmarginspage.cpp | 48 +-- src/richtext/richtextprint.cpp | 20 +- src/richtext/richtextsizepage.cpp | 126 +++--- src/richtext/richtextstyledlg.cpp | 44 +- src/richtext/richtextstylepage.cpp | 8 +- src/richtext/richtextstyles.cpp | 32 +- src/richtext/richtextsymboldlg.cpp | 16 +- src/richtext/richtexttabspage.cpp | 4 +- src/richtext/richtextxml.cpp | 40 +- src/stc/PlatWX.cpp | 58 +-- src/stc/ScintillaWX.cpp | 18 +- src/stc/gen_iface.py | 26 +- src/stc/stc.cpp | 38 +- src/stc/stc.cpp.in | 18 +- src/stc/stc.h.in | 76 ++-- src/stc/stc.interface.h.in | 2 +- src/univ/anybutton.cpp | 4 +- src/univ/combobox.cpp | 10 +- src/univ/dialog.cpp | 4 +- src/univ/inpcons.cpp | 2 +- src/univ/listbox.cpp | 20 +- src/univ/menu.cpp | 52 +-- src/univ/notebook.cpp | 6 +- src/univ/radiobox.cpp | 2 +- src/univ/scrarrow.cpp | 8 +- src/univ/scrolbar.cpp | 8 +- src/univ/scrthumb.cpp | 8 +- src/univ/slider.cpp | 4 +- src/univ/stdrend.cpp | 18 +- src/univ/textctrl.cpp | 58 +-- src/univ/theme.cpp | 18 +- src/univ/themes/gtk.cpp | 20 +- src/univ/themes/metal.cpp | 2 +- src/univ/themes/mono.cpp | 18 +- src/univ/themes/win32.cpp | 46 +-- src/univ/toolbar.cpp | 26 +- src/univ/topluniv.cpp | 8 +- src/univ/winuniv.cpp | 22 +- src/unix/appunix.cpp | 8 +- src/unix/dialup.cpp | 28 +- src/unix/dir.cpp | 14 +- src/unix/displayx11.cpp | 2 +- src/unix/dlunix.cpp | 10 +- src/unix/epolldispatcher.cpp | 6 +- src/unix/evtloopunix.cpp | 10 +- src/unix/fontenum.cpp | 6 +- src/unix/fontutil.cpp | 16 +- src/unix/fswatcher_inotify.cpp | 6 +- src/unix/fswatcher_kqueue.cpp | 10 +- src/unix/glegl.cpp | 50 +-- src/unix/glx11.cpp | 32 +- src/unix/joystick.cpp | 10 +- src/unix/mediactrl.cpp | 48 +-- src/unix/mediactrl_gstplayer.cpp | 20 +- src/unix/mimetype.cpp | 12 +- src/unix/net.cpp | 10 +- src/unix/secretstore.cpp | 18 +- src/unix/sound.cpp | 14 +- src/unix/sound_sdl.cpp | 8 +- src/unix/stackwalk.cpp | 8 +- src/unix/taskbarx11.cpp | 14 +- src/unix/threadpsx.cpp | 24 +- src/unix/timerunx.cpp | 4 +- src/unix/uiactionx11.cpp | 6 +- src/unix/uilocale.cpp | 14 +- src/unix/utilsunx.cpp | 36 +- src/unix/utilsx11.cpp | 16 +- src/x11/app.cpp | 42 +- src/x11/bitmap.cpp | 86 ++-- src/x11/brush.cpp | 2 +- src/x11/clipbrd.cpp | 16 +- src/x11/colour.cpp | 4 +- src/x11/cursor.cpp | 4 +- src/x11/dcclient.cpp | 48 +-- src/x11/dcmemory.cpp | 2 +- src/x11/dnd.cpp | 2 +- src/x11/evtloop.cpp | 2 +- src/x11/font.cpp | 8 +- src/x11/palette.cpp | 14 +- src/x11/pango_x.cpp | 6 +- src/x11/pen.cpp | 2 +- src/x11/region.cpp | 8 +- src/x11/reparent.cpp | 12 +- src/x11/textctrl.cpp | 16 +- src/x11/toplevel.cpp | 2 +- src/x11/utils.cpp | 8 +- src/x11/utilsx.cpp | 4 +- src/x11/window.cpp | 42 +- src/xml/xml.cpp | 134 +++--- src/xrc/xh_animatctrl.cpp | 6 +- src/xrc/xh_aui.cpp | 18 +- src/xrc/xh_auitoolb.cpp | 32 +- src/xrc/xh_bmpcbox.cpp | 10 +- src/xrc/xh_bookctrlbase.cpp | 6 +- src/xrc/xh_chckl.cpp | 4 +- src/xrc/xh_choic.cpp | 4 +- src/xrc/xh_choicbk.cpp | 2 +- src/xrc/xh_collpane.cpp | 6 +- src/xrc/xh_combo.cpp | 4 +- src/xrc/xh_comboctrl.cpp | 2 +- src/xrc/xh_dataview.cpp | 2 +- src/xrc/xh_editlbox.cpp | 6 +- src/xrc/xh_htmllbox.cpp | 4 +- src/xrc/xh_infobar.cpp | 4 +- src/xrc/xh_listb.cpp | 4 +- src/xrc/xh_listbk.cpp | 2 +- src/xrc/xh_mdi.cpp | 2 +- src/xrc/xh_menu.cpp | 4 +- src/xrc/xh_notbk.cpp | 2 +- src/xrc/xh_odcombo.cpp | 4 +- src/xrc/xh_propdlg.cpp | 2 +- src/xrc/xh_radbx.cpp | 6 +- src/xrc/xh_ribbon.cpp | 12 +- src/xrc/xh_simplebook.cpp | 6 +- src/xrc/xh_sizer.cpp | 56 +-- src/xrc/xh_split.cpp | 8 +- src/xrc/xh_toolb.cpp | 22 +- src/xrc/xh_toolbk.cpp | 2 +- src/xrc/xh_treebk.cpp | 6 +- src/xrc/xh_unkwn.cpp | 6 +- src/xrc/xh_wizrd.cpp | 12 +- src/xrc/xmlres.cpp | 130 +++--- tests/archive/archivetest.cpp | 22 +- tests/archive/archivetest.h | 6 +- tests/archive/tartest.cpp | 2 +- tests/archive/ziptest.cpp | 4 +- tests/base64/base64.cpp | 10 +- tests/benchmarks/bench.cpp | 4 +- tests/benchmarks/bench.h | 8 +- tests/benchmarks/graphics.cpp | 14 +- tests/benchmarks/htmlparser/htmlpars.cpp | 44 +- tests/benchmarks/htmlparser/htmlpars.h | 2 +- tests/benchmarks/htmlparser/htmltag.cpp | 16 +- tests/benchmarks/htmlparser/htmltag.h | 2 +- tests/benchmarks/ipcclient.cpp | 6 +- tests/benchmarks/mbconv.cpp | 2 +- tests/benchmarks/strings.cpp | 2 +- tests/benchmarks/tls.cpp | 2 +- tests/cmdline/cmdlinetest.cpp | 10 +- tests/controls/auitest.cpp | 2 +- tests/controls/choicetest.cpp | 2 +- tests/controls/comboboxtest.cpp | 4 +- tests/controls/dataviewctrltest.cpp | 2 +- tests/controls/datepickerctrltest.cpp | 2 +- tests/controls/dialogtest.cpp | 6 +- tests/controls/frametest.cpp | 2 +- tests/controls/gridtest.cpp | 12 +- tests/controls/headerctrltest.cpp | 2 +- tests/controls/itemcontainertest.cpp | 4 +- tests/controls/listboxtest.cpp | 6 +- tests/controls/listctrltest.cpp | 2 +- tests/controls/listviewtest.cpp | 2 +- tests/controls/notebooktest.cpp | 4 +- tests/controls/ownerdrawncomboboxtest.cpp | 4 +- tests/controls/pickerbasetest.cpp | 4 +- tests/controls/radioboxtest.cpp | 2 +- tests/controls/radiobuttontest.cpp | 12 +- tests/controls/richtextctrltest.cpp | 2 +- tests/controls/textctrltest.cpp | 16 +- tests/controls/textentrytest.h | 2 +- tests/controls/treebooktest.cpp | 2 +- tests/controls/treectrltest.cpp | 2 +- tests/controls/treelistctrltest.cpp | 2 +- tests/controls/virtlistctrltest.cpp | 2 +- tests/controls/windowtest.cpp | 18 +- tests/datetime/datetimetest.cpp | 2 +- tests/drawing/drawing.cpp | 4 +- tests/drawing/plugindriver.cpp | 2 +- tests/events/evthandler.cpp | 22 +- tests/events/propagation.cpp | 22 +- tests/exec/exec.cpp | 4 +- tests/filename/filenametest.cpp | 6 +- tests/filesys/filesystest.cpp | 2 +- tests/formatconverter/formatconvertertest.cpp | 6 +- tests/fswatcher/fswatchertest.cpp | 4 +- tests/graphics/affinematrix.cpp | 4 +- tests/graphics/bitmap.cpp | 42 +- tests/graphics/clippingbox.cpp | 2 +- tests/graphics/coords.cpp | 8 +- tests/graphics/graphbitmap.cpp | 160 ++++---- tests/graphics/graphmatrix.cpp | 6 +- tests/graphics/imagelist.cpp | 24 +- tests/graphics/measuring.cpp | 10 +- tests/hashes/hashes.cpp | 36 +- tests/html/htmlparser.cpp | 8 +- tests/html/htmlwindow.cpp | 2 +- tests/image/image.cpp | 4 +- tests/interactive/output.cpp | 4 +- tests/intl/intltest.cpp | 12 +- tests/log/logtest.cpp | 2 +- tests/longlong/longlongtest.cpp | 2 +- tests/mbconv/convautotest.cpp | 2 +- tests/mbconv/mbconvtest.cpp | 40 +- tests/menu/menu.cpp | 14 +- tests/misc/guifuncs.cpp | 10 +- tests/misc/misctests.cpp | 18 +- tests/net/ipc.cpp | 20 +- tests/net/socket.cpp | 14 +- tests/regex/wxregextest.cpp | 6 +- tests/sizers/gridsizer.cpp | 4 +- tests/streams/bstream.h | 16 +- tests/streams/largefile.cpp | 16 +- tests/streams/socketstream.cpp | 8 +- tests/streams/sstream.cpp | 2 +- tests/streams/stdstream.cpp | 4 +- tests/streams/zlibstream.cpp | 18 +- tests/strings/crt.cpp | 8 +- tests/strings/numformatter.cpp | 6 +- tests/strings/strings.cpp | 4 +- tests/strings/tokenizer.cpp | 2 +- tests/strings/unicode.cpp | 30 +- tests/strings/vsnprintf.cpp | 16 +- tests/test.cpp | 10 +- tests/testableframe.cpp | 10 +- tests/testimage.h | 4 +- tests/textfile/textfiletest.cpp | 2 +- tests/thread/atomic.cpp | 2 +- tests/thread/misc.cpp | 6 +- tests/thread/queue.cpp | 8 +- tests/thread/tls.cpp | 4 +- tests/toplevel/toplevel.cpp | 6 +- tests/uris/ftp.cpp | 6 +- tests/uris/uris.cpp | 4 +- tests/validators/valnum.cpp | 2 +- tests/weakref/evtconnection.cpp | 18 +- tests/weakref/weakref.cpp | 8 +- tests/xlocale/xlocale.cpp | 40 +- tests/xml/xmltest.cpp | 32 +- tests/xml/xrctest.cpp | 4 +- utils/emulator/src/emulator.cpp | 12 +- utils/helpview/src/client.cpp | 10 +- utils/helpview/src/helpview.cpp | 14 +- utils/helpview/src/remhelp.cpp | 10 +- utils/ifacecheck/src/ifacecheck.cpp | 6 +- utils/ifacecheck/src/xmlparser.cpp | 12 +- utils/ifacecheck/src/xmlparser.h | 2 +- utils/screenshotgen/src/autocapture.cpp | 4 +- utils/screenshotgen/src/guiframe.cpp | 6 +- utils/wxrc/wxrc.cpp | 10 +- 1844 files changed, 13721 insertions(+), 13734 deletions(-) diff --git a/build/bakefiles/wxpresets/sample/minimal.cpp b/build/bakefiles/wxpresets/sample/minimal.cpp index 1820aba4a3..25b7fb0f71 100644 --- a/build/bakefiles/wxpresets/sample/minimal.cpp +++ b/build/bakefiles/wxpresets/sample/minimal.cpp @@ -129,7 +129,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { // set the frame icon diff --git a/demos/bombs/bombs.cpp b/demos/bombs/bombs.cpp index 0e6c004108..d526efc792 100644 --- a/demos/bombs/bombs.cpp +++ b/demos/bombs/bombs.cpp @@ -32,7 +32,7 @@ wxIMPLEMENT_APP(BombsApp); // Called to initialize the program bool BombsApp::OnInit() { - srand((unsigned) time(NULL)); + srand((unsigned) time(nullptr)); m_frame = new BombsFrame(&m_game); @@ -52,7 +52,7 @@ wxBEGIN_EVENT_TABLE(BombsFrame, wxFrame) wxEND_EVENT_TABLE() BombsFrame::BombsFrame(BombsGame *game) - : wxFrame(NULL, wxID_ANY, wxT("wxBombs"), wxDefaultPosition, + : wxFrame(nullptr, wxID_ANY, wxT("wxBombs"), wxDefaultPosition, wxSize(300, 300), wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX) { m_game = game; @@ -248,7 +248,7 @@ BombsCanvas::BombsCanvas(wxFrame *parent, BombsGame *game) m_cellWidth = (sx+3+X_UNIT)/X_UNIT; m_cellHeight = (sy+3+Y_UNIT)/Y_UNIT; dc.SetMapMode(wxMM_TEXT); - m_bmp = NULL; + m_bmp = nullptr; } BombsCanvas::~BombsCanvas() @@ -256,7 +256,7 @@ BombsCanvas::~BombsCanvas() if (m_bmp) { delete m_bmp; - m_bmp = NULL; + m_bmp = nullptr; } } @@ -302,7 +302,7 @@ void BombsCanvas::UpdateGridSize() if (m_bmp) { delete m_bmp; - m_bmp = NULL; + m_bmp = nullptr; } SetSize(GetGridSizeInPixels()); Refresh(); diff --git a/demos/bombs/game.h b/demos/bombs/game.h index 0463ddfd25..12cb059e2e 100644 --- a/demos/bombs/game.h +++ b/demos/bombs/game.h @@ -26,7 +26,7 @@ public: BombsGame() { m_width = m_height = 0; - m_field = NULL; + m_field = nullptr; } ~BombsGame(); diff --git a/demos/forty/game.cpp b/demos/forty/game.cpp index 304c385932..0d7e292b67 100644 --- a/demos/forty/game.cpp +++ b/demos/forty/game.cpp @@ -179,7 +179,7 @@ void Game::DoMove(wxDC& dc, Pile* src, Pile* dest) if (HaveYouWon()) { wxWindow *frame = wxTheApp->GetTopWindow(); - wxWindow *canvas = (wxWindow *) NULL; + wxWindow *canvas = nullptr; if (frame) { diff --git a/demos/forty/pile.cpp b/demos/forty/pile.cpp index 4d84ec2595..8e7bbb3408 100644 --- a/demos/forty/pile.cpp +++ b/demos/forty/pile.cpp @@ -57,7 +57,7 @@ Pile::Pile(int x, int y, int dx, int dy) //+-------------------------------------------------------------+ //| Description: | //| Redraw the pile on the screen. If the pile is empty | -//| just draw a NULL card as a place holder for the pile. | +//| just draw a null card as a place holder for the pile. | //| Otherwise draw the pile from the bottom up, starting | //| at the origin of the pile, shifting each subsequent | //| card by the pile's x and y offsets. | @@ -65,7 +65,7 @@ Pile::Pile(int x, int y, int dx, int dy) void Pile::Redraw(wxDC& dc ) { FortyFrame *frame = (FortyFrame*) wxTheApp->GetTopWindow(); - wxWindow *canvas = (wxWindow *) NULL; + wxWindow *canvas = nullptr; if (frame) { canvas = frame->GetCanvas(); @@ -103,7 +103,7 @@ void Pile::Redraw(wxDC& dc ) //| Pile::GetTopCard() | //+-------------------------------------------------------------+ //| Description: | -//| Return a pointer to the top card in the pile or NULL | +//| Return a pointer to the top card in the pile or nullptr | //| if the pile is empty. | //| NB: Gets a copy of the card without removing it from the | //| pile. | @@ -126,7 +126,7 @@ Card* Pile::GetTopCard() //| Description: | //| If the pile is not empty, remove the top card from the | //| pile and return the pointer to the removed card. | -//| If the pile is empty return a NULL pointer. | +//| If the pile is empty return a null pointer. | //+-------------------------------------------------------------+ Card* Pile::RemoveTopCard() { @@ -229,7 +229,7 @@ int Pile::CalcDistance(int x, int y) // Return the card at x, y. Check the top card first, then // work down the pile. If a card is found then return a pointer -// to the card, otherwise return NULL +// to the card, otherwise return nullptr Card* Pile::GetCard(int x, int y) { int cardX; diff --git a/demos/fractal/fractal.cpp b/demos/fractal/fractal.cpp index 6b2113899c..fad9aab02e 100644 --- a/demos/fractal/fractal.cpp +++ b/demos/fractal/fractal.cpp @@ -40,12 +40,12 @@ hack doesn't fix. #include #define Random(x) (rand() % x) -#define Randomize() (srand((unsigned int)time(NULL))) +#define Randomize() (srand((unsigned int)time(nullptr))) static int detail = 9; // CHANGE THIS... 7,8,9 etc static bool running = false; -static wxMenuBar *menuBar = NULL; +static wxMenuBar *menuBar = nullptr; // Define a new application type class MyApp: public wxApp @@ -89,7 +89,7 @@ private: bool MyApp::OnInit() { // Create the main frame window - MyFrame *frame = new MyFrame(NULL, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480)); + MyFrame *frame = new MyFrame(nullptr, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480)); // Make a menubar wxMenu *file_menu = new wxMenu; diff --git a/demos/life/dialogs.cpp b/demos/life/dialogs.cpp index f889265c6b..e0fb49bf56 100644 --- a/demos/life/dialogs.cpp +++ b/demos/life/dialogs.cpp @@ -89,7 +89,7 @@ LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent) m_list = new wxListBox( this, ID_LISTBOX, wxDefaultPosition, listSize, - 0, NULL, + 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL ); for (unsigned i = 0; i < (sizeof(g_patterns) / sizeof(LifePattern)); i++) diff --git a/demos/life/game.cpp b/demos/life/game.cpp index 1e1d1f7e67..f06e49b2f5 100644 --- a/demos/life/game.cpp +++ b/demos/life/game.cpp @@ -112,10 +112,10 @@ Life::Life() // pattern data m_numcells = 0; m_boxes = new LifeCellBox *[HASHSIZE]; - m_head = NULL; - m_available = NULL; + m_head = nullptr; + m_available = nullptr; for (int i = 0; i < HASHSIZE; i++) - m_boxes[i] = NULL; + m_boxes[i] = nullptr; // state vars for BeginFind & FindMore m_cells = new LifeCell[CELLSARRAYSIZE]; @@ -141,7 +141,7 @@ void Life::Clear() // clear the hash table pointers for (int i = 0; i < HASHSIZE; i++) - m_boxes[i] = NULL; + m_boxes[i] = nullptr; // free used boxes c = m_head; @@ -151,7 +151,7 @@ void Life::Clear() delete c; c = nc; } - m_head = NULL; + m_head = nullptr; // free available boxes c = m_available; @@ -161,7 +161,7 @@ void Life::Clear() delete c; c = nc; } - m_available = NULL; + m_available = nullptr; // reset state m_name = wxEmptyString; @@ -295,7 +295,7 @@ LifeCellBox* Life::CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv) // LinkBox: // Returns a pointer to the box (x, y); if it didn't exist yet, -// it returns NULL or creates a new one, depending on the value +// it returns nullptr or creates a new one, depending on the value // of the 'create' parameter. // LifeCellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create) @@ -312,7 +312,7 @@ LifeCellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create) if ((c->m_x == x) && (c->m_y == y)) return c; // if not found, and (create == true), create a new one - return create? CreateBox(x, y, hv) : (LifeCellBox*) NULL; + return create? CreateBox(x, y, hv) : nullptr; } // KillBox: @@ -338,10 +338,10 @@ void Life::KillBox(LifeCellBox *c) // update neighbours if (c->m_next) c->m_next->m_prev = c->m_prev; if (c->m_hnext) c->m_hnext->m_hprev = c->m_hprev; - if (c->m_up) c->m_up->m_dn = NULL; - if (c->m_dn) c->m_dn->m_up = NULL; - if (c->m_lf) c->m_lf->m_rt = NULL; - if (c->m_rt) c->m_rt->m_lf = NULL; + if (c->m_up) c->m_up->m_dn = nullptr; + if (c->m_dn) c->m_dn->m_up = nullptr; + if (c->m_lf) c->m_lf->m_rt = nullptr; + if (c->m_rt) c->m_rt->m_lf = nullptr; // append to the list of available boxes c->m_next = m_available; @@ -515,7 +515,7 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells) for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0) for ( ; m_x <= m_x1; m_x += 8) { - if ((c = LinkBox(m_x, m_y, false)) == NULL) + if ((c = LinkBox(m_x, m_y, false)) == nullptr) continue; // check whether there is enough space left in the array @@ -540,7 +540,7 @@ bool Life::FindMore(LifeCell *cells[], size_t *ncells) for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0) for ( ; m_x <= m_x1; m_x += 8) { - if ((c = LinkBox(m_x, m_y, false)) == NULL) + if ((c = LinkBox(m_x, m_y, false)) == nullptr) continue; // check whether there is enough space left in the array diff --git a/demos/life/life.cpp b/demos/life/life.cpp index 642c9570d6..a4e4596c85 100644 --- a/demos/life/life.cpp +++ b/demos/life/life.cpp @@ -173,8 +173,8 @@ bool LifeApp::OnInit() // frame constructor LifeFrame::LifeFrame() : - wxFrame( (wxFrame *) NULL, wxID_ANY, _("Life!"), wxDefaultPosition ), - m_navigator(NULL) + wxFrame( nullptr, wxID_ANY, _("Life!"), wxDefaultPosition ), + m_navigator(nullptr) { // frame icon SetIcon(wxICON(mondrian)); @@ -1104,12 +1104,12 @@ void LifeCanvas::OnScroll(wxScrollWinEvent& event) if (orient == wxHORIZONTAL) { m_viewportX += scrollinc; - ScrollWindow( -m_cellsize * scrollinc, 0, (const wxRect *) NULL); + ScrollWindow( -m_cellsize * scrollinc, 0, nullptr); } else { m_viewportY += scrollinc; - ScrollWindow( 0, -m_cellsize * scrollinc, (const wxRect *) NULL); + ScrollWindow( 0, -m_cellsize * scrollinc, nullptr); } } diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp index 9549df099e..504e77ac47 100644 --- a/demos/poem/wxpoem.cpp +++ b/demos/poem/wxpoem.cpp @@ -62,8 +62,8 @@ static int XPos; // Startup X position static int YPos; // Startup Y position static int pointSize = 12; // Font size -static const wxChar *index_filename = NULL; // Index filename -static const wxChar *data_filename = NULL; // Data filename +static const wxChar *index_filename = nullptr; // Index filename +static const wxChar *data_filename = nullptr; // Data filename static wxChar error_buf[300]; // Error message buffer static bool loaded_ok = false; // Poem loaded ok static bool index_ok = false; // Index loaded ok @@ -72,7 +72,7 @@ static bool paging = false; // Are we paging? static int current_page = 0; // Currently viewed page // Backing bitmap -wxBitmap *backingBitmap = NULL; +wxBitmap *backingBitmap = nullptr; void PoetryError(const wxChar *, const wxChar *caption=wxT("wxPoem Error")); void PoetryNotify(const wxChar *Msg, const wxChar *caption=wxT("wxPoem")); @@ -90,7 +90,7 @@ void FindMax(int *max_thing, int thing); wxIMPLEMENT_APP(MyApp); -MainWindow *TheMainWindow = NULL; +MainWindow *TheMainWindow = nullptr; // Create the fonts void MainWindow::CreateFonts() @@ -110,7 +110,7 @@ MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxFrame(frame, id, title, pos, size, style) { - m_corners[0] = m_corners[1] = m_corners[2] = m_corners[3] = NULL; + m_corners[0] = m_corners[1] = m_corners[2] = m_corners[3] = nullptr; ReadPreferences(); CreateFonts(); @@ -510,7 +510,7 @@ bool MyApp::OnInit() // randomize(); pages[0] = 0; - TheMainWindow = new MainWindow(NULL, + TheMainWindow = new MainWindow(nullptr, wxID_ANY, wxT("wxPoem"), wxPoint(XPos, YPos), @@ -592,7 +592,7 @@ MyCanvas::~MyCanvas() // Note: this must be done before the main window/canvas are destroyed // or we get an error (no parent window for menu item button) delete m_popupMenu; - m_popupMenu = NULL; + m_popupMenu = nullptr; } // Define the repainting behaviour @@ -693,13 +693,13 @@ int LoadIndex(const wxChar *file_name) wxChar buf[100]; - if (file_name == NULL) + if (file_name == nullptr) return 0; wxSprintf(buf, wxT("%s.idx"), file_name); index_file = wxFopen(buf, wxT("r")); - if (index_file == NULL) + if (index_file == nullptr) return 0; wxFscanf(index_file, wxT("%ld"), &nitems); @@ -769,7 +769,7 @@ bool LoadPoem(const wxChar *file_name, long position) paging = false; current_page = 0; - if (file_name == NULL) + if (file_name == nullptr) { wxSprintf(error_buf, wxT("Error in Poem loading.")); PoetryError(error_buf); @@ -779,7 +779,7 @@ bool LoadPoem(const wxChar *file_name, long position) wxSprintf(buf, wxT("%s.dat"), file_name); data_file = wxFopen(buf, wxT("rb")); - if (data_file == NULL) + if (data_file == nullptr) { wxSprintf(error_buf, wxT("Data file %s not found."), buf); PoetryError(error_buf); diff --git a/distrib/autopackage/sample/minimal.cpp b/distrib/autopackage/sample/minimal.cpp index 1820aba4a3..25b7fb0f71 100644 --- a/distrib/autopackage/sample/minimal.cpp +++ b/distrib/autopackage/sample/minimal.cpp @@ -129,7 +129,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { // set the frame icon diff --git a/docs/contributing/how-to-add-class-documentation.md b/docs/contributing/how-to-add-class-documentation.md index 329826219c..26193a8657 100644 --- a/docs/contributing/how-to-add-class-documentation.md +++ b/docs/contributing/how-to-add-class-documentation.md @@ -73,7 +73,7 @@ DO: It's also very important to make a consistent use of the ALIASES defined by wxWidgets' Doxyfile. Open that file for more info. -- when you write true, false and NULL with their C++ semantic meaning, +- when you write true, false and nullptr with their C++ semantic meaning, then use the @true, @false and @NULL commands. - separate different paragraphs with an empty comment line. diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index e20f86cac6..3b1151fd5d 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -140,7 +140,7 @@ ALIASES += header{1}="Include file:^^ \verbatim #include <\1> \endverbatim" # some formatting aliases ALIASES += true="true" ALIASES += false="false" -ALIASES += NULL="NULL" +ALIASES += NULL="nullptr" ALIASES += NUL="NUL" # NOTE: these are important as you can't write in the docs diff --git a/docs/doxygen/mainpages/samples.h b/docs/doxygen/mainpages/samples.h index 9dd572587e..97565a9cde 100644 --- a/docs/doxygen/mainpages/samples.h +++ b/docs/doxygen/mainpages/samples.h @@ -189,7 +189,7 @@ See @ref overview_config for the descriptions of all features of this class. This sample shows how to use wxDebugReport class to generate a debug report in case of a program crash or otherwise. On start up, -it proposes to either crash itself (by dereferencing a NULL pointer) or +it proposes to either crash itself (by dereferencing a @NULL) or generate debug report without doing it. Next it initializes the debug report with standard information adding a custom file to it (just a timestamp) and allows to view the information gathered using diff --git a/docs/doxygen/overviews/app.h b/docs/doxygen/overviews/app.h index cb2ae2e963..ab2e8d40e3 100644 --- a/docs/doxygen/overviews/app.h +++ b/docs/doxygen/overviews/app.h @@ -45,7 +45,7 @@ wxIMPLEMENT_APP(DerivedApp); bool DerivedApp::OnInit() { - wxFrame *the_frame = new wxFrame(NULL, ID_MYFRAME, argv[0]); + wxFrame *the_frame = new wxFrame(nullptr, ID_MYFRAME, argv[0]); ... the_frame->Show(true); diff --git a/docs/doxygen/overviews/archive.h b/docs/doxygen/overviews/archive.h index 735b2a4dbc..5538224244 100644 --- a/docs/doxygen/overviews/archive.h +++ b/docs/doxygen/overviews/archive.h @@ -73,7 +73,7 @@ auto_ptr entry; wxFFileInputStream in(wxT("test.zip")); wxZipInputStream zip(in); -while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) +while (entry.reset(zip.GetNextEntry()), entry.get() != nullptr) { // access meta-data wxString name = entry->GetName(); @@ -114,7 +114,7 @@ auto_ptr entry; outzip.CopyArchiveMetaData(inzip); // call CopyEntry for each entry except those matching the pattern -while (entry.reset(inzip.GetNextEntry()), entry.get() != NULL) +while (entry.reset(inzip.GetNextEntry()), entry.get() != nullptr) if (!entry->GetName().Matches(wxT("*.txt"))) if (!outzip.CopyEntry(entry.release(), inzip)) break; @@ -165,9 +165,9 @@ do { entry.reset(zip.GetNextEntry()); } -while (entry.get() != NULL && entry->GetInternalName() != name); +while (entry.get() != nullptr && entry->GetInternalName() != name); -if (entry.get() != NULL) +if (entry.get() != nullptr) { // read the entry's data... } @@ -189,7 +189,7 @@ wxFFileInputStream in(wxT("test.zip")); wxZipInputStream zip(in); // load the zip catalog -while ((entry = zip.GetNextEntry()) != NULL) +while ((entry = zip.GetNextEntry()) != nullptr) { wxZipEntry*& current = cat[entry->GetInternalName()]; // some archive formats can have multiple entries with the same name @@ -296,7 +296,7 @@ if (in->IsOk()) auto_ptr entry; // list the contents of the archive - while ((entry.reset(arc->GetNextEntry())), entry.get() != NULL) + while ((entry.reset(arc->GetNextEntry())), entry.get() != nullptr) std::wcout << entry->GetName() << "\n"; } else @@ -381,7 +381,7 @@ auto_ptr entry; outarc->CopyArchiveMetaData(*arc); -while (entry.reset(arc->GetNextEntry()), entry.get() != NULL) +while (entry.reset(arc->GetNextEntry()), entry.get() != nullptr) { if (entry->GetName() == from) entry->SetName(to); @@ -418,7 +418,7 @@ MyNotifier notifier; outarc->CopyArchiveMetaData(*arc); -while (entry.reset(arc->GetNextEntry()), entry.get() != NULL) +while (entry.reset(arc->GetNextEntry()), entry.get() != nullptr) { entry->SetNotifier(notifier); if (!outarc->CopyEntry(entry.release(), *arc)) diff --git a/docs/doxygen/overviews/debugging.h b/docs/doxygen/overviews/debugging.h index 7c1520ea46..1048cd1ef7 100644 --- a/docs/doxygen/overviews/debugging.h +++ b/docs/doxygen/overviews/debugging.h @@ -81,7 +81,7 @@ Example of using an assertion macro: @code void GetTheAnswer(int *p) { - wxCHECK_RET( p, "pointer can't be NULL in GetTheAnswer()" ); + wxCHECK_RET( p, "pointer can't be null in GetTheAnswer()" ); *p = 42; }; @@ -89,7 +89,7 @@ void GetTheAnswer(int *p) If the condition is false, i.e. @c p is @NULL, the assertion handler is called and, in any case (even when wxDEBUG_LEVEL is 0), the function returns without -dereferencing the NULL pointer on the next line thus avoiding a crash. +dereferencing the null pointer on the next line thus avoiding a crash. The default assertion handler behaviour depends on whether the application using wxWidgets was compiled in release build (with @c NDEBUG defined) or debug diff --git a/docs/doxygen/overviews/helloworld.h b/docs/doxygen/overviews/helloworld.h index 2886905a2d..1121053815 100644 --- a/docs/doxygen/overviews/helloworld.h +++ b/docs/doxygen/overviews/helloworld.h @@ -127,7 +127,7 @@ window. Both have to be bound to the frame with respective calls. @code MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "Hello World") + : wxFrame(nullptr, wxID_ANY, "Hello World") { wxMenu *menuFile = new wxMenu; menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", @@ -272,7 +272,7 @@ bool MyApp::OnInit() } MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "Hello World") + : wxFrame(nullptr, wxID_ANY, "Hello World") { wxMenu *menuFile = new wxMenu; menuFile->Append(ID_Hello, "&Hello...\tCtrl-H", diff --git a/docs/doxygen/overviews/ipc.h b/docs/doxygen/overviews/ipc.h index 1de051e8c8..1e1b81bfc9 100644 --- a/docs/doxygen/overviews/ipc.h +++ b/docs/doxygen/overviews/ipc.h @@ -200,7 +200,7 @@ connection = (MyConnection *)client->MakeConnection(hostName, server, "IPC TEST" if (!connection) { wxMessageBox("Failed to make connection to server", "Client Demo Error"); - return NULL; + return nullptr; } connection->StartAdvise("Item"); diff --git a/docs/doxygen/overviews/propgrid.h b/docs/doxygen/overviews/propgrid.h index d44db7eeea..d9034a4a62 100644 --- a/docs/doxygen/overviews/propgrid.h +++ b/docs/doxygen/overviews/propgrid.h @@ -270,7 +270,7 @@ A very simple example: // Using wxChar* array // const wxChar* arrayDiet[] = - { wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), NULL }; + { wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), nullptr }; pg->Append( new wxEnumProperty("Diet", wxPG_LABEL, @@ -348,7 +348,7 @@ wxFlagsProperty has similar construction: @code const wxChar* flags_prop_labels[] = { wxT("wxICONIZE"), - wxT("wxCAPTION"), wxT("wxMINIMIZE_BOX"), wxT("wxMAXIMIZE_BOX"), NULL }; + wxT("wxCAPTION"), wxT("wxMINIMIZE_BOX"), wxT("wxMAXIMIZE_BOX"), nullptr }; // this value array would be optional if values matched string indexes long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, diff --git a/docs/doxygen/overviews/string.h b/docs/doxygen/overviews/string.h index e791565772..b3933e9abc 100644 --- a/docs/doxygen/overviews/string.h +++ b/docs/doxygen/overviews/string.h @@ -71,7 +71,7 @@ Example: // it's a single Unicode code-point encoded as: // - a UTF16 surrogate pair under Windows // - a UTF8 multiple-bytes sequence under Linux - // (without considering the final NULL) + // (without considering the final NUL) wxPrintf("wxString reports a length of %d character(s)", test.length()); // prints "wxString reports a length of 1 character(s)" on Linux @@ -88,7 +88,7 @@ Example: // they are 3 Unicode code-points encoded as: // - 3 UTF16 code units under Windows // - 6 UTF8 code units under Linux - // (without considering the final NULL) + // (without considering the final NUL) wxPrintf("wxString reports a length of %d character(s)", test2.length()); // prints "wxString reports a length of 3 character(s)" on Linux @@ -96,7 +96,7 @@ Example: @endcode To better explain what stated above, consider the second string of the example -above; it's composed by 3 characters and the final @c NULL: +above; it's composed by 3 characters and the final @NUL: @image html overview_wxstring_encoding.png @@ -303,12 +303,12 @@ for (i = s.begin(); i != s.end(); ++i) As most programs use character strings, the standard C library provides quite a few functions to work with them. Unfortunately, some of them have rather counter-intuitive behaviour (like @c strncpy() which doesn't always terminate -the resulting string with a @NULL) and are in general not very safe (passing +the resulting string with a @NUL) and are in general not very safe (passing @NULL to them will probably lead to program crash). Moreover, some very useful functions are not standard at all. This is why in addition to all wxString functions, there are also a few global string functions which try to correct these problems: wxIsEmpty() verifies whether the string is empty (returning -@true for @NULL pointers), wxStrlen() also handles @NULL correctly and returns +@true for @NULL), wxStrlen() also handles @NULL correctly and returns 0 for them and wxStricmp() is just a platform-independent version of case-insensitive string comparison function known either as @c stricmp() or @c strcasecmp() on different platforms. diff --git a/docs/doxygen/overviews/xrc.h b/docs/doxygen/overviews/xrc.h index ee81c52f11..a8ad31203d 100644 --- a/docs/doxygen/overviews/xrc.h +++ b/docs/doxygen/overviews/xrc.h @@ -142,7 +142,7 @@ This is how you would use the above simple dialog in your code. void MyClass::ShowDialog() { wxDialog dlg; - if (wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog")) + if (wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog")) dlg.ShowModal(); } @endcode @@ -165,7 +165,7 @@ the XRCCTRL macro to get a pointer to the child. To expand the previous code: void MyClass::ShowDialog() { wxDialog dlg; - if (!wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog")) + if (!wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog")) return; wxTextCtrl* pText = XRCCTRL(dlg, "text", wxTextCtrl); @@ -195,7 +195,7 @@ control to the XRCID macro: void MyClass::ShowDialog() { wxDialog dlg; - if (!wxXmlResource::Get()->LoadDialog(&dlg, NULL, "SimpleDialog")) + if (!wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "SimpleDialog")) return; XRCCTRL(dlg, "text", wxTextCtrl)->Bind(wxEVT_TEXT, @@ -367,7 +367,7 @@ protected: private: void InitWidgetsFromXRC() { - wxXmlResource::Get()->LoadObject(this, NULL, "TestWnd", "wxFrame"); + wxXmlResource::Get()->LoadObject(this, nullptr, "TestWnd", "wxFrame"); A = XRCCTRL(*this, "A", wxTextCtrl); B = XRCCTRL(*this, "B", wxButton); } diff --git a/docs/qt/architecture.md b/docs/qt/architecture.md index c80d0406b9..76c5a697e4 100644 --- a/docs/qt/architecture.md +++ b/docs/qt/architecture.md @@ -59,7 +59,7 @@ The approach chosen was to use templates to help inherit QObject's (QWidget), pr ### Delete later -Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reset to NULL when the wx counterpart is marked to deletion). +Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reset to @NULL when the wx counterpart is marked to deletion). This is due that in some situations, Qt object could still be referenced in the Qt event queue, so it cannot be removed immediately. diff --git a/include/wx/aboutdlg.h b/include/wx/aboutdlg.h index 0143154bc4..dbbe2d33f4 100644 --- a/include/wx/aboutdlg.h +++ b/include/wx/aboutdlg.h @@ -161,7 +161,7 @@ private: }; // functions to show the about dialog box -WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); +WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); #endif // wxUSE_ABOUTDLG diff --git a/include/wx/accel.h b/include/wx/accel.h index 645edff200..cb8d08a120 100644 --- a/include/wx/accel.h +++ b/include/wx/accel.h @@ -48,18 +48,18 @@ class WXDLLIMPEXP_CORE wxAcceleratorEntry { public: wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, - wxMenuItem *item = NULL) + wxMenuItem *item = nullptr) : m_flags(flags) , m_keyCode(keyCode) , m_command(cmd) , m_item(item) { } - // create accelerator corresponding to the specified string, return NULL if + // create accelerator corresponding to the specified string, return nullptr if // string couldn't be parsed or a pointer to be deleted by the caller static wxAcceleratorEntry *Create(const wxString& str); - void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL) + void Set(int flags, int keyCode, int cmd, wxMenuItem *item = nullptr) { m_flags = flags; m_keyCode = keyCode; @@ -121,7 +121,7 @@ private: int m_keyCode; // ASCII or virtual keycode int m_command; // Command id to generate - // the menu item this entry corresponds to, may be NULL + // the menu item this entry corresponds to, may be null wxMenuItem *m_item; // for compatibility with old code, use accessors now! diff --git a/include/wx/access.h b/include/wx/access.h index 4948969209..cbf42fa6be 100644 --- a/include/wx/access.h +++ b/include/wx/access.h @@ -263,13 +263,13 @@ public: { return wxACC_NOT_IMPLEMENTED; } // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, + // If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. virtual wxAccStatus GetChild(int WXUNUSED(childId), wxAccessible** WXUNUSED(child)) { return wxACC_NOT_IMPLEMENTED; } - // Gets the parent, or NULL. + // Gets the parent, or nullptr. virtual wxAccStatus GetParent(wxAccessible** WXUNUSED(parent)) { return wxACC_NOT_IMPLEMENTED; } @@ -320,7 +320,7 @@ public: { return wxACC_NOT_IMPLEMENTED; } // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in + // If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. virtual wxAccStatus GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) diff --git a/include/wx/addremovectrl.h b/include/wx/addremovectrl.h index d58abaf06e..74167c24be 100644 --- a/include/wx/addremovectrl.h +++ b/include/wx/addremovectrl.h @@ -96,7 +96,7 @@ private: // Common part of all ctors. void Init() { - m_impl = NULL; + m_impl = nullptr; } class wxAddRemoveImpl* m_impl; diff --git a/include/wx/affinematrix2dbase.h b/include/wx/affinematrix2dbase.h index f2d51d26d9..35dd27ef43 100644 --- a/include/wx/affinematrix2dbase.h +++ b/include/wx/affinematrix2dbase.h @@ -92,7 +92,7 @@ public: void TransformPoint(wxDouble* x, wxDouble* y) const { - wxCHECK_RET( x && y, "Can't be NULL" ); + wxCHECK_RET( x && y, "Can't be null" ); const wxPoint2DDouble dst = DoTransformPoint(wxPoint2DDouble(*x, *y)); *x = dst.m_x; @@ -107,7 +107,7 @@ public: void TransformDistance(wxDouble* dx, wxDouble* dy) const { - wxCHECK_RET( dx && dy, "Can't be NULL" ); + wxCHECK_RET( dx && dy, "Can't be null" ); const wxPoint2DDouble dst = DoTransformDistance(wxPoint2DDouble(*dx, *dy)); diff --git a/include/wx/any.h b/include/wx/any.h index 3f3eb47c1e..d0359cb30d 100644 --- a/include/wx/any.h +++ b/include/wx/any.h @@ -44,7 +44,7 @@ union wxAnyValueBuffer wxAnyValueBuffer() { - m_ptr = NULL; + m_ptr = nullptr; } }; @@ -324,7 +324,7 @@ public: #if wxUSE_EXTENDED_RTTI virtual const wxTypeInfo* GetTypeInfo() const { - return wxGetTypeInfo((T*)NULL); + return wxGetTypeInfo((T*)nullptr); } #endif }; @@ -389,7 +389,7 @@ public: \ _WX_ANY_DEFINE_SUB_TYPE(T, CLSTYPE)\ virtual const wxTypeInfo* GetTypeInfo() const \ { \ - return wxGetTypeInfo((T*)NULL); \ + return wxGetTypeInfo((T*)nullptr); \ } \ }; #else @@ -673,7 +673,7 @@ public: /* Let's define a discrete Null value so we don't have to really - ever check if wxAny.m_type pointer is NULL or not. This is an + ever check if wxAny.m_type pointer is null or not. This is an optimization, mostly. Implementation of this value type is "hidden" in the source file. */ @@ -965,7 +965,7 @@ public: const char* and const wchar_t*) has been assigned to wxAny. */ template - T As(T* = NULL) const + T As(T* = nullptr) const { return wxPrivate::wxAnyAsImpl::DoAs(*this); } @@ -1124,7 +1124,7 @@ struct wxAnyAsImpl // 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)) + (any).As(static_cast(nullptr)) template diff --git a/include/wx/anystr.h b/include/wx/anystr.h index fb71504990..f5da11466c 100644 --- a/include/wx/anystr.h +++ b/include/wx/anystr.h @@ -22,7 +22,7 @@ // ---------------------------------------------------------------------------- // This is a helper class convertible to either narrow or wide string pointer. -// It is similar to wxCStrData but, unlike it, can be NULL which is required to +// It is similar to wxCStrData but, unlike it, can be null which is required to // represent the return value of wxDateTime::ParseXXX() methods for example. // // NB: this class is fully inline and so doesn't need to be DLL-exported @@ -30,12 +30,12 @@ class wxAnyStrPtr { public: // ctors: this class must be created from the associated string or using - // its default ctor for an invalid NULL-like object; notice that it is + // its default ctor for an invalid nullptr-like object; notice that it is // immutable after creation. // ctor for invalid pointer wxAnyStrPtr() - : m_str(NULL) + : m_str(nullptr) { } @@ -58,7 +58,7 @@ public: // e.g. "if ( FuncReturningAnyStrPtr() && ... )" (unfortunately using // unspecified_bool_type here wouldn't help with ambiguity between all the // different conversions to pointers) - operator bool() const { return m_str != NULL; } + operator bool() const { return m_str != nullptr; } // at least VC7 also needs this one or it complains about ambiguity // for !anystr expressions @@ -71,7 +71,7 @@ public: operator const char *() const { if ( !m_str ) - return NULL; + return nullptr; // check if the string is convertible to char at all // @@ -100,7 +100,7 @@ public: operator const wchar_t *() const { if ( !m_str ) - return NULL; + return nullptr; // no complications with wide strings (as long as we discount // surrogates as we do for now) @@ -112,8 +112,8 @@ public: } // Because the objects of this class are only used as return type for - // functions which can return NULL we can skip providing dereferencing - // operators: the code using this class must test it for NULL first and if + // functions which can return nullptr we can skip providing dereferencing + // operators: the code using this class must test it for null first and if // it does anything else with it has to assign it to either char* or // wchar_t* itself, before dereferencing. // @@ -130,7 +130,7 @@ public: private: // the original string and the position in it we correspond to, if the - // string is NULL this object is NULL pointer-like + // string is null this object is null pointer-like const wxString * const m_str; const wxString::const_iterator m_iter; diff --git a/include/wx/app.h b/include/wx/app.h index bbffd10d5c..e6dcbb434d 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -226,14 +226,14 @@ public: // wxTheApp->GetTraits() during startup or termination when the global // application object itself may be unavailable // - // of course, it still returns NULL in this case and the caller must check + // of course, it still returns nullptr in this case and the caller must check // for it static wxAppTraits *GetTraitsIfExists(); // Return some valid traits object. // // This method checks if we have wxTheApp and returns its traits if it does - // exist and the traits are non-NULL, similarly to GetTraitsIfExists(), but + // exist and the traits are non-null, similarly to GetTraitsIfExists(), but // falls back to wxConsoleAppTraits to ensure that it always returns // something valid. static wxAppTraits& GetValidTraits(); @@ -241,8 +241,8 @@ public: // returns the main event loop instance, i.e. the event loop which is started // by OnRun() and which dispatches all events sent from the native toolkit // to the application (except when new event loops are temporarily set-up). - // The returned value maybe NULL. Put initialization code which needs a - // non-NULL main event loop into OnEventLoopEnter(). + // The returned value maybe null. Put initialization code which needs a + // non-null main event loop into OnEventLoopEnter(). wxEventLoopBase* GetMainLoop() const { return m_mainLoop; } @@ -495,7 +495,7 @@ protected: // the one and only global application object static wxAppConsole *ms_appInstance; - // create main loop from AppTraits or return NULL if + // create main loop from AppTraits or return nullptr if // there is no main loop implementation wxEventLoopBase *CreateMainLoop(); @@ -506,11 +506,11 @@ protected: m_appDisplayName, // app display name ("My Application") m_className; // class name - // the class defining the application behaviour, NULL initially and created + // the class defining the application behaviour, nullptr initially and created // by GetTraits() when first needed wxAppTraits *m_traits; - // the main event loop of the application (may be NULL if the loop hasn't + // the main event loop of the application (may be null if the loop hasn't // been started yet or has already terminated) wxEventLoopBase *m_mainLoop; @@ -622,11 +622,11 @@ public: // return the "main" top level window (if it hadn't been set previously // with SetTopWindow(), will return just some top level window and, if - // there are none, will return NULL) + // there are none, will return nullptr) virtual wxWindow *GetTopWindow() const; // convenient helper which is safe to use even if there is no wxApp at - // all, it will just return NULL in this case + // all, it will just return nullptr in this case static wxWindow *GetMainTopWindow(); // control the exit behaviour: by default, the program will exit the @@ -697,7 +697,7 @@ public: { return ms_appInstance && ms_appInstance->IsGUI() ? static_cast(ms_appInstance) - : NULL; + : nullptr; } protected: @@ -709,7 +709,7 @@ protected: void DeleteAllTLWs(); - // the main top level window (may be NULL) + // the main top level window (may be null) wxWindow *m_topWindow; // if Yes, exit the main loop when the last top level window is deleted, if diff --git a/include/wx/appprogress.h b/include/wx/appprogress.h index 72293c3c33..4932d3952d 100644 --- a/include/wx/appprogress.h +++ b/include/wx/appprogress.h @@ -37,7 +37,7 @@ private: class wxAppProgressIndicator : public wxAppProgressIndicatorBase { public: - wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL, + wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = nullptr, int WXUNUSED(maxValue) = 100) { } diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index cc86eeba90..2de2219864 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -66,8 +66,8 @@ public: #endif // wxUSE_FONTMAP // get the renderer to use for drawing the generic controls (return value - // may be NULL in which case the default renderer for the current platform - // is used); this is used in GUI only and always returns NULL in console + // may be null in which case the default renderer for the current platform + // is used); this is used in GUI only and always returns nullptr in console // // NB: returned pointer will be deleted by the caller virtual wxRendererNative *CreateRenderer() = 0; @@ -139,9 +139,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, - int *microVer = NULL) const = 0; + virtual wxPortId GetToolkitVersion(int *majVer = nullptr, + int *minVer = nullptr, + int *microVer = nullptr) const = 0; // return true if the port is using wxUniversal for the GUI, false if not virtual bool IsUsingUniversalWidgets() const = 0; @@ -206,7 +206,7 @@ class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits { public: #if !wxUSE_CONSOLE_EVENTLOOP - virtual wxEventLoopBase *CreateEventLoop() override { return NULL; } + virtual wxEventLoopBase *CreateEventLoop() override { return nullptr; } #endif // !wxUSE_CONSOLE_EVENTLOOP #if wxUSE_LOG @@ -224,9 +224,9 @@ public: const wxString& title) override; // the GetToolkitVersion for console application is always the same - wxPortId GetToolkitVersion(int *verMaj = NULL, - int *verMin = NULL, - int *verMicro = NULL) const override + wxPortId GetToolkitVersion(int *verMaj = nullptr, + int *verMin = nullptr, + int *verMicro = nullptr) const override { // no toolkits (wxBase is for console applications without GUI support) // NB: zero means "no toolkit", -1 means "not initialized yet" diff --git a/include/wx/archive.h b/include/wx/archive.h index 1cd6c55d47..3876f85d63 100644 --- a/include/wx/archive.h +++ b/include/wx/archive.h @@ -58,11 +58,11 @@ public: wxArchiveEntry *Clone() const { return DoClone(); } void SetNotifier(wxArchiveNotifier& notifier); - virtual void UnsetNotifier() { m_notifier = NULL; } + virtual void UnsetNotifier() { m_notifier = nullptr; } protected: - wxArchiveEntry() : m_notifier(NULL) { } - wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(NULL) { } + wxArchiveEntry() : m_notifier(nullptr) { } + wxArchiveEntry(const wxArchiveEntry& e) : wxObject(e), m_notifier(nullptr) { } virtual void SetOffset(wxFileOffset offset) = 0; virtual wxArchiveEntry* DoClone() const = 0; @@ -85,7 +85,7 @@ private: // the wxArchiveInputStream then returns the entry's data. Eof() becomes true // after an attempt has been made to read past the end of the entry's data. // -// When there are no more entries, GetNextEntry() returns NULL and sets Eof(). +// When there are no more entries, GetNextEntry() returns nullptr and sets Eof(). class WXDLLIMPEXP_BASE wxArchiveInputStream : public wxFilterInputStream { @@ -191,11 +191,11 @@ public: typedef T* pointer; typedef T& reference; - wxArchiveIterator() : m_rep(NULL) { } + wxArchiveIterator() : m_rep(nullptr) { } wxArchiveIterator(Arc& arc) { typename Arc::entry_type* entry = arc.GetNextEntry(); - m_rep = entry ? new Rep(arc, entry) : NULL; + m_rep = entry ? new Rep(arc, entry) : nullptr; } wxArchiveIterator(const wxArchiveIterator& it) : m_rep(it.m_rep) { @@ -270,7 +270,7 @@ private: typename Arc::entry_type* entry = m_arc.GetNextEntry(); if (!entry) { UnRef(); - return NULL; + return nullptr; } if (m_ref > 1) { m_ref--; @@ -285,7 +285,7 @@ private: const T& GetValue() { if (m_entry) { _wxSetArchiveIteratorValue(m_value, m_entry, m_entry); - m_entry = NULL; + m_entry = nullptr; } return m_value; } @@ -361,7 +361,7 @@ protected: virtual wxArchiveInputStream *DoNewStream(wxInputStream *stream) const = 0; virtual wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const = 0; - wxArchiveClassFactory() : m_pConv(NULL), m_next(this) { } + wxArchiveClassFactory() : m_pConv(nullptr), m_next(this) { } wxArchiveClassFactory& operator=(const wxArchiveClassFactory& WXUNUSED(f)) { return *this; } diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index 951dd16d1b..dcfe499d6f 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -287,7 +287,7 @@ public: friend difference_type operator -(const itor& i1, const itor& i2); public: pointer m_ptr; - reverse_iterator() : m_ptr(NULL) { } + reverse_iterator() : m_ptr(nullptr) { } explicit reverse_iterator(pointer ptr) : m_ptr(ptr) { } reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } reference operator*() const { return *m_ptr; } @@ -313,7 +313,7 @@ public: friend difference_type operator -(const itor& i1, const itor& i2); public: pointer m_ptr; - const_reverse_iterator() : m_ptr(NULL) { } + const_reverse_iterator() : m_ptr(nullptr) { } explicit const_reverse_iterator(pointer ptr) : m_ptr(ptr) { } const_reverse_iterator(const itor& it) : m_ptr(it.m_ptr) { } const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { } @@ -395,7 +395,7 @@ protected: private: // 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). + // (if the old buffer is big enough, just return nullptr). wxString *Grow(size_t nIncrement); // Binary search in the sorted array: return the index of the string if it's @@ -432,7 +432,7 @@ class WXDLLIMPEXP_BASE wxCArrayString { public: wxCArrayString( const wxArrayString& array ) - : m_array( array ), m_strings( NULL ) + : m_array( array ), m_strings( nullptr ) { } ~wxCArrayString() { delete[] m_strings; } @@ -450,7 +450,7 @@ public: wxString* Release() { wxString *r = GetStrings(); - m_strings = NULL; + m_strings = nullptr; return r; } @@ -513,7 +513,7 @@ public: wxArrayStringsAdapter(const std::vector& strings) : m_type(wxSTRING_POINTER), m_size(strings.size()) { - m_data.ptr = m_size == 0 ? NULL : &strings[0]; + m_data.ptr = m_size == 0 ? nullptr : &strings[0]; } #endif // wxUSE_STD_CONTAINERS_COMPATIBLY diff --git a/include/wx/artprov.h b/include/wx/artprov.h index 7785011fda..a0448f46b3 100644 --- a/include/wx/artprov.h +++ b/include/wx/artprov.h @@ -195,12 +195,12 @@ public: // Gets native size for given 'client' or wxDefaultSize if it doesn't // have native equivalent. The first version returns the size in logical // pixels while the second one returns it in DIPs. - static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = nullptr); static wxSize GetNativeDIPSizeHint(const wxArtClient& client); // Get the size hint of an icon from a specific wxArtClient from the // topmost (i.e. first used) provider. - static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = nullptr); static wxSize GetDIPSizeHint(const wxArtClient& client); #if WXWIN_COMPATIBILITY_3_0 diff --git a/include/wx/aui/auibar.h b/include/wx/aui/auibar.h index 6d0f74638b..0d6febe80c 100644 --- a/include/wx/aui/auibar.h +++ b/include/wx/aui/auibar.h @@ -110,8 +110,8 @@ public: wxAuiToolBarItem() { - m_window = NULL; - m_sizerItem = NULL; + m_window = nullptr; + m_sizerItem = nullptr; m_spacerPixels = 0; m_toolId = 0; m_kind = wxITEM_NORMAL; @@ -507,7 +507,7 @@ public: const wxBitmapBundle& bitmap, const wxBitmapBundle& disabledBitmap, bool toggle = false, - wxObject* clientData = NULL, + wxObject* clientData = nullptr, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) { diff --git a/include/wx/aui/auibook.h b/include/wx/aui/auibook.h index eee31b50aa..f52e5e82c5 100644 --- a/include/wx/aui/auibook.h +++ b/include/wx/aui/auibook.h @@ -68,7 +68,7 @@ public: int winId = 0) : wxBookCtrlEvent(commandType, winId) { - m_dragSource = NULL; + m_dragSource = nullptr; } wxEvent *Clone() const override { return new wxAuiNotebookEvent(*this); } @@ -151,7 +151,7 @@ public: void SetColour(const wxColour& colour); void SetActiveColour(const wxColour& colour); void DoShowHide(); - void SetRect(const wxRect& rect, wxWindow* wnd = NULL); + void SetRect(const wxRect& rect, wxWindow* wnd = nullptr); void RemoveButton(int id); void AddButton(int id, @@ -344,7 +344,7 @@ public: //wxBookCtrlBase functions virtual void SetPageSize (const wxSize &size) override; - virtual int HitTest (const wxPoint &pt, long *flags=NULL) const override; + virtual int HitTest (const wxPoint &pt, long *flags=nullptr) const override; virtual int GetPageImage(size_t n) const override; virtual bool SetPageImage(size_t n, int imageId) override; @@ -383,7 +383,7 @@ protected: virtual wxSize CalculateNewSplitSize(); // remove the page and return a pointer to it - virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) override { return NULL; } + virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) override { return nullptr; } //A general selection function virtual int DoModifySelection(size_t n, bool events); @@ -415,7 +415,7 @@ protected: void OnNavigationKeyNotebook(wxNavigationKeyEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); - // set selection to the given window (which must be non-NULL and be one of + // set selection to the given window (which must be non-null and be one of // our pages, otherwise an assert is raised) void SetSelectionToWindow(wxWindow *win); void SetSelectionToPage(const wxAuiNotebookPage& page) diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 7c7929ba8a..1e6ff1c577 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -152,8 +152,8 @@ public: , floating_pos(wxDefaultPosition) , floating_size(wxDefaultSize) { - window = NULL; - frame = NULL; + window = nullptr; + frame = nullptr; state = 0; dock_direction = wxAUI_DOCK_LEFT; dock_layer = 0; @@ -180,7 +180,7 @@ public: *this = source; } - bool IsOk() const { return window != NULL; } + bool IsOk() const { return window != nullptr; } bool IsFixed() const { return !HasFlag(optionResizable); } bool IsResizable() const { return HasFlag(optionResizable); } bool IsShown() const { return !HasFlag(optionHidden); } @@ -405,7 +405,7 @@ class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler public: - wxAuiManager(wxWindow* managedWnd = NULL, + wxAuiManager(wxWindow* managedWnd = nullptr, unsigned int flags = wxAUI_MGR_DEFAULT); virtual ~wxAuiManager(); void UnInit(); @@ -533,7 +533,7 @@ protected: void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt); void OnFloatingPaneResized(wxWindow* window, const wxRect& rect); void Render(wxDC* dc); - void Repaint(wxDC* dc = NULL); + void Repaint(wxDC* dc = nullptr); void ProcessMgrEvent(wxAuiManagerEvent& event); void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart, const wxMouseEvent& event); @@ -596,7 +596,7 @@ protected: wxPoint m_actionStart; // position where the action click started wxPoint m_actionOffset; // offset from upper left of the item clicked wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to - wxWindow* m_actionWindow; // action frame or window (NULL if none) + wxWindow* m_actionWindow; // action frame or window (nullptr if none) wxRect m_actionHintRect; // hint rectangle for the action wxRect m_lastRect; wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over @@ -630,12 +630,12 @@ class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent public: wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type) { - manager = NULL; - pane = NULL; + manager = nullptr; + pane = nullptr; button = 0; veto_flag = false; canveto_flag = true; - dc = NULL; + dc = nullptr; } wxEvent *Clone() const override { return new wxAuiManagerEvent(*this); } diff --git a/include/wx/aui/tabart.h b/include/wx/aui/tabart.h index a71c2e63e7..e37638a25c 100644 --- a/include/wx/aui/tabart.h +++ b/include/wx/aui/tabart.h @@ -48,7 +48,7 @@ public: virtual void SetSizingInfo(const wxSize& tabCtrlSize, size_t tabCount, - wxWindow* wnd = NULL) = 0; + wxWindow* wnd = nullptr) = 0; virtual void SetNormalFont(const wxFont& font) = 0; virtual void SetSelectedFont(const wxFont& font) = 0; @@ -128,7 +128,7 @@ public: void SetFlags(unsigned int flags) override; void SetSizingInfo(const wxSize& tabCtrlSize, size_t tabCount, - wxWindow* wnd = NULL) override; + wxWindow* wnd = nullptr) override; void SetNormalFont(const wxFont& font) override; void SetSelectedFont(const wxFont& font) override; @@ -231,7 +231,7 @@ public: void SetSizingInfo(const wxSize& tabCtrlSize, size_t tabCount, - wxWindow* wnd = NULL) override; + wxWindow* wnd = nullptr) override; void SetNormalFont(const wxFont& font) override; void SetSelectedFont(const wxFont& font) override; diff --git a/include/wx/base64.h b/include/wx/base64.h index e682757598..ff5e357dbe 100644 --- a/include/wx/base64.h +++ b/include/wx/base64.h @@ -29,7 +29,7 @@ inline size_t wxBase64EncodedSize(size_t len) { return 4*((len+2)/3); } // // returns the length of the encoded data or wxCONV_FAILED if the buffer is not // large enough; to determine the needed size you can either allocate a buffer -// of wxBase64EncodedSize(srcLen) size or call the function with NULL buffer in +// of wxBase64EncodedSize(srcLen) size or call the function with null buffer in // which case the required size will be returned WXDLLIMPEXP_BASE size_t wxBase64Encode(char *dst, size_t dstLen, const void *src, size_t srcLen); @@ -83,18 +83,18 @@ inline size_t wxBase64DecodedSize(size_t srcLen) { return 3*srcLen/4; } // returns the length of the decoded data or wxCONV_FAILED if an error occurs // such as the buffer is too small or the encoded string is invalid; in the // latter case the posErr is filled with the position where the decoding -// stopped if it is not NULL +// stopped if it is not null WXDLLIMPEXP_BASE size_t wxBase64Decode(void *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); inline size_t wxBase64Decode(void *dst, size_t dstLen, const wxString& src, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL) + size_t *posErr = nullptr) { // don't use str.length() here as the ASCII buffer is shorter than it for // strings with embedded NULs @@ -106,12 +106,12 @@ wxBase64Decode(void *dst, size_t dstLen, WXDLLIMPEXP_BASE wxMemoryBuffer wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); inline wxMemoryBuffer wxBase64Decode(const wxString& src, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL) + size_t *posErr = nullptr) { // don't use str.length() here as the ASCII buffer is shorter than it for // strings with embedded NULs diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index 6a50e800ea..3968f1b97a 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -135,7 +135,7 @@ public: { return false; } virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), - wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const + wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = nullptr) const { return false; } void SetName(const wxString& name) { m_name = name; } @@ -233,7 +233,7 @@ public: virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0; virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const = 0; + const wxPalette *palette = nullptr) const = 0; virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0; /* diff --git a/include/wx/bmpbndl.h b/include/wx/bmpbndl.h index d099fb70bc..470db23e44 100644 --- a/include/wx/bmpbndl.h +++ b/include/wx/bmpbndl.h @@ -112,7 +112,7 @@ public: static wxBitmapBundle FromImpl(wxBitmapBundleImpl* impl); // Check if bitmap bundle is non-empty. - bool IsOk() const { return m_impl.get() != NULL; } + bool IsOk() const { return m_impl.get() != nullptr; } // Clear the bundle contents, IsOk() will return false after doing this. void Clear(); diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 8531b617e7..2e0fce1e1f 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -94,11 +94,11 @@ public: // get the panel which represents the given page virtual wxWindow *GetPage(size_t n) const { return m_pages.at(n); } - // get the current page or NULL if none + // get the current page or nullptr if none wxWindow *GetCurrentPage() const { const int n = GetSelection(); - return n == wxNOT_FOUND ? NULL : GetPage(n); + return n == wxNOT_FOUND ? nullptr : GetPage(n); } // get the currently selected page or wxNOT_FOUND if none @@ -162,7 +162,7 @@ public: virtual bool RemovePage(size_t n) { DoInvalidateBestSize(); - return DoRemovePage(n) != NULL; + return DoRemovePage(n) != nullptr; } // remove all pages and delete them @@ -217,7 +217,7 @@ public: // hit test: returns which page is hit and, optionally, where (icon, label) virtual int HitTest(const wxPoint& WXUNUSED(pt), - long * WXUNUSED(flags) = NULL) const + long * WXUNUSED(flags) = nullptr) const { return wxNOT_FOUND; } @@ -279,7 +279,7 @@ protected: // create a new "page changing" event virtual wxBookCtrlEvent* CreatePageChangingEvent() const - { wxFAIL_MSG(wxT("Override this function!")); return NULL; } + { wxFAIL_MSG(wxT("Override this function!")); return nullptr; } // modify the event created by CreatePageChangingEvent() to "page changed" // event, usually by just calling SetEventType() on it @@ -292,15 +292,15 @@ protected: virtual void DoShowPage(wxWindow* page, bool show) { page->Show(show); } - // Should we accept NULL page pointers in Add/InsertPage()? + // Should we accept null page pointers in Add/InsertPage()? // - // Default is no but derived classes may override it if they can treat NULL + // Default is no but derived classes may override it if they can treat null // pages in some sensible way (e.g. wxTreebook overrides this to allow // having nodes without any associated page) virtual bool AllowNullPage() const { return false; } // For classes that allow null pages, we also need a way to find the - // closest non-NULL page corresponding to the given index, e.g. the first + // closest non-null page corresponding to the given index, e.g. the first // leaf item in wxTreebook tree and this method must be overridden to // return it if AllowNullPage() is overridden. Note that it can still // return null if there are no valid pages after this one. @@ -349,7 +349,7 @@ protected: // event handlers void OnSize(wxSizeEvent& event); - // controller buddy if available, NULL otherwise (usually for native book controls like wxNotebook) + // controller buddy if available, nullptr otherwise (usually for native book controls like wxNotebook) wxWindow *m_bookctrl; // Whether to shrink to fit current page diff --git a/include/wx/buffer.h b/include/wx/buffer.h index 9d24f53577..74cbcf8e7d 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -133,7 +133,7 @@ public: CharType *release() const { if ( m_data == GetNullData() ) - return NULL; + return nullptr; wxASSERT_MSG( m_data->m_owned, wxT("can't release non-owned buffer") ); wxASSERT_MSG( m_data->m_ref == 1, wxT("can't release shared buffer") ); @@ -141,7 +141,7 @@ public: CharType * const p = m_data->Get(); wxScopedCharTypeBuffer *self = const_cast(this); - self->m_data->Set(NULL, 0); + self->m_data->Set(nullptr, 0); self->DecRef(); return p; @@ -176,7 +176,7 @@ protected: } }; - // placeholder for NULL string, to simplify this code + // placeholder for null string, to simplify this code static Data *GetNullData() { return static_cast(wxPrivate::GetUntypedNullData()); @@ -252,7 +252,7 @@ protected: public: typedef T CharType; - wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN) + wxCharTypeBuffer(const CharType *str = nullptr, size_t len = wxNO_LEN) { if ( str ) { @@ -365,7 +365,7 @@ public: wxCharBuffer(const wxScopedCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} - wxCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} + wxCharBuffer(const CharType *str = nullptr) : wxCharTypeBufferBase(str) {} wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} wxCharBuffer(const wxCStrData& cstr); @@ -382,7 +382,7 @@ public: wxWCharBuffer(const wxScopedCharTypeBufferBase& buf) : wxCharTypeBufferBase(buf) {} - wxWCharBuffer(const CharType *str = NULL) : wxCharTypeBufferBase(str) {} + wxWCharBuffer(const CharType *str = nullptr) : wxCharTypeBufferBase(str) {} wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {} wxWCharBuffer(const wxCStrData& cstr); @@ -401,7 +401,7 @@ public: // always return a buffer // + we should derive this class from wxScopedCharTypeBuffer // then - wxWritableCharTypeBuffer(const CharType *str = NULL) + wxWritableCharTypeBuffer(const CharType *str = nullptr) : wxCharTypeBuffer(str) {} operator CharType*() { return this->data(); } @@ -448,7 +448,7 @@ public: // everything is private as it can only be used by wxMemoryBuffer private: wxMemoryBufferData(size_t size = wxMemoryBufferData::DefBufSize) - : m_data(size ? malloc(size) : NULL), m_size(size), m_len(0), m_ref(0) + : m_data(size ? malloc(size) : nullptr), m_size(size), m_len(0), m_ref(0) { } ~wxMemoryBufferData() { free(m_data); } @@ -483,13 +483,13 @@ private: void *release() { - if ( m_data == NULL ) - return NULL; + if ( m_data == nullptr ) + return nullptr; wxASSERT_MSG( m_ref == 1, "can't release shared buffer" ); void *p = m_data; - m_data = NULL; + m_data = nullptr; m_len = m_size = 0; diff --git a/include/wx/busyinfo.h b/include/wx/busyinfo.h index 94f8fabdcc..7209a8e527 100644 --- a/include/wx/busyinfo.h +++ b/include/wx/busyinfo.h @@ -31,7 +31,7 @@ class wxBusyInfoFlags public: wxBusyInfoFlags() { - m_parent = NULL; + m_parent = nullptr; m_alpha = wxALPHA_OPAQUE; } diff --git a/include/wx/button.h b/include/wx/button.h index 64d765ac2c..b37907cb77 100644 --- a/include/wx/button.h +++ b/include/wx/button.h @@ -36,12 +36,12 @@ public: // make this button the default button in its top level window // - // returns the old default item (possibly NULL) + // returns the old default item (possibly null) virtual wxWindow *SetDefault(); // returns the default button size for this platform, and optionally for a // specific window when the platform supports per-monitor DPI - static wxSize GetDefaultSize(wxWindow* win = NULL); + static wxSize GetDefaultSize(wxWindow* win = nullptr); protected: wxDECLARE_NO_COPY_CLASS(wxButtonBase); diff --git a/include/wx/calctrl.h b/include/wx/calctrl.h index f3c191bf63..5f1f3e6941 100644 --- a/include/wx/calctrl.h +++ b/include/wx/calctrl.h @@ -204,7 +204,7 @@ public: } // retrieves the limits currently in use (wxDefaultDateTime if none) in the - // provided pointers (which may be NULL) and returns true if there are any + // provided pointers (which may be null) and returns true if there are any // limits or false if none virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const @@ -223,8 +223,8 @@ public: // notice that this is not implemented in all versions virtual wxCalendarHitTestResult HitTest(const wxPoint& WXUNUSED(pos), - wxDateTime* WXUNUSED(date) = NULL, - wxDateTime::WeekDay* WXUNUSED(wd) = NULL) + wxDateTime* WXUNUSED(date) = nullptr, + wxDateTime::WeekDay* WXUNUSED(wd) = nullptr) { return wxCAL_HITTEST_NOWHERE; } @@ -253,7 +253,7 @@ public: virtual void Mark(size_t day, bool mark) = 0; virtual wxCalendarDateAttr *GetAttr(size_t WXUNUSED(day)) const - { return NULL; } + { return nullptr; } virtual void SetAttr(size_t WXUNUSED(day), wxCalendarDateAttr *attr) { delete attr; } virtual void ResetAttr(size_t WXUNUSED(day)) { } diff --git a/include/wx/caret.h b/include/wx/caret.h index bb659f2ee7..863ea74b31 100644 --- a/include/wx/caret.h +++ b/include/wx/caret.h @@ -179,7 +179,7 @@ protected: private: void Init() { - m_window = NULL; + m_window = nullptr; m_x = m_y = 0; m_width = m_height = 0; m_countVisible = 0; diff --git a/include/wx/clipbrd.h b/include/wx/clipbrd.h index d94d52c9bd..cd7834a508 100644 --- a/include/wx/clipbrd.h +++ b/include/wx/clipbrd.h @@ -168,7 +168,7 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); class WXDLLIMPEXP_CORE wxClipboardLocker { public: - wxClipboardLocker(wxClipboard *clipboard = NULL) + wxClipboardLocker(wxClipboard *clipboard = nullptr) { m_clipboard = clipboard ? clipboard : wxTheClipboard; if ( m_clipboard ) diff --git a/include/wx/clntdata.h b/include/wx/clntdata.h index d6df32e34b..20ebc17418 100644 --- a/include/wx/clntdata.h +++ b/include/wx/clntdata.h @@ -54,7 +54,7 @@ public: return true; } - void AddField( const wxString &name, void* initialValue = NULL ) + void AddField( const wxString &name, void* initialValue = nullptr ) { wxShadowObjectFields::iterator it = m_fields.find( name ); if (it == m_fields.end()) @@ -71,7 +71,7 @@ public: it->second = value; } - void* GetField( const wxString &name, void *defaultValue = NULL ) + void* GetField( const wxString &name, void *defaultValue = nullptr ) { wxShadowObjectFields::iterator it = m_fields.find( name ); if (it == m_fields.end()) @@ -180,7 +180,7 @@ public: void *GetClientData() const; protected: - bool HasClientDataContainer() const { return m_data.get() != NULL; } + bool HasClientDataContainer() const { return m_data.get() != nullptr; } void CopyClientDataContainer(const wxSharedClientDataContainer& other) { m_data = other.m_data; @@ -192,7 +192,7 @@ private: { }; - // Helper function that will create m_data if it is currently NULL + // Helper function that will create m_data if it is currently null wxClientDataContainer *GetValidClientData(); // m_data is shared, not deep copied, when cloned. If you make changes to diff --git a/include/wx/cmdargs.h b/include/wx/cmdargs.h index 9df612fb63..552c42c54c 100644 --- a/include/wx/cmdargs.h +++ b/include/wx/cmdargs.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_BASE wxCmdLineArgsArray { public: - wxCmdLineArgsArray() { m_argsA = NULL; m_argsW = NULL; } + wxCmdLineArgsArray() { m_argsA = nullptr; m_argsW = nullptr; } template void Init(int argc, T **argv) @@ -53,7 +53,7 @@ public: for ( size_t n = 0; n < count; n++ ) m_argsA[n] = wxStrdup(m_args[n].ToAscii()); - m_argsA[count] = NULL; + m_argsA[count] = nullptr; } return m_argsA; @@ -68,7 +68,7 @@ public: for ( size_t n = 0; n < count; n++ ) m_argsW[n] = wxStrdup(m_args[n].wc_str()); - m_argsW[count] = NULL; + m_argsW[count] = nullptr; } return m_argsW; @@ -125,7 +125,7 @@ private: free(args[n]); delete [] args; - args = NULL; + args = nullptr; } void FreeArgs() diff --git a/include/wx/cmdline.h b/include/wx/cmdline.h index 729ac0cb21..ec7e9e5c44 100644 --- a/include/wx/cmdline.h +++ b/include/wx/cmdline.h @@ -93,7 +93,7 @@ struct wxCmdLineEntryDesc // the list of wxCmdLineEntryDesc objects should be terminated with this one #define wxCMD_LINE_DESC_END \ - { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0x0 } + { wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0x0 } // ---------------------------------------------------------------------------- // wxCmdLineArg contains the value for one command line argument @@ -141,7 +141,7 @@ public: typedef std::bidirectional_iterator_tag iterator_category; #endif // wx_USE_STD_STRING - const_iterator() : m_parser(NULL), m_index(0) {} + const_iterator() : m_parser(nullptr), m_index(0) {} reference operator *() const; pointer operator ->() const; const_iterator &operator ++ (); diff --git a/include/wx/cmdproc.h b/include/wx/cmdproc.h index 8f9656c5c3..43fba8ab4b 100644 --- a/include/wx/cmdproc.h +++ b/include/wx/cmdproc.h @@ -90,7 +90,7 @@ public: const wxList& GetCommands() const { return m_commands; } wxCommand *GetCurrentCommand() const { - return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : NULL); + return (wxCommand *)(m_currentCommand ? m_currentCommand->GetData() : nullptr); } int GetMaxCommands() const { return m_maxNoCommands; } virtual void ClearCommands(); diff --git a/include/wx/colordlg.h b/include/wx/colordlg.h index 21aa6e856d..07a17f543c 100644 --- a/include/wx/colordlg.h +++ b/include/wx/colordlg.h @@ -78,10 +78,10 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COLOUR_CHANGED, wxColourDialogE // get the colour from user and return it -WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = NULL, +WXDLLIMPEXP_CORE wxColour wxGetColourFromUser(wxWindow *parent = nullptr, const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString, - wxColourData *data = NULL); + wxColourData *data = nullptr); #endif // wxUSE_COLOURDLG diff --git a/include/wx/colour.h b/include/wx/colour.h index 7906318d29..1fe6e56773 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -206,14 +206,14 @@ protected: { wxFAIL_MSG( "must be overridden if used" ); - return NULL; + return nullptr; } virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const override { wxFAIL_MSG( "must be overridden if used" ); - return NULL; + return nullptr; } #endif }; diff --git a/include/wx/combo.h b/include/wx/combo.h index 080536cf01..193d21903e 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -181,7 +181,7 @@ public: bool IsPopupShown() const { return m_popupWinState == Visible; } // set interface class instance derived from wxComboPopup - // NULL popup can be used to indicate default in a derived class + // null popup can be used to indicate default in a derived class void SetPopupControl( wxComboPopup* popup ) { DoSetPopupControl(popup); @@ -538,7 +538,7 @@ protected: virtual wxSize DoGetBestSize() const override; virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const override; - // NULL popup can be used to indicate default in a derived class + // null popup can be used to indicate default in a derived class virtual void DoSetPopupControl(wxComboPopup* popup); // ensures there is at least the default popup @@ -674,7 +674,7 @@ protected: wxRect m_tcArea; wxRect m_btnArea; - // Colour of the text area, in case m_text is NULL + // Colour of the text area, in case m_text is null wxColour m_tcBgCol; // current button state (uses renderer flags) @@ -752,7 +752,7 @@ class WXDLLIMPEXP_CORE wxComboPopup public: wxComboPopup() { - m_combo = NULL; + m_combo = nullptr; m_iFlags = 0; } @@ -796,7 +796,7 @@ public: // implementation. If the found item matched the string, but is // different, it should be written back to pItem. Default implementation // always return true and does not alter trueItem. - virtual bool FindItem(const wxString& item, wxString* trueItem=NULL); + virtual bool FindItem(const wxString& item, wxString* trueItem=nullptr); // This is called to custom paint in the combo control itself (ie. not the popup). // Default implementation draws value as string. diff --git a/include/wx/compositewin.h b/include/wx/compositewin.h index 9fefa6edad..d9fad98d47 100644 --- a/include/wx/compositewin.h +++ b/include/wx/compositewin.h @@ -147,7 +147,7 @@ private: { wxWindow * const child = *i; - // Allow NULL elements in the list, this makes the code of derived + // Allow null elements in the list, this makes the code of derived // composite controls which may have optionally shown children // simpler and it doesn't cost us much here. if ( child ) @@ -165,7 +165,7 @@ class wxCompositeWindow : public wxCompositeWindowSettersOnly public: virtual void SetFocus() override { - wxSetFocusToChild(this, NULL); + wxSetFocusToChild(this, nullptr); } protected: diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 731f9cbad3..e25373b8e2 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -104,7 +104,7 @@ public: // comments near definition wxUSE_CONFIG_NATIVE for details. It returns // the created object and also sets it as ms_pConfig. static wxConfigBase *Create(); - // should Get() try to create a new log object if the current one is NULL? + // should Get() try to create a new log object if the current one is null? static void DontCreateOnDemand() { ms_bAutoCreate = false; } // ctor & virtual dtor diff --git a/include/wx/containr.h b/include/wx/containr.h index 133fc9e4f7..43a477294e 100644 --- a/include/wx/containr.h +++ b/include/wx/containr.h @@ -39,13 +39,13 @@ public: // default ctor, SetContainerWindow() must be called later wxControlContainerBase() { - m_winParent = NULL; + m_winParent = nullptr; // By default, we accept focus ourselves. m_acceptsFocusSelf = true; m_inSetFocus = false; - m_winLastFocused = NULL; + m_winLastFocused = nullptr; } virtual ~wxControlContainerBase() {} diff --git a/include/wx/control.h b/include/wx/control.h index 2d2370187f..166bf7f511 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -145,9 +145,9 @@ public: int flags = wxELLIPSIZE_FLAGS_DEFAULT); // return the accel index in the string or -1 if none and puts the modified - // string into second parameter if non NULL + // string into second parameter if non-null static int FindAccelIndex(const wxString& label, - wxString *labelOnly = NULL); + wxString *labelOnly = nullptr); // this is a helper for the derived class GetClassDefaultAttributes() // implementation: it returns the right colours for the classes which diff --git a/include/wx/convauto.h b/include/wx/convauto.h index e020969cf1..089a166c01 100644 --- a/include/wx/convauto.h +++ b/include/wx/convauto.h @@ -107,7 +107,7 @@ private: { // We don't initialize m_encDefault here as different ctors do it // differently. - m_conv = NULL; + m_conv = nullptr; m_bomType = wxBOM_Unknown; m_ownsConv = false; m_consumedBOM = false; @@ -139,7 +139,7 @@ private: // wxFONTENCODING_MAX but not wxFONTENCODING_DEFAULT static wxFontEncoding ms_defaultMBEncoding; - // conversion object which we really use, NULL until the first call to + // conversion object which we really use, null until the first call to // either ToWChar() or FromWChar() wxMBConv *m_conv; diff --git a/include/wx/cpp.h b/include/wx/cpp.h index d6873e5b30..5f467378b7 100644 --- a/include/wx/cpp.h +++ b/include/wx/cpp.h @@ -109,7 +109,7 @@ /* Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as - NULL for the compilers which don't support the latter. + nullptr for the compilers which don't support the latter. */ #ifndef __WXFUNCTION__ #if defined(__GNUC__) || \ @@ -118,7 +118,7 @@ #define __WXFUNCTION__ __FUNCTION__ #else /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */ - #define __WXFUNCTION__ (NULL) + #define __WXFUNCTION__ (nullptr) #endif #endif /* __WXFUNCTION__ already defined */ diff --git a/include/wx/cshelp.h b/include/wx/cshelp.h index 62e18a70bb..33c0734bd4 100644 --- a/include/wx/cshelp.h +++ b/include/wx/cshelp.h @@ -38,7 +38,7 @@ class WXDLLIMPEXP_CORE wxContextHelp : public wxObject { public: - wxContextHelp(wxWindow* win = NULL, bool beginHelp = true); + wxContextHelp(wxWindow* win = nullptr, bool beginHelp = true); virtual ~wxContextHelp(); bool BeginContextHelp(wxWindow* win); @@ -146,7 +146,7 @@ public: const wxPoint& pt, wxHelpEvent::Origin origin) { - wxCHECK_MSG( window, false, wxT("window must not be NULL") ); + wxCHECK_MSG( window, false, wxT("window must not be null") ); m_helptextAtPoint = pt; m_helptextOrigin = origin; @@ -229,7 +229,7 @@ class WXDLLIMPEXP_CORE wxHelpControllerHelpProvider : public wxSimpleHelpProvide public: // Note that it doesn't own the help controller. The help controller // should be deleted separately. - wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL); + wxHelpControllerHelpProvider(wxHelpControllerBase* hc = nullptr); // implement wxHelpProvider methods diff --git a/include/wx/ctrlsub.h b/include/wx/ctrlsub.h index d10c074ed6..7953261e07 100644 --- a/include/wx/ctrlsub.h +++ b/include/wx/ctrlsub.h @@ -119,7 +119,7 @@ private: int AppendItems(const wxArrayStringsAdapter& items) { - return AppendItems(items, NULL, wxClientData_None); + return AppendItems(items, nullptr, wxClientData_None); } int AppendItems(const wxArrayStringsAdapter& items, void **clientData) @@ -162,7 +162,7 @@ private: int InsertItems(const wxArrayStringsAdapter& items, unsigned int pos) { - return InsertItems(items, pos, NULL, wxClientData_None); + return InsertItems(items, pos, nullptr, wxClientData_None); } int InsertItems(const wxArrayStringsAdapter& items, @@ -316,7 +316,7 @@ public: // SetClientObject() takes ownership of the pointer, GetClientObject() // returns it but keeps the ownership while DetachClientObject() expects // the caller to delete the pointer and also resets the internally stored - // one to NULL for this item + // one to nullptr for this item void SetClientObject(unsigned int n, wxClientData* clientData); wxClientData* GetClientObject(unsigned int n) const; wxClientData* DetachClientObject(unsigned int n); @@ -397,7 +397,7 @@ protected: wxClientDataType type); // free the client object associated with the item at given position and - // set it to NULL (must only be called if HasClientObjectData()) + // set it to nullptr (must only be called if HasClientObjectData()) void ResetItemClientObject(unsigned int n); // set the type of the client data stored in this control: override this if diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 4eda8f7c87..6e7ed6af01 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -268,7 +268,7 @@ public: // out what kind of data object was received. wxDataFormat GetReceivedFormat() const; - // Returns the pointer to the object which supports this format or NULL. + // Returns the pointer to the object which supports this format or nullptr. // The returned pointer is owned by wxDataObjectComposite and must // therefore not be destroyed by the caller. wxDataObjectSimple *GetObject(const wxDataFormat& format, diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 9bbabfd1f8..d72101848f 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -108,8 +108,8 @@ WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray); class WXDLLIMPEXP_CORE wxDataViewModelNotifier { public: - wxDataViewModelNotifier() { m_owner = NULL; } - virtual ~wxDataViewModelNotifier() { m_owner = NULL; } + wxDataViewModelNotifier() { m_owner = nullptr; } + virtual ~wxDataViewModelNotifier() { m_owner = nullptr; } virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) = 0; @@ -723,10 +723,10 @@ public: wxDataViewItem GetCurrentItem() const; void SetCurrentItem(const wxDataViewItem& item); - virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(NULL); } + virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(nullptr); } virtual int GetCountPerPage() const { return wxNOT_FOUND; } - // Currently focused column of the current item or NULL if no column has focus + // Currently focused column of the current item or nullptr if no column has focus virtual wxDataViewColumn *GetCurrentColumn() const = 0; // Selection: both GetSelection() and GetSelections() can be used for the @@ -754,9 +754,9 @@ public: virtual bool IsExpanded( const wxDataViewItem & item ) const = 0; virtual void EnsureVisible( const wxDataViewItem & item, - const wxDataViewColumn *column = NULL ) = 0; + const wxDataViewColumn *column = nullptr ) = 0; virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0; - virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0; + virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = nullptr ) const = 0; virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; } @@ -857,7 +857,7 @@ public: wxDataViewEvent() : wxNotifyEvent() { - Init(NULL, NULL, wxDataViewItem()); + Init(nullptr, nullptr, wxDataViewItem()); } // Constructor for the events affecting columns (and possibly also items). @@ -876,7 +876,7 @@ public: const wxDataViewItem& item) : wxNotifyEvent(evtType, dvc->GetId()) { - Init(dvc, NULL, item); + Init(dvc, nullptr, item); } wxDataViewEvent(const wxDataViewEvent& event) @@ -1241,7 +1241,7 @@ public: wxDataViewTreeStoreNode( wxDataViewTreeStoreNode *parent, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); virtual ~wxDataViewTreeStoreNode(); void SetText( const wxString &text ) @@ -1284,7 +1284,7 @@ public: const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), const wxBitmapBundle &expanded = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); virtual ~wxDataViewTreeStoreContainerNode(); const wxDataViewTreeStoreNodes &GetChildren() const @@ -1328,31 +1328,31 @@ public: wxDataViewItem AppendItem( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem PrependItem( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem PrependContainer( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), const wxBitmapBundle &expanded = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem AppendContainer( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), const wxBitmapBundle &expanded = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, const wxString &text, const wxBitmapBundle &icon = wxBitmapBundle(), const wxBitmapBundle &expanded = wxBitmapBundle(), - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const; int GetChildCount( const wxDataViewItem& parent ) const; @@ -1429,21 +1429,21 @@ public: { return GetStore()->IsContainer(item); } wxDataViewItem AppendItem( const wxDataViewItem& parent, - const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = nullptr ); wxDataViewItem PrependItem( const wxDataViewItem& parent, - const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = nullptr ); wxDataViewItem InsertItem( const wxDataViewItem& parent, const wxDataViewItem& previous, - const wxString &text, int icon = NO_IMAGE, wxClientData *data = NULL ); + const wxString &text, int icon = NO_IMAGE, wxClientData *data = nullptr ); wxDataViewItem PrependContainer( const wxDataViewItem& parent, const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem AppendContainer( const wxDataViewItem& parent, const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem InsertContainer( const wxDataViewItem& parent, const wxDataViewItem& previous, const wxString &text, int icon = NO_IMAGE, int expanded = NO_IMAGE, - wxClientData *data = NULL ); + wxClientData *data = nullptr ); wxDataViewItem GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const { return GetStore()->GetNthChild(parent, pos); } diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 2eafe4470a..8d2dd5d938 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -927,7 +927,7 @@ public: // all conversions functions return true to indicate whether parsing // succeeded or failed and fill in the provided end iterator, which must - // not be NULL, with the location of the character where the parsing + // not be null, with the location of the character where the parsing // stopped (this will be end() of the passed string if everything was // parsed) @@ -1021,7 +1021,7 @@ public: // backwards compatible versions of the parsing functions: they return an // object representing the next character following the date specification - // (i.e. the one where the scan had to stop) or a special NULL-like object + // (i.e. the one where the scan had to stop) or a special nullptr-like object // on failure // // they're not deprecated because a lot of existing code uses them and @@ -1120,7 +1120,7 @@ public: inline wxLongLong GetValue() const; // a helper function to get the current time_t - static time_t GetTimeNow() { return time(NULL); } + static time_t GetTimeNow() { return time(nullptr); } // another one to get the current time broken down static struct tm *GetTmNow() diff --git a/include/wx/dc.h b/include/wx/dc.h index 4dbb616a71..ca8e75e939 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -183,10 +183,10 @@ public: // get Cairo context virtual void* GetCairoContext() const { - return NULL; + return nullptr; } - virtual void* GetHandle() const { return NULL; } + virtual void* GetHandle() const { return nullptr; } // query dimension, colour deps, resolution @@ -347,14 +347,14 @@ public: virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const = 0; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const = 0; virtual void GetMultiLineTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *heightLine = NULL, - const wxFont *font = NULL) const; + wxCoord *heightLine = nullptr, + const wxFont *font = nullptr) const; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; // clearing @@ -592,7 +592,7 @@ public: #if wxUSE_GRAPHICS_CONTEXT virtual wxGraphicsContext* GetGraphicsContext() const - { return NULL; } + { return nullptr; } virtual void SetGraphicsContext( wxGraphicsContext* WXUNUSED(ctx) ) {} #endif @@ -627,7 +627,7 @@ protected: double GetMMToPXy() const; - // window on which the DC draws or NULL + // window on which the DC draws or nullptr wxWindow *m_window; // flags @@ -876,9 +876,9 @@ public: void GetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } wxSize GetTextExtent(const wxString& string) const @@ -891,8 +891,8 @@ public: void GetMultiLineTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *heightLine = NULL, - const wxFont *font = NULL) const + wxCoord *heightLine = nullptr, + const wxFont *font = nullptr) const { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); } wxSize GetMultiLineTextExtent(const wxString& string) const @@ -1190,7 +1190,7 @@ public: const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounding = NULL); + wxRect *rectBounding = nullptr); void DrawLabel(const wxString& text, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, @@ -1234,7 +1234,7 @@ public: source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y); } - wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const + wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) nullptr) const { return m_pimpl->DoGetAsBitmap(subrect); } @@ -1276,7 +1276,7 @@ public: : m_dc(thdc.m_dc), m_hdc(thdc.m_hdc) { - const_cast(thdc).m_hdc = NULL; + const_cast(thdc).m_hdc = nullptr; } ~TempHDC() diff --git a/include/wx/dcbuffer.h b/include/wx/dcbuffer.h index b7e1eb6e7d..b6cb5260f8 100644 --- a/include/wx/dcbuffer.h +++ b/include/wx/dcbuffer.h @@ -40,8 +40,8 @@ class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC public: // Default ctor, must subsequently call Init for two stage construction. wxBufferedDC() - : m_dc(NULL), - m_buffer(NULL), + : m_dc(nullptr), + m_buffer(nullptr), m_style(0) { } @@ -50,7 +50,7 @@ public: wxBufferedDC(wxDC *dc, wxBitmap& buffer = wxNullBitmap, int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) + : m_dc(nullptr), m_buffer(nullptr) { Init(dc, buffer, style); } @@ -59,7 +59,7 @@ public: // (where area is usually something like the size of the window // being buffered) wxBufferedDC(wxDC *dc, const wxSize& area, int style = wxBUFFER_CLIENT_AREA) - : m_dc(NULL), m_buffer(NULL) + : m_dc(nullptr), m_buffer(nullptr) { Init(dc, area, style); } diff --git a/include/wx/dcgraph.h b/include/wx/dcgraph.h index 67c013017c..7d84e82371 100644 --- a/include/wx/dcgraph.h +++ b/include/wx/dcgraph.h @@ -209,9 +209,9 @@ public: virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override; diff --git a/include/wx/dcmirror.h b/include/wx/dcmirror.h index ff93325e48..74f9ed2670 100644 --- a/include/wx/dcmirror.h +++ b/include/wx/dcmirror.h @@ -86,7 +86,7 @@ protected: // exchange x and y components of all points in the array if necessary wxPoint* Mirror(int n, const wxPoint*& points) const { - wxPoint* points_alloc = NULL; + wxPoint* points_alloc = nullptr; if ( m_mirror ) { points_alloc = new wxPoint[n]; @@ -256,9 +256,9 @@ protected: virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override { // never mirrored m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); diff --git a/include/wx/dcscreen.h b/include/wx/dcscreen.h index fb60309da0..ce9e0f511a 100644 --- a/include/wx/dcscreen.h +++ b/include/wx/dcscreen.h @@ -21,7 +21,7 @@ public: static bool StartDrawingOnTop(wxWindow * WXUNUSED(window)) { return true; } - static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL) + static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = nullptr) { return true; } static bool EndDrawingOnTop() { return true; } diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h index fa8be003f8..f80f27c31b 100644 --- a/include/wx/dcsvg.h +++ b/include/wx/dcsvg.h @@ -135,7 +135,7 @@ public: virtual void SetFont(const wxFont& font) override; virtual void SetPen(const wxPen& pen) override; - virtual void* GetHandle() const override { return NULL; } + virtual void* GetHandle() const override { return nullptr; } void SetBitmapHandler(wxSVGBitmapHandler* handler); @@ -235,9 +235,9 @@ private: virtual void DoGetTextExtent(const wxString& string, wxCoord* x, wxCoord* y, - wxCoord* descent = NULL, - wxCoord* externalLeading = NULL, - const wxFont* theFont = NULL) const override; + wxCoord* descent = nullptr, + wxCoord* externalLeading = nullptr, + const wxFont* theFont = nullptr) const override; virtual void DoSetDeviceClippingRegion(const wxRegion& region) override; diff --git a/include/wx/debug.h b/include/wx/debug.h index a56d266e5c..49260740a1 100644 --- a/include/wx/debug.h +++ b/include/wx/debug.h @@ -81,7 +81,7 @@ typedef void (*wxAssertHandler_t)(const wxString& file, #if wxDEBUG_LEVEL -// the global assert handler function, if it is NULL asserts don't check their +// the global assert handler function, if it is null asserts don't check their // conditions extern WXDLLIMPEXP_DATA_BASE(wxAssertHandler_t) wxTheAssertHandler; @@ -99,7 +99,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxAssertHandler_t) wxTheAssertHandler; need to provide your assertion handler function. This function also provides a simple way to disable all asserts: simply - pass NULL pointer to it. Doing this will result in not even evaluating + pass null pointer to it. Doing this will result in not even evaluating assert conditions at all, avoiding almost all run-time cost of asserts. Notice that this function is not MT-safe, so you should call it before @@ -132,15 +132,15 @@ extern void WXDLLIMPEXP_BASE wxSetDefaultAssertHandler(); // defined inline wxAssertHandler_t wxSetAssertHandler(wxAssertHandler_t /* handler */) { - return NULL; + return nullptr; } inline void wxSetDefaultAssertHandler() { } #endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL -// simply a synonym for wxSetAssertHandler(NULL) -inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } +// simply a synonym for wxSetAssertHandler(nullptr) +inline void wxDisableAsserts() { wxSetAssertHandler(nullptr); } /* A macro which disables asserts for applications compiled in release build. @@ -162,7 +162,7 @@ inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } overloads are needed because these macros can be used with or without wxT(). All of them are implemented in src/common/appcmn.cpp and unconditionally - call wxTheAssertHandler so the caller must check that it is non-NULL + call wxTheAssertHandler so the caller must check that it is non-null (assert macros do it). */ @@ -170,7 +170,7 @@ inline void wxDisableAsserts() { wxSetAssertHandler(NULL); } // these overloads are the ones typically used by debugging macros: we have to // provide wxChar* msg version because it's common to use wxT() in the macros -// and finally, we can't use const wx(char)* msg = NULL, because that would +// and finally, we can't use const wx(char)* msg = nullptr, because that would // be ambiguous // // also notice that these functions can't be inline as wxString is not defined @@ -200,7 +200,7 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const wxChar *file, int line, const char *func, const wxChar *cond, - const wxChar *msg = NULL); + const wxChar *msg = nullptr); // these overloads work when msg passed to debug macro is a string and we // also have to provide wxCStrData overload to resolve ambiguity which would @@ -300,7 +300,7 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, // 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) + #define wxASSERT(cond) wxASSERT_MSG(cond, (const char*)nullptr) // wxFAIL is a special form of assert: it always triggers (and so is // usually used in normally unreachable code) @@ -322,7 +322,7 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, 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) + #define wxFAIL wxFAIL_MSG((const char*)nullptr) #else // !wxDEBUG_LEVEL #define wxTrap() @@ -357,10 +357,10 @@ extern void WXDLLIMPEXP_BASE wxAbort(); debug level 1 -- they call the assert handler if the condition is false They are supposed to be used only in invalid situation: for example, an - invalid parameter (e.g. a NULL pointer) is passed to a function. Instead of + invalid parameter (e.g. a null pointer) is passed to a function. Instead of dereferencing it and causing core dump the function might use - wxCHECK_RET( p != NULL, "pointer can't be NULL" ) + wxCHECK_RET( p != nullptr, "pointer can't be null" ) */ // the generic macro: takes the condition to check, the statement to be executed @@ -379,10 +379,10 @@ extern void WXDLLIMPEXP_BASE wxAbort(); #define wxCHECK_MSG(cond, rc, msg) wxCHECK2_MSG(cond, return rc, msg) // check that expression is true, "return" if not (also FAILs in debug mode) -#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)NULL) +#define wxCHECK(cond, rc) wxCHECK_MSG(cond, rc, (const char*)nullptr) // check that expression is true, perform op if not -#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)NULL) +#define wxCHECK2(cond, op) wxCHECK2_MSG(cond, op, (const char*)nullptr) // special form of wxCHECK2: as wxCHECK, but for use in void functions // diff --git a/include/wx/defs.h b/include/wx/defs.h index 3bb6989102..5052698504 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -707,9 +707,7 @@ typedef short int WXTYPE; wxDEPRECATED(func) { body } #endif -/* 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) */ +/* Get size_t declaration. */ #include /* size of statically declared array */ @@ -852,29 +850,29 @@ typedef short int WXTYPE; // everybody gets the assert and other debug macros #include "wx/debug.h" - // delete pointer if it is not NULL and NULL it afterwards + // delete pointer if it is not null and null it afterwards template inline void wxDELETE(T*& ptr) { typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; - if ( ptr != NULL ) + if ( ptr != nullptr ) { delete ptr; - ptr = NULL; + ptr = nullptr; } } - // delete an array and NULL it (see comments above) + // delete an array and null it (see comments above) template inline void wxDELETEA(T*& ptr) { typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; - if ( ptr != NULL ) + if ( ptr != nullptr ) { delete [] ptr; - ptr = NULL; + ptr = nullptr; } } @@ -973,16 +971,10 @@ typedef double wxDouble; #endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */ /* - This constant should be used instead of NULL in vararg functions taking - wxChar* arguments: passing NULL (which is the same as 0, unless the compiler - defines it specially, e.g. like gcc does with its __null built-in) doesn't - work in this case as va_arg() wouldn't interpret the integer 0 correctly - when trying to convert it to a pointer on architectures where sizeof(int) is - strictly less than sizeof(void *). - - Examples of places where this must be used include wxFileTypeInfo ctor. + Deprecated constant existing only for compatibility, use nullptr directly in + the new code. */ -#define wxNullPtr ((void *)NULL) +#define wxNullPtr nullptr /* Define wxChar16 and wxChar32 */ diff --git a/include/wx/dfb/bitmap.h b/include/wx/dfb/bitmap.h index c3967b168a..523ac36209 100644 --- a/include/wx/dfb/bitmap.h +++ b/include/wx/dfb/bitmap.h @@ -59,7 +59,7 @@ public: virtual wxBitmap GetSubBitmap(const wxRect& rect) const; virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const; + const wxPalette *palette = nullptr) const; virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); #if wxUSE_PALETTE diff --git a/include/wx/dfb/dc.h b/include/wx/dfb/dc.h index 4dac548d98..30e7a4ca02 100644 --- a/include/wx/dfb/dc.h +++ b/include/wx/dfb/dc.h @@ -25,14 +25,14 @@ class WXDLLIMPEXP_CORE wxDFBDCImpl : public wxDCImpl { public: // ctors - wxDFBDCImpl(wxDC *owner) : wxDCImpl(owner) { m_surface = NULL; } + wxDFBDCImpl(wxDC *owner) : wxDCImpl(owner) { m_surface = nullptr; } wxDFBDCImpl(wxDC *owner, const wxIDirectFBSurfacePtr& surface) : wxDCImpl(owner) { DFBInit(surface); } - bool IsOk() const { return m_surface != NULL; } + bool IsOk() const { return m_surface != nullptr; } // implement base class pure virtuals // ---------------------------------- @@ -62,9 +62,9 @@ public: 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; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const; virtual bool CanDrawBitmap() const { return true; } virtual bool CanGetTextExtent() const { return true; } diff --git a/include/wx/dfb/dcclient.h b/include/wx/dfb/dcclient.h index bc185c6864..98655e4fd3 100644 --- a/include/wx/dfb/dcclient.h +++ b/include/wx/dfb/dcclient.h @@ -26,7 +26,7 @@ public: virtual ~wxWindowDCImpl(); protected: - // initializes the DC for painting on given window; if rect!=NULL, then + // initializes the DC for painting on given window; if rect!=nullptr, then // for painting only on the given region of the window void InitForWin(wxWindow *win, const wxRect *rect); diff --git a/include/wx/dfb/dfbptr.h b/include/wx/dfb/dfbptr.h index 0d442b8ebc..fd3e1669b3 100644 --- a/include/wx/dfb/dfbptr.h +++ b/include/wx/dfb/dfbptr.h @@ -54,7 +54,7 @@ public: Takes ownership of @a ptr, i.e. AddRef() is @em not called on it. */ - wxDfbPtr(T *ptr = NULL) : m_ptr(ptr) {} + wxDfbPtr(T *ptr = nullptr) : m_ptr(ptr) {} /// Copy ctor wxDfbPtr(const wxDfbPtr& ptr) { InitFrom(ptr); } @@ -62,13 +62,13 @@ public: /// Dtor. Releases the interface ~wxDfbPtr() { Reset(); } - /// Resets the pointer to NULL, decreasing reference count of the interface. + /// Resets the pointer to nullptr, decreasing reference count of the interface. void Reset() { if ( m_ptr ) { this->DoRelease((wxDfbWrapperBase*)m_ptr); - m_ptr = NULL; + m_ptr = nullptr; } } diff --git a/include/wx/dfb/window.h b/include/wx/dfb/window.h index ccd7df176a..90c780f1c5 100644 --- a/include/wx/dfb/window.h +++ b/include/wx/dfb/window.h @@ -72,7 +72,7 @@ public: virtual void WarpPointer(int x, int y); virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL); + const wxRect *rect = nullptr); virtual void Update(); virtual bool SetCursor(const wxCursor &cursor); @@ -105,9 +105,9 @@ protected: // implement the base class pure virtuals virtual void DoGetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL) const; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *theFont = nullptr) 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; @@ -178,7 +178,7 @@ private: // don't access it directly) wxRect m_rect; - // overlays for this window (or NULL if it doesn't have any) + // overlays for this window (or nullptr if it doesn't have any) wxDfbOverlaysList *m_overlays; friend class wxNonOwnedWindow; // for HandleXXXEvent diff --git a/include/wx/dfb/wrapdfb.h b/include/wx/dfb/wrapdfb.h index 14d8b02c87..f40770cae0 100644 --- a/include/wx/dfb/wrapdfb.h +++ b/include/wx/dfb/wrapdfb.h @@ -126,7 +126,7 @@ protected: The wrapper provides same API as DirectFB, with a few exceptions: - methods return true/false instead of error code - methods that return or create another interface return pointer to the - interface (or NULL on failure) instead of storing it in the last + interface (or nullptr on failure) instead of storing it in the last argument - interface arguments use wxFooPtr type instead of raw DirectFB pointer - methods taking flags use int type instead of an enum when the flags @@ -245,9 +245,9 @@ struct wxIDirectFBSurface : public wxDfbWrapper /** Updates the front buffer from the back buffer. If @a region is not - NULL, only given rectangle is updated. + nullptr, only given rectangle is updated. */ - bool FlipToFront(const DFBRegion *region = NULL); + bool FlipToFront(const DFBRegion *region = nullptr); wxIDirectFBSurfacePtr GetSubSurface(const DFBRectangle *rect) { @@ -255,7 +255,7 @@ struct wxIDirectFBSurface : public wxDfbWrapper if ( Check(m_ptr->GetSubSurface(m_ptr, rect, &s)) ) return new wxIDirectFBSurface(s); else - return NULL; + return nullptr; } wxIDirectFBPalettePtr GetPalette() @@ -264,7 +264,7 @@ struct wxIDirectFBSurface : public wxDfbWrapper if ( Check(m_ptr->GetPalette(m_ptr, &s)) ) return new wxIDirectFBPalette(s); else - return NULL; + return nullptr; } bool SetPalette(const wxIDirectFBPalettePtr& pal) @@ -336,7 +336,7 @@ struct wxIDirectFBSurface : public wxDfbWrapper : m_surface(surface) { if ( !surface->Lock(flags, &ptr, &pitch) ) - ptr = NULL; + ptr = nullptr; } ~Locked() @@ -415,7 +415,7 @@ struct wxIDirectFBWindow : public wxDfbWrapper if ( Check(m_ptr->GetSurface(m_ptr, &s)) ) return new wxIDirectFBSurface(s); else - return NULL; + return nullptr; } bool AttachEventBuffer(const wxIDirectFBEventBufferPtr& buffer) @@ -443,7 +443,7 @@ struct wxIDirectFBDisplayLayer : public wxDfbWrapper if ( Check(m_ptr->CreateWindow(m_ptr, desc, &w)) ) return new wxIDirectFBWindow(w); else - return NULL; + return nullptr; } bool GetConfiguration(DFBDisplayLayerConfig *config) @@ -466,7 +466,7 @@ struct wxIDirectFBDisplayLayer : public wxDfbWrapper struct wxIDirectFB : public wxDfbWrapper { /** - Returns pointer to DirectFB singleton object, it never returns NULL + Returns pointer to DirectFB singleton object, it never returns nullptr after wxApp was initialized. The object is cached, so calling this method is cheap. */ @@ -485,7 +485,7 @@ struct wxIDirectFB : public wxDfbWrapper if ( Check(m_ptr->CreateSurface(m_ptr, desc, &s)) ) return new wxIDirectFBSurface(s); else - return NULL; + return nullptr; } wxIDirectFBEventBufferPtr CreateEventBuffer() @@ -494,7 +494,7 @@ struct wxIDirectFB : public wxDfbWrapper if ( Check(m_ptr->CreateEventBuffer(m_ptr, &b)) ) return new wxIDirectFBEventBuffer(b); else - return NULL; + return nullptr; } wxIDirectFBFontPtr CreateFont(const char *filename, @@ -504,7 +504,7 @@ struct wxIDirectFB : public wxDfbWrapper if ( Check(m_ptr->CreateFont(m_ptr, filename, desc, &f)) ) return new wxIDirectFBFont(f); else - return NULL; + return nullptr; } wxIDirectFBDisplayLayerPtr @@ -514,7 +514,7 @@ struct wxIDirectFB : public wxDfbWrapper if ( Check(m_ptr->GetDisplayLayer(m_ptr, id, &l)) ) return new wxIDirectFBDisplayLayer(l); else - return NULL; + return nullptr; } /// Returns primary surface diff --git a/include/wx/dialog.h b/include/wx/dialog.h index 37cf7d4b24..7248937df5 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -104,7 +104,7 @@ public: // not set yet and hence must be passed explicitly to it so that we could // check whether it contains wxDIALOG_NO_PARENT bit. // - // This function always returns a valid top level window or NULL. + // This function always returns a valid top level window or nullptr. wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const { return DoGetParentForDialog(wxDIALOG_MODALITY_APP_MODAL, parent, style); @@ -142,7 +142,7 @@ public: // returns a horizontal wxBoxSizer containing the given buttons // - // notice that the returned sizer can be NULL if no buttons are put in the + // notice that the returned sizer can be null if no buttons are put in the // sizer (this mostly happens under smart phones and other atypical // platforms which have hardware buttons replacing OK/Cancel and such) wxSizer *CreateButtonSizer(long flags); @@ -171,7 +171,7 @@ public: // Returns a content window if there is one. This can be used by the layout adapter, for // example to make the pages of a book control into scrolling windows - virtual wxWindow* GetContentWindow() const { return NULL; } + virtual wxWindow* GetContentWindow() const { return nullptr; } // Add an id to the list of main button identifiers that should be in the button sizer void AddMainButtonId(wxWindowID id) { m_mainButtonIds.Add((int) id); } @@ -262,7 +262,7 @@ private: long style) const; // helper of DoGetParentForDialog(): returns the passed in window if it - // can be used as parent for this kind of dialog or NULL if it can't + // can be used as parent for this kind of dialog or nullptr if it can't wxWindow *CheckIfCanBeUsedAsParent(wxDialogModality modality, wxWindow *parent) const; @@ -349,8 +349,8 @@ public: #endif // wxUSE_BUTTON // Reparent the controls to the scrolled window, except those in buttonSizer - virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL); - static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL); + virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = nullptr); + static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = nullptr); // A function to fit the dialog around its contents, and then adjust for screen size. // If scrolled windows are passed, scrolling is enabled in the required orientation(s). diff --git a/include/wx/dir.h b/include/wx/dir.h index 305411b749..ee83757ea0 100644 --- a/include/wx/dir.h +++ b/include/wx/dir.h @@ -96,7 +96,7 @@ public: // ----- // default, use Open() - wxDir() { m_data = NULL; } + wxDir() { m_data = nullptr; } // opens the directory for enumeration, use IsOpened() to test success wxDir(const wxString& dir); @@ -162,7 +162,7 @@ public: #if wxUSE_LONGLONG // returns the size of all directories recursively found in given path - static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = NULL); + static wxULongLong GetTotalSize(const wxString &dir, wxArrayString *filesSkipped = nullptr); #endif // wxUSE_LONGLONG diff --git a/include/wx/dirdlg.h b/include/wx/dirdlg.h index c257a8a65e..5a8254d321 100644 --- a/include/wx/dirdlg.h +++ b/include/wx/dirdlg.h @@ -136,7 +136,7 @@ wxDirSelector(const wxString& message = wxASCII_STR(wxDirSelectorPromptStr), const wxString& defaultPath = wxEmptyString, long style = wxDD_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); #endif // wxUSE_DIRDLG diff --git a/include/wx/display.h b/include/wx/display.h index a5e8271e9b..332810d1ea 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -73,7 +73,7 @@ public: // return true if the object was initialized successfully - bool IsOk() const { return m_impl != NULL; } + bool IsOk() const { return m_impl != nullptr; } // get the full display size wxRect GetGeometry() const; diff --git a/include/wx/dlist.h b/include/wx/dlist.h index e44e3e3e46..243b46562c 100644 --- a/include/wx/dlist.h +++ b/include/wx/dlist.h @@ -42,7 +42,7 @@ public: public: compatibility_iterator() - : m_iter(), m_list( NULL ) {} + : m_iter(), m_list( nullptr ) {} compatibility_iterator( ListType* li, iterator i ) : m_iter( i ), m_list( li ) {} compatibility_iterator( const ListType* li, iterator i ) @@ -206,10 +206,10 @@ public: class Node { public: - Node(wxDList *list = NULL, - Node *previous = NULL, - Node *next = NULL, - T *data = NULL) + Node(wxDList *list = nullptr, + Node *previous = nullptr, + Node *next = nullptr, + T *data = nullptr) { m_list = list; m_previous = previous; @@ -226,7 +226,7 @@ public: // handle the case when we're being deleted from the list by // the user (i.e. not by the list itself from DeleteNode) - // we must do it for compatibility with old code - if (m_list != NULL) + if (m_list != nullptr) m_list->DetachNode(this); } @@ -267,7 +267,7 @@ public: class compatibility_iterator { public: - compatibility_iterator(nodetype *ptr = NULL) : m_ptr(ptr) { } + compatibility_iterator(nodetype *ptr = nullptr) : m_ptr(ptr) { } nodetype *operator->() const { return m_ptr; } operator nodetype *() const { return m_ptr; } @@ -279,7 +279,7 @@ private: void Init() { m_nodeFirst = - m_nodeLast = NULL; + m_nodeLast = nullptr; m_count = 0; m_destroy = false; } @@ -289,7 +289,7 @@ private: if ( m_destroy ) node->DeleteData(); // so that the node knows that it's being deleted by the list - node->m_list = NULL; + node->m_list = nullptr; delete node; } @@ -328,7 +328,7 @@ public: ~wxDList() { nodetype *each = m_nodeFirst; - while ( each != NULL ) + while ( each != nullptr ) { nodetype *next = each->GetNext(); DoDeleteNode(each); @@ -342,8 +342,8 @@ public: "copying list which owns it's elements is a bad idea" ); Clear(); m_destroy = list.m_destroy; - m_nodeFirst = NULL; - m_nodeLast = NULL; + m_nodeFirst = nullptr; + m_nodeLast = nullptr; nodetype* node; for (node = list.GetFirst(); node; node = node->GetNext() ) Append(node->GetData()); @@ -352,7 +352,7 @@ public: nodetype *Append( T *object ) { - nodetype *node = new nodetype( this, m_nodeLast, NULL, object ); + nodetype *node = new nodetype( this, m_nodeLast, nullptr, object ); if ( !m_nodeFirst ) { @@ -370,7 +370,7 @@ public: nodetype *Insert( T* object ) { - return Insert( NULL, object ); + return Insert( nullptr, object ); } nodetype *Insert( size_t pos, T* object ) @@ -383,7 +383,7 @@ public: nodetype *Insert( nodetype *position, T* object ) { - wxCHECK_MSG( !position || position->m_list == this, NULL, + wxCHECK_MSG( !position || position->m_list == this, nullptr, "can't insert before a node from another list" ); // previous and next node for the node being inserted @@ -396,13 +396,13 @@ public: else { // inserting in the beginning of the list - prev = NULL; + prev = nullptr; next = m_nodeFirst; } nodetype *node = new nodetype( this, prev, next, object ); if ( !m_nodeFirst ) m_nodeLast = node; - if ( prev == NULL ) + if ( prev == nullptr ) m_nodeFirst = node; m_count++; return node; @@ -424,19 +424,19 @@ public: return current; } wxFAIL_MSG( "invalid index in Item()" ); - return NULL; + return nullptr; } T *operator[](size_t index) const { nodetype *node = Item(index); - return node ? node->GetData() : NULL; + return node ? node->GetData() : nullptr; } nodetype *DetachNode( nodetype *node ) { - wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" ); - wxCHECK_MSG( node->m_list == this, NULL, + wxCHECK_MSG( node, nullptr, "detaching null wxNodeBase" ); + wxCHECK_MSG( node->m_list == this, nullptr, "detaching node which is not from this list" ); // update the list nodetype **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next @@ -447,7 +447,7 @@ public: *nextPrev = node->GetPrevious(); m_count--; // mark the node as not belonging to this list any more - node->m_list = NULL; + node->m_list = nullptr; return node; } @@ -486,7 +486,7 @@ public: return current; } // not found - return NULL; + return nullptr; } int IndexOf(const T *object) const @@ -511,7 +511,7 @@ public: current = next; } m_nodeFirst = - m_nodeLast = NULL; + m_nodeLast = nullptr; m_count = 0; } @@ -556,7 +556,7 @@ public: if ( (*F)(current->GetData()) ) return current->GetData(); } - return NULL; + return nullptr; } T *LastThat(wxListIterateFunction F) @@ -566,7 +566,7 @@ public: if ( (*F)(current->GetData()) ) return current->GetData(); } - return NULL; + return nullptr; } /* STL interface */ @@ -593,7 +593,7 @@ public: typedef ptr_type pointer_type; iterator(Node* node, Node* init) : m_node(node), m_init(init) {} - iterator() : m_node(NULL), m_init(NULL) { } + iterator() : m_node(nullptr), m_init(nullptr) { } reference_type operator*() const { return *m_node->GetDataPtr(); } // ptrop @@ -633,7 +633,7 @@ public: const_iterator(Node* node, Node* init) : m_node(node), m_init(init) { } - const_iterator() : m_node(NULL), m_init(NULL) { } + const_iterator() : m_node(nullptr), m_init(nullptr) { } const_iterator(const iterator& it) : m_node(it.m_node), m_init(it.m_init) { } reference_type operator*() const @@ -676,7 +676,7 @@ public: reverse_iterator(Node* node, Node* init) : m_node(node), m_init(init) { } - reverse_iterator() : m_node(NULL), m_init(NULL) { } + reverse_iterator() : m_node(nullptr), m_init(nullptr) { } reference_type operator*() const { return *m_node->GetDataPtr(); } // ptrop @@ -715,7 +715,7 @@ public: const_reverse_iterator(Node* node, Node* init) : m_node(node), m_init(init) { } - const_reverse_iterator() : m_node(NULL), m_init(NULL) { } + const_reverse_iterator() : m_node(nullptr), m_init(nullptr) { } const_reverse_iterator(const reverse_iterator& it) : m_node(it.m_node), m_init(it.m_init) { } reference_type operator*() const @@ -746,15 +746,15 @@ public: iterator begin() { return iterator(GetFirst(), GetLast()); } const_iterator begin() const { return const_iterator(GetFirst(), GetLast()); } - iterator end() { return iterator(NULL, GetLast()); } - const_iterator end() const { return const_iterator(NULL, GetLast()); } + iterator end() { return iterator(nullptr, GetLast()); } + const_iterator end() const { return const_iterator(nullptr, GetLast()); } reverse_iterator rbegin() { return reverse_iterator(GetLast(), GetFirst()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(GetLast(), GetFirst()); } - reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); } + reverse_iterator rend() { return reverse_iterator(nullptr, GetFirst()); } const_reverse_iterator rend() const - { return const_reverse_iterator(NULL, GetFirst()); } + { return const_reverse_iterator(nullptr, GetFirst()); } void resize(size_type n, value_type v = value_type()) { while (n < size()) diff --git a/include/wx/dnd.h b/include/wx/dnd.h index 5d0c1b35ae..e41ee68b50 100644 --- a/include/wx/dnd.h +++ b/include/wx/dnd.h @@ -62,7 +62,7 @@ public: : m_cursorCopy(cursorCopy), m_cursorMove(cursorMove), m_cursorStop(cursorStop) - { m_data = NULL; } + { m_data = nullptr; } virtual ~wxDropSourceBase() { } // set the data which is transferred by drag and drop @@ -134,7 +134,7 @@ public: // ctor takes a pointer to heap-allocated wxDataObject which will be owned // by wxDropTarget and deleted by it automatically. If you don't give it // here, you can use SetDataObject() later. - wxDropTargetBase(wxDataObject *dataObject = NULL) + wxDropTargetBase(wxDataObject *dataObject = nullptr) { m_dataObject = dataObject; m_defaultAction = wxDragNone; } // dtor deletes our data object virtual ~wxDropTargetBase() diff --git a/include/wx/docview.h b/include/wx/docview.h index af8eeb78d4..b486b5d3b9 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -67,7 +67,7 @@ typedef wxVector wxDocTemplateVector; class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler { public: - wxDocument(wxDocument *parent = NULL); + wxDocument(wxDocument *parent = nullptr); virtual ~wxDocument(); // accessors @@ -159,7 +159,7 @@ public: wxView *GetFirstView() const; - virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL); + virtual void UpdateAllViews(wxView *sender = nullptr, wxObject *hint = nullptr); virtual void NotifyClosing(); // Remove all views (because we're closing the document) @@ -183,7 +183,7 @@ public: // Returns true if this document is a child document corresponding to a // part of the parent document and not a disk file as usual. - bool IsChildDocument() const { return m_documentParent != NULL; } + bool IsChildDocument() const { return m_documentParent != nullptr; } // Ask the user if the document should be saved if it's modified and save // it if necessary. @@ -199,7 +199,7 @@ protected: wxDocTemplate* m_documentTemplate; bool m_documentModified; - // if the document parent is non-NULL, it's a pseudo-document corresponding + // if the document parent is non-null, it's a pseudo-document corresponding // to a part of the parent document which can't be saved or loaded // independently of its parent and is always closed when its parent is wxDocument* m_documentParent; @@ -245,7 +245,7 @@ public: wxView *deactiveView); virtual void OnDraw(wxDC *dc) = 0; virtual void OnPrint(wxDC *dc, wxObject *info); - virtual void OnUpdate(wxView *sender, wxObject *hint = NULL); + virtual void OnUpdate(wxView *sender, wxObject *hint = nullptr); virtual void OnClosingDocument() {} virtual void OnChangeFilename(); @@ -280,7 +280,7 @@ public: // destroyed void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame); - // get the associated frame, may be NULL during destruction + // get the associated frame, may be null during destruction wxDocChildFrameAnyBase* GetDocChildFrame() const { return m_docChildFrame; } protected: @@ -314,8 +314,8 @@ public: const wxString& ext, const wxString& docTypeName, const wxString& viewTypeName, - wxClassInfo *docClassInfo = NULL, - wxClassInfo *viewClassInfo = NULL, + wxClassInfo *docClassInfo = nullptr, + wxClassInfo *viewClassInfo = nullptr, long flags = wxDEFAULT_TEMPLATE_FLAGS); virtual ~wxDocTemplate(); @@ -446,10 +446,10 @@ public: void AssociateTemplate(wxDocTemplate *temp); void DisassociateTemplate(wxDocTemplate *temp); - // Find template from document class info, may return NULL. + // Find template from document class info, may return nullptr. wxDocTemplate* FindTemplate(const wxClassInfo* documentClassInfo); - // Find document from file name, may return NULL. + // Find document from file name, may return nullptr. wxDocument* FindDocumentByPath(const wxString& path) const; wxDocument *GetCurrentDocument() const; @@ -476,7 +476,7 @@ public: virtual wxView *GetCurrentView() const { return m_currentView; } // This method tries to find an active view harder than GetCurrentView(): - // if the latter is NULL, it also checks if we don't have just a single + // if the latter is null, it also checks if we don't have just a single // view and returns it then. wxView *GetAnyUsableView() const; @@ -576,10 +576,10 @@ public: // default ctor, use Create() after it wxDocChildFrameAnyBase() { - m_childDocument = NULL; - m_childView = NULL; - m_win = NULL; - m_lastEvent = NULL; + m_childDocument = nullptr; + m_childView = nullptr; + m_win = nullptr; + m_lastEvent = nullptr; } // full ctor equivalent to using the default one and Create() @@ -611,7 +611,7 @@ public: // prevent the view from deleting us if we're being deleted directly // (and not via Close() + Destroy()) if ( m_childView ) - m_childView->SetDocChildFrame(NULL); + m_childView->SetDocChildFrame(nullptr); } wxDocument *GetDocument() const { return m_childDocument; } @@ -808,7 +808,7 @@ public: wxDocParentFrameAnyBase(wxWindow* frame) : m_frame(frame) { - m_docManager = NULL; + m_docManager = nullptr; } wxDocManager *GetDocumentManager() const { return m_docManager; } @@ -949,7 +949,7 @@ private: class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout { public: - wxDocPrintout(wxView *view = NULL, const wxString& title = wxString()); + wxDocPrintout(wxView *view = nullptr, const wxString& title = wxString()); // implement wxPrintout methods virtual bool OnPrintPage(int page) override; diff --git a/include/wx/dvrenderers.h b/include/wx/dvrenderers.h index 5e121af8e6..5d45a985d5 100644 --- a/include/wx/dvrenderers.h +++ b/include/wx/dvrenderers.h @@ -203,7 +203,7 @@ public: virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent), wxRect WXUNUSED(labelRect), const wxVariant& WXUNUSED(value)) - { return NULL; } + { return nullptr; } virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor), wxVariant& WXUNUSED(value)) { return false; } diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 96d4e8ea48..c5cddbd0b4 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -360,7 +360,7 @@ public: T* const pItem = Traits::Clone(item); const size_t nOldSize = size(); - if ( pItem != NULL ) + if ( pItem != nullptr ) base::insert(this->end(), nInsert, pItem); for ( size_t i = 1; i < nInsert; i++ ) @@ -381,7 +381,7 @@ public: return; T* const pItem = Traits::Clone(item); - if ( pItem != NULL ) + if ( pItem != nullptr ) base::insert(this->begin() + uiIndex, nInsert, pItem); for ( size_t i = 1; i < nInsert; ++i ) diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 93473b0add..caa9dcaa92 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -62,7 +62,7 @@ enum wxDLFlags // and especially don't use directly, use wxLoadedDLL instead if you really // do need it wxDL_GET_LOADED = 0x00000040, // Win32 only: return handle of already - // loaded DLL or NULL otherwise; Unload() + // loaded DLL or nullptr otherwise; Unload() // should not be called so don't forget to // Detach() if you use this function @@ -162,7 +162,7 @@ class WXDLLIMPEXP_BASE wxDynamicLibraryDetails public: // ctor, normally never used as these objects are only created by // wxDynamicLibrary::ListLoaded() - wxDynamicLibraryDetails() { m_address = NULL; m_length = 0; } + wxDynamicLibraryDetails() { m_address = nullptr; m_length = 0; } // get the (base) name wxString GetName() const { return m_name; } @@ -213,16 +213,16 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetails, class WXDLLIMPEXP_BASE wxDynamicLibrary { public: - // return a valid handle for the main program itself or NULL if back + // return a valid handle for the main program itself or nullptr if back // linking is not supported by the current platform (e.g. Win32) static wxDllType GetProgramHandle(); // return the platform standard DLL extension (with leading dot) static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY); - wxDynamicLibrary() : m_handle(NULL) { } + wxDynamicLibrary() : m_handle(nullptr) { } wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) - : m_handle(NULL) + : m_handle(nullptr) { Load(libname, flags); } @@ -232,14 +232,14 @@ public: ~wxDynamicLibrary() { Unload(); } // return true if the library was loaded successfully - bool IsLoaded() const { return m_handle != NULL; } + bool IsLoaded() const { return m_handle != nullptr; } // load the library with the given name (full or not), return true if ok bool Load(const wxString& libname, int flags = wxDL_DEFAULT); // raw function for loading dynamic libs: always behaves as if // wxDL_VERBATIM were specified and doesn't log error message if the - // library couldn't be loaded but simply returns NULL + // library couldn't be loaded but simply returns nullptr static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT); // attach to an existing handle @@ -248,13 +248,13 @@ public: // detach the library object from its handle, i.e. prevent the object from // unloading the library in its dtor -- the caller is now responsible for // doing this - wxDllType Detach() { wxDllType h = m_handle; m_handle = NULL; return h; } + wxDllType Detach() { wxDllType h = m_handle; m_handle = nullptr; return h; } // unload the given library handle (presumably returned by Detach() before) static void Unload(wxDllType handle); // unload the library, also done automatically in dtor - void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = NULL; } } + void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = nullptr; } } // Return the raw handle from dlopen and friends. wxDllType GetLibHandle() const { return m_handle; } @@ -273,14 +273,14 @@ public: // 'name' is the (possibly mangled) name of the symbol. (use extern "C" to // export unmangled names) // - // Since it is perfectly valid for the returned symbol to actually be NULL, + // Since it is perfectly valid for the returned symbol to actually be null, // that is not always indication of an error. Pass and test the parameter // 'success' for a true indication of success or failure to load the // symbol. // - // Returns a pointer to the symbol on success, or NULL if an error occurred + // Returns a pointer to the symbol on success, or nullptr if an error occurred // or the symbol wasn't found. - void *GetSymbol(const wxString& name, bool *success = NULL) const; + void *GetSymbol(const wxString& name, bool *success = nullptr) const; // low-level version of GetSymbol() static void *RawGetSymbol(wxDllType handle, const wxString& name); @@ -334,11 +334,11 @@ public: static wxString GetPluginsDirectory(); // Return the load address of the module containing the given address or - // NULL if not found. + // nullptr if not found. // - // If path output parameter is non-NULL, fill it with the full path to this + // 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); + static void* GetModuleFromAddress(const void* addr, wxString* path = nullptr); #ifdef __WINDOWS__ // return the handle (HMODULE/HINSTANCE) of the DLL with the given name @@ -355,13 +355,13 @@ public: protected: // common part of GetSymbol() and HasSymbol() - void* DoGetSymbol(const wxString& name, bool* success = NULL) const; + void* DoGetSymbol(const wxString& name, bool* success = nullptr) const; // log the error after an OS dynamic library function failure static void ReportError(const wxString& msg, const wxString& name = wxString()); - // the handle to DLL or NULL + // the handle to DLL or nullptr wxDllType m_handle; // no copy ctor/assignment operators (or we'd try to unload the library diff --git a/include/wx/dynload.h b/include/wx/dynload.h index 5637387c88..8d9c9a22a5 100644 --- a/include/wx/dynload.h +++ b/include/wx/dynload.h @@ -81,7 +81,7 @@ public: private: - // These pointers may be NULL but if they are not, then m_ourLast follows + // These pointers may be null but if they are not, then m_ourLast follows // m_ourFirst in the linked list, i.e. can be found by calling GetNext() a // sufficient number of times. const wxClassInfo *m_ourFirst; // first class info in this plugin @@ -112,7 +112,7 @@ public: // Instance methods. - wxPluginManager() : m_entry(NULL) {} + wxPluginManager() : m_entry(nullptr) {} wxPluginManager(const wxString &libname, int flags = wxDL_DEFAULT) { Load(libname, flags); @@ -123,22 +123,22 @@ public: void Unload(); bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } - void* GetSymbol(const wxString& symbol, bool* success = NULL) + void* GetSymbol(const wxString& symbol, bool* success = nullptr) { return m_entry->GetSymbol( symbol, success ); } static void CreateManifest() { ms_manifest = new wxDLManifest(wxKEY_STRING); } - static void ClearManifest() { delete ms_manifest; ms_manifest = NULL; } + static void ClearManifest() { delete ms_manifest; ms_manifest = nullptr; } private: // return the pointer to the entry for the library with given name in - // ms_manifest or NULL if none + // ms_manifest or nullptr if none static wxPluginLibrary *FindByName(const wxString& name) { const wxDLManifest::iterator i = ms_manifest->find(name); - return i == ms_manifest->end() ? NULL : i->second; + return i == ms_manifest->end() ? nullptr : i->second; } static wxDLManifest* ms_manifest; // Static hash of loaded libs. diff --git a/include/wx/editlbox.h b/include/wx/editlbox.h index 5ad53fda05..6062e24c82 100644 --- a/include/wx/editlbox.h +++ b/include/wx/editlbox.h @@ -74,8 +74,8 @@ protected: { m_style = 0; m_selection = 0; - m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL; - m_listCtrl = NULL; + m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = nullptr; + m_listCtrl = nullptr; } void OnItemSelected(wxListEvent& event); diff --git a/include/wx/event.h b/include/wx/event.h index d6f647f4b7..73b812ac28 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -87,7 +87,7 @@ typedef int wxEventType; wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj) #define wxDECLARE_EVENT_TABLE_TERMINATOR() \ - wxEventTableEntry(wxEVT_NULL, 0, 0, NULL, NULL) + wxEventTableEntry(wxEVT_NULL, 0, 0, nullptr, nullptr) // generate a new unique event type extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); @@ -241,14 +241,14 @@ public: // If the functor holds an wxEvtHandler, then get access to it and track // its lifetime with wxEventConnectionRef: virtual wxEvtHandler *GetEvtHandler() const - { return NULL; } + { return nullptr; } // This is only used to maintain backward compatibility in // wxAppConsoleBase::CallEventHandler and ensures that an overwritten // wxAppConsoleBase::HandleEvent is still called for functors which hold an // wxEventFunction: virtual wxEventFunction GetEvtMethod() const - { return NULL; } + { return nullptr; } private: WX_DECLARE_ABSTRACT_TYPEINFO(wxEventFunctor) @@ -289,7 +289,7 @@ private: wxEventFunction m_method; // Provide a dummy default ctor for type info purposes - wxObjectEventFunctor() : m_handler(NULL), m_method(NULL) { } + wxObjectEventFunctor() : m_handler(nullptr), m_method(nullptr) { } WX_DECLARE_TYPEINFO_INLINE(wxObjectEventFunctor) }; @@ -308,7 +308,7 @@ inline wxObjectEventFunctor * wxNewEventTableFunctor(const wxEventType& WXUNUSED(evtType), wxObjectEventFunction method) { - return new wxObjectEventFunctor(method, NULL); + return new wxObjectEventFunctor(method, nullptr); } inline wxObjectEventFunctor @@ -369,11 +369,11 @@ struct HandlerImpl static bool IsEvtHandler() { return false; } static T *ConvertFromEvtHandler(wxEvtHandler *) - { return NULL; } + { return nullptr; } static wxEvtHandler *ConvertToEvtHandler(T *) - { return NULL; } + { return nullptr; } static wxEventFunction ConvertToEvtMethod(void (T::*)(A&)) - { return NULL; } + { return nullptr; } }; } // namespace wxPrivate @@ -416,7 +416,7 @@ public: // if you get an error here it means that the signature of the handler // you're trying to use is not compatible with (i.e. is not the same as // or a base class of) the real event class used for this event type - CheckHandlerArgument(static_cast(NULL)); + CheckHandlerArgument(static_cast(nullptr)); } virtual void operator()(wxEvtHandler *handler, wxEvent& event) override @@ -447,8 +447,8 @@ public: // the cast is valid because wxTypeId()s matched above const ThisFunctor& other = static_cast(functor); - return (m_method == other.m_method || other.m_method == NULL) && - (m_handler == other.m_handler || other.m_handler == NULL); + return (m_method == other.m_method || other.m_method == nullptr) && + (m_handler == other.m_handler || other.m_handler == nullptr); } virtual wxEvtHandler *GetEvtHandler() const override @@ -487,7 +487,7 @@ public: // if you get an error here it means that the signature of the handler // you're trying to use is not compatible with (i.e. is not the same as // or a base class of) the real event class used for this event type - CheckHandlerArgument(static_cast(NULL)); + CheckHandlerArgument(static_cast(nullptr)); } virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) override @@ -495,10 +495,10 @@ public: // If you get an error here like "must use .* or ->* to call // pointer-to-member function" then you probably tried to call // Bind/Unbind with a method pointer but without a handler pointer or - // NULL as a handler e.g.: + // nullptr as a handler e.g.: // Unbind( wxEVT_XXX, &EventHandler::method ); // or - // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) + // Unbind( wxEVT_XXX, &EventHandler::method, nullptr ) m_handler(static_cast(event)); } @@ -540,10 +540,10 @@ public: // If you get an error here like "must use '.*' or '->*' to call // pointer-to-member function" then you probably tried to call // Bind/Unbind with a method pointer but without a handler pointer or - // NULL as a handler e.g.: + // nullptr as a handler e.g.: // Unbind( wxEVT_XXX, &EventHandler::method ); // or - // Unbind( wxEVT_XXX, &EventHandler::method, NULL ) + // Unbind( wxEVT_XXX, &EventHandler::method, nullptr ) m_handler(static_cast(event)); } @@ -643,7 +643,7 @@ inline wxEventFunctorMethod * wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&)) { return new wxEventFunctorMethod( - method, NULL); + method, nullptr); } @@ -1085,7 +1085,7 @@ public: // never be used anywhere else. void DidntHonourProcessOnlyIn() { - m_handlerToProcessOnlyIn = NULL; + m_handlerToProcessOnlyIn = nullptr; } protected: @@ -1107,7 +1107,7 @@ protected: // the parent window (if any) int m_propagationLevel; - // The object that the event is being propagated from, initially NULL and + // The object that the event is being propagated from, initially nullptr and // only set by wxPropagateOnce. wxEvtHandler* m_propagatedFrom; @@ -1170,10 +1170,10 @@ private: class WXDLLIMPEXP_BASE wxPropagateOnce { public: - // The handler argument should normally be non-NULL to allow the parent + // The handler argument should normally be non-null to allow the parent // event handler to know that it's being used to process an event coming - // from the child, it's only NULL by default for backwards compatibility. - wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = NULL) + // from the child, it's only nullptr by default for backwards compatibility. + wxPropagateOnce(wxEvent& event, wxEvtHandler* handler = nullptr) : m_event(event), m_propagatedFromOld(event.m_propagatedFrom) { @@ -1607,8 +1607,8 @@ public: wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) : wxEvent(winid, commandType) { - m_clientData = NULL; - m_clientObject = NULL; + m_clientData = nullptr; + m_clientObject = nullptr; m_isCommandEvent = true; // the command events are propagated upwards by default @@ -2420,7 +2420,7 @@ class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent #ifdef WXBUILDING public: #endif // WXBUILDING - explicit wxPaintEvent(wxWindowBase* window = NULL); + explicit wxPaintEvent(wxWindowBase* window = nullptr); public: // default copy ctor and dtor are fine @@ -2438,7 +2438,7 @@ class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent #ifdef WXBUILDING public: #endif // WXBUILDING - explicit wxNcPaintEvent(wxWindowBase* window = NULL); + explicit wxNcPaintEvent(wxWindowBase* window = nullptr); public: virtual wxEvent *Clone() const override { return new wxNcPaintEvent(*this); } @@ -2455,7 +2455,7 @@ private: class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent { public: - wxEraseEvent(int Id = 0, wxDC *dc = NULL) + wxEraseEvent(int Id = 0, wxDC *dc = nullptr) : wxEvent(Id, wxEVT_ERASE_BACKGROUND), m_dc(dc) { } @@ -2487,7 +2487,7 @@ class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent public: wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0) : wxEvent(winid, type) - { m_win = NULL; } + { m_win = nullptr; } wxFocusEvent(const wxFocusEvent& event) : wxEvent(event) @@ -2495,7 +2495,7 @@ public: // The window associated with this event is the window which had focus // before for SET event and the window which will have focus for the KILL - // one. NB: it may be NULL in both cases! + // one. NB: it may be null in both cases! wxWindow *GetWindow() const { return m_win; } void SetWindow(wxWindow *win) { m_win = win; } @@ -2513,7 +2513,7 @@ private: class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent { public: - wxChildFocusEvent(wxWindow *win = NULL); + wxChildFocusEvent(wxWindow *win = nullptr); wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } @@ -2596,7 +2596,7 @@ private: class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent { public: - wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL) + wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = nullptr) : wxEvent(winid, type) { m_menuId = winid; m_menu = menu; } wxMenuEvent(const wxMenuEvent& event) @@ -2885,7 +2885,7 @@ public: wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, - wxString *files = NULL) + wxString *files = nullptr) : wxEvent(0, type), m_noFiles(noFiles), m_pos(), @@ -2897,7 +2897,7 @@ public: : wxEvent(other), m_noFiles(other.m_noFiles), m_pos(other.m_pos), - m_files(NULL) + m_files(nullptr) { m_files = new wxString[m_noFiles]; for ( int n = 0; n < m_noFiles; n++ ) @@ -3057,7 +3057,7 @@ private: class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent { public: - wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL) + wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = nullptr) : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED), m_gainedCapture(gainedCapture) { } @@ -3158,7 +3158,7 @@ class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent public: wxPaletteChangedEvent(wxWindowID winid = 0) : wxEvent(winid, wxEVT_PALETTE_CHANGED), - m_changedWindow(NULL) + m_changedWindow(nullptr) { } wxPaletteChangedEvent(const wxPaletteChangedEvent& event) @@ -3219,7 +3219,7 @@ public: wxNavigationKeyEvent() : wxEvent(0, wxEVT_NAVIGATION_KEY), m_flags(IsForward | FromTab), // defaults are for TAB - m_focus(NULL) + m_focus(nullptr) { m_propagationLevel = wxEVENT_PROPAGATE_NONE; } @@ -3250,7 +3250,7 @@ public: void SetFromTab(bool bIs) { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; } - // the child which has the focus currently (may be NULL - use + // the child which has the focus currently (may be null - use // wxWindow::FindFocus then) wxWindow* GetCurrentFocus() const { return m_focus; } void SetCurrentFocus(wxWindow *win) { m_focus = win; } @@ -3288,7 +3288,7 @@ private: class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent { public: - wxWindowCreateEvent(wxWindow *win = NULL); + wxWindowCreateEvent(wxWindow *win = nullptr); wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } @@ -3301,7 +3301,7 @@ private: class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent { public: - wxWindowDestroyEvent(wxWindow *win = NULL); + wxWindowDestroyEvent(wxWindow *win = nullptr); wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } @@ -3484,7 +3484,7 @@ struct WXDLLIMPEXP_BASE wxEventTableEntryBase // being initialized (a temporary instance is created and then this // constructor is called). - const_cast( entry ).m_fn = NULL; + const_cast( entry ).m_fn = nullptr; } ~wxEventTableEntryBase() @@ -3795,8 +3795,8 @@ public: int lastId, wxEventType eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { DoBind(winid, lastId, eventType, wxNewEventFunctor(eventType, func, eventSink), @@ -3807,23 +3807,23 @@ public: void Connect(int winid, wxEventType eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); } // Even more convenient: without id (same as using id of wxID_ANY) void Connect(wxEventType eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); } bool Disconnect(int winid, int lastId, wxEventType eventType, - wxObjectEventFunction func = NULL, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObjectEventFunction func = nullptr, + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { return DoUnbind(winid, lastId, eventType, wxMakeEventFunctor(eventType, func, eventSink), @@ -3832,15 +3832,15 @@ public: bool Disconnect(int winid = wxID_ANY, wxEventType eventType = wxEVT_NULL, - wxObjectEventFunction func = NULL, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObjectEventFunction func = nullptr, + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); } bool Disconnect(wxEventType eventType, wxObjectEventFunction func, - wxObject *userData = NULL, - wxEvtHandler *eventSink = NULL) + wxObject *userData = nullptr, + wxEvtHandler *eventSink = nullptr) { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } // Bind functions to an event: @@ -3849,7 +3849,7 @@ public: void (*function)(EventArg &), int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL) + wxObject *userData = nullptr) { DoBind(winid, lastId, eventType, wxNewEventFunctor(eventType, function), @@ -3862,7 +3862,7 @@ public: void (*function)(EventArg &), int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL) + wxObject *userData = nullptr) { return DoUnbind(winid, lastId, eventType, wxMakeEventFunctor(eventType, function), @@ -3875,7 +3875,7 @@ public: const Functor &functor, int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL) + wxObject *userData = nullptr) { DoBind(winid, lastId, eventType, wxNewEventFunctor(eventType, functor), @@ -3888,7 +3888,7 @@ public: const Functor &functor, int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL) + wxObject *userData = nullptr) { return DoUnbind(winid, lastId, eventType, wxMakeEventFunctor(eventType, functor), @@ -3905,7 +3905,7 @@ public: EventHandler *handler, int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL) + wxObject *userData = nullptr) { DoBind(winid, lastId, eventType, wxNewEventFunctor(eventType, method, handler), @@ -3918,7 +3918,7 @@ public: EventHandler *handler, int winid = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL ) + wxObject *userData = nullptr ) { return DoUnbind(winid, lastId, eventType, wxMakeEventFunctor(eventType, method, handler), @@ -3967,13 +3967,13 @@ private: int lastId, wxEventType eventType, wxEventFunctor *func, - wxObject* userData = NULL); + wxObject* userData = nullptr); bool DoUnbind(int winid, int lastId, wxEventType eventType, const wxEventFunctor& func, - wxObject *userData = NULL); + wxObject *userData = nullptr); static const wxEventTableEntry sm_eventTableEntries[]; @@ -4099,7 +4099,7 @@ inline void wxObjectEventFunctor::operator()(wxEvtHandler *handler, wxEvent& eve class wxEventConnectionRef : public wxTrackerNode { public: - wxEventConnectionRef() : m_src(NULL), m_sink(NULL), m_refCount(0) { } + wxEventConnectionRef() : m_src(nullptr), m_sink(nullptr), m_refCount(0) { } wxEventConnectionRef(wxEvtHandler *src, wxEvtHandler *sink) : m_src(src), m_sink(sink), m_refCount(1) { @@ -4474,7 +4474,7 @@ typedef void (wxEvtHandler::*wxPressAndTapEventFunction)(wxPressAndTapEvent&); // - id1, id2 ids of the first/last id // - fn the function (should be cast to the right type) #define wx__DECLARE_EVT2(evt, id1, id2, fn) \ - wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL), + wxDECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, nullptr), #define wx__DECLARE_EVT1(evt, id, fn) \ wx__DECLARE_EVT2(evt, id, wxID_ANY, fn) #define wx__DECLARE_EVT0(evt, fn) \ diff --git a/include/wx/eventfilter.h b/include/wx/eventfilter.h index 1205216264..f105b0c0b1 100644 --- a/include/wx/eventfilter.h +++ b/include/wx/eventfilter.h @@ -40,7 +40,7 @@ public: wxEventFilter() { - m_next = NULL; + m_next = nullptr; } virtual ~wxEventFilter() diff --git a/include/wx/evtloop.h b/include/wx/evtloop.h index 39404b9d2a..206babcc80 100644 --- a/include/wx/evtloop.h +++ b/include/wx/evtloop.h @@ -174,7 +174,7 @@ public: // active loop // ----------- - // return currently active (running) event loop, may be NULL + // return currently active (running) event loop, may be null static wxEventLoopBase *GetActive() { return ms_activeLoop; } // set currently active (running) event loop @@ -307,7 +307,7 @@ class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl; class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase { public: - wxGUIEventLoop() { m_impl = NULL; } + wxGUIEventLoop() { m_impl = nullptr; } virtual ~wxGUIEventLoop(); virtual void ScheduleExit(int rc = 0); @@ -380,7 +380,7 @@ protected: virtual void OnExit() override { delete m_windowDisabler; - m_windowDisabler = NULL; + m_windowDisabler = nullptr; wxGUIEventLoop::OnExit(); } @@ -424,7 +424,7 @@ class wxEventLoopGuarantor public: wxEventLoopGuarantor() { - m_evtLoopNew = NULL; + m_evtLoopNew = nullptr; if (!wxEventLoop::GetActive()) { m_evtLoopNew = new wxEventLoop; @@ -436,7 +436,7 @@ public: { if (m_evtLoopNew) { - wxEventLoop::SetActive(NULL); + wxEventLoop::SetActive(nullptr); delete m_evtLoopNew; } } diff --git a/include/wx/fdrepdlg.h b/include/wx/fdrepdlg.h index 56d9a4f941..72527acefb 100644 --- a/include/wx/fdrepdlg.h +++ b/include/wx/fdrepdlg.h @@ -96,7 +96,7 @@ class WXDLLIMPEXP_CORE wxFindReplaceDialogBase : public wxDialog { public: // ctors and such - wxFindReplaceDialogBase() { m_FindReplaceData = NULL; } + wxFindReplaceDialogBase() { m_FindReplaceData = nullptr; } wxFindReplaceDialogBase(wxWindow * WXUNUSED(parent), wxFindReplaceData *data, const wxString& WXUNUSED(title), diff --git a/include/wx/ffile.h b/include/wx/ffile.h index 954a700387..d89ff229f2 100644 --- a/include/wx/ffile.h +++ b/include/wx/ffile.h @@ -34,7 +34,7 @@ public: // ctors // ----- // def ctor - wxFFile() { m_fp = NULL; } + wxFFile() { m_fp = nullptr; } // open specified file (may fail, use IsOpened()) wxFFile(const wxString& filename, const wxString& mode = wxT("r")); // attach to (already opened) file @@ -49,7 +49,7 @@ public: // assign an existing file descriptor and get it back from wxFFile object void Attach(FILE *lfp, const wxString& name = wxEmptyString) { Close(); m_fp = lfp; m_name = name; } - FILE* Detach() { FILE* fpOld = m_fp; m_fp = NULL; return fpOld; } + FILE* Detach() { FILE* fpOld = m_fp; m_fp = nullptr; return fpOld; } FILE *fp() const { return m_fp; } // read/write (unbuffered) @@ -78,7 +78,7 @@ public: // simple accessors: note that Eof() and Error() may only be called if // IsOpened(). Otherwise they assert and return false. // is file opened? - bool IsOpened() const { return m_fp != NULL; } + bool IsOpened() const { return m_fp != nullptr; } // is end of file reached? bool Eof() const; // has an error occurred? @@ -98,7 +98,7 @@ private: wxFFile(const wxFFile&); wxFFile& operator=(const wxFFile&); - FILE *m_fp; // IO stream or NULL if not opened + FILE *m_fp; // IO stream or nullptr if not opened wxString m_name; // the name of the file (for diagnostic messages) }; diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h index 0e8cbf4e10..e461b44d9a 100644 --- a/include/wx/fileconf.h +++ b/include/wx/fileconf.h @@ -189,7 +189,7 @@ public: // functions to work with this list wxFileConfigLineList *LineListAppend(const wxString& str); wxFileConfigLineList *LineListInsert(const wxString& str, - wxFileConfigLineList *pLine); // NULL => Prepend() + wxFileConfigLineList *pLine); // nullptr => Prepend() void LineListRemove(wxFileConfigLineList *pLine); bool LineListIsEmpty(); diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index c62860b363..d2cdf61250 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -210,11 +210,11 @@ protected: wxWindow* CreateExtraControlWithParent(wxWindow* parent) const; // returns true if control is created, also sets m_extraControl bool CreateExtraControl(); - // destroy m_extraControl and reset it to NULL + // destroy m_extraControl and reset it to nullptr void DestroyExtraControl(); // return true if SetExtraControlCreator() was called bool HasExtraControlCreator() const - { return m_extraControlCreator != NULL; } + { return m_extraControlCreator != nullptr; } // Helper function for native file dialog usage where no wx events // are processed. void UpdateExtraControlUI(); @@ -243,7 +243,7 @@ wxFileSelector(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), const wxString& default_extension = wxEmptyString, const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), int flags = 0, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); // An extended version of wxFileSelector @@ -251,10 +251,10 @@ WXDLLIMPEXP_CORE wxString wxFileSelectorEx(const wxString& message = wxASCII_STR(wxFileSelectorPromptStr), const wxString& default_path = wxEmptyString, const wxString& default_filename = wxEmptyString, - int *indexDefaultExtension = NULL, + int *indexDefaultExtension = nullptr, const wxString& wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr), int flags = 0, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); // Ask for filename to load @@ -262,14 +262,14 @@ WXDLLIMPEXP_CORE wxString wxLoadFileSelector(const wxString& what, const wxString& extension, const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); // Ask for filename to save WXDLLIMPEXP_CORE wxString wxSaveFileSelector(const wxString& what, const wxString& extension, const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); #if defined (__WXUNIVERSAL__) diff --git a/include/wx/filename.h b/include/wx/filename.h index 1bdb3b7299..2e29a9d3ca 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -277,7 +277,7 @@ public: // time functions #if wxUSE_DATETIME // set the file last access/mod and creation times - // (any of the pointers may be NULL) + // (any of the pointers may be null) bool SetTimes(const wxDateTime *dtAccess, const wxDateTime *dtMod, const wxDateTime *dtCreate) const; @@ -286,7 +286,7 @@ public: bool Touch() const; // return the last access, last modification and create times - // (any of the pointers may be NULL) + // (any of the pointers may be null) bool GetTimes(wxDateTime *dtAccess, wxDateTime *dtMod, wxDateTime *dtCreate) const; @@ -295,7 +295,7 @@ public: wxDateTime GetModificationTime() const { wxDateTime dtMod; - (void)GetTimes(NULL, &dtMod, NULL); + (void)GetTimes(nullptr, &dtMod, nullptr); return dtMod; } #endif // wxUSE_DATETIME @@ -422,7 +422,7 @@ public: // the arguments bool GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, - wxString* arguments = NULL) const; + wxString* arguments = nullptr) const; #endif // if the path contains the value of the environment variable named envname @@ -554,13 +554,13 @@ public: static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE ); // split a fullpath into the volume, path, (base) name and extension - // (all of the pointers can be NULL) + // (all of the pointers can be null) static void SplitPath(const wxString& fullpath, wxString *volume, wxString *path, wxString *name, wxString *ext, - bool *hasExt = NULL, + bool *hasExt = nullptr, wxPathFormat format = wxPATH_NATIVE); static void SplitPath(const wxString& fullpath, @@ -570,7 +570,7 @@ public: wxString *ext, wxPathFormat format) { - SplitPath(fullpath, volume, path, name, ext, NULL, format); + SplitPath(fullpath, volume, path, name, ext, nullptr, format); } // compatibility version: volume is part of path diff --git a/include/wx/filepicker.h b/include/wx/filepicker.h index 0bc469d327..7cbcfef815 100644 --- a/include/wx/filepicker.h +++ b/include/wx/filepicker.h @@ -148,7 +148,7 @@ class WXDLLIMPEXP_CORE wxFileDirPickerCtrlBase : public wxPickerBase { public: wxFileDirPickerCtrlBase() - : m_pickerIface(NULL) + : m_pickerIface(nullptr) { } diff --git a/include/wx/filesys.h b/include/wx/filesys.h index 4ff3b5d549..cf5a99d45a 100644 --- a/include/wx/filesys.h +++ b/include/wx/filesys.h @@ -57,7 +57,7 @@ public: wxInputStream *DetachStream() { wxInputStream *stream = m_Stream; - m_Stream = NULL; + m_Stream = nullptr; return stream; } @@ -113,7 +113,7 @@ public: virtual bool CanOpen(const wxString& location) = 0; // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. + // Returns nullptr if opening failed. // The location is always absolute path. virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0; @@ -170,7 +170,7 @@ WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(wxFileSystemHandler*, wxFSHandlerHash, cla class WXDLLIMPEXP_BASE wxFileSystem : public wxObject { public: - wxFileSystem() : wxObject() { m_FindFileHandler = NULL;} + wxFileSystem() : wxObject() { m_FindFileHandler = nullptr;} virtual ~wxFileSystem(); // sets the current location. Every call to OpenFile is @@ -184,7 +184,7 @@ public: wxString GetPath() const {return m_Path;} // opens given file and returns pointer to input stream. - // Returns NULL if opening failed. + // Returns nullptr if opening failed. // It first tries to open the file in relative scope // (based on ChangePathTo()'s value) and then as an absolute // path. diff --git a/include/wx/fontdlg.h b/include/wx/fontdlg.h index 847b892eb9..a240380038 100644 --- a/include/wx/fontdlg.h +++ b/include/wx/fontdlg.h @@ -43,7 +43,7 @@ public: protected: virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } - void InitFontData(const wxFontData *data = NULL) + void InitFontData(const wxFontData *data = nullptr) { if ( data ) m_fontData = *data; } wxFontData m_fontData; @@ -82,7 +82,7 @@ protected: // get the font from user and return it, returns wxNullFont if the dialog was // cancelled -WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL, +WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = nullptr, const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); diff --git a/include/wx/fontmap.h b/include/wx/fontmap.h index 404a0cd08a..13d8153b95 100644 --- a/include/wx/fontmap.h +++ b/include/wx/fontmap.h @@ -140,7 +140,7 @@ protected: const wxString& GetConfigPath(); // change to the given (relative) path in the config, return true if ok - // (then GetConfig() will return something !NULL), false if no config + // (then GetConfig() will return something non-null), false if no config // object // // caller should provide a pointer to the string variable which should be @@ -164,7 +164,7 @@ protected: int NonInteractiveCharsetToEncoding(const wxString& charset); private: - // the global fontmapper object or NULL + // the global fontmapper object or nullptr static wxFontMapper *sm_instance; friend class wxFontMapperPathChanger; diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h index 5890f570cd..744715d99e 100644 --- a/include/wx/fontutil.h +++ b/include/wx/fontutil.h @@ -126,7 +126,7 @@ public: // fonts inside the library itself. wxNativeFontInfo(const LOGFONT& lf_, const wxWindow* win #ifndef WXBUILDING - = NULL + = nullptr #endif ); diff --git a/include/wx/frame.h b/include/wx/frame.h index 8a1f18a7bf..8096795221 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -162,8 +162,8 @@ public: #endif // wxUSE_STATUSBAR // send wxUpdateUIEvents for all menu items in the menubar, - // or just for menu if non-NULL - virtual void DoMenuUpdates(wxMenu* menu = NULL); + // or just for menu if non-null + virtual void DoMenuUpdates(wxMenu* menu = nullptr); #endif // wxUSE_MENUS // do the UI update processing for this window diff --git a/include/wx/gauge.h b/include/wx/gauge.h index 0d253b0001..69181a1bff 100644 --- a/include/wx/gauge.h +++ b/include/wx/gauge.h @@ -55,7 +55,7 @@ public: #if wxGAUGE_EMULATE_INDETERMINATE_MODE m_nDirection(wxRIGHT), #endif - m_appProgressIndicator(NULL) { } + m_appProgressIndicator(nullptr) { } virtual ~wxGaugeBase(); diff --git a/include/wx/gbsizer.h b/include/wx/gbsizer.h index 23cb73f803..b2d2a2ced9 100644 --- a/include/wx/gbsizer.h +++ b/include/wx/gbsizer.h @@ -71,7 +71,7 @@ public: // errors. static wxGBSpan Invalid() { - return wxGBSpan(NULL); + return wxGBSpan(nullptr); } int GetRowspan() const { return m_rowspan; } @@ -132,7 +132,7 @@ public: const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); // window wxGBSizerItem( wxWindow *window, @@ -140,7 +140,7 @@ public: const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL ); + wxObject* userData=nullptr ); // subsizer wxGBSizerItem( wxSizer *sizer, @@ -148,7 +148,7 @@ public: const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL ); + wxObject* userData=nullptr ); // default ctor wxGBSizerItem(); @@ -217,20 +217,20 @@ public: const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, - wxObject* userData = NULL ); + wxObject* userData = nullptr ); wxSizerItem* Add( wxSizer *sizer, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, - wxObject* userData = NULL ); + wxObject* userData = nullptr ); wxSizerItem* Add( int width, int height, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, int flag = 0, int border = 0, - wxObject* userData = NULL ); + wxObject* userData = nullptr ); wxSizerItem* Add( wxGBSizerItem *item ); @@ -267,18 +267,18 @@ public: bool SetItemSpan(size_t index, const wxGBSpan& span); - // Find the sizer item for the given window or subsizer, returns NULL if + // Find the sizer item for the given window or subsizer, returns nullptr if // not found. (non-recursive) wxGBSizerItem* FindItem(wxWindow* window); wxGBSizerItem* FindItem(wxSizer* sizer); - // Return the sizer item for the given grid cell, or NULL if there is no + // Return the sizer item for the given grid cell, or nullptr if there is no // item at that position. (non-recursive) wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); - // Return the sizer item located at the point given in pt, or NULL if + // Return the sizer item located at the point given in pt, or nullptr if // there is no item at that point. The (x,y) coordinates in pt correspond // to the client coordinates of the window using the sizer for // layout. (non-recursive) @@ -286,7 +286,7 @@ public: // Return the sizer item that has a matching user data (it only compares - // pointer values) or NULL if not found. (non-recursive) + // pointer values) or nullptr if not found. (non-recursive) wxGBSizerItem* FindItemWithData(const wxObject* userData); @@ -299,28 +299,28 @@ public: // item. Returns true if so, false if there would be no overlap. If an // excludeItem is given then it will not be checked for intersection, for // example it may be the item we are checking the position of. - bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); - bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); + bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = nullptr); + bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = nullptr); // The Add base class virtuals should not be used with this class, but // we'll try to make them automatically select a location for the item // anyway. - virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); // The Insert and Prepend base class virtuals that are not appropriate for // this class and should not be used. Their implementation in this class // simply fails. virtual wxSizerItem* Add( wxSizerItem *item ); - 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, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ) override; - 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 ); + virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); + virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = nullptr ); virtual wxSizerItem* Prepend( wxSizerItem *item ); diff --git a/include/wx/gdiobj.h b/include/wx/gdiobj.h index a66e2c49d1..c83b807f6d 100644 --- a/include/wx/gdiobj.h +++ b/include/wx/gdiobj.h @@ -50,7 +50,7 @@ public: } // don't use in the new code, use IsOk() instead - bool IsNull() const { return m_refData == NULL; } + bool IsNull() const { return m_refData == nullptr; } // older version, for backwards compatibility only (but not deprecated // because it's still widely used) @@ -66,7 +66,7 @@ public: virtual bool IsFree() const { return false; } // Returns handle. - virtual WXHANDLE GetResourceHandle() const { return NULL; } + virtual WXHANDLE GetResourceHandle() const { return nullptr; } #endif // defined(__WXMSW__) protected: diff --git a/include/wx/generic/aboutdlgg.h b/include/wx/generic/aboutdlgg.h index 6b363e26a3..4c6338a56d 100644 --- a/include/wx/generic/aboutdlgg.h +++ b/include/wx/generic/aboutdlgg.h @@ -44,7 +44,7 @@ public: wxGenericAboutDialog() { Init(); } // ctor which fully initializes the object - wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL) + wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = nullptr) { Init(); @@ -52,7 +52,7 @@ public: } // this method must be called if and only if the default ctor was used - bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL); + bool Create(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); protected: // this virtual method may be overridden to add some more controls to the @@ -80,7 +80,7 @@ protected: private: // common part of all ctors - void Init() { m_sizerText = NULL; } + void Init() { m_sizerText = nullptr; } #if !wxUSE_MODAL_ABOUT_DIALOG // An explicit handler for deleting the dialog when it's closed is needed @@ -94,7 +94,7 @@ private: // unlike wxAboutBox which can show either the native or generic about dialog, // this function always shows the generic one -WXDLLIMPEXP_CORE void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); +WXDLLIMPEXP_CORE void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); #endif // wxUSE_ABOUTDLG diff --git a/include/wx/generic/activityindicator.h b/include/wx/generic/activityindicator.h index 745c98d4fe..80d6037120 100644 --- a/include/wx/generic/activityindicator.h +++ b/include/wx/generic/activityindicator.h @@ -24,7 +24,7 @@ class WXDLLIMPEXP_ADV wxActivityIndicatorGeneric : public wxActivityIndicatorBas public: wxActivityIndicatorGeneric() { - m_impl = NULL; + m_impl = nullptr; } explicit @@ -35,7 +35,7 @@ public: long style = 0, const wxString& name = wxActivityIndicatorNameStr) { - m_impl = NULL; + m_impl = nullptr; Create(parent, winid, pos, size, style, name); } diff --git a/include/wx/generic/bmpcbox.h b/include/wx/generic/bmpcbox.h index 96e6846a0d..e94d705664 100644 --- a/include/wx/generic/bmpcbox.h +++ b/include/wx/generic/bmpcbox.h @@ -38,7 +38,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) diff --git a/include/wx/generic/busyinfo.h b/include/wx/generic/busyinfo.h index df1c764f51..1aae62828b 100644 --- a/include/wx/generic/busyinfo.h +++ b/include/wx/generic/busyinfo.h @@ -33,7 +33,7 @@ public: Init(flags); } - wxBusyInfo(const wxString& message, wxWindow *parent = NULL) + wxBusyInfo(const wxString& message, wxWindow *parent = nullptr) { Init(wxBusyInfoFlags().Parent(parent).Label(message)); } diff --git a/include/wx/generic/calctrlg.h b/include/wx/generic/calctrlg.h index c84a5b0b2f..d0b3131dcc 100644 --- a/include/wx/generic/calctrlg.h +++ b/include/wx/generic/calctrlg.h @@ -124,7 +124,7 @@ public: virtual wxCalendarDateAttr *GetAttr(size_t day) const override { - wxCHECK_MSG( day > 0 && day < 32, NULL, wxT("invalid day") ); + wxCHECK_MSG( day > 0 && day < 32, nullptr, wxT("invalid day") ); return m_attrs[day - 1]; } @@ -137,13 +137,13 @@ public: m_attrs[day - 1] = attr; } - virtual void ResetAttr(size_t day) override { SetAttr(day, NULL); } + virtual void ResetAttr(size_t day) override { SetAttr(day, nullptr); } virtual void SetHoliday(size_t day) override; virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, - wxDateTime *date = NULL, - wxDateTime::WeekDay *wd = NULL) override; + wxDateTime *date = nullptr, + wxDateTime::WeekDay *wd = nullptr) override; // implementation only from now on // ------------------------------- diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 524eb23320..02c4ec520b 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -33,7 +33,7 @@ class WXDLLIMPEXP_FWD_CORE wxListBoxBase; class WXDLLIMPEXP_CORE wxAnyChoiceDialog : public wxDialog { public: - wxAnyChoiceDialog() : m_listbox(NULL) { } + wxAnyChoiceDialog() : m_listbox(nullptr) { } wxAnyChoiceDialog(wxWindow *parent, const wxString& message, @@ -100,7 +100,7 @@ public: const wxString& caption, int n, const wxString *choices, - void **clientData = NULL, + void **clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition) { @@ -111,7 +111,7 @@ public: const wxString& message, const wxString& caption, const wxArrayString& choices, - void **clientData = NULL, + void **clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition) { @@ -123,14 +123,14 @@ public: const wxString& caption, int n, const wxString *choices, - void **clientData = NULL, + void **clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); bool Create(wxWindow *parent, const wxString& message, const wxString& caption, const wxArrayString& choices, - void **clientData = NULL, + void **clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); @@ -224,7 +224,7 @@ private: WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, const wxString& caption, const wxArrayString& choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -235,7 +235,7 @@ WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, const wxString& caption, int n, const wxString *choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -247,20 +247,20 @@ WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, const wxString& caption, const wxArrayString& choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); WXDLLIMPEXP_CORE wxString wxGetSingleChoice(const wxString& message, const wxString& caption, int n, const wxString *choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); // Same as above but gets position in list of strings, instead of string, // or -1 if no selection WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -271,7 +271,7 @@ WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int n, const wxString *choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -283,20 +283,20 @@ WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); WXDLLIMPEXP_CORE int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int n, const wxString *choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); -// Return client data instead or NULL if canceled +// Return client data instead or nullptr if canceled WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, const wxArrayString& choices, void **client_data, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -308,7 +308,7 @@ WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, int n, const wxString *choices, void **client_data, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -321,7 +321,7 @@ WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, const wxArrayString& choices, void **client_data, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, @@ -329,7 +329,7 @@ WXDLLIMPEXP_CORE void* wxGetSingleChoiceData(const wxString& message, int n, const wxString *choices, void **client_data, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); // fill the array with the indices of the chosen items, it will be empty // if no items were selected or Cancel was pressed - return the number of @@ -338,7 +338,7 @@ WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, int n, const wxString *choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -349,7 +349,7 @@ WXDLLIMPEXP_CORE int wxGetSelectedChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, const wxArrayString& choices, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, diff --git a/include/wx/generic/collpaneg.h b/include/wx/generic/collpaneg.h index a731cbb8c1..a5e7fedc8d 100644 --- a/include/wx/generic/collpaneg.h +++ b/include/wx/generic/collpaneg.h @@ -56,7 +56,7 @@ public: virtual void SetLabel(const wxString &label) override; virtual bool IsCollapsed() const override - { return m_pPane==NULL || !m_pPane->IsShown(); } + { return m_pPane==nullptr || !m_pPane->IsShown(); } virtual wxWindow *GetPane() const override { return m_pPane; } virtual wxString GetLabel() const override; diff --git a/include/wx/generic/colrdlgg.h b/include/wx/generic/colrdlgg.h index c0cb7b2d8c..45bc3a6f63 100644 --- a/include/wx/generic/colrdlgg.h +++ b/include/wx/generic/colrdlgg.h @@ -37,10 +37,10 @@ class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog public: wxGenericColourDialog(); wxGenericColourDialog(wxWindow *parent, - const wxColourData *data = NULL); + const wxColourData *data = nullptr); virtual ~wxGenericColourDialog(); - bool Create(wxWindow *parent, const wxColourData *data = NULL); + bool Create(wxWindow *parent, const wxColourData *data = nullptr); wxColourData &GetColourData() { return m_colourData; } diff --git a/include/wx/generic/combo.h b/include/wx/generic/combo.h index 2e57ef706b..d7b0805bbf 100644 --- a/include/wx/generic/combo.h +++ b/include/wx/generic/combo.h @@ -85,8 +85,8 @@ protected: #if defined(__WXUNIVERSAL__) // Looks like there's nothing we need to override here #elif defined(__WXGTK__) - virtual GtkEditable *GetEditable() const override { return NULL; } - virtual GtkEntry *GetEntry() const override { return NULL; } + virtual GtkEditable *GetEditable() const override { return nullptr; } + virtual GtkEntry *GetEntry() const override { return nullptr; } #elif defined(__WXOSX__) virtual wxTextWidgetImpl * GetTextPeer() const override; #endif diff --git a/include/wx/generic/ctrlsub.h b/include/wx/generic/ctrlsub.h index 2636192389..03951e44e9 100644 --- a/include/wx/generic/ctrlsub.h +++ b/include/wx/generic/ctrlsub.h @@ -23,7 +23,7 @@ public: virtual void DoInitItemClientData() { - m_itemsClientData.resize(GetCount(), NULL); + m_itemsClientData.resize(GetCount(), nullptr); } virtual void DoSetItemClientData(unsigned int n, void *clientData) @@ -79,7 +79,7 @@ protected: // it's more efficient to insert everything at once and then update // for big number of items to avoid moving the array contents // around (which would result in O(N^2) algorithm) - m_itemsClientData.Insert(NULL, pos, numItems); + m_itemsClientData.Insert(nullptr, pos, numItems); for ( unsigned int n = 0; n < numItems; ++n, ++pos ) m_itemsClientData[pos] = clientData[n]; diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h index 02b1fad6d6..694b3a1a4e 100644 --- a/include/wx/generic/dataview.h +++ b/include/wx/generic/dataview.h @@ -254,11 +254,11 @@ public: virtual void UnselectAll() override; virtual void EnsureVisible( const wxDataViewItem & item, - const wxDataViewColumn *column = NULL ) override; + const wxDataViewColumn *column = nullptr ) override; virtual void HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) const override; virtual wxRect GetItemRect( const wxDataViewItem & item, - const wxDataViewColumn *column = NULL ) const override; + const wxDataViewColumn *column = nullptr ) const override; virtual bool SetRowHeight( int rowHeight ) override; diff --git a/include/wx/generic/dcpsg.h b/include/wx/generic/dcpsg.h index 430fc06ff1..2d80207c33 100644 --- a/include/wx/generic/dcpsg.h +++ b/include/wx/generic/dcpsg.h @@ -99,7 +99,7 @@ public: virtual int GetResolution() const override; virtual wxRect GetPaperRect() const override; - virtual void* GetHandle() const override { return NULL; } + virtual void* GetHandle() const override { return nullptr; } protected: bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, @@ -137,9 +137,9 @@ protected: wxFAIL_MSG( "not implemented" ); } void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; void DoGetSize(int* width, int* height) const override; void DoGetSizeMM(int *width, int *height) const override; diff --git a/include/wx/generic/dirctrlg.h b/include/wx/generic/dirctrlg.h index 8ec71ba8e0..a14730604c 100644 --- a/include/wx/generic/dirctrlg.h +++ b/include/wx/generic/dirctrlg.h @@ -186,7 +186,7 @@ protected: virtual wxTreeItemId AppendItem (const wxTreeItemId & parent, const wxString & text, int image = -1, int selectedImage = -1, - wxTreeItemData * data = NULL); + wxTreeItemData * data = nullptr); //void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames); virtual wxTreeCtrl* CreateTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long treeStyle); @@ -305,7 +305,7 @@ public: const wxSize& GetSize() const { return m_size; } void SetSize(const wxSize& sz) { m_size = sz; } - bool IsOk() const { return m_smallImageList != NULL; } + bool IsOk() const { return m_smallImageList != nullptr; } protected: void Create(const wxSize& sz); // create on first use diff --git a/include/wx/generic/dragimgg.h b/include/wx/generic/dragimgg.h index 4c54243631..443da1b182 100644 --- a/include/wx/generic/dragimgg.h +++ b/include/wx/generic/dragimgg.h @@ -77,7 +77,7 @@ { m_dragImage->EndDrag(this); delete m_dragImage; - m_dragImage = NULL; + m_dragImage = nullptr; } ReleaseMouse(); } @@ -175,7 +175,7 @@ public: // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = nullptr); // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. This is full screen only. fullScreenRect gives the @@ -186,7 +186,7 @@ public: bool EndDrag(); // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. + // is non-null, or in screen coordinates if null. bool Move(const wxPoint& pt); // Show the image diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 1f56230ffb..00de8a95e4 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -278,7 +278,7 @@ public: // Factory functions, only used by the library itself. static wxGridActivationSource FromProgram() { - return wxGridActivationSource(Program, NULL); + return wxGridActivationSource(Program, nullptr); } static wxGridActivationSource From(const wxKeyEvent& event) @@ -391,14 +391,14 @@ class WXDLLIMPEXP_CORE wxGridCellEditor : public wxGridCellWorker public: wxGridCellEditor() : wxGridCellWorker(), - m_control(NULL), - m_attr(NULL) + m_control(nullptr), + m_attr(nullptr) { } wxGridCellEditor(const wxGridCellEditor& other); - bool IsCreated() const { return m_control != NULL; } + bool IsCreated() const { return m_control != nullptr; } wxWindow* GetWindow() const { return m_control; } void SetWindow(wxWindow* window) { m_control = window; } @@ -416,7 +416,7 @@ public: // Show or hide the edit control, use the specified attributes to set // colours/fonts for it - virtual void Show(bool show, wxGridCellAttr *attr = NULL); + virtual void Show(bool show, wxGridCellAttr *attr = nullptr); // Draws the part of the cell not occupied by the control: the base class // version just fills it with background colour from the attribute @@ -748,7 +748,7 @@ public: }; // default ctor - explicit wxGridCellAttr(wxGridCellAttr *attrDefault = NULL) + explicit wxGridCellAttr(wxGridCellAttr *attrDefault = nullptr) { Init(attrDefault); @@ -803,8 +803,8 @@ public: { return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID; } - bool HasRenderer() const { return m_renderer != NULL; } - bool HasEditor() const { return m_editor != NULL; } + bool HasRenderer() const { return m_renderer != nullptr; } + bool HasEditor() const { return m_editor != nullptr; } bool HasReadWriteMode() const { return m_isReadOnly != Unset; } bool HasOverflowMode() const { return m_fitMode.IsSpecified(); } bool HasSize() const { return m_sizeRows != 1 || m_sizeCols != 1; } @@ -864,7 +864,7 @@ private: }; // the common part of all ctors - void Init(wxGridCellAttr *attrDefault = NULL); + void Init(wxGridCellAttr *attrDefault = nullptr); wxColour m_colText, @@ -939,7 +939,7 @@ public: // get renderers for the given row/column header label and the corner // window: unlike cell renderers, these objects are not reference counted - // and are never NULL so they are returned by reference + // and are never null so they are returned by reference virtual const wxGridColumnHeaderRenderer& GetColumnHeaderRenderer(int col); virtual const wxGridRowHeaderRenderer& GetRowHeaderRenderer(int row); virtual const wxGridCornerHeaderRenderer& GetCornerRenderer(); @@ -1286,7 +1286,7 @@ public: // give us the attr provider to use - we take ownership of the pointer void SetAttrProvider(wxGridCellAttrProvider *attrProvider); - // get the currently used attr provider (may be NULL) + // get the currently used attr provider (may be null) wxGridCellAttrProvider *GetAttrProvider() const { return m_attrProvider; } // Does this table allow attributes? Default implementation creates @@ -1574,11 +1574,11 @@ public: // ------ display update functions // wxArrayInt CalcRowLabelsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; wxArrayInt CalcColLabelsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; void PrepareDCFor(wxDC &dc, wxGridWindow *gridWindow); @@ -1703,7 +1703,7 @@ public: int GetBatchCount() const { return m_batchCount; } - virtual void Refresh(bool eraseb = true, const wxRect* rect = NULL) override; + virtual void Refresh(bool eraseb = true, const wxRect* rect = nullptr) override; // Use this, rather than wxWindow::Refresh(), to force an // immediate repainting of the grid. Has no effect if you are @@ -1738,14 +1738,14 @@ public: // grid cells and labels so you will need to convert from device // coordinates for mouse events etc. // - wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = NULL) const; + wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = nullptr) const; void XYToCell(int x, int y, wxGridCellCoords& coords, - wxGridWindow *gridWindow = NULL) const + wxGridWindow *gridWindow = nullptr) const { coords = XYToCell(x, y, gridWindow); } wxGridCellCoords XYToCell(const wxPoint& pos, - wxGridWindow *gridWindow = NULL) const + wxGridWindow *gridWindow = nullptr) const { return XYToCell(pos.x, pos.y, gridWindow); } // these functions return the index of the row/columns corresponding to the @@ -1754,8 +1754,8 @@ public: // if clipToMinMax is false (default, wxNOT_FOUND is returned if the // position is outside any row/column, otherwise the first/last element is // returned in this case - int YToRow( int y, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const; - int XToCol( int x, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL ) const; + int YToRow( int y, bool clipToMinMax = false, wxGridWindow *gridWindow = nullptr ) const; + int XToCol( int x, bool clipToMinMax = false, wxGridWindow *gridWindow = nullptr ) const; int YToEdgeOfRow( int y ) const; int XToEdgeOfCol( int x ) const; @@ -2303,7 +2303,7 @@ public: // wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, const wxGridCellCoords & bottomRight, - const wxGridWindow *gridWindow = NULL) const; + const wxGridWindow *gridWindow = nullptr) const; // Access or update the selection fore/back colours wxColour GetSelectionBackground() const @@ -2611,7 +2611,7 @@ protected: // for this to work, you should always use it and not set m_cursorMode // directly! void ChangeCursorMode(CursorMode mode, - wxWindow *win = NULL, + wxWindow *win = nullptr, bool captureMouse = true); wxWindow *m_winCapture; // the window which captured the mouse @@ -3048,7 +3048,7 @@ private: void DoSaveEditControlValue(); // these sets contain the indices of fixed, i.e. non-resizable - // interactively, grid rows or columns and are NULL if there are no fixed + // interactively, grid rows or columns and are null if there are no fixed // elements (which is the default) wxGridFixedIndicesSet *m_setFixedRows, *m_setFixedCols; @@ -3065,13 +3065,13 @@ private: class WXDLLIMPEXP_CORE wxGridUpdateLocker { public: - // if the pointer is NULL, Create() can be called later - wxGridUpdateLocker(wxGrid *grid = NULL) + // if the pointer is null, Create() can be called later + wxGridUpdateLocker(wxGrid *grid = nullptr) { Init(grid); } - // can be called if ctor was used with a NULL pointer, must not be called + // can be called if ctor was used with a null pointer, must not be called // more than once void Create(wxGrid *grid) { @@ -3296,7 +3296,7 @@ public: { m_row = 0; m_col = 0; - m_window = NULL; + m_window = nullptr; } wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, @@ -3455,9 +3455,9 @@ extern const int wxEVT_GRID_CREATE_CELL; extern const int wxEVT_GRID_CHANGE_LABELS; extern const int wxEVT_GRID_CHANGE_SEL_LABEL; -#define EVT_GRID_CREATE_CELL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), -#define EVT_GRID_CHANGE_LABELS(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), -#define EVT_GRID_CHANGE_SEL_LABEL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), NULL ), +#define EVT_GRID_CREATE_CELL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CREATE_CELL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), nullptr ), +#define EVT_GRID_CHANGE_LABELS(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_LABELS, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), nullptr ), +#define EVT_GRID_CHANGE_SEL_LABEL(fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_GRID_CHANGE_SEL_LABEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxGridEventFunction, &fn ), nullptr ), #endif diff --git a/include/wx/generic/grideditors.h b/include/wx/generic/grideditors.h index 3759b37128..30ac9543d6 100644 --- a/include/wx/generic/grideditors.h +++ b/include/wx/generic/grideditors.h @@ -292,7 +292,7 @@ public: wxEvtHandler* evtHandler) override; virtual void SetSize(const wxRect& rect) override; - virtual void Show(bool show, wxGridCellAttr *attr = NULL) override; + virtual void Show(bool show, wxGridCellAttr *attr = nullptr) override; virtual bool IsAcceptedKey(wxKeyEvent& event) override; virtual void BeginEdit(int row, int col, wxGrid* grid) override; @@ -348,7 +348,7 @@ class WXDLLIMPEXP_ADV wxGridCellChoiceEditor : public wxGridCellEditor public: // if !allowOthers, user can't type a string not in choices array explicit wxGridCellChoiceEditor(size_t count = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, bool allowOthers = false); explicit wxGridCellChoiceEditor(const wxArrayString& choices, bool allowOthers = false) diff --git a/include/wx/generic/headerctrlg.h b/include/wx/generic/headerctrlg.h index 5797d1aa0e..e75934f295 100644 --- a/include/wx/generic/headerctrlg.h +++ b/include/wx/generic/headerctrlg.h @@ -96,7 +96,7 @@ private: // position is near the divider at the right end of this column (notice // that this means that we return column 0 even if the position is over // column 1 but close enough to the divider separating it from column 0) - unsigned int FindColumnAtPoint(int x, bool *onSeparator = NULL) const; + unsigned int FindColumnAtPoint(int x, bool *onSeparator = nullptr) const; // return the result of FindColumnAtPoint() if it is a valid column, // otherwise the index of the last (rightmost) displayed column diff --git a/include/wx/generic/helpext.h b/include/wx/generic/helpext.h index 10b8217115..7afab65101 100644 --- a/include/wx/generic/helpext.h +++ b/include/wx/generic/helpext.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_ADV wxExtHelpController : public wxHelpControllerBase { public: - wxExtHelpController(wxWindow* parentWindow = NULL); + wxExtHelpController(wxWindow* parentWindow = nullptr); virtual ~wxExtHelpController(); // Set viewer: new name for SetBrowser @@ -60,11 +60,11 @@ public: // does nothing by default } - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) override + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = nullptr, + wxPoint *WXUNUSED(pos) = nullptr, + bool *WXUNUSED(newFrameEachTime) = nullptr) override { - return NULL; // does nothing by default + return nullptr; // does nothing by default } protected: diff --git a/include/wx/generic/laywin.h b/include/wx/generic/laywin.h index e215da530f..7802c85e08 100644 --- a/include/wx/generic/laywin.h +++ b/include/wx/generic/laywin.h @@ -106,7 +106,7 @@ typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEv wxEVENT_HANDLER_CAST( wxQueryLayoutInfoEventFunction, func ) #define EVT_QUERY_LAYOUT_INFO(func) \ - wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, wxQueryLayoutInfoEventHandler( func ), NULL ), + wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_QUERY_LAYOUT_INFO, wxID_ANY, wxID_ANY, wxQueryLayoutInfoEventHandler( func ), nullptr ), /* * This event is used to take a bite out of the available client area. @@ -145,7 +145,7 @@ typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEv #define wxCalculateLayoutEventHandler( func ) wxEVENT_HANDLER_CAST(wxCalculateLayoutEventFunction, func) #define EVT_CALCULATE_LAYOUT(func) \ - wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, wxCalculateLayoutEventHandler( func ), NULL ), + wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_CALCULATE_LAYOUT, wxID_ANY, wxID_ANY, wxCalculateLayoutEventHandler( func ), nullptr ), #if wxUSE_SASH @@ -212,15 +212,15 @@ public: #if wxUSE_MDI_ARCHITECTURE // The MDI client window is sized to whatever's left over. - bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL); + bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = nullptr); #endif // wxUSE_MDI_ARCHITECTURE // mainWindow is sized to whatever's left over. This function for backward // compatibility; use LayoutWindow. - bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL); + bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = nullptr); // mainWindow is sized to whatever's left over. - bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = NULL); + bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = nullptr); }; #endif diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index aef37a4951..af5a530088 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -147,7 +147,7 @@ public: long FindItem( long start, const wxString& str, bool partial = false ); long FindItem( long start, wxUIntPtr data ); long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC - long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const; + long HitTest( const wxPoint& point, int& flags, long *pSubItem = nullptr ) const; long InsertItem(wxListItem& info); long InsertItem( long index, const wxString& label ); long InsertItem( long index, int imageIndex ); @@ -189,7 +189,7 @@ public: // We have to hand down a few functions virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = NULL) override; + const wxRect *rect = nullptr) override; virtual bool SetBackgroundColour( const wxColour &colour ) override; virtual bool SetForegroundColour( const wxColour &colour ) override; diff --git a/include/wx/generic/logg.h b/include/wx/generic/logg.h index ef95432170..042d2300fd 100644 --- a/include/wx/generic/logg.h +++ b/include/wx/generic/logg.h @@ -112,7 +112,7 @@ private: class WXDLLIMPEXP_CORE wxLogWindow : public wxLogPassThrough { public: - wxLogWindow(wxWindow *pParent, // the parent frame (can be NULL) + wxLogWindow(wxWindow *pParent, // the parent frame (can be null) const wxString& szTitle, // the title of the frame bool bShow = true, // show window immediately? bool bPassToOld = true); // pass messages to the old target? diff --git a/include/wx/generic/mdig.h b/include/wx/generic/mdig.h index cb3a12db90..f6c520a288 100644 --- a/include/wx/generic/mdig.h +++ b/include/wx/generic/mdig.h @@ -113,14 +113,14 @@ private: void OnClose(wxCloseEvent& event); - // return the client window, may be NULL if we hadn't been created yet + // return the client window, may be null if we hadn't been created yet wxGenericMDIClientWindow *GetGenericClientWindow() const; // close all children, return false if any of them vetoed it bool CloseAll(); - // this pointer is non-NULL if we're currently inside our ProcessEvent() + // this pointer is non-null if we're currently inside our ProcessEvent() // and we forwarded the event to this child (as we do with menu events) wxMDIChildFrameBase *m_childHandler; diff --git a/include/wx/generic/msgdlgg.h b/include/wx/generic/msgdlgg.h index 454a76af64..c498dee13b 100644 --- a/include/wx/generic/msgdlgg.h +++ b/include/wx/generic/msgdlgg.h @@ -42,7 +42,7 @@ private: // Creates and returns a standard button sizer using the style of this // dialog and the custom labels, if any. // - // May return NULL on smart phone platforms not using buttons at all. + // May return nullptr on smart phone platforms not using buttons at all. wxSizer *CreateMsgDlgButtonSizer(); wxPoint m_pos; diff --git a/include/wx/generic/notifmsg.h b/include/wx/generic/notifmsg.h index ee178c2f9d..3b5b76bce4 100644 --- a/include/wx/generic/notifmsg.h +++ b/include/wx/generic/notifmsg.h @@ -24,7 +24,7 @@ public: wxGenericNotificationMessage(const wxString& title, const wxString& message = wxString(), - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int flags = wxICON_INFORMATION) { Init(); diff --git a/include/wx/generic/numdlgg.h b/include/wx/generic/numdlgg.h index 905efee6df..9544d10b2e 100644 --- a/include/wx/generic/numdlgg.h +++ b/include/wx/generic/numdlgg.h @@ -85,7 +85,7 @@ WXDLLIMPEXP_CORE long long value = 0, long min = 0, long max = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, const wxPoint& pos = wxDefaultPosition); #endif // wxUSE_NUMBERDLG diff --git a/include/wx/generic/printps.h b/include/wx/generic/printps.h index 9ad7fb24e3..c19725e700 100644 --- a/include/wx/generic/printps.h +++ b/include/wx/generic/printps.h @@ -23,7 +23,7 @@ class WXDLLIMPEXP_CORE wxPostScriptPrinter : public wxPrinterBase { public: - wxPostScriptPrinter(wxPrintDialogData *data = NULL); + wxPostScriptPrinter(wxPrintDialogData *data = nullptr); virtual ~wxPostScriptPrinter(); virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) override; @@ -43,8 +43,8 @@ class WXDLLIMPEXP_CORE wxPostScriptPrintPreview : public wxPrintPreviewBase { public: wxPostScriptPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxPostScriptPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/generic/private/animate.h b/include/wx/generic/private/animate.h index 1e57abd288..59c2ee0853 100644 --- a/include/wx/generic/private/animate.h +++ b/include/wx/generic/private/animate.h @@ -20,11 +20,11 @@ class WXDLLIMPEXP_ADV wxAnimationGenericImpl : public wxAnimationImpl { public: - wxAnimationGenericImpl() : m_decoder(NULL) {} + wxAnimationGenericImpl() : m_decoder(nullptr) {} virtual ~wxAnimationGenericImpl() { UnRef(); } virtual bool IsOk() const override - { return m_decoder != NULL; } + { return m_decoder != nullptr; } virtual bool IsCompatibleWith(wxClassInfo* ci) const override; virtual unsigned int GetFrameCount() const override; diff --git a/include/wx/generic/private/grid.h b/include/wx/generic/private/grid.h index e3bd211928..86a0b35c34 100644 --- a/include/wx/generic/private/grid.h +++ b/include/wx/generic/private/grid.h @@ -1083,7 +1083,7 @@ public: virtual int MoveByPixelDistance(int line, int distance) const override { int pos = m_oper.GetLineStartPos(m_grid, line); - return m_oper.PosToLine(m_grid, pos - distance + 1, NULL, true); + return m_oper.PosToLine(m_grid, pos - distance + 1, nullptr, true); } }; @@ -1133,7 +1133,7 @@ public: virtual int MoveByPixelDistance(int line, int distance) const override { int pos = m_oper.GetLineStartPos(m_grid, line); - return m_oper.PosToLine(m_grid, pos + distance, NULL, true); + return m_oper.PosToLine(m_grid, pos + distance, nullptr, true); } private: diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index 8aee6bded4..5135ce9db7 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -96,13 +96,13 @@ public: wxUIntPtr m_data; // the item coordinates are not used in report mode; instead this pointer is - // NULL and the owner window is used to retrieve the item position and size + // null and the owner window is used to retrieve the item position and size wxRect *m_rect; // the list ctrl we are in wxListMainWindow *m_owner; - // custom attributes or NULL + // custom attributes or nullptr wxItemAttr *m_attr; protected: @@ -221,7 +221,7 @@ public: if ( inReportView ) { delete m_gi; - m_gi = NULL; + m_gi = nullptr; } else { @@ -602,13 +602,13 @@ public: wxTextCtrl *GetEditControl() const { - return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL; + return m_textctrlWrapper ? m_textctrlWrapper->GetText() : nullptr; } void ResetTextControl(wxTextCtrl *text) { delete text; - m_textctrlWrapper = NULL; + m_textctrlWrapper = nullptr; } void OnRenameTimer(); @@ -946,7 +946,7 @@ private: *m_highlightUnfocusedBrush; // wrapper around the text control currently used for in place editing or - // NULL if no item is being edited + // nullptr if no item is being edited wxListTextCtrlWrapper *m_textctrlWrapper; // tells whether or not to paint empty rows with alternate colour and draw diff --git a/include/wx/generic/private/markuptext.h b/include/wx/generic/private/markuptext.h index d2e3425b9f..54edb88766 100644 --- a/include/wx/generic/private/markuptext.h +++ b/include/wx/generic/private/markuptext.h @@ -36,7 +36,7 @@ public: // The font currently selected into the DC is used for measuring (notice // that it is changed by this function but normally -- i.e. if markup is // valid -- restored to its original value when it returns). - wxSize Measure(wxDC& dc, int *visibleHeight = NULL) const; + wxSize Measure(wxDC& dc, int *visibleHeight = nullptr) const; protected: wxMarkupTextBase(const wxString& markup) diff --git a/include/wx/generic/private/richtooltip.h b/include/wx/generic/private/richtooltip.h index 75a9e076dd..16f4b7c0fb 100644 --- a/include/wx/generic/private/richtooltip.h +++ b/include/wx/generic/private/richtooltip.h @@ -41,7 +41,7 @@ public: virtual void SetTipKind(wxTipKind tipKind) override; virtual void SetTitleFont(const wxFont& font) override; - virtual void ShowFor(wxWindow* win, const wxRect* rect = NULL) override; + virtual void ShowFor(wxWindow* win, const wxRect* rect = nullptr) override; protected: wxString m_title, diff --git a/include/wx/generic/private/textmeasure.h b/include/wx/generic/private/textmeasure.h index 4b2e8f9918..52e1fc92bf 100644 --- a/include/wx/generic/private/textmeasure.h +++ b/include/wx/generic/private/textmeasure.h @@ -17,17 +17,17 @@ class wxTextMeasure : public wxTextMeasureBase { public: - explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = nullptr) : wxTextMeasureBase(dc, font) {} - explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = nullptr) : wxTextMeasureBase(win, font) {} protected: virtual void DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL) override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr) override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths, diff --git a/include/wx/generic/prntdlgg.h b/include/wx/generic/prntdlgg.h index 673bb0aaed..39e85d832f 100644 --- a/include/wx/generic/prntdlgg.h +++ b/include/wx/generic/prntdlgg.h @@ -140,7 +140,7 @@ class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase { public: wxGenericPrintDialog(wxWindow *parent, - wxPrintDialogData* data = NULL); + wxPrintDialogData* data = nullptr); wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); virtual ~wxGenericPrintDialog(); @@ -222,8 +222,8 @@ private: class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase { public: - wxGenericPageSetupDialog(wxWindow *parent = NULL, - wxPageSetupDialogData* data = NULL); + wxGenericPageSetupDialog(wxWindow *parent = nullptr, + wxPageSetupDialogData* data = nullptr); virtual ~wxGenericPageSetupDialog(); virtual bool TransferDataFromWindow() override; diff --git a/include/wx/generic/progdlgg.h b/include/wx/generic/progdlgg.h index 2ff6619d85..64673233a4 100644 --- a/include/wx/generic/progdlgg.h +++ b/include/wx/generic/progdlgg.h @@ -30,7 +30,7 @@ public: wxGenericProgressDialog(); wxGenericProgressDialog(const wxString& title, const wxString& message, int maximum = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); virtual ~wxGenericProgressDialog(); @@ -38,11 +38,11 @@ public: bool Create(const wxString& title, const wxString& message, int maximum = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL); - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL); + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = nullptr); + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = nullptr); virtual void Resume(); @@ -128,7 +128,7 @@ protected: // parent reference we store in this class itself. void SetTopParent(wxWindow* parent); - // return the top level parent window of this dialog (may be NULL) + // return the top level parent window of this dialog (may be null) wxWindow *GetTopParent() const { return m_parentTop; } @@ -178,7 +178,7 @@ private: void DisableSkip() { EnableSkip(false); } void DisableAbort() { EnableAbort(false); } - // the widget displaying current status (may be NULL) + // the widget displaying current status (may be null) wxGauge *m_gauge; // the message displayed wxStaticText *m_msg; @@ -187,8 +187,8 @@ private: *m_estimated, *m_remaining; - // Reference to the parent top level window, automatically becomes NULL if - // it is destroyed and could be always NULL if it's not given at all. + // Reference to the parent top level window, automatically becomes null if + // it is destroyed and could be always null if it's not given at all. wxWindowRef m_parentTop; // Progress dialog styles: this is not the same as m_windowStyle because @@ -200,7 +200,7 @@ private: // skip some portion bool m_skip; - // the abort and skip buttons (or NULL if none) + // the abort and skip buttons (or nullptr if none) wxButton *m_btnAbort; wxButton *m_btnSkip; diff --git a/include/wx/generic/richmsgdlgg.h b/include/wx/generic/richmsgdlgg.h index 969a6eceeb..10a1bc7393 100644 --- a/include/wx/generic/richmsgdlgg.h +++ b/include/wx/generic/richmsgdlgg.h @@ -23,8 +23,8 @@ public: const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), long style = wxOK | wxCENTRE) : wxRichMessageDialogBase( parent, message, caption, style ), - m_checkBox(NULL), - m_detailsPane(NULL) + m_checkBox(nullptr), + m_detailsPane(nullptr) { } virtual bool IsCheckBoxChecked() const override; diff --git a/include/wx/generic/splitter.h b/include/wx/generic/splitter.h index 9f5b9c029e..1a55ca5bb3 100644 --- a/include/wx/generic/splitter.h +++ b/include/wx/generic/splitter.h @@ -118,10 +118,10 @@ public: // Removes the specified (or second) window from the view // Doesn't actually delete the window. - bool Unsplit(wxWindow *toRemove = NULL); + bool Unsplit(wxWindow *toRemove = nullptr); // Replaces one of the windows with another one (neither old nor new - // parameter should be NULL) + // parameter should be null) bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew); // Make sure the child window sizes are updated. This is useful @@ -130,7 +130,7 @@ public: void UpdateSize(); // Is the window split? - bool IsSplit() const { return (m_windowTwo != NULL); } + bool IsSplit() const { return (m_windowTwo != nullptr); } // Sets the border size void SetBorderSize(int WXUNUSED(width)) { } @@ -316,7 +316,7 @@ class WXDLLIMPEXP_CORE wxSplitterEvent : public wxNotifyEvent { public: wxSplitterEvent(wxEventType type = wxEVT_NULL, - wxSplitterWindow *splitter = NULL) + wxSplitterWindow *splitter = nullptr) : wxNotifyEvent(type) { SetEventObject(splitter); diff --git a/include/wx/generic/srchctlg.h b/include/wx/generic/srchctlg.h index 453c3cbc1a..3e5cfd2cff 100644 --- a/include/wx/generic/srchctlg.h +++ b/include/wx/generic/srchctlg.h @@ -211,7 +211,7 @@ protected: bool HasMenu() const { #if wxUSE_MENUS - return m_menu != NULL; + return m_menu != nullptr; #else // !wxUSE_MENUS return false; #endif // wxUSE_MENUS/!wxUSE_MENUS diff --git a/include/wx/generic/statline.h b/include/wx/generic/statline.h index 39dfa09300..8d7105cbbe 100644 --- a/include/wx/generic/statline.h +++ b/include/wx/generic/statline.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase public: // constructors and pseudo-constructors - wxStaticLine() { m_statbox = NULL; } + wxStaticLine() { m_statbox = nullptr; } wxStaticLine( wxWindow *parent, wxWindowID id = wxID_ANY, diff --git a/include/wx/generic/stattextg.h b/include/wx/generic/stattextg.h index 732fdbbdc4..eacd74d4ff 100644 --- a/include/wx/generic/stattextg.h +++ b/include/wx/generic/stattextg.h @@ -67,7 +67,7 @@ private: void Init() { #if wxUSE_MARKUP - m_markupText = NULL; + m_markupText = nullptr; #endif // wxUSE_MARKUP } @@ -75,7 +75,7 @@ private: void DoDrawLabel(wxDC& dc, const wxRect& rect); - // These fields are only used if m_markupText == NULL. + // These fields are only used if m_markupText == nullptr. wxString m_label; int m_mnemonic; diff --git a/include/wx/generic/tabg.h b/include/wx/generic/tabg.h index 2ecbabbf3c..f59f9e048f 100644 --- a/include/wx/generic/tabg.h +++ b/include/wx/generic/tabg.h @@ -30,7 +30,7 @@ class WXDLLIMPEXP_CORE wxTabControl: public wxObject { wxDECLARE_DYNAMIC_CLASS(wxTabControl); public: - wxTabControl(wxTabView *v = NULL); + wxTabControl(wxTabView *v = nullptr); virtual ~wxTabControl(void); virtual void OnDraw(wxDC& dc, bool lastInRow); @@ -107,7 +107,7 @@ public: inline wxWindow* GetWindow(void) const { return m_window; } // Automatically positions tabs - wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = NULL); + wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = nullptr); // Remove the tab without deleting the window bool RemoveTab(int id); diff --git a/include/wx/generic/textdlgg.h b/include/wx/generic/textdlgg.h index a9305aa42f..b04237a044 100644 --- a/include/wx/generic/textdlgg.h +++ b/include/wx/generic/textdlgg.h @@ -38,7 +38,7 @@ class WXDLLIMPEXP_CORE wxTextEntryDialog : public wxDialog public: wxTextEntryDialog() { - m_textctrl = NULL; + m_textctrl = nullptr; m_dialogStyle = 0; } @@ -128,7 +128,7 @@ WXDLLIMPEXP_CORE wxString wxGetTextFromUser(const wxString& message, const wxString& caption = wxASCII_STR(wxGetTextFromUserPromptStr), const wxString& default_value = wxEmptyString, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, wxCoord x = wxDefaultCoord, wxCoord y = wxDefaultCoord, bool centre = true); @@ -137,7 +137,7 @@ WXDLLIMPEXP_CORE wxString wxGetPasswordFromUser(const wxString& message, const wxString& caption = wxASCII_STR(wxGetPasswordFromUserPromptStr), const wxString& default_value = wxEmptyString, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, wxCoord x = wxDefaultCoord, wxCoord y = wxDefaultCoord, bool centre = true); diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index 063e32036a..156f6555f9 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -143,7 +143,7 @@ public: virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual void Delete(const wxTreeItemId& item) override; virtual void DeleteChildren(const wxTreeItemId& item) override; @@ -201,7 +201,7 @@ public: virtual bool SetBackgroundColour(const wxColour& colour) override; virtual bool SetForegroundColour(const wxColour& colour) override; - virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL) override; + virtual void Refresh(bool eraseBackground = true, const wxRect *rect = nullptr) override; virtual bool SetFont( const wxFont &font ) override; virtual void SetWindowStyleFlag(long styles) override; @@ -314,7 +314,7 @@ protected: const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const override; // called by wxTextTreeCtrl when it marks itself for deletion diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index bb1926b136..00d7cdb2f1 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -62,7 +62,7 @@ public: // ------------------------------- // is the wizard running? - bool IsRunning() const { return m_page != NULL; } + bool IsRunning() const { return m_page != nullptr; } // show the prev/next page, but call TransferDataFromWindow on the current // page first and return false without changing the page if @@ -102,7 +102,7 @@ protected: virtual bool ResizeBitmap(wxBitmap& bmp); // was the dialog really created? - bool WasCreated() const { return m_btnPrev != NULL; } + bool WasCreated() const { return m_btnPrev != nullptr; } // event handlers void OnCancel(wxCommandEvent& event); @@ -126,8 +126,8 @@ protected: wxPoint m_posWizard; // wizard state - wxWizardPage *m_page; // the current page or NULL - wxWizardPage *m_firstpage; // the page RunWizard started on or NULL + wxWizardPage *m_page; // the current page or nullptr + wxWizardPage *m_firstpage; // the page RunWizard started on or nullptr wxBitmapBundle m_bitmap; // the default bitmap to show // wizard controls diff --git a/include/wx/glcanvas.h b/include/wx/glcanvas.h index 68677790b7..a3bf461765 100644 --- a/include/wx/glcanvas.h +++ b/include/wx/glcanvas.h @@ -94,7 +94,7 @@ public: // Accessors const int* GetGLAttrs() const { - return (m_GLValues.empty() || !m_GLValues[0]) ? NULL : &*m_GLValues.begin(); + return (m_GLValues.empty() || !m_GLValues[0]) ? nullptr : &*m_GLValues.begin(); } int GetSize() const { return (int)(m_GLValues.size()); } @@ -174,8 +174,8 @@ public: // The derived class should provide a ctor with this signature: // // wxGLContext(wxGLCanvas *win, -// const wxGLContext *other = NULL, -// const wxGLContextAttrs *ctxAttrs = NULL); +// const wxGLContext *other = nullptr, +// const wxGLContextAttrs *ctxAttrs = nullptr); // set this context as the current one virtual bool SetCurrent(const wxGLCanvas& win) const = 0; @@ -275,7 +275,7 @@ protected: // Return false if an unknown attribute is found. static bool ParseAttribList(const int* attribList, wxGLAttributes& dispAttrs, - wxGLContextAttrs* ctxAttrs = NULL); + wxGLContextAttrs* ctxAttrs = nullptr); #if wxUSE_PALETTE // create default palette if we're not using RGBA mode diff --git a/include/wx/graphics.h b/include/wx/graphics.h index 95f715e0e7..e30403f1eb 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -133,7 +133,7 @@ public: bool IsNull() const; - // returns the renderer that was used to create this instance, or NULL if it has not been initialized yet + // returns the renderer that was used to create this instance, or nullptr if it has not been initialized yet wxGraphicsRenderer* GetRenderer() const; wxGraphicsObjectRefData* GetGraphicsData() const; protected: @@ -220,8 +220,8 @@ public: wxDouble tx=0.0, wxDouble ty=0.0); // gets the component values 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; + virtual void Get(wxDouble* a=nullptr, wxDouble* b=nullptr, wxDouble* c=nullptr, + wxDouble* d=nullptr, wxDouble* tx=nullptr, wxDouble* ty=nullptr) const; // makes this the inverse matrix virtual void Invert(); @@ -565,7 +565,7 @@ extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; class WXDLLIMPEXP_CORE wxGraphicsContext : public wxGraphicsObject { public: - wxGraphicsContext(wxGraphicsRenderer* renderer, wxWindow* window = NULL); + wxGraphicsContext(wxGraphicsRenderer* renderer, wxWindow* window = nullptr); virtual ~wxGraphicsContext(); @@ -580,7 +580,7 @@ public: #endif #endif - // Create a context from a DC of unknown type, if supported, returns NULL otherwise + // Create a context from a DC of unknown type, if supported, returns nullptr otherwise static wxGraphicsContext* CreateFromUnknownDC(const wxDC& dc); static wxGraphicsContext* CreateFromNative( void * context ); @@ -850,7 +850,7 @@ public: virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, - wxDouble *descent = NULL, wxDouble *externalLeading = NULL ) const = 0; + wxDouble *descent = nullptr, wxDouble *externalLeading = nullptr ) const = 0; virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const = 0; @@ -1099,7 +1099,7 @@ public: virtual wxString GetName() const = 0; virtual void - GetVersion(int* major, int* minor = NULL, int* micro = NULL) const = 0; + GetVersion(int* major, int* minor = nullptr, int* micro = nullptr) const = 0; private: wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer); diff --git a/include/wx/gtk/app.h b/include/wx/gtk/app.h index b32a310210..f994e528bb 100644 --- a/include/wx/gtk/app.h +++ b/include/wx/gtk/app.h @@ -49,7 +49,7 @@ public: // instead of the default one (it's used by wxGLApp) // // must return XVisualInfo pointer (it is not freed by caller) - virtual void *GetXVisualInfo() { return NULL; } + virtual void *GetXVisualInfo() { return nullptr; } // Check if we're using a global menu. Currently this is only true when // running under Ubuntu Unity and global menu is not disabled. diff --git a/include/wx/gtk/bitmap.h b/include/wx/gtk/bitmap.h index 10331e5045..fc32617b0a 100644 --- a/include/wx/gtk/bitmap.h +++ b/include/wx/gtk/bitmap.h @@ -107,7 +107,7 @@ public: wxBitmap GetSubBitmap( const wxRect& rect ) const override; bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const override; + const wxPalette *palette = nullptr) const override; bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) override; #if wxUSE_PALETTE @@ -129,8 +129,8 @@ public: #ifdef __WXGTK3__ cairo_t* CairoCreate() const; - void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = NULL, const wxColour* bg = NULL) const; - void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = NULL, const wxColour* bg = NULL) const; + void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = nullptr, const wxColour* bg = nullptr) const; + void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = nullptr, const wxColour* bg = nullptr) const; wxBitmap CreateDisabled() const; #else GdkPixmap *GetPixmap() const; diff --git a/include/wx/gtk/bmpcbox.h b/include/wx/gtk/bmpcbox.h index d05934e255..59b756aea0 100644 --- a/include/wx/gtk/bmpcbox.h +++ b/include/wx/gtk/bmpcbox.h @@ -34,7 +34,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) diff --git a/include/wx/gtk/checklst.h b/include/wx/gtk/checklst.h index 6ba578f3b2..ab276394bf 100644 --- a/include/wx/gtk/checklst.h +++ b/include/wx/gtk/checklst.h @@ -22,7 +22,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString *choices = NULL, + const wxString *choices = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index 89aff99bed..f936745180 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -28,7 +28,7 @@ public: wxChoice( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = (const wxString *) nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr) ) @@ -51,7 +51,7 @@ public: bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr) ); diff --git a/include/wx/gtk/clipbrd.h b/include/wx/gtk/clipbrd.h index 70f23b858e..981cef5ec9 100644 --- a/include/wx/gtk/clipbrd.h +++ b/include/wx/gtk/clipbrd.h @@ -105,7 +105,7 @@ private: bool DoIsSupported(const wxDataFormat& format); - // both of these pointers can be non-NULL simultaneously but we only use + // both of these pointers can be non-null simultaneously but we only use // one of them at any moment depending on m_usePrimary value, use Data() // (from inside) or GTKGetDataObject() (from outside) accessors wxDataObject *m_dataPrimary, diff --git a/include/wx/gtk/clrpicker.h b/include/wx/gtk/clrpicker.h index 4fec58017e..30abbdeb8f 100644 --- a/include/wx/gtk/clrpicker.h +++ b/include/wx/gtk/clrpicker.h @@ -21,7 +21,7 @@ class WXDLLIMPEXP_CORE wxColourButton : public wxButton, public wxColourPickerWidgetBase { public: - wxColourButton() : m_topParent(NULL) {} + wxColourButton() : m_topParent(nullptr) {} wxColourButton(wxWindow *parent, wxWindowID id, const wxColour& initial = *wxBLACK, @@ -30,7 +30,7 @@ public: long style = wxCLRBTN_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr)) - : m_topParent(NULL) + : m_topParent(nullptr) { Create(parent, id, initial, pos, size, style, validator, name); } diff --git a/include/wx/gtk/colordlg.h b/include/wx/gtk/colordlg.h index 56cd8bc622..0ce405b5d6 100644 --- a/include/wx/gtk/colordlg.h +++ b/include/wx/gtk/colordlg.h @@ -18,10 +18,10 @@ class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog public: wxColourDialog() {} wxColourDialog(wxWindow *parent, - const wxColourData *data = NULL); + const wxColourData *data = nullptr); virtual ~wxColourDialog() {} - bool Create(wxWindow *parent, const wxColourData *data = NULL); + bool Create(wxWindow *parent, const wxColourData *data = nullptr); wxColourData &GetColourData() { return m_data; } diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index 520fc463b2..03d1e1443c 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -32,7 +32,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)) @@ -61,7 +61,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = (const wxString *) nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); diff --git a/include/wx/gtk/cursor.h b/include/wx/gtk/cursor.h index 8cee2c1175..2bd6b1857f 100644 --- a/include/wx/gtk/cursor.h +++ b/include/wx/gtk/cursor.h @@ -29,8 +29,8 @@ public: int hotSpotX = 0, int hotSpotY = 0); wxCursor( const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, - const char maskBits[] = NULL, - const wxColour* fg = NULL, const wxColour* bg = NULL); + const char maskBits[] = nullptr, + const wxColour* fg = nullptr, const wxColour* bg = nullptr); virtual wxPoint GetHotSpot() const override; diff --git a/include/wx/gtk/dataobj2.h b/include/wx/gtk/dataobj2.h index f1cb738928..e35ba4b5f1 100644 --- a/include/wx/gtk/dataobj2.h +++ b/include/wx/gtk/dataobj2.h @@ -57,7 +57,7 @@ protected: void DoConvertToPng(); private: - void Init() { m_pngData = NULL; m_pngSize = 0; } + void Init() { m_pngData = nullptr; m_pngSize = 0; } }; // ---------------------------------------------------------------------------- diff --git a/include/wx/gtk/dataview.h b/include/wx/gtk/dataview.h index 1b95e330b3..84a66a041e 100644 --- a/include/wx/gtk/dataview.h +++ b/include/wx/gtk/dataview.h @@ -151,12 +151,12 @@ public: virtual void UnselectAll() override; virtual void EnsureVisible( const wxDataViewItem& item, - const wxDataViewColumn *column = NULL ) override; + const wxDataViewColumn *column = nullptr ) override; virtual void HitTest( const wxPoint &point, wxDataViewItem &item, wxDataViewColumn *&column ) const override; virtual wxRect GetItemRect( const wxDataViewItem &item, - const wxDataViewColumn *column = NULL ) const override; + const wxDataViewColumn *column = nullptr ) const override; virtual bool SetRowHeight( int rowHeight ) override; @@ -187,7 +187,7 @@ public: // Return wxDataViewColumn matching the given GtkTreeViewColumn. // - // If the input argument is NULL, return NULL too. Otherwise we must find + // If the input argument is null, return nullptr too. Otherwise we must find // the matching column and assert if we didn't. wxDataViewColumn* GTKColumnToWX(GtkTreeViewColumn *gtk_col) const; diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 48ada6e298..ee79c2d588 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -146,7 +146,7 @@ public: virtual void StartPage() override { } virtual void EndPage() override { } - virtual GdkWindow* GetGDKWindow() const { return NULL; } + virtual GdkWindow* GetGDKWindow() const { return nullptr; } virtual void* GetHandle() const override { return GetGDKWindow(); } // base class pure virtuals implemented here diff --git a/include/wx/gtk/dcclient.h b/include/wx/gtk/dcclient.h index 007547be7c..6b42e90467 100644 --- a/include/wx/gtk/dcclient.h +++ b/include/wx/gtk/dcclient.h @@ -65,9 +65,9 @@ public: double angle) override; virtual void DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override; virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) override; virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ) override; diff --git a/include/wx/gtk/dnd.h b/include/wx/gtk/dnd.h index 900e24668d..4bb76ed5b8 100644 --- a/include/wx/gtk/dnd.h +++ b/include/wx/gtk/dnd.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase { public: - wxDropTarget(wxDataObject *dataObject = NULL ); + wxDropTarget(wxDataObject *dataObject = nullptr ); virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) override; virtual bool OnDrop(wxCoord x, wxCoord y) override; @@ -66,7 +66,7 @@ class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase { public: // constructor. set data later with SetData() - wxDropSource( wxWindow *win = NULL, + wxDropSource( wxWindow *win = nullptr, const wxIcon © = wxNullIcon, const wxIcon &move = wxNullIcon, const wxIcon &none = wxNullIcon); diff --git a/include/wx/gtk/dvrenderer.h b/include/wx/gtk/dvrenderer.h index 07ecf13e6b..d7751df7e3 100644 --- a/include/wx/gtk/dvrenderer.h +++ b/include/wx/gtk/dvrenderer.h @@ -57,9 +57,9 @@ public: virtual void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); } // return the text renderer used by this renderer for setting text cell - // specific attributes: can return NULL if this renderer doesn't render any + // specific attributes: can return nullptr if this renderer doesn't render any // text - virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; } + virtual GtkCellRendererText *GtkGetTextRenderer() const { return nullptr; } // return the widget actually used by the renderer for editing, this may be // different from the editor control widget for the custom renderers diff --git a/include/wx/gtk/filepicker.h b/include/wx/gtk/filepicker.h index b4549858c6..c34da0a1ac 100644 --- a/include/wx/gtk/filepicker.h +++ b/include/wx/gtk/filepicker.h @@ -23,14 +23,14 @@ //----------------------------------------------------------------------------- #define FILEDIRBTN_OVERRIDES \ - /* NULL is because of a problem with destruction order which happens */ \ + /* nullptr is because of a problem with destruction order which happens*/ \ /* if we pass GetParent(): in fact, this GTK native implementation */ \ /* 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() override \ + virtual wxWindow *GetDialogParent() override \ { \ - return NULL; \ + return nullptr; \ } \ \ /* even if wx derive from wxGenericFileButton, i.e. from wxButton, our */ \ @@ -38,12 +38,12 @@ /* GTK_BUTTON(m_widget) macro done by wxButton must be bypassed to */ \ /* avoid bunch of GTK+ warnings like: */ \ /* invalid cast from `GtkFileChooserButton' to `GtkButton' */ \ - /* so, override wxButton::GTKGetWindow and return NULL as GTK+ doesn't */ \ + /* so, override wxButton::GTKGetWindow and return nullptr as GTK+ doesn't */ \ /* give us access to the internal GdkWindow of a GtkFileChooserButton */ \ protected: \ virtual GdkWindow * \ - GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const override \ - { return NULL; } + GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const override \ + { return nullptr; } //----------------------------------------------------------------------------- @@ -105,7 +105,7 @@ protected: private: // common part of all ctors - void Init() { m_dialog = NULL; } + void Init() { m_dialog = nullptr; } wxDECLARE_DYNAMIC_CLASS(wxFileButton); }; @@ -183,7 +183,7 @@ public: // used by the GTK callback only private: void Init() { - m_dialog = NULL; + m_dialog = nullptr; m_bIgnoreNextChange = false; } diff --git a/include/wx/gtk/glcanvas.h b/include/wx/gtk/glcanvas.h index 9dd5d1fc5b..b69bcf9f46 100644 --- a/include/wx/gtk/glcanvas.h +++ b/include/wx/gtk/glcanvas.h @@ -41,7 +41,7 @@ public: explicit // avoid implicitly converting a wxWindow* to wxGLCanvas wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -63,7 +63,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPalette& palette = wxNullPalette); virtual bool SetBackgroundStyle(wxBackgroundStyle style) override; diff --git a/include/wx/gtk/infobar.h b/include/wx/gtk/infobar.h index 2c27b5d85f..fc6256bc1c 100644 --- a/include/wx/gtk/infobar.h +++ b/include/wx/gtk/infobar.h @@ -60,7 +60,7 @@ protected: virtual void DoApplyWidgetStyle(GtkRcStyle *style) override; private: - void Init() { m_impl = NULL; } + void Init() { m_impl = nullptr; } // add a button with the given id/label and return its widget GtkWidget *GTKAddButton(wxWindowID btnid, diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index 557b6f589e..9f62cea220 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -27,7 +27,7 @@ public: wxListBox( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = (const wxString *) nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr) ) @@ -51,7 +51,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = (const wxString *) nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 3a3360f5e8..04bf004f2e 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -30,7 +30,7 @@ public: virtual int FindMenuItem(const wxString& menuString, const wxString& itemString) const override; - virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const override; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = nullptr ) const override; virtual void EnableTop( size_t pos, bool flag ) override; virtual bool IsEnabledTop(size_t pos) const override; diff --git a/include/wx/gtk/menuitem.h b/include/wx/gtk/menuitem.h index 5c1d0f72b5..96c93daa62 100644 --- a/include/wx/gtk/menuitem.h +++ b/include/wx/gtk/menuitem.h @@ -16,12 +16,12 @@ class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase { public: - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); virtual ~wxMenuItem(); // implement base class virtuals diff --git a/include/wx/gtk/nonownedwnd.h b/include/wx/gtk/nonownedwnd.h index c9c8129be7..75c926fd21 100644 --- a/include/wx/gtk/nonownedwnd.h +++ b/include/wx/gtk/nonownedwnd.h @@ -19,7 +19,7 @@ class wxNonOwnedWindowShapeImpl; class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase { public: - wxNonOwnedWindow() { m_shapeImpl = NULL; } + wxNonOwnedWindow() { m_shapeImpl = nullptr; } virtual ~wxNonOwnedWindow(); // Overridden to actually set the shape when the window becomes realized. @@ -34,7 +34,7 @@ protected: private: - // If non-NULL, contains information about custom window shape. + // If non-null, contains information about custom window shape. wxNonOwnedWindowShapeImpl* m_shapeImpl; wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow); diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index c38dd6847e..1f0dc739f5 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -74,7 +74,7 @@ public: // geometry virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const override; - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; // operations // ---------- diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index 44d6b83f16..d73b72a021 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -36,19 +36,19 @@ public: virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) override; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ) override; + wxPrintout *printout = nullptr, + wxPrintDialogData *data = nullptr ) override; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout, wxPrintData *data ) override; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ) override; + wxPrintDialogData *data = nullptr ) override; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, wxPrintData *data ) override; virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ) override; + wxPageSetupDialogData * data = nullptr ) override; virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) override; @@ -71,7 +71,7 @@ class WXDLLIMPEXP_CORE wxGtkPrintDialog: public wxPrintDialogBase { public: wxGtkPrintDialog( wxWindow *parent, - wxPrintDialogData* data = NULL ); + wxPrintDialogData* data = nullptr ); wxGtkPrintDialog( wxWindow *parent, wxPrintData* data); virtual ~wxGtkPrintDialog(); @@ -116,7 +116,7 @@ class WXDLLIMPEXP_CORE wxGtkPageSetupDialog: public wxPageSetupDialogBase { public: wxGtkPageSetupDialog( wxWindow *parent, - wxPageSetupDialogData* data = NULL ); + wxPageSetupDialogData* data = nullptr ); virtual ~wxGtkPageSetupDialog(); virtual wxPageSetupDialogData& GetPageSetupDialogData() override { return m_pageDialogData; } @@ -150,7 +150,7 @@ private: class WXDLLIMPEXP_CORE wxGtkPrinter : public wxPrinterBase { public: - wxGtkPrinter(wxPrintDialogData *data = NULL); + wxGtkPrinter(wxPrintDialogData *data = nullptr); virtual ~wxGtkPrinter(); virtual bool Print(wxWindow *parent, @@ -284,9 +284,9 @@ protected: wxFAIL_MSG( "not implemented" ); } void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL ) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr ) const override; bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override; void DoGetSize(int* width, int* height) const override; void DoGetSizeMM(int *width, int *height) const override; @@ -324,8 +324,8 @@ class WXDLLIMPEXP_CORE wxGtkPrintPreview : public wxPrintPreviewBase { public: wxGtkPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxGtkPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/gtk/private/animate.h b/include/wx/gtk/private/animate.h index 156efdf890..402a37f317 100644 --- a/include/wx/gtk/private/animate.h +++ b/include/wx/gtk/private/animate.h @@ -27,11 +27,11 @@ class WXDLLIMPEXP_ADV wxAnimationGTKImpl : public wxAnimationImpl { public: wxAnimationGTKImpl() - : m_pixbuf(NULL) {} + : m_pixbuf(nullptr) {} ~wxAnimationGTKImpl() { UnRef(); } virtual bool IsOk() const override - { return m_pixbuf != NULL; } + { return m_pixbuf != nullptr; } virtual bool IsCompatibleWith(wxClassInfo* ci) const override; diff --git a/include/wx/gtk/private/error.h b/include/wx/gtk/private/error.h index 25802dd6f3..0b8a1d9978 100644 --- a/include/wx/gtk/private/error.h +++ b/include/wx/gtk/private/error.h @@ -20,7 +20,7 @@ class wxGtkError { public: - wxGtkError() { m_error = NULL; } + wxGtkError() { m_error = nullptr; } explicit wxGtkError(GError* error) { m_error = error; } ~wxGtkError() { if ( m_error ) g_error_free(m_error); } @@ -35,7 +35,7 @@ public: // Check if any error actually occurred. operator bool() const { - return m_error != NULL; + return m_error != nullptr; } operator GError*() const diff --git a/include/wx/gtk/private/eventsdisabler.h b/include/wx/gtk/private/eventsdisabler.h index 5ca9c7b590..fe74cf2547 100644 --- a/include/wx/gtk/private/eventsdisabler.h +++ b/include/wx/gtk/private/eventsdisabler.h @@ -20,7 +20,7 @@ template class wxGtkEventsDisabler { public: - // Disable the events for the specified (non-NULL, having lifetime greater + // 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) { diff --git a/include/wx/gtk/private/gtk2-compat.h b/include/wx/gtk/private/gtk2-compat.h index 12e32d2e79..5f3db10ee1 100644 --- a/include/wx/gtk/private/gtk2-compat.h +++ b/include/wx/gtk/private/gtk2-compat.h @@ -400,7 +400,7 @@ static inline gint wx_gdk_visual_get_depth(GdkVisual* visual) static inline gboolean wx_gtk_window_has_group(GtkWindow* window) { - return window->group != NULL; + return window->group != nullptr; } #define gtk_window_has_group wx_gtk_window_has_group @@ -424,7 +424,7 @@ static inline GdkScreen* wx_gdk_window_get_screen(GdkWindow* window) static inline gint wx_gdk_window_get_height(GdkWindow* window) { int h; - gdk_drawable_get_size(window, NULL, &h); + gdk_drawable_get_size(window, nullptr, &h); return h; } #define gdk_window_get_height wx_gdk_window_get_height @@ -432,7 +432,7 @@ static inline gint wx_gdk_window_get_height(GdkWindow* window) static inline gint wx_gdk_window_get_width(GdkWindow* window) { int w; - gdk_drawable_get_size(window, &w, NULL); + gdk_drawable_get_size(window, &w, nullptr); return w; } #define gdk_window_get_width wx_gdk_window_get_width @@ -450,7 +450,7 @@ static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window #ifndef g_signal_handlers_disconnect_by_data #define g_signal_handlers_disconnect_by_data(instance, data) \ - g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data)) + g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, (data)) #endif // ---------------------------------------------------------------------------- @@ -458,7 +458,7 @@ static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window static inline void wx_gdk_window_get_geometry(GdkWindow* window, gint* x, gint* y, gint* width, gint* height) { - gdk_window_get_geometry(window, x, y, width, height, NULL); + gdk_window_get_geometry(window, x, y, width, height, nullptr); } #define gdk_window_get_geometry wx_gdk_window_get_geometry @@ -548,7 +548,7 @@ static inline void wx_gtk_widget_get_preferred_width(GtkWidget* widget, gint* mi static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition* minimum, GtkRequisition* natural) { GtkRequisition* req = minimum; - if (req == NULL) + if (req == nullptr) req = natural; gtk_widget_size_request(widget, req); } @@ -685,7 +685,7 @@ static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequis // anyhow. inline bool wx_is_at_least_gtk2(int minor) { - return gtk_check_version(2, minor, 0) == NULL; + return gtk_check_version(2, minor, 0) == nullptr; } #else // __WXGTK3__ diff --git a/include/wx/gtk/private/gtk3-compat.h b/include/wx/gtk/private/gtk3-compat.h index e8727f8b9b..350160a5a0 100644 --- a/include/wx/gtk/private/gtk3-compat.h +++ b/include/wx/gtk/private/gtk3-compat.h @@ -72,7 +72,7 @@ static inline bool wx_is_at_least_gtk3(int /* minor */) #else static inline bool wx_is_at_least_gtk3(int minor) { - return gtk_check_version(3, minor, 0) == NULL; + return gtk_check_version(3, minor, 0) == nullptr; } #endif diff --git a/include/wx/gtk/private/image.h b/include/wx/gtk/private/image.h index 4335a7feee..b175c0ee8f 100644 --- a/include/wx/gtk/private/image.h +++ b/include/wx/gtk/private/image.h @@ -27,7 +27,7 @@ public: static GType Type(); static GtkWidget* New(BitmapProvider* provider); - static GtkWidget* New(wxWindow* win = NULL); + static GtkWidget* New(wxWindow* win = nullptr); // Use bitmaps from the given bundle, the logical bitmap size is the // default size of the bundle. diff --git a/include/wx/gtk/private/log.h b/include/wx/gtk/private/log.h index 4c3d9f74fd..ceff26fab4 100644 --- a/include/wx/gtk/private/log.h +++ b/include/wx/gtk/private/log.h @@ -30,7 +30,7 @@ class LogFilter public: LogFilter() { - m_next = NULL; + m_next = nullptr; } // Allow installing our own log writer function, we don't do it by default diff --git a/include/wx/gtk/private/mediactrl.h b/include/wx/gtk/private/mediactrl.h index 5ff50c16d4..b8ba1d06d7 100644 --- a/include/wx/gtk/private/mediactrl.h +++ b/include/wx/gtk/private/mediactrl.h @@ -49,7 +49,7 @@ inline gpointer wxGtkGetIdFromWidget(GtkWidget* widget) } #endif - return (gpointer)NULL; + return (gpointer)nullptr; } } diff --git a/include/wx/gtk/private/stylecontext.h b/include/wx/gtk/private/stylecontext.h index f13cc2461d..98b787602d 100644 --- a/include/wx/gtk/private/stylecontext.h +++ b/include/wx/gtk/private/stylecontext.h @@ -25,13 +25,13 @@ public: wxGtkStyleContext& AddLabel(); wxGtkStyleContext& AddMenu(); wxGtkStyleContext& AddMenuItem(); - wxGtkStyleContext& AddTextview(const char* child1 = NULL, const char* child2 = NULL); + wxGtkStyleContext& AddTextview(const char* child1 = nullptr, const char* child2 = nullptr); wxGtkStyleContext& AddTooltip(); wxGtkStyleContext& AddTreeview(); #if GTK_CHECK_VERSION(3,20,0) wxGtkStyleContext& AddTreeviewHeaderButton(int pos); #endif // GTK >= 3.20 - wxGtkStyleContext& AddWindow(const char* className2 = NULL); + wxGtkStyleContext& AddWindow(const char* className2 = nullptr); void Bg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const; void Fg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const; void Border(wxColour& color) const; diff --git a/include/wx/gtk/private/textmeasure.h b/include/wx/gtk/private/textmeasure.h index 6689236c8f..2c375ab64b 100644 --- a/include/wx/gtk/private/textmeasure.h +++ b/include/wx/gtk/private/textmeasure.h @@ -19,13 +19,13 @@ class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl; class wxTextMeasure : public wxTextMeasureBase { public: - explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = nullptr) : wxTextMeasureBase(dc, font) { Init(); } - explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = nullptr) : wxTextMeasureBase(win, font) { Init(); @@ -41,8 +41,8 @@ protected: virtual void DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL) override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr) override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths, diff --git a/include/wx/gtk/private/treeview.h b/include/wx/gtk/private/treeview.h index d029a8ff78..c432784fb3 100644 --- a/include/wx/gtk/private/treeview.h +++ b/include/wx/gtk/private/treeview.h @@ -22,8 +22,8 @@ class wxGtkTreePath { public: - // Ctor takes ownership of the given path and will free it if non-NULL. - wxGtkTreePath(GtkTreePath *path = NULL) : m_path(path) { } + // Ctor takes ownership of the given path and will free it if non-null. + wxGtkTreePath(GtkTreePath *path = nullptr) : m_path(path) { } // Creates a tree path for the given string path. wxGtkTreePath(const gchar *strpath) diff --git a/include/wx/gtk/private/webkit.h b/include/wx/gtk/private/webkit.h index 10e0feca5c..a44ee4e139 100644 --- a/include/wx/gtk/private/webkit.h +++ b/include/wx/gtk/private/webkit.h @@ -29,7 +29,7 @@ public: ~wxWebKitJavascriptResult() { - if ( m_jsresult != NULL ) + if ( m_jsresult != nullptr ) webkit_javascript_result_unref(m_jsresult); } diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index 40372e104f..aa94849a1b 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -34,7 +34,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = (const wxString *) NULL, + const wxString choices[] = (const wxString *) nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, @@ -63,7 +63,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = (const wxString *) NULL, + const wxString choices[] = (const wxString *) nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, diff --git a/include/wx/gtk/srchctrl.h b/include/wx/gtk/srchctrl.h index 8b68f196d9..5a37843472 100644 --- a/include/wx/gtk/srchctrl.h +++ b/include/wx/gtk/srchctrl.h @@ -90,7 +90,7 @@ private: bool HasMenu() const { #if wxUSE_MENUS - return m_menu != NULL; + return m_menu != nullptr; #else // !wxUSE_MENUS return false; #endif // wxUSE_MENUS/!wxUSE_MENUS diff --git a/include/wx/gtk/statbox.h b/include/wx/gtk/statbox.h index 031f727b48..c81f7c57d8 100644 --- a/include/wx/gtk/statbox.h +++ b/include/wx/gtk/statbox.h @@ -50,7 +50,7 @@ public: long style = 0, const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) { - return DoCreate( parent, id, &label, NULL, pos, size, style, name ); + return DoCreate( parent, id, &label, nullptr, pos, size, style, name ); } bool Create( wxWindow *parent, @@ -61,7 +61,7 @@ public: long style = 0, const wxString &name = wxASCII_STR(wxStaticBoxNameStr) ) { - return DoCreate( parent, id, NULL, label, pos, size, style, name ); + return DoCreate( parent, id, nullptr, label, pos, size, style, name ); } virtual void SetLabel( const wxString &label ) override; diff --git a/include/wx/gtk/toolbar.h b/include/wx/gtk/toolbar.h index ed5e53d5fe..dde9f7d201 100644 --- a/include/wx/gtk/toolbar.h +++ b/include/wx/gtk/toolbar.h @@ -60,7 +60,7 @@ public: const wxBitmapBundle& bitmap1, const wxBitmapBundle& bitmap2 = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) override; virtual wxToolBarToolBase *CreateTool(wxControl *control, diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index 37b201e98c..f35562777d 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -87,7 +87,7 @@ public: virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = (const wxRect *) nullptr ) override; // implementation from now on // -------------------------- @@ -143,7 +143,7 @@ public: virtual void SetMinSize(const wxSize& minSize) override; - virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = NULL) override; + virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = nullptr) override; private: // Flags to call WXSetInitialFittingClientSize() with if != 0. diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h index 8016717720..98f7e1d584 100644 --- a/include/wx/gtk/webview_webkit.h +++ b/include/wx/gtk/webview_webkit.h @@ -122,14 +122,14 @@ public: virtual void ClearSelection() override; #if wxUSE_WEBVIEW_WEBKIT2 - virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const override; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = nullptr) const override; virtual bool AddScriptMessageHandler(const wxString& name) override; virtual bool RemoveScriptMessageHandler(const wxString& name) override; virtual bool AddUserScript(const wxString& javascript, wxWebViewUserScriptInjectionTime injectionTime = wxWEBVIEW_INJECT_AT_DOCUMENT_START) override; virtual void RemoveAllUserScripts() override; #else - virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const override; + virtual bool RunScript(const wxString& javascript, wxString* output = nullptr) const override; #endif //Virtual Filesystem Support diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index ee4e0a78a3..f0c94d8d2a 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -84,7 +84,7 @@ public: #endif // __WXGTK3__ virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = (const wxRect *) nullptr ) override; virtual void Update() override; virtual void ClearBackground() override; @@ -94,7 +94,7 @@ public: virtual bool SetFont( const wxFont &font ) override; virtual bool SetBackgroundStyle(wxBackgroundStyle style) override ; - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const override; + virtual bool IsTransparentBackgroundSupported(wxString* reason = nullptr) const override; virtual int GetCharHeight() const override; virtual int GetCharWidth() const override; @@ -108,7 +108,7 @@ public: virtual int GetScrollThumb( int orient ) const override; virtual int GetScrollRange( int orient ) const override; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) override; + const wxRect* rect = nullptr ) override; virtual bool ScrollLines(int lines) override; virtual bool ScrollPages(int pages) override; @@ -234,7 +234,7 @@ protected: // Get the GdkWindows making part of this window: usually there will be // only one of them in which case it should be returned directly by this // function. If there is more than one GdkWindow (can be the case for - // composite widgets), return NULL and fill in the provided array + // composite widgets), return nullptr and fill in the provided array // // This is not pure virtual for backwards compatibility but almost // certainly must be overridden in any wxControl-derived class! @@ -284,7 +284,7 @@ public: wxString m_gtkLabel; // return true if the window is of a standard (i.e. not wxWidgets') class - bool IsOfStandardClass() const { return m_wxwindow == NULL; } + bool IsOfStandardClass() const { return m_wxwindow == nullptr; } // this widget will be queried for GTK's focus events GtkWidget *m_focusWidget; @@ -301,10 +301,10 @@ public: // this window are really needed but currently we do it unconditionally. // // For native widgets (i.e. those for which IsOfStandardClass() returns - // true) it is NULL. + // true) it is null. GtkIMContext* m_imContext; - // Pointer to the event being currently processed by the IME or NULL if not + // Pointer to the event being currently processed by the IME or nullptr if not // inside key handling. GdkEventKey* m_imKeyEvent; @@ -355,7 +355,7 @@ public: void GTKUpdateCursor( bool isBusyOrGlobalCursor = false, bool isRealize = false, - const wxCursor* overrideCursor = NULL); + const wxCursor* overrideCursor = nullptr); // extra (wxGTK-specific) flags bool m_noExpose:1; // wxGLCanvas has its own redrawing @@ -374,9 +374,9 @@ protected: // 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 override; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) const override; virtual void DoClientToScreen( int *x, int *y ) const override; virtual void DoScreenToClient( int *x, int *y ) const override; virtual void DoGetPosition( int *x, int *y ) const override; @@ -467,7 +467,7 @@ protected: private: void Init(); - // return true if this window must have a non-NULL parent, false if it can + // return true if this window must have a non-null parent, false if it can // be created without parent (normally only top level windows but in wxGTK // there is also the exception of wxMenuBar) virtual bool GTKNeedsParent() const { return !IsTopLevel(); } diff --git a/include/wx/hash.h b/include/wx/hash.h index bd987a32a0..01ca912d07 100644 --- a/include/wx/hash.h +++ b/include/wx/hash.h @@ -230,7 +230,7 @@ public: // Way of iterating through whole hash table (e.g. to delete everything) // Not necessary, of course, if you're only storing pointers to // objects maintained separately - void BeginFind() { m_curr = NULL; m_currBucket = 0; } + void BeginFind() { m_curr = nullptr; m_currBucket = 0; } Node* Next(); void Clear() { wxHashTableBase::Clear(); } diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index 2d7948c52f..ca63c5fe95 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -30,7 +30,7 @@ // private struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase { - _wxHashTable_NodeBase() : m_next(NULL) {} + _wxHashTable_NodeBase() : m_next(nullptr) {} _wxHashTable_NodeBase* m_next; @@ -56,7 +56,7 @@ protected: for( size_t i = 0; i < buckets; ++i ) if( table[i] ) return table[i]; - return NULL; + return nullptr; } // as static const unsigned prime_count = 31 but works with all compilers @@ -141,7 +141,7 @@ public: \ Node* m_node; \ Self* m_ht; \ \ - Iterator() : m_node(NULL), m_ht(NULL) {} \ + Iterator() : m_node(nullptr), m_ht(nullptr) {} \ Iterator( Node* node, const Self* ht ) \ : m_node(node), m_ht(const_cast(ht)) {} \ bool operator ==( const Iterator& it ) const \ @@ -157,7 +157,7 @@ public: \ if( m_ht->m_table[i] ) \ return static_cast(m_ht->m_table[i]); \ } \ - return NULL; \ + return nullptr; \ } \ \ void PlusPlus() \ @@ -206,7 +206,7 @@ public: \ } \ \ CLASSNAME( const Self& ht ) \ - : m_table(NULL), \ + : m_table(nullptr), \ m_tableBuckets( 0 ), \ m_items( ht.m_items ), \ m_hasher( ht.m_hasher ), \ @@ -252,8 +252,8 @@ public: \ size_type max_size() const { return size_type(-1); } \ bool empty() const { return size() == 0; } \ \ - const_iterator end() const { return const_iterator(NULL, this); } \ - iterator end() { return iterator(NULL, this); } \ + const_iterator end() const { return const_iterator(nullptr, this); } \ + iterator end() { return iterator(nullptr, this); } \ const_iterator begin() const \ { return const_iterator(static_cast(GetFirstNode(m_tableBuckets, m_table)), this); } \ iterator begin() \ @@ -319,7 +319,7 @@ protected: \ CreateNode(value, m_hasher( m_getKey(value) ) % m_tableBuckets ); \ }\ \ - /* returns NULL if not found */ \ + /* returns nullptr if not found */ \ _wxHashTable_NodeBase** GetNodePtr(const const_key_type& key) const \ { \ size_t bucket = m_hasher( key ) % m_tableBuckets; \ @@ -332,10 +332,10 @@ protected: \ node = &(*node)->m_next; \ } \ \ - return NULL; \ + return nullptr; \ } \ \ - /* returns NULL if not found */ \ + /* returns nullptr if not found */ \ /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ Node* GetNode( const const_key_type& key ) const \ { \ @@ -349,7 +349,7 @@ protected: \ node = node->next(); \ } \ \ - return NULL; \ + return nullptr; \ } \ \ void ResizeTable( size_t newSize ) \ diff --git a/include/wx/headerctrl.h b/include/wx/headerctrl.h index be5ec62a5f..b13abd9052 100644 --- a/include/wx/headerctrl.h +++ b/include/wx/headerctrl.h @@ -174,7 +174,7 @@ public: // 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) override; + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = nullptr) override; protected: // this method must be implemented by the derived classes to return the diff --git a/include/wx/helpbase.h b/include/wx/helpbase.h index 4ff7aa73ba..f55a4f9b5f 100644 --- a/include/wx/helpbase.h +++ b/include/wx/helpbase.h @@ -34,7 +34,7 @@ enum wxHelpSearchMode class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject { public: - inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; } + inline wxHelpControllerBase(wxWindow* parentWindow = nullptr) { m_parentWindow = parentWindow; } inline ~wxHelpControllerBase() {} // Must call this to set the filename and server name. @@ -77,11 +77,11 @@ public: } /// Obtains the latest settings used by the help frame and the help /// frame. - virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, - wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) + virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = nullptr, + wxPoint *WXUNUSED(pos) = nullptr, + bool *WXUNUSED(newFrameEachTime) = nullptr) { - return NULL; // does nothing by default + return nullptr; // does nothing by default } virtual bool Quit() = 0; diff --git a/include/wx/html/helpctrl.h b/include/wx/html/helpctrl.h index 7ddfe6ff92..6ceaac9f01 100644 --- a/include/wx/html/helpctrl.h +++ b/include/wx/html/helpctrl.h @@ -44,7 +44,7 @@ class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxE wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpController); public: - wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL); + wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = nullptr); wxHtmlHelpController(wxWindow* parentWindow, int style = wxHF_DEFAULT_STYLE); virtual ~wxHtmlHelpController(); @@ -96,9 +96,9 @@ public: bool newFrameEachTime = false) override; /// Obtains the latest settings used by the help frame and the help /// frame. - virtual wxFrame *GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newFrameEachTime = NULL) override; + virtual wxFrame *GetFrameParameters(wxSize *size = nullptr, + wxPoint *pos = nullptr, + bool *newFrameEachTime = nullptr) override; // Get direct access to help data: wxHtmlHelpData *GetHelpData() { return &m_helpData; } diff --git a/include/wx/html/helpdata.h b/include/wx/html/helpdata.h index 8e54cd7a2c..e5cdfd91e0 100644 --- a/include/wx/html/helpdata.h +++ b/include/wx/html/helpdata.h @@ -77,7 +77,7 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray, struct WXDLLIMPEXP_HTML wxHtmlHelpDataItem { - wxHtmlHelpDataItem() : level(0), parent(NULL), id(wxID_ANY), book(NULL) {} + wxHtmlHelpDataItem() : level(0), parent(nullptr), id(wxID_ANY), book(nullptr) {} int level; wxHtmlHelpDataItem *parent; diff --git a/include/wx/html/helpdlg.h b/include/wx/html/helpdlg.h index ef0ccf2b3a..bb43576de4 100644 --- a/include/wx/html/helpdlg.h +++ b/include/wx/html/helpdlg.h @@ -39,10 +39,10 @@ class WXDLLIMPEXP_HTML wxHtmlHelpDialog : public wxDialog wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpDialog); public: - wxHtmlHelpDialog(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpDialog(wxHtmlHelpData* data = nullptr) { Init(data); } wxHtmlHelpDialog(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL); + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = nullptr); virtual ~wxHtmlHelpDialog(); bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, @@ -68,7 +68,7 @@ public: virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} protected: - void Init(wxHtmlHelpData* data = NULL); + void Init(wxHtmlHelpData* data = nullptr); void OnCloseWindow(wxCloseEvent& event); diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index fe9f013b4c..47edc45457 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -70,18 +70,18 @@ class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame); public: - wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpFrame(wxHtmlHelpData* data = nullptr) { Init(data); } wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, - int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL + int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = nullptr #if wxUSE_CONFIG - , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString + , wxConfigBase *config=nullptr, const wxString& rootpath = wxEmptyString #endif // wxUSE_CONFIG ); bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, int style = wxHF_DEFAULT_STYLE #if wxUSE_CONFIG - , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString + , wxConfigBase *config=nullptr, const wxString& rootpath = wxEmptyString #endif // wxUSE_CONFIG ); virtual ~wxHtmlHelpFrame(); @@ -121,7 +121,7 @@ public: virtual bool ShouldPreventAppExit() const override { return m_shouldPreventAppExit; } protected: - void Init(wxHtmlHelpData* data = NULL); + void Init(wxHtmlHelpData* data = nullptr); void OnCloseWindow(wxCloseEvent& event); void OnActivate(wxActivateEvent& event); diff --git a/include/wx/html/helpwnd.h b/include/wx/html/helpwnd.h index ffa8369c41..cb3231defc 100644 --- a/include/wx/html/helpwnd.h +++ b/include/wx/html/helpwnd.h @@ -79,13 +79,13 @@ class WXDLLIMPEXP_HTML wxHtmlHelpWindow : public wxWindow wxDECLARE_DYNAMIC_CLASS(wxHtmlHelpWindow); public: - wxHtmlHelpWindow(wxHtmlHelpData* data = NULL) { Init(data); } + wxHtmlHelpWindow(wxHtmlHelpData* data = nullptr) { Init(data); } wxHtmlHelpWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxNO_BORDER, int helpStyle = wxHF_DEFAULT_STYLE, - wxHtmlHelpData* data = NULL); + wxHtmlHelpData* data = nullptr); bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -164,7 +164,7 @@ public: wxTreeCtrl *GetTreeCtrl() const { return m_ContentsBox; } protected: - void Init(wxHtmlHelpData* data = NULL); + void Init(wxHtmlHelpData* data = nullptr); // Adds items to m_Contents tree control void CreateContents(); diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index b9d689bcfc..039132a6ce 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -35,7 +35,7 @@ public: wxHtmlSelection() : m_fromPos(wxDefaultPosition), m_toPos(wxDefaultPosition), m_fromCharacterPos(-1), m_toCharacterPos(-1), - m_fromCell(NULL), m_toCell(NULL), + m_fromCell(nullptr), m_toCell(nullptr), m_extBeforeSel(0), m_extBeforeSelEnd(0) {} // this version is used for the user selection defined with the mouse @@ -127,7 +127,7 @@ public: class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle { public: - explicit wxDefaultHtmlRenderingStyle(const wxWindowBase* wnd = NULL) + explicit wxDefaultHtmlRenderingStyle(const wxWindowBase* wnd = nullptr) : m_wnd(wnd) {} @@ -148,8 +148,8 @@ class WXDLLIMPEXP_HTML wxHtmlRenderingInfo { public: wxHtmlRenderingInfo() - : m_selection(NULL), - m_style(NULL), + : m_selection(nullptr), + m_style(nullptr), m_prevUnderlined(false) { } @@ -251,7 +251,7 @@ public: // return next cell among parent's cells wxHtmlCell *GetNext() const {return m_Next;} // returns first child cell (if there are any, i.e. if this is container): - virtual wxHtmlCell* GetFirstChild() const { return NULL; } + virtual wxHtmlCell* GetFirstChild() const { return nullptr; } // members writing methods virtual void SetPos(int x, int y) {m_PosX = x; m_PosY = y;} @@ -331,7 +331,7 @@ public: virtual bool IsTerminalCell() const { return true; } // Find a cell inside this cell positioned at the given coordinates - // (relative to this's positions). Returns NULL if no such cell exists. + // (relative to this's positions). Returns nullptr if no such cell exists. // The flag can be used to specify whether to look for terminal or // nonterminal cells or both. In either case, returned cell is deepest // cell in cells tree that contains [x,y]. @@ -341,18 +341,18 @@ public: // Returns absolute position of the cell on HTML canvas. // If rootCell is provided, then it's considered to be the root of the // hierarchy and the returned value is relative to it. - wxPoint GetAbsPos(const wxHtmlCell *rootCell = NULL) const; + wxPoint GetAbsPos(const wxHtmlCell *rootCell = nullptr) const; // Returns minimum bounding rectangle of this cell in coordinates, relative // to the rootCell, if it is provided, or relative to the result of - // GetRootCell() if the rootCell is NULL. - wxRect GetRect(const wxHtmlCell *rootCell = NULL) const; + // GetRootCell() if the rootCell is null. + wxRect GetRect(const wxHtmlCell *rootCell = nullptr) const; // Returns root cell of the hierarchy (i.e. grand-grand-...-parent that // doesn't have a parent itself) wxHtmlCell *GetRootCell() const; - // Returns first (last) terminal cell inside this cell. It may return NULL, + // Returns first (last) terminal cell inside this cell. It may return nullptr, // but it is rare -- only if there are no terminals in the tree. virtual wxHtmlCell *GetFirstTerminal() const { return wxConstCast(this, wxHtmlCell); } @@ -368,7 +368,7 @@ public: // then both A.IsBefore(B) and B.IsBefore(A) always return true. bool IsBefore(wxHtmlCell *cell) const; - // Converts the cell into text representation. If sel != NULL then + // Converts the cell into text representation. If sel != nullptr then // only part of the cell inside the selection is converted. virtual wxString ConvertToText(wxHtmlSelection *WXUNUSED(sel)) const { return wxEmptyString; } @@ -396,7 +396,7 @@ protected: wxHtmlScriptMode m_ScriptMode; long m_ScriptBaseline; - // destination address if this fragment is hypertext link, NULL otherwise + // destination address if this fragment is hypertext link, nullptr otherwise wxHtmlLinkInfo *m_Link; // true if this cell can be placed on pagebreak, false otherwise bool m_CanLiveOnPagebreak; @@ -699,11 +699,11 @@ class WXDLLIMPEXP_HTML wxHtmlLinkInfo : public wxObject { public: wxHtmlLinkInfo() - { m_Event = NULL; m_Cell = NULL; } + { m_Event = nullptr; m_Cell = nullptr; } wxHtmlLinkInfo(const wxString& href, const wxString& target = wxString()) : m_Href(href) , m_Target(target) - { m_Event = NULL; m_Cell = NULL; } + { m_Event = nullptr; m_Cell = nullptr; } void SetEvent(const wxMouseEvent *e) { m_Event = e; } void SetHtmlCell(const wxHtmlCell *e) { m_Cell = e; } @@ -731,7 +731,7 @@ public: wxHtmlTerminalCellsInterator(const wxHtmlCell *from, const wxHtmlCell *to) : m_to(to), m_pos(from) {} - operator bool() const { return m_pos != NULL; } + operator bool() const { return m_pos != nullptr; } const wxHtmlCell* operator++(); const wxHtmlCell* operator->() const { return m_pos; } const wxHtmlCell* operator*() const { return m_pos; } diff --git a/include/wx/html/htmlpars.h b/include/wx/html/htmlpars.h index c3f271a085..d7b0a35aa5 100644 --- a/include/wx/html/htmlpars.h +++ b/include/wx/html/htmlpars.h @@ -218,7 +218,7 @@ class WXDLLIMPEXP_HTML wxHtmlTagHandler : public wxObject wxDECLARE_ABSTRACT_CLASS(wxHtmlTagHandler); public: - wxHtmlTagHandler() : wxObject () { m_Parser = NULL; } + wxHtmlTagHandler() : wxObject () { m_Parser = nullptr; } // Sets the parser. // NOTE : each _instance_ of handler is guaranteed to be called diff --git a/include/wx/html/htmltag.h b/include/wx/html/htmltag.h index c432493cb2..81d58ef3f5 100644 --- a/include/wx/html/htmltag.h +++ b/include/wx/html/htmltag.h @@ -35,7 +35,7 @@ private: wxHtmlTagsCacheData& Cache() { return *m_Cache; } public: - wxHtmlTagsCache() {m_Cache = NULL;} + wxHtmlTagsCache() {m_Cache = nullptr;} wxHtmlTagsCache(const wxString& source); virtual ~wxHtmlTagsCache(); diff --git a/include/wx/html/htmlwin.h b/include/wx/html/htmlwin.h index 7d64cdcb0d..35343b56bf 100644 --- a/include/wx/html/htmlwin.h +++ b/include/wx/html/htmlwin.h @@ -81,7 +81,7 @@ public: @param url URL the parser wants to open @param redirect If the return value is wxHTML_REDIRECT, then the URL to redirect to will be stored in this variable - (the pointer must never be NULL) + (the pointer must never be null) @return indicator of how to treat the request */ @@ -96,7 +96,7 @@ public: virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const = 0; - /// Returns the window used for rendering (may be NULL). + /// Returns the window used for rendering (may be null). virtual wxWindow* GetHTMLWindow() = 0; /// Returns background colour to use by default. @@ -302,7 +302,7 @@ public: // Sets fonts to be used when displaying HTML page. void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int *sizes = NULL); + const int *sizes = nullptr); // Sets font sizes to be relative to the given size or the system // default size; use either specified or default font @@ -497,7 +497,7 @@ protected: // defaults to 10 pixels. int m_Borders; - // current text selection or NULL + // current text selection or nullptr wxHtmlSelection *m_selection; // true if the user is dragging mouse to select text diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index 0c746276c0..521a98d6bf 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -60,7 +60,7 @@ public: void SetHtmlCell(wxHtmlContainerCell& cell); // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = nullptr); // Sets font sizes to be relative to the given size or the system // default size; use either specified or default font @@ -143,7 +143,7 @@ public: // You can set different header/footer for odd and even pages // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = nullptr); // Sets font sizes to be relative to the given size or the system // default size; use either specified or default font @@ -231,7 +231,7 @@ private: class WXDLLIMPEXP_HTML wxHtmlEasyPrinting : public wxObject { public: - wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); + wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = nullptr); virtual ~wxHtmlEasyPrinting(); bool PreviewFile(const wxString &htmlfile); @@ -257,7 +257,7 @@ public: // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. // You can set different header/footer for odd and even pages - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int* sizes = NULL); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int* sizes = nullptr); // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) // Sets font sizes to be relative to the given size or the system diff --git a/include/wx/html/winpars.h b/include/wx/html/winpars.h index 9cde03d074..2a9a60d17b 100644 --- a/include/wx/html/winpars.h +++ b/include/wx/html/winpars.h @@ -38,7 +38,7 @@ class WXDLLIMPEXP_HTML wxHtmlWinParser : public wxHtmlParser friend class wxHtmlWindow; public: - wxHtmlWinParser(wxHtmlWindowInterface *wndIface = NULL); + wxHtmlWinParser(wxHtmlWindowInterface *wndIface = nullptr); virtual ~wxHtmlWinParser(); @@ -68,7 +68,7 @@ public: wxHtmlWindowInterface *GetWindowInterface() {return m_windowInterface;} // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = NULL); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = nullptr); // Sets font sizes to be relative to the given size or the system // default size; use either specified or default font @@ -218,7 +218,7 @@ private: // [bold][italic][underlined][fixed_size] // last index is font size : from 0 to 6 (remapped from html sizes 1 to 7) // Note : this table covers all possible combinations of fonts, but not - // all of them are used, so many items in table are usually NULL. + // all of them are used, so many items in table are usually null. int m_FontsSizes[7]; wxString m_FontFaceFixed, m_FontFaceNormal; // html font sizes and faces of fixed and proportional fonts diff --git a/include/wx/htmllbox.h b/include/wx/htmllbox.h index 5ca51ad202..7f7d6df26f 100644 --- a/include/wx/htmllbox.h +++ b/include/wx/htmllbox.h @@ -216,7 +216,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)) @@ -239,7 +239,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxSimpleHtmlListBoxNameStr)); diff --git a/include/wx/image.h b/include/wx/image.h index 7358bb7368..e5bc53decc 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -210,7 +210,7 @@ public: // find first colour that is not used in the image and has higher // RGB values than RGB(startR, startG, startB) // - // returns true and puts this colour in r, g, b (each of which may be NULL) + // returns true and puts this colour in r, g, b (each of which may be null) // on success or returns false if there are no more free colours bool FindFirstUnusedColour(unsigned char *r, unsigned char *g, @@ -383,7 +383,7 @@ public: // Rotates the image about the given point, 'angle' radians. // Returns the rotated image, leaving this image intact. wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = true, wxPoint * offset_after_rotation = NULL) const; + bool interpolating = true, wxPoint * offset_after_rotation = nullptr) const; wxImage Rotate90( bool clockwise = true ) const; wxImage Rotate180() const; @@ -506,9 +506,9 @@ public: void SetData( unsigned char *data, bool static_data=false ); void SetData( unsigned char *data, int new_width, int new_height, bool static_data=false ); - unsigned char *GetAlpha() const; // may return NULL! - bool HasAlpha() const { return GetAlpha() != NULL; } - void SetAlpha(unsigned char *alpha = NULL, bool static_data=false); + unsigned char *GetAlpha() const; // may return nullptr! + bool HasAlpha() const { return GetAlpha() != nullptr; } + void SetAlpha(unsigned char *alpha = nullptr, bool static_data=false); void InitAlpha(); void ClearAlpha(); diff --git a/include/wx/imaggif.h b/include/wx/imaggif.h index fb052310ee..da099b227d 100644 --- a/include/wx/imaggif.h +++ b/include/wx/imaggif.h @@ -37,7 +37,7 @@ public: m_extension = wxT("gif"); m_type = wxBITMAP_TYPE_GIF; m_mime = wxT("image/gif"); - m_hashTable = NULL; + m_hashTable = nullptr; } #if wxUSE_STREAMS diff --git a/include/wx/intl.h b/include/wx/intl.h index ffda779ff5..40511e68e9 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -125,7 +125,7 @@ public: wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); // return true if the locale was set successfully - bool IsOk() const { return m_pszOldLocale != NULL; } + bool IsOk() const { return m_pszOldLocale != nullptr; } // returns locale name const wxString& GetLocale() const { return m_strLocale; } @@ -169,7 +169,7 @@ public: // Retrieve the language info struct for the given language // - // Returns NULL if no info found, pointer must *not* be deleted by caller + // Returns nullptr if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo *GetLanguageInfo(int lang); // Returns language name in English or empty string if the language @@ -184,7 +184,7 @@ public: // canonical ISO 2 letter language code ("xx"), a language code followed by // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") // - // Returns NULL if no info found, pointer must *not* be deleted by caller + // Returns nullptr if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo *FindLanguageInfo(const wxString& locale); // Add custom language to the list of known languages. @@ -274,7 +274,7 @@ private: // global functions // ---------------------------------------------------------------------------- -// get the current locale object (note that it may be NULL!) +// get the current locale object (note that it may be null!) extern WXDLLIMPEXP_BASE wxLocale* wxGetLocale(); #endif // wxUSE_INTL diff --git a/include/wx/ipcbase.h b/include/wx/ipcbase.h index 9d13867d78..1425e92c6a 100644 --- a/include/wx/ipcbase.h +++ b/include/wx/ipcbase.h @@ -78,7 +78,7 @@ public: { return Execute(cs.AsString()); } virtual const void *Request(const wxString& item, - size_t *size = NULL, + size_t *size = nullptr, wxIPCFormat format = wxIPC_TEXT) = 0; bool Poke(const wxString& item, const void *data, size_t size, @@ -150,7 +150,7 @@ public: const wxString& WXUNUSED(item), size_t *size, wxIPCFormat WXUNUSED(format)) - { *size = 0; return NULL; } + { *size = 0; return nullptr; } virtual bool OnPoke(const wxString& WXUNUSED(topic), const wxString& WXUNUSED(item), @@ -202,7 +202,7 @@ public: // return a buffer at least this size, reallocating buffer if needed - // returns NULL if using an inadequate user buffer which can't be resized + // returns nullptr if using an inadequate user buffer which can't be resized void *GetBufferAtLeast(size_t bytes); protected: @@ -249,7 +249,7 @@ public: virtual bool ValidHost(const wxString& host) = 0; - // Call this to make a connection. Returns NULL if cannot. + // Call this to make a connection. Returns nullptr if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0; diff --git a/include/wx/itemid.h b/include/wx/itemid.h index 99897e9c17..b832ea7344 100644 --- a/include/wx/itemid.h +++ b/include/wx/itemid.h @@ -27,18 +27,18 @@ public: // this class with void* you're strongly advised to make the derived class // ctor explicit as implicitly converting from any pointer is simply too // dangerous. - wxItemId(Type item = NULL) : m_pItem(item) { } + wxItemId(Type item = nullptr) : m_pItem(item) { } // Default copy ctor, assignment operator and dtor are ok. - bool IsOk() const { return m_pItem != NULL; } + bool IsOk() const { return m_pItem != nullptr; } Type GetID() const { return m_pItem; } operator const Type() const { return m_pItem; } // This is used for implementation purposes only. Type operator->() const { return m_pItem; } - void Unset() { m_pItem = NULL; } + void Unset() { m_pItem = nullptr; } // This field is public *only* for compatibility with the old wxTreeItemId // implementation and must not be used in any new code. diff --git a/include/wx/list.h b/include/wx/list.h index e93b3b43ff..573d4f85a0 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -99,7 +99,7 @@ private: reference to Foo::Bar() function - Note 2: the EmptyList is needed to allow having a NULL pointer-like + Note 2: the EmptyList is needed to allow having a null pointer-like invalid iterator. We used to use just an uninitialized iterator object instead but this fails with some debug/checked versions of STL, notably the glibc version activated with _GLIBCXX_DEBUG, so we need to have a separate @@ -135,7 +135,7 @@ private: \ public: \ compatibility_iterator() \ - : m_iter(_WX_LIST_HELPER_##liT::EmptyList.end()), m_list( NULL ) {} \ + : m_iter(_WX_LIST_HELPER_##liT::EmptyList.end()), m_list( nullptr ) {} \ compatibility_iterator( liT* li, iterator i ) \ : m_iter( i ), m_list( li ) {} \ compatibility_iterator( const liT* li, iterator i ) \ @@ -383,10 +383,10 @@ class WXDLLIMPEXP_BASE wxNodeBase friend class wxListBase; public: // ctor - wxNodeBase(wxListBase *list = NULL, - wxNodeBase *previous = NULL, - wxNodeBase *next = NULL, - void *data = NULL, + wxNodeBase(wxListBase *list = nullptr, + wxNodeBase *previous = nullptr, + wxNodeBase *next = nullptr, + void *data = nullptr, const wxListKey& key = wxDefaultListKey); virtual ~wxNodeBase(); @@ -515,7 +515,7 @@ protected: { wxNodeBase *node = Item(n); - return node ? node->GetData() : NULL; + return node ? node->GetData() : nullptr; } // operations @@ -526,12 +526,12 @@ protected: wxNodeBase *Append(void *object); // insert a new item at the beginning of the list wxNodeBase *Insert(void *object) - { return Insert(static_cast(NULL), object); } + { return Insert(static_cast(nullptr), object); } // insert a new item at the given position wxNodeBase *Insert(size_t pos, void *object) { return pos == GetCount() ? Append(object) : Insert(Item(pos), object); } - // insert before given node or at front of list if prev == NULL + // insert before given node or at front of list if prev == nullptr wxNodeBase *Insert(wxNodeBase *prev, void *object); // keyed append @@ -539,7 +539,7 @@ protected: wxNodeBase *Append(const wxString& key, void *object); // removes node from the list but doesn't delete it (returns pointer - // to the node or NULL if it wasn't found in the list) + // to the node or nullptr if it wasn't found in the list) wxNodeBase *DetachNode(wxNodeBase *node); // delete element from list, returns false if node not found bool DeleteNode(wxNodeBase *node); @@ -547,7 +547,7 @@ protected: // is on), returns false if object not found bool DeleteObject(void *object); - // search (all return NULL if item not found) + // search (all return nullptr if item not found) // by data wxNodeBase *Find(const void *object) const; @@ -567,7 +567,7 @@ protected: void *LastThat(wxListIterateFunction func); // for STL interface, "last" points to one after the last node - // of the controlled sequence (NULL for the end of the list) + // of the controlled sequence (nullptr for the end of the list) void Reverse(); void DeleteNodes(wxNodeBase* first, wxNodeBase* last); private: @@ -641,10 +641,10 @@ private: classexp nodetype : public wxNodeBase \ { \ public: \ - nodetype(wxListBase *list = NULL, \ - nodetype *previous = NULL, \ - nodetype *next = NULL, \ - T *data = NULL, \ + nodetype(wxListBase *list = nullptr, \ + nodetype *previous = nullptr, \ + nodetype *next = nullptr, \ + T *data = nullptr, \ const wxListKey& key = wxDefaultListKey) \ : wxNodeBase(list, previous, next, data, key) { } \ \ @@ -671,7 +671,7 @@ private: classexp compatibility_iterator \ { \ public: \ - compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ + compatibility_iterator(Node *ptr = nullptr) : m_ptr(ptr) { } \ \ Node *operator->() const { return m_ptr; } \ operator Node *() const { return m_ptr; } \ @@ -699,13 +699,13 @@ private: T *operator[](size_t index) const \ { \ nodetype *node = Item(index); \ - return node ? (T*)(node->GetData()) : NULL; \ + return node ? (T*)(node->GetData()) : nullptr; \ } \ \ nodetype *Append(Tbase *object) \ { return (nodetype *)wxListBase::Append(object); } \ nodetype *Insert(Tbase *object) \ - { return (nodetype *)Insert(static_cast(NULL), \ + { return (nodetype *)Insert(static_cast(nullptr), \ object); } \ nodetype *Insert(size_t pos, Tbase *object) \ { return (nodetype *)wxListBase::Insert(pos, object); } \ @@ -733,7 +733,7 @@ private: { return (nodetype *)wxListBase::Find(key); } \ \ bool Member(const Tbase *object) const \ - { return Find(object) != NULL; } \ + { return Find(object) != nullptr; } \ \ int IndexOf(Tbase *object) const \ { return wxListBase::IndexOf(object); } \ @@ -783,7 +783,7 @@ private: typedef pointer pointer_type; \ \ iterator(Node* node, Node* init) : m_node(node), m_init(init) {}\ - iterator() : m_node(NULL), m_init(NULL) { } \ + iterator() : m_node(nullptr), m_init(nullptr) { } \ reference_type operator*() const \ { return *(pointer_type)m_node->GetDataPtr(); } \ ptrop \ @@ -835,7 +835,7 @@ private: \ const_iterator(Node* node, Node* init) \ : m_node(node), m_init(init) { } \ - const_iterator() : m_node(NULL), m_init(NULL) { } \ + const_iterator() : m_node(nullptr), m_init(nullptr) { } \ const_iterator(const iterator& it) \ : m_node(it.m_node), m_init(it.m_init) { } \ reference_type operator*() const \ @@ -889,7 +889,7 @@ private: \ reverse_iterator(Node* node, Node* init) \ : m_node(node), m_init(init) { } \ - reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + reverse_iterator() : m_node(nullptr), m_init(nullptr) { } \ reference_type operator*() const \ { return *(pointer_type)m_node->GetDataPtr(); } \ ptrop \ @@ -929,7 +929,7 @@ private: \ const_reverse_iterator(Node* node, Node* init) \ : m_node(node), m_init(init) { } \ - const_reverse_iterator() : m_node(NULL), m_init(NULL) { } \ + const_reverse_iterator() : m_node(nullptr), m_init(nullptr) { } \ const_reverse_iterator(const reverse_iterator& it) \ : m_node(it.m_node), m_init(it.m_init) { } \ reference_type operator*() const \ @@ -960,15 +960,15 @@ private: iterator begin() { return iterator(GetFirst(), GetLast()); } \ const_iterator begin() const \ { return const_iterator(GetFirst(), GetLast()); } \ - iterator end() { return iterator(NULL, GetLast()); } \ - const_iterator end() const { return const_iterator(NULL, GetLast()); }\ + iterator end() { return iterator(nullptr, GetLast()); } \ + const_iterator end() const { return const_iterator(nullptr, GetLast()); }\ reverse_iterator rbegin() \ { return reverse_iterator(GetLast(), GetFirst()); } \ const_reverse_iterator rbegin() const \ { return const_reverse_iterator(GetLast(), GetFirst()); } \ - reverse_iterator rend() { return reverse_iterator(NULL, GetFirst()); }\ + reverse_iterator rend() { return reverse_iterator(nullptr, GetFirst()); }\ const_reverse_iterator rend() const \ - { return const_reverse_iterator(NULL, GetFirst()); } \ + { return const_reverse_iterator(nullptr, GetFirst()); } \ void resize(size_type n, value_type v = value_type()) \ { \ while (n < size()) \ diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 2082c6a016..f73d27a03b 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -171,7 +171,7 @@ typedef wxItemAttr wxListItemAttr; class WXDLLIMPEXP_CORE wxListItem : public wxObject { public: - wxListItem() { Init(); m_attr = NULL; } + wxListItem() { Init(); m_attr = nullptr; } wxListItem(const wxListItem& item) : wxObject(), m_mask(item.m_mask), @@ -184,7 +184,7 @@ public: m_data(item.m_data), m_format(item.m_format), m_width(item.m_width), - m_attr(NULL) + m_attr(nullptr) { // copy list item attributes if ( item.HasAttributes() ) @@ -205,7 +205,7 @@ public: m_data = item.m_data; m_format = item.m_format; m_width = item.m_width; - m_attr = item.m_attr ? new wxItemAttr(*item.m_attr) : NULL; + m_attr = item.m_attr ? new wxItemAttr(*item.m_attr) : nullptr; } return *this; @@ -215,7 +215,7 @@ public: // resetting void Clear() { Init(); m_text.clear(); ClearAttributes(); } - void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } } + void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = nullptr; } } // setters void SetMask(long mask) @@ -262,7 +262,7 @@ public: wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } wxItemAttr *GetAttributes() const { return m_attr; } - bool HasAttributes() const { return m_attr != NULL; } + bool HasAttributes() const { return m_attr != nullptr; } wxColour GetTextColour() const { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; } @@ -347,7 +347,7 @@ public: void SetNormalImages(const wxVector& images); void SetSmallImages(const wxVector& images); - // Associate the given (possibly NULL to indicate that no images will be + // Associate the given (possibly null to indicate that no images will be // used) image list with the control. The ownership of the image list // passes to the control, i.e. it will be deleted when the control itself // is destroyed. @@ -359,7 +359,7 @@ public: // so it can be shared among several controls. virtual void SetImageList(wxImageList* imageList, int which); - // Return the currently used image list, may be NULL. + // Return the currently used image list, may be null. virtual wxImageList* GetImageList(int which) const; @@ -477,7 +477,7 @@ protected: // these functions are only used for virtual list view controls, i.e. the // ones with wxLC_VIRTUAL style - // return the attribute for the item (may return NULL if none) + // return the attribute for the item (may return nullptr if none) virtual wxItemAttr* OnGetItemAttr(long item) const; // return the text for the given column of the given item @@ -494,7 +494,7 @@ protected: // return the icon for the given item and column. virtual int OnGetItemColumnImage(long item, long column) const; - // return the attribute for the given item and column (may return NULL if none) + // return the attribute for the given item and column (may return nullptr if none) virtual wxItemAttr* OnGetItemColumnAttr(long item, long column) const; private: diff --git a/include/wx/listbook.h b/include/wx/listbook.h index a9f7f90f23..cfd20a4479 100644 --- a/include/wx/listbook.h +++ b/include/wx/listbook.h @@ -72,7 +72,7 @@ public: int imageId = NO_IMAGE) override; virtual int SetSelection(size_t n) override { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) override { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; virtual bool DeleteAllPages() override; diff --git a/include/wx/log.h b/include/wx/log.h index 644c0a44cf..0e66721d56 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -156,7 +156,7 @@ public: threadId = wxThread::GetCurrentId(); #endif // wxUSE_THREADS - m_data = NULL; + m_data = nullptr; } // we need to define copy ctor and assignment operator because of m_data @@ -184,15 +184,15 @@ public: // the file name and line number of the file where the log record was - // generated, if available or NULL and 0 otherwise + // generated, if available or nullptr and 0 otherwise const char *filename; int line; - // the name of the function where the log record was generated (may be NULL + // the name of the function where the log record was generated (may be null // if the compiler doesn't support __FUNCTION__) const char *func; - // the name of the component which generated this message, may be NULL if + // the name of the component which generated this message, may be null if // not set (i.e. wxLOG_COMPONENT not defined). It must be in ASCII. const char *component; @@ -277,7 +277,7 @@ private: wxStringToStringHashMap strValues; }; - // NULL if not used + // nullptr if not used ExtraData *m_data; }; @@ -432,7 +432,7 @@ public: // wxAppTraits::CreateLogTarget() to create one if none exists static wxLog *GetActiveTarget(); - // change log target, logger may be NULL + // change log target, logger may be null static wxLog *SetActiveTarget(wxLog *logger); #if wxUSE_THREADS @@ -450,7 +450,7 @@ public: static void Resume() { ms_suspendCount--; } // should GetActiveTarget() try to create a new log object if the - // current is NULL? + // current is null? static void DontCreateOnDemand(); // Make GetActiveTarget() create a new log object again. @@ -554,7 +554,7 @@ public: // a helper calling the above overload with current time static void OnLog(wxLogLevel level, const wxString& msg) { - OnLog(level, msg, time(NULL)); + OnLog(level, msg, time(nullptr)); } @@ -679,7 +679,7 @@ class WXDLLIMPEXP_BASE wxLogStderr : public wxLog, { public: // redirect log output to a FILE - wxLogStderr(FILE *fp = NULL, + wxLogStderr(FILE *fp = nullptr, const wxMBConv &conv = wxConvWhateverWorks); protected: @@ -697,7 +697,7 @@ class WXDLLIMPEXP_BASE wxLogStream : public wxLog, { public: // redirect log output to an ostream - wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) NULL, + wxLogStream(wxSTD ostream *ostr = (wxSTD ostream *) nullptr, const wxMBConv& conv = wxConvWhateverWorks); protected: @@ -767,14 +767,14 @@ public: // are we passing the messages to the previous log target? bool IsPassingMessages() const { return m_bPassMessages; } - // return the previous log target (may be NULL) + // return the previous log target (may be null) wxLog *GetOldLog() const { return m_logOld; } // override base class version to flush the old logger as well virtual void Flush() override; // call to avoid destroying the old log target - void DetachOldLog() { m_logOld = NULL; } + void DetachOldLog() { m_logOld = nullptr; } protected: // pass the record to the old logger if needed @@ -1307,7 +1307,7 @@ public: // Dummy macros to replace some functions. #define wxSysErrorCode() (unsigned long)0 -#define wxSysErrorMsg( X ) (const wxChar*)NULL +#define wxSysErrorMsg( X ) (const wxChar*)nullptr #define wxSysErrorMsgStr( X ) wxEmptyString // Fake symbolic trace masks... for those that are used frequently diff --git a/include/wx/mdi.h b/include/wx/mdi.h index d21a3189f8..4d9fa69457 100644 --- a/include/wx/mdi.h +++ b/include/wx/mdi.h @@ -33,10 +33,10 @@ class WXDLLIMPEXP_CORE wxMDIParentFrameBase : public wxFrame public: wxMDIParentFrameBase() { - m_clientWindow = NULL; - m_currentChild = NULL; + m_clientWindow = nullptr; + m_currentChild = nullptr; #if wxUSE_MENUS - m_windowMenu = NULL; + m_windowMenu = nullptr; #endif // wxUSE_MENUS } @@ -78,13 +78,13 @@ public: // -------------------------- #if wxUSE_MENUS - // return the pointer to the current window menu or NULL if we don't have + // return the pointer to the current window menu or nullptr if we don't have // because of wxFRAME_NO_WINDOW_MENU style wxMenu* GetWindowMenu() const { return m_windowMenu; } // use the given menu instead of the default window menu // - // menu can be NULL to disable the window menu completely + // menu can be null to disable the window menu completely virtual void SetWindowMenu(wxMenu *menu) { if ( menu != m_windowMenu ) @@ -134,7 +134,7 @@ protected: wxMDIChildFrame *m_currentChild; #if wxUSE_MENUS - // the current window menu or NULL if we are not using it + // the current window menu or nullptr if we are not using it wxMenu *m_windowMenu; #endif // wxUSE_MENUS }; @@ -146,7 +146,7 @@ protected: class WXDLLIMPEXP_CORE wxMDIChildFrameBase : public wxFrame { public: - wxMDIChildFrameBase() { m_mdiParent = NULL; } + wxMDIChildFrameBase() { m_mdiParent = nullptr; } /* Derived classes should provide Create() with the following signature: @@ -225,10 +225,10 @@ public: wxWindowID WXUNUSED(id) = 1, const wxString& WXUNUSED(name) = wxEmptyString) override - { return NULL; } + { return nullptr; } virtual wxStatusBar *GetStatusBar() const override - { return NULL; } + { return nullptr; } virtual void SetStatusText(const wxString &WXUNUSED(text), int WXUNUSED(number)=0) override { } @@ -244,8 +244,8 @@ public: virtual wxToolBar *CreateToolBar(long WXUNUSED(style), wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name)) override - { return NULL; } - virtual wxToolBar *GetToolBar() const override { return NULL; } + { return nullptr; } + virtual wxToolBar *GetToolBar() const override { return nullptr; } #endif // wxUSE_TOOLBAR // no icon @@ -279,7 +279,7 @@ public: // extra platform-specific hacks #ifdef __WXMSW__ - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override { return wxWindow::MSWGetStyle(flags, exstyle); } diff --git a/include/wx/mediactrl.h b/include/wx/mediactrl.h index 123967d287..4a039bafe6 100644 --- a/include/wx/mediactrl.h +++ b/include/wx/mediactrl.h @@ -125,7 +125,7 @@ public: class WXDLLIMPEXP_MEDIA wxMediaCtrl : public wxControl { public: - wxMediaCtrl() : m_imp(NULL), m_bLoaded(false) + wxMediaCtrl() : m_imp(nullptr), m_bLoaded(false) { } wxMediaCtrl(wxWindow* parent, wxWindowID winid, @@ -136,7 +136,7 @@ public: const wxString& szBackend = wxEmptyString, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxT("mediaCtrl")) - : m_imp(NULL), m_bLoaded(false) + : m_imp(nullptr), m_bLoaded(false) { Create(parent, winid, fileName, pos, size, style, szBackend, validator, name); } @@ -148,7 +148,7 @@ public: const wxString& szBackend = wxEmptyString, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxT("mediaCtrl")) - : m_imp(NULL), m_bLoaded(false) + : m_imp(nullptr), m_bLoaded(false) { Create(parent, winid, location, pos, size, style, szBackend, validator, name); } @@ -330,18 +330,18 @@ typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&); wxEVENT_HANDLER_CAST(wxMediaEventFunction, func) //Macro for usage with message maps -#define EVT_MEDIA_FINISHED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), -#define EVT_MEDIA_STOP(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_FINISHED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), +#define EVT_MEDIA_STOP(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMediaEvent ); -#define EVT_MEDIA_LOADED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_LOADED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_STATECHANGED, wxMediaEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PLAY, wxMediaEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_PAUSE, wxMediaEvent ); -#define EVT_MEDIA_STATECHANGED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), -#define EVT_MEDIA_PLAY(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), -#define EVT_MEDIA_PAUSE(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), NULL ), +#define EVT_MEDIA_STATECHANGED(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STATECHANGED, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), +#define EVT_MEDIA_PLAY(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PLAY, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), +#define EVT_MEDIA_PAUSE(winid, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_PAUSE, winid, wxID_ANY, wxMediaEventHandler(fn), nullptr ), // ---------------------------------------------------------------------------- // common backend base class used by many other backends diff --git a/include/wx/memory.h b/include/wx/memory.h index 6749798f41..d010e8b013 100644 --- a/include/wx/memory.h +++ b/include/wx/memory.h @@ -62,7 +62,7 @@ inline void * operator new (size_t size, wxChar * fileName, int lineNum) inline void * operator new (size_t size) { - return wxDebugAlloc(size, NULL, 0, false); + return wxDebugAlloc(size, nullptr, 0, false); } inline void operator delete (void * buf) @@ -73,7 +73,7 @@ inline void operator delete (void * buf) #if wxUSE_ARRAY_MEMORY_OPERATORS inline void * operator new[] (size_t size) { - return wxDebugAlloc(size, NULL, 0, false, true); + return wxDebugAlloc(size, nullptr, 0, false, true); } inline void * operator new[] (size_t size, wxChar * fileName, int lineNum) @@ -218,7 +218,7 @@ protected: static size_t GetPadding (size_t size) ; // Traverse the list. - static void TraverseList (PmSFV, wxMemStruct *from = NULL); + static void TraverseList (PmSFV, wxMemStruct *from = nullptr); static int debugLevel; static bool debugOn; diff --git a/include/wx/menu.h b/include/wx/menu.h index 15e6337a7f..91cc175eab 100644 --- a/include/wx/menu.h +++ b/include/wx/menu.h @@ -222,7 +222,7 @@ public: // search virtual int FindItem(const wxString& item) const; - wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + wxMenuItem* FindItem(int itemid, wxMenu **menu = nullptr) const; // find by position wxMenuItem* FindItemByPosition(size_t position) const; @@ -257,7 +257,7 @@ public: // Invoking window: this is set by wxWindow::PopupMenu() before showing a // popup menu and reset after it's hidden. Notice that you probably want to // use GetWindow() below instead of GetInvokingWindow() as the latter only - // returns non-NULL for the top level menus + // returns non-null for the top level menus // // NB: avoid calling SetInvokingWindow() directly if possible, use // wxMenuInvokingWindowSetter class below instead @@ -280,10 +280,10 @@ public: // // 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); + void UpdateUI(wxEvtHandler* source = nullptr); #if wxUSE_MENUBAR - // get the menu bar this menu is attached to (may be NULL, always NULL for + // get the menu bar this menu is attached to (may be null, always null for // popup menus). Traverse up the menu hierarchy to find it. wxMenuBar *GetMenuBar() const; @@ -292,7 +292,7 @@ public: virtual void Detach(); // is the menu attached to a menu bar (or is it a popup one)? - bool IsAttached() const { return GetMenuBar() != NULL; } + bool IsAttached() const { return GetMenuBar() != nullptr; } #endif // set/get the parent of this menu @@ -304,8 +304,8 @@ public: // unlike FindItem(), this function doesn't recurse but only looks through // our direct children and also may return the index of the found child if - // pos != NULL - wxMenuItem *FindChildItem(int itemid, size_t *pos = NULL) const; + // pos != nullptr + wxMenuItem *FindChildItem(int itemid, size_t *pos = nullptr) const; // called to generate a wxCommandEvent, return true if it was processed, // false otherwise @@ -314,7 +314,7 @@ public: 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 + // 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); @@ -385,8 +385,8 @@ protected: // associate the submenu with this menu void AddSubMenu(wxMenu *submenu); - wxMenuBar *m_menuBar; // menubar we belong to or NULL - wxMenu *m_menuParent; // parent menu or NULL + wxMenuBar *m_menuBar; // menubar we belong to or nullptr + wxMenu *m_menuParent; // parent menu or nullptr wxString m_title; // the menu title or label wxMenuItemList m_items; // the list of menu items @@ -417,7 +417,7 @@ protected: class WXDLLEXPORT wxMenuInfoHelper : public wxObject { public: - wxMenuInfoHelper() { m_menu = NULL; } + wxMenuInfoHelper() { m_menu = nullptr; } virtual ~wxMenuInfoHelper() { } bool Create( wxMenu *menu, const wxString &title ) @@ -503,10 +503,10 @@ public: // found item virtual int FindMenuItem(const wxString& menu, const wxString& item) const; - // find item by id (in any menu), returns NULL if not found + // find item by id (in any menu), returns nullptr if not found // - // if menu is !NULL, it will be filled with wxMenu this item belongs to - virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = NULL) const; + // if menu is not null, it will be filled with wxMenu this item belongs to + virtual wxMenuItem* FindItem(int itemid, wxMenu **menu = nullptr) const; // find menu by its caption, return wxNOT_FOUND on failure int FindMenu(const wxString& title) const; @@ -534,11 +534,11 @@ public: // implementation helpers - // get the frame we are attached to (may return NULL) + // get the frame we are attached to (may return nullptr) wxFrame *GetFrame() const { return m_menuBarFrame; } // returns true if we're attached to a frame - bool IsAttached() const { return GetFrame() != NULL; } + bool IsAttached() const { return GetFrame() != nullptr; } // associate the menubar with the frame virtual void Attach(wxFrame *frame); @@ -575,7 +575,7 @@ protected: wxMenuInfoHelperList m_menuInfos; #endif - // the frame we are attached to (may be NULL) + // the frame we are attached to (may be null) wxFrame *m_menuBarFrame; wxDECLARE_NO_COPY_CLASS(wxMenuBarBase); @@ -622,7 +622,7 @@ public: // Dtor resets the invoking window. ~wxMenuInvokingWindowSetter() { - m_menu.SetInvokingWindow(NULL); + m_menu.SetInvokingWindow(nullptr); } private: diff --git a/include/wx/menuitem.h b/include/wx/menuitem.h index 1c70e129e0..1e0cc85d03 100644 --- a/include/wx/menuitem.h +++ b/include/wx/menuitem.h @@ -46,12 +46,12 @@ class WXDLLIMPEXP_CORE wxMenuItemBase : public wxObject { public: // creation - static wxMenuItem *New(wxMenu *parentMenu = NULL, + static wxMenuItem *New(wxMenu *parentMenu = nullptr, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); // destruction: wxMenuItem will delete its submenu virtual ~wxMenuItemBase(); @@ -99,7 +99,7 @@ public: bool IsCheckable() const { return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; } - bool IsSubMenu() const { return m_subMenu != NULL; } + bool IsSubMenu() const { return m_subMenu != nullptr; } void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } wxMenu *GetSubMenu() const { return m_subMenu; } @@ -125,11 +125,11 @@ public: virtual wxBitmap GetBitmap() const; #if wxUSE_ACCEL - // extract the accelerator from the given menu string, return NULL if none + // extract the accelerator from the given menu string, return nullptr if none // found static wxAcceleratorEntry *GetAccelFromString(const wxString& label); - // get our accelerator or NULL (caller must delete the pointer) + // get our accelerator or nullptr (caller must delete the pointer) virtual wxAcceleratorEntry *GetAccel() const; // set the accel for this item - this may also be done indirectly with @@ -150,7 +150,7 @@ public: const wxString& text, const wxString& help, bool isCheckable, - wxMenu *subMenu = NULL) + wxMenu *subMenu = nullptr) { return New(parentMenu, itemid, text, help, isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu); @@ -163,7 +163,7 @@ protected: wxWindowIDRef m_id; // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR wxMenu *m_parentMenu, // the menu we belong to - *m_subMenu; // our sub menu or NULL + *m_subMenu; // our sub menu or nullptr wxString m_text, // label of the item m_help; // the help string for the item wxBitmapBundle m_bitmap; // item bitmap, may be invalid @@ -176,12 +176,12 @@ protected: #endif // wxUSE_ACCEL // this ctor is for the derived classes only, we're never created directly - wxMenuItemBase(wxMenu *parentMenu = NULL, + wxMenuItemBase(wxMenu *parentMenu = nullptr, int itemid = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); private: // and, if we have one ctor, compiler won't generate a default copy one, so diff --git a/include/wx/mimetype.h b/include/wx/mimetype.h index efa807d7bf..3584e70876 100644 --- a/include/wx/mimetype.h +++ b/include/wx/mimetype.h @@ -99,7 +99,7 @@ public: { return m_verbs.Index(verb) != wxNOT_FOUND; } // returns empty string and wxNOT_FOUND in idx if no such verb - wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const; + wxString GetCommandForVerb(const wxString& verb, size_t *idx = nullptr) const; // get a "verb=command" string wxString GetVerbCmd(size_t n) const; @@ -128,7 +128,7 @@ private: const wxString *openCmd, const wxString *printCmd, const wxString *desc, - // the other parameters form a NULL terminated list of + // the other parameters form a nullptr terminated list of // extensions ...); @@ -170,8 +170,7 @@ public: // const wxString& printCmd, // const wxString& desc, // // the other parameters form a list of extensions for this - // // file type and should be terminated with wxNullPtr (not - // // just NULL!) + // // file type and should be terminated with nullptr // ...); WX_DEFINE_VARARG_FUNC_CTOR(wxFileTypeInfo, 4, (const CtorString&, @@ -368,7 +367,7 @@ private: wxFileType(const wxFileType&); wxFileType& operator=(const wxFileType&); - // the static container of wxFileType data: if it's not NULL, it means that + // the static container of wxFileType data: if it's not null, it means that // this object is used as fallback only const wxFileTypeInfo *m_info; @@ -435,7 +434,7 @@ public: // Database lookup: all functions return a pointer to wxFileType object // whose methods may be used to query it for the information you're - // interested in. If the return value is !NULL, caller is responsible for + // interested in. If the return value is not null, caller is responsible for // deleting it. // get file type from file extension wxFileType *GetFileTypeFromExtension(const wxString& ext); @@ -450,7 +449,7 @@ public: // these functions can be used to provide default values for some of the // MIME types inside the program itself // - // The filetypes array should be terminated by either NULL entry or an + // The filetypes array should be terminated by either null entry or an // invalid wxFileTypeInfo (i.e. the one created with default ctor) void AddFallbacks(const wxFileTypeInfo *filetypes); void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } @@ -480,7 +479,7 @@ private: // the object working with the system MIME database wxMimeTypesManagerImpl *m_impl; - // if m_impl is NULL, create one + // if m_impl is null, create one void EnsureImpl(); friend class wxMimeTypeCmnModule; diff --git a/include/wx/module.h b/include/wx/module.h index 1f107029aa..5684ed047f 100644 --- a/include/wx/module.h +++ b/include/wx/module.h @@ -64,7 +64,7 @@ protected: // after that void AddDependency(wxClassInfo *dep) { - wxCHECK_RET( dep, wxT("NULL module dependency") ); + wxCHECK_RET( dep, wxT("null module dependency") ); m_dependencies.push_back(dep); } diff --git a/include/wx/mousemanager.h b/include/wx/mousemanager.h index 997bee01ea..0779949606 100644 --- a/include/wx/mousemanager.h +++ b/include/wx/mousemanager.h @@ -125,7 +125,7 @@ private: void OnMove(wxMouseEvent& event); - // the associated window, never NULL except between the calls to the + // the associated window, never null except between the calls to the // default ctor and Create() wxWindow *m_win; diff --git a/include/wx/msgdlg.h b/include/wx/msgdlg.h index 19f9a7f193..8e2988077c 100644 --- a/include/wx/msgdlg.h +++ b/include/wx/msgdlg.h @@ -314,7 +314,7 @@ private: int WXDLLIMPEXP_CORE wxMessageBox(const wxString& message, const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr), long style = wxOK | wxCENTRE, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); #endif // wxUSE_MSGDLG diff --git a/include/wx/msgout.h b/include/wx/msgout.h index 96b0d527a0..107c4ac486 100644 --- a/include/wx/msgout.h +++ b/include/wx/msgout.h @@ -29,7 +29,7 @@ class WXDLLIMPEXP_BASE wxMessageOutput public: virtual ~wxMessageOutput() { } - // gets the current wxMessageOutput object (may be NULL during + // gets the current wxMessageOutput object (may be null during // initialization or shutdown) static wxMessageOutput* Get(); diff --git a/include/wx/mstream.h b/include/wx/mstream.h index d3ea88b1ce..a6f7ec3105 100644 --- a/include/wx/mstream.h +++ b/include/wx/mstream.h @@ -65,8 +65,8 @@ private: class WXDLLIMPEXP_BASE wxMemoryOutputStream : public wxOutputStream { public: - // if data is !NULL it must be allocated with malloc() - wxMemoryOutputStream(void *data = NULL, size_t length = 0); + // if data is not null it must be allocated with malloc() + wxMemoryOutputStream(void *data = nullptr, size_t length = 0); virtual ~wxMemoryOutputStream(); virtual wxFileOffset GetLength() const override { return m_o_streambuf->GetLastAccess(); } virtual bool IsSeekable() const override { return true; } diff --git a/include/wx/msw/anybutton.h b/include/wx/msw/anybutton.h index 26329cef3f..60a66a4990 100644 --- a/include/wx/msw/anybutton.h +++ b/include/wx/msw/anybutton.h @@ -19,9 +19,9 @@ class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase public: wxAnyButton() { - m_imageData = NULL; + m_imageData = nullptr; #if wxUSE_MARKUP - m_markupText = NULL; + m_markupText = nullptr; #endif // wxUSE_MARKUP } @@ -57,7 +57,7 @@ protected: // Increases the passed in size to account for the button image. // // Should only be called if we do have a button, i.e. if m_imageData is - // non-NULL. + // non-null. void AdjustForBitmapSize(wxSize& size) const; class wxButtonImageData *m_imageData; diff --git a/include/wx/msw/app.h b/include/wx/msw/app.h index 5ece28e3b0..66c07cb2ec 100644 --- a/include/wx/msw/app.h +++ b/include/wx/msw/app.h @@ -73,7 +73,7 @@ public: // get the name of the registered Win32 class with the given (unique) base // name: this function constructs the unique class name using this name as // prefix, checks if the class is already registered and registers it if it - // isn't and returns the name it was registered under (or NULL if it failed) + // isn't and returns the name it was registered under (or nullptr if it failed) // // the registered class will always have CS_[HV]REDRAW and CS_DBLCLKS // styles as well as any additional styles specified as arguments here; and @@ -101,7 +101,7 @@ public: // 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); + static wxLayoutDirection MSWGetDefaultLayout(wxWindow* parent = nullptr); // Call ProcessPendingEvents() but only if we need to do it, i.e. there was // a recent call to WakeUpIdle(). diff --git a/include/wx/msw/appprogress.h b/include/wx/msw/appprogress.h index 5926a3032c..87622b272e 100644 --- a/include/wx/msw/appprogress.h +++ b/include/wx/msw/appprogress.h @@ -18,7 +18,7 @@ class WXDLLIMPEXP_CORE wxAppProgressIndicator : public wxAppProgressIndicatorBase { public: - wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + wxAppProgressIndicator(wxWindow* parent = nullptr, int maxValue = 100); virtual ~wxAppProgressIndicator(); virtual bool IsAvailable() const override; diff --git a/include/wx/msw/apptrait.h b/include/wx/msw/apptrait.h index a23ed42275..f89adb9c11 100644 --- a/include/wx/msw/apptrait.h +++ b/include/wx/msw/apptrait.h @@ -30,7 +30,7 @@ public: #endif // wxUSE_THREADS virtual bool CanUseStderr() override { return true; } virtual bool WriteToStderr(const wxString& text) override; - virtual WXHWND GetMainHWND() const override { return NULL; } + virtual WXHWND GetMainHWND() const override { return nullptr; } }; #if wxUSE_GUI @@ -50,9 +50,9 @@ public: virtual bool DoMessageFromThreadWait() override; virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags) override; #endif // wxUSE_THREADS - wxPortId GetToolkitVersion(int *majVer = NULL, - int *minVer = NULL, - int *microVer = NULL) const override; + wxPortId GetToolkitVersion(int *majVer = nullptr, + int *minVer = nullptr, + int *microVer = nullptr) const override; virtual bool CanUseStderr() override; virtual bool WriteToStderr(const wxString& text) override; @@ -65,7 +65,7 @@ class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase { public: virtual wxEventLoopBase *CreateEventLoop() override; - virtual void *BeforeChildWaitLoop() override { return NULL; } + virtual void *BeforeChildWaitLoop() override { return nullptr; } virtual void AfterChildWaitLoop(void *WXUNUSED(data)) override { } #if wxUSE_TIMER virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override; @@ -81,14 +81,14 @@ public: virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) override { return DoSimpleWaitForThread(hThread); } #endif // wxUSE_THREADS - virtual wxPortId GetToolkitVersion(int *majVer = NULL, - int *minVer = NULL, - int *microVer = NULL) const override; + virtual wxPortId GetToolkitVersion(int *majVer = nullptr, + int *minVer = nullptr, + int *microVer = nullptr) const override; virtual bool CanUseStderr() override { return false; } virtual bool WriteToStderr(const wxString& WXUNUSED(text)) override { return false; } - virtual WXHWND GetMainHWND() const override { return NULL; } + virtual WXHWND GetMainHWND() const override { return nullptr; } }; #elif defined(__WXQT__) @@ -97,7 +97,7 @@ class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase { public: virtual wxEventLoopBase *CreateEventLoop() override; - virtual void *BeforeChildWaitLoop() override { return NULL; } + virtual void *BeforeChildWaitLoop() override { return nullptr; } virtual void AfterChildWaitLoop(void*) override { } #if wxUSE_TIMER virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) override; @@ -108,13 +108,13 @@ public: virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) override { return DoSimpleWaitForThread(hThread); } #endif // wxUSE_THREADS - virtual wxPortId GetToolkitVersion(int *majVer = NULL, - int *minVer = NULL, - int *microVer = NULL) const override; + virtual wxPortId GetToolkitVersion(int *majVer = nullptr, + int *minVer = nullptr, + int *microVer = nullptr) const override; virtual bool CanUseStderr() override { return false; } virtual bool WriteToStderr(const wxString&) override { return false; } - virtual WXHWND GetMainHWND() const override { return NULL; } + virtual WXHWND GetMainHWND() const override { return nullptr; } }; #endif diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index b28d559b47..9293963d34 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -159,7 +159,7 @@ public: { return CreateWithDIPSize(wxSize(width, height), scale, depth); } virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = nullptr) const; wxBitmapRefData *GetBitmapData() const { return (wxBitmapRefData *)m_refData; } @@ -203,7 +203,7 @@ public: #endif // WXWIN_COMPATIBILITY_3_0 WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } bool InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth); - void ResetHBITMAP() { InitFromHBITMAP(NULL, 0, 0, 0); } + void ResetHBITMAP() { InitFromHBITMAP(nullptr, 0, 0, 0); } void SetSelectedInto(wxDC *dc); wxDC *GetSelectedInto() const; @@ -326,7 +326,7 @@ public: virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, wxBitmapType type, - const wxPalette *palette = NULL) const; + const wxPalette *palette = nullptr) const; private: wxDECLARE_DYNAMIC_CLASS(wxBitmapHandler); diff --git a/include/wx/msw/bmpcbox.h b/include/wx/msw/bmpcbox.h index 872f09887f..a71bea42a0 100644 --- a/include/wx/msw/bmpcbox.h +++ b/include/wx/msw/bmpcbox.h @@ -35,7 +35,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr)) diff --git a/include/wx/msw/calctrl.h b/include/wx/msw/calctrl.h index 5ace14826e..676bd7e047 100644 --- a/include/wx/msw/calctrl.h +++ b/include/wx/msw/calctrl.h @@ -47,8 +47,8 @@ public: virtual void SetHoliday(size_t day) override; virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, - wxDateTime *date = NULL, - wxDateTime::WeekDay *wd = NULL) override; + wxDateTime *date = nullptr, + wxDateTime::WeekDay *wd = nullptr) override; virtual void SetWindowStyleFlag(long style) override; diff --git a/include/wx/msw/checkbox.h b/include/wx/msw/checkbox.h index 0fc9d84099..8289e6d820 100644 --- a/include/wx/msw/checkbox.h +++ b/include/wx/msw/checkbox.h @@ -57,7 +57,7 @@ public: virtual bool CanApplyThemeBorder() const override { return false; } // implementation only from now on - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; protected: virtual wxSize DoGetBestClientSize() const override; diff --git a/include/wx/msw/checklst.h b/include/wx/msw/checklst.h index ec946612cc..58c4abdba8 100644 --- a/include/wx/msw/checklst.h +++ b/include/wx/msw/checklst.h @@ -27,7 +27,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); @@ -42,7 +42,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index fd16c852b5..1dd86bfa7a 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -28,7 +28,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)) @@ -54,7 +54,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)); diff --git a/include/wx/msw/colordlg.h b/include/wx/msw/colordlg.h index 819d1b2643..30a5944db6 100644 --- a/include/wx/msw/colordlg.h +++ b/include/wx/msw/colordlg.h @@ -21,14 +21,14 @@ class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog { public: wxColourDialog() { Init(); } - wxColourDialog(wxWindow *parent, const wxColourData *data = NULL) + wxColourDialog(wxWindow *parent, const wxColourData *data = nullptr) { Init(); Create(parent, data); } - bool Create(wxWindow *parent, const wxColourData *data = NULL); + bool Create(wxWindow *parent, const wxColourData *data = nullptr); wxColourData& GetColourData() { return m_colourData; } diff --git a/include/wx/msw/combo.h b/include/wx/msw/combo.h index b472c20e62..28bc562edb 100644 --- a/include/wx/msw/combo.h +++ b/include/wx/msw/combo.h @@ -81,7 +81,7 @@ protected: protected: // Dummy method - we override all functions that call this - virtual WXHWND GetEditHWND() const override { return NULL; } + virtual WXHWND GetEditHWND() const override { return nullptr; } // customization virtual void OnResize() override; diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index 1320a7dac2..9406e515c9 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -30,7 +30,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)) @@ -60,7 +60,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); @@ -141,7 +141,7 @@ protected: virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const override; // this is the implementation of GetEditHWND() which can also be used when - // we don't have the edit control, it simply returns NULL then + // we don't have the edit control, it simply returns nullptr then // // try not to use this function unless absolutely necessary (as in the // message handling code where the edit control might not be created yet diff --git a/include/wx/msw/crashrpt.h b/include/wx/msw/crashrpt.h index f354b482c2..3788174224 100644 --- a/include/wx/msw/crashrpt.h +++ b/include/wx/msw/crashrpt.h @@ -61,7 +61,7 @@ struct WXDLLIMPEXP_BASE wxCrashContext { // initialize this object with the given information or from the current // global exception info which is only valid inside wxApp::OnFatalException - wxCrashContext(_EXCEPTION_POINTERS *ep = NULL); + wxCrashContext(_EXCEPTION_POINTERS *ep = nullptr); // get the name for this exception code wxString GetExceptionString() const; @@ -101,10 +101,10 @@ struct WXDLLIMPEXP_BASE wxCrashReport // write the exception report to the file, return true if it could be done // or false otherwise // - // if ep pointer is NULL, the global exception info which is valid only + // if ep pointer is null, the global exception info which is valid only // inside wxApp::OnFatalException() is used static bool Generate(int flags = wxCRASH_REPORT_DEFAULT, - _EXCEPTION_POINTERS *ep = NULL); + _EXCEPTION_POINTERS *ep = nullptr); // generate a crash report from outside of wxApp::OnFatalException(), this diff --git a/include/wx/msw/custombgwin.h b/include/wx/msw/custombgwin.h index 36bfe2252e..750a49f7af 100644 --- a/include/wx/msw/custombgwin.h +++ b/include/wx/msw/custombgwin.h @@ -24,7 +24,7 @@ class wxCustomBackgroundWindow : public W, public: typedef W BaseWindowClass; - wxCustomBackgroundWindow() { m_backgroundBrush = NULL; } + wxCustomBackgroundWindow() { m_backgroundBrush = nullptr; } virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush; } @@ -32,7 +32,7 @@ protected: virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) override { delete m_backgroundBrush; - m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL; + m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : nullptr; // Our transparent children should use our background if we have it, // otherwise try to restore m_inheritBgCol to some reasonable value: true diff --git a/include/wx/msw/dc.h b/include/wx/msw/dc.h index a63739e3b4..c21e913c3a 100644 --- a/include/wx/msw/dc.h +++ b/include/wx/msw/dc.h @@ -157,15 +157,15 @@ protected: void Init() { m_bOwnsDC = false; - m_hDC = NULL; + m_hDC = nullptr; - m_oldBitmap = NULL; - m_oldPen = NULL; - m_oldBrush = NULL; - m_oldFont = NULL; + m_oldBitmap = nullptr; + m_oldPen = nullptr; + m_oldBrush = nullptr; + m_oldFont = nullptr; #if wxUSE_PALETTE - m_oldPalette = NULL; + m_oldPalette = nullptr; #endif // wxUSE_PALETTE m_isClipBoxValid = false; } @@ -188,9 +188,9 @@ public: int *averageWidth) const override; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override; virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, @@ -262,7 +262,7 @@ public: wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override; virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const override { - return subrect == NULL ? GetSelectedBitmap() + return subrect == nullptr ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } @@ -349,7 +349,7 @@ public: virtual ~wxDCTempImpl() { // prevent base class dtor from freeing it - SetHDC((WXHDC)NULL); + SetHDC((WXHDC)nullptr); } virtual void DoGetSize(int *w, int *h) const override diff --git a/include/wx/msw/dcclient.h b/include/wx/msw/dcclient.h index b0f0236f79..ac29c9719d 100644 --- a/include/wx/msw/dcclient.h +++ b/include/wx/msw/dcclient.h @@ -82,7 +82,7 @@ public: static void EndPaint(wxWindow *win); protected: - // Find the DC for this window in the cache, return NULL if not found. + // Find the DC for this window in the cache, return nullptr if not found. static wxPaintDCInfo *FindInCache(wxWindow* win); wxDECLARE_CLASS(wxPaintDCImpl); diff --git a/include/wx/msw/dcmemory.h b/include/wx/msw/dcmemory.h index 37cf5321ef..177442909b 100644 --- a/include/wx/msw/dcmemory.h +++ b/include/wx/msw/dcmemory.h @@ -30,10 +30,10 @@ public: virtual void DoSelect(const wxBitmap& bitmap) override; virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const override - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} + { return subrect == nullptr ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} protected: - // create DC compatible with the given one or screen if dc == NULL + // create DC compatible with the given one or screen if dc == nullptr bool CreateCompatible(wxDC *dc); // initialize the newly created DC diff --git a/include/wx/msw/dde.h b/include/wx/msw/dde.h index 05d190a3d0..36ac5bd148 100644 --- a/include/wx/msw/dde.h +++ b/include/wx/msw/dde.h @@ -49,7 +49,7 @@ public: // implement base class pure virtual methods virtual const void *Request(const wxString& item, - size_t *size = NULL, + size_t *size = nullptr, wxIPCFormat format = wxIPC_TEXT) override; virtual bool StartAdvise(const wxString& item) override; virtual bool StopAdvise(const wxString& item) override; @@ -109,7 +109,7 @@ public: bool ValidHost(const wxString& host) override; - // Call this to make a connection. Returns NULL if cannot. + // Call this to make a connection. Returns nullptr if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) override; diff --git a/include/wx/msw/debughlp.h b/include/wx/msw/debughlp.h index 94a399cbdf..dd03ae5848 100644 --- a/include/wx/msw/debughlp.h +++ b/include/wx/msw/debughlp.h @@ -391,7 +391,7 @@ private: // dereference the given symbol, i.e. return symbol which is not a // pointer/reference any more // - // if ppData != NULL, dereference the pointer as many times as we + // if ppData != nullptr, dereference the pointer as many times as we // dereferenced the symbol // // return the tag of the dereferenced symbol diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index 610cb691d6..a0a02bf3fe 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -46,7 +46,7 @@ public: virtual ~wxDialog(); // return true if we're showing the dialog modally - virtual bool IsModal() const override { return m_modalData != NULL; } + virtual bool IsModal() const override { return m_modalData != nullptr; } // show the dialog modally and return the value passed to EndModal() virtual int ShowModal() override; @@ -81,10 +81,10 @@ private: // gripper if we have one void OnWindowCreate(wxWindowCreateEvent& event); - // gripper window for a resizable dialog, NULL if we're not resizable + // gripper window for a resizable dialog, nullptr if we're not resizable WXHWND m_hGripper; - // this pointer is non-NULL only while the modal event loop is running + // this pointer is non-null only while the modal event loop is running wxDialogModalData *m_modalData; wxDECLARE_DYNAMIC_CLASS(wxDialog); diff --git a/include/wx/msw/dib.h b/include/wx/msw/dib.h index 7ca20c444d..78be822b25 100644 --- a/include/wx/msw/dib.h +++ b/include/wx/msw/dib.h @@ -73,11 +73,11 @@ public: // 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 = NULL) const; + HBITMAP CreateDDB(HDC hdc = nullptr) const; // 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 = NULL; return hbmp; } + HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = nullptr; return hbmp; } #if defined(__WXMSW__) && wxUSE_PALETTE // create a palette for this DIB (always a trivial/default one for 24bpp) @@ -92,7 +92,7 @@ public: // --------- // return true if DIB was successfully created, false otherwise - bool IsOk() const { return m_handle != NULL; } + bool IsOk() const { return m_handle != nullptr; } // get the bitmap size wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } @@ -119,17 +119,17 @@ public: // 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) + // non null) static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, - HDC hdc = NULL, - const void *bits = NULL); + HDC hdc = nullptr, + const void *bits = nullptr); // create a plain DIB (not a DIB section) from a DDB, the caller is // responsible for freeing it using ::GlobalFree() static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); // creates a DIB from the given DDB or calculates the space needed by it: - // if pbi is NULL, only the space is calculated, otherwise pbi is supposed + // if pbi is null, only the space is calculated, otherwise pbi is supposed // to point at BITMAPINFO of the correct size which is filled by this // function (this overload is needed for wxBitmapDataObject code in // src/msw/ole/dataobj.cpp) @@ -216,7 +216,7 @@ private: // gets their values from m_handle, if not done yet void DoGetObject() const; - // pointer to DIB bits, may be NULL + // pointer to DIB bits, may be null void *m_data; // size and depth of the image @@ -242,10 +242,10 @@ private: inline void wxDIB::Init() { - m_handle = NULL; + m_handle = nullptr; m_ownsHandle = true; - m_data = NULL; + m_data = nullptr; m_width = m_height = diff --git a/include/wx/msw/dragimag.h b/include/wx/msw/dragimag.h index 2f8f20542d..4d84e2aa6a 100644 --- a/include/wx/msw/dragimag.h +++ b/include/wx/msw/dragimag.h @@ -80,7 +80,7 @@ { m_dragImage->EndDrag(this); delete m_dragImage; - m_dragImage = NULL; + m_dragImage = nullptr; } ReleaseMouse(); } @@ -174,7 +174,7 @@ public: // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. - bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = NULL); + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = false, wxRect* rect = nullptr); // Begin drag. hotspot is the location of the drag position relative to the upper-left // corner of the image. This is full screen only. fullScreenRect gives the @@ -185,7 +185,7 @@ public: bool EndDrag(); // Move the image: call from OnMouseMove. Pt is in window client coordinates if window - // is non-NULL, or in screen coordinates if NULL. + // is non-null, or in screen coordinates if null. bool Move(const wxPoint& pt); // Show the image diff --git a/include/wx/msw/enhmeta.h b/include/wx/msw/enhmeta.h index 413785f675..01db394bd2 100644 --- a/include/wx/msw/enhmeta.h +++ b/include/wx/msw/enhmeta.h @@ -40,10 +40,10 @@ public: { Free(); } // display the picture stored in the metafile on the given DC - bool Play(wxDC *dc, wxRect *rectBound = NULL); + bool Play(wxDC *dc, wxRect *rectBound = nullptr); // accessors - virtual bool IsOk() const override { return m_hMF != NULL; } + virtual bool IsOk() const override { return m_hMF != nullptr; } wxSize GetSize() const; int GetWidth() const { return GetSize().x; } @@ -59,7 +59,7 @@ public: // 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 = NULL; return h; } + WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = nullptr; return h; } // Destroy the given HENHMETAFILE object. static void Free(WXHANDLE handle); diff --git a/include/wx/msw/evtloop.h b/include/wx/msw/evtloop.h index ccb17371ff..9c40cabb2f 100644 --- a/include/wx/msw/evtloop.h +++ b/include/wx/msw/evtloop.h @@ -39,7 +39,7 @@ public: // except those to this window (and its children) stop to be processed // (typical examples: assert or crash report dialog) // - // calling this function with NULL argument restores the normal event + // calling this function with null argument restores the normal event // handling static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; } @@ -60,13 +60,13 @@ protected: private: // check if the given window is a child of ms_winCritical (which must be - // non NULL) + // non null) static bool IsChildOfCriticalWindow(wxWindowMSW *win); // array of messages used for temporary storage by YieldFor() wxMSGArray m_arrMSG; - // critical window or NULL + // critical window or nullptr static wxWindowMSW *ms_winCritical; }; diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index c0f4178869..e8761d82f7 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -65,7 +65,7 @@ public: underlined, face, encoding); } - wxFont(const wxNativeFontInfo& info, WXHFONT hFont = NULL) + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = nullptr) { Create(info, hFont); } @@ -90,7 +90,7 @@ public: encoding)); } - bool Create(const wxNativeFontInfo& info, WXHFONT hFont = NULL); + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = nullptr); virtual ~wxFont(); diff --git a/include/wx/msw/frame.h b/include/wx/msw/frame.h index 6e9ad844a9..37b26440d1 100644 --- a/include/wx/msw/frame.h +++ b/include/wx/msw/frame.h @@ -119,7 +119,7 @@ public: // // 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. + // nullptr if the initialization of taskbar button failed. wxTaskBarButton* MSWGetTaskBarButton(); #endif // wxUSE_TASKBARBUTTON @@ -163,7 +163,7 @@ protected: #endif // wxUSE_STATUSBAR #if wxUSE_MENUS - // frame menu, NULL if none + // frame menu, nullptr if none WXHMENU m_hMenu; // The number of currently opened menus: 0 initially, 1 when a top level diff --git a/include/wx/msw/gdiimage.h b/include/wx/msw/gdiimage.h index a056d0e789..cf537d1383 100644 --- a/include/wx/msw/gdiimage.h +++ b/include/wx/msw/gdiimage.h @@ -38,7 +38,7 @@ public: m_scaleFactor = 1.0; - m_handle = NULL; + m_handle = nullptr; } wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData() @@ -50,11 +50,11 @@ public: m_scaleFactor = data.m_scaleFactor; // can't copy handles like this, derived class copy ctor must do it! - m_handle = NULL; + m_handle = nullptr; } // accessors - virtual bool IsOk() const override { return m_handle != NULL; } + virtual bool IsOk() const override { return m_handle != nullptr; } void SetSize(int w, int h) { m_width = w; m_height = h; } @@ -111,7 +111,7 @@ public: // accessors WXHANDLE GetHandle() const - { return IsNull() ? NULL : GetGDIImageData()->m_handle; } + { return IsNull() ? nullptr : GetGDIImageData()->m_handle; } void SetHandle(WXHANDLE handle) { AllocExclusive(); GetGDIImageData()->m_handle = handle; } @@ -164,7 +164,7 @@ protected: { wxFAIL_MSG( wxT("must be implemented if used") ); - return NULL; + return nullptr; } static wxGDIImageHandlerList ms_handlers; diff --git a/include/wx/msw/glcanvas.h b/include/wx/msw/glcanvas.h index 0ba7cbba12..241d223d8d 100644 --- a/include/wx/msw/glcanvas.h +++ b/include/wx/msw/glcanvas.h @@ -25,8 +25,8 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: wxGLContext(wxGLCanvas *win, - const wxGLContext *other = NULL, - const wxGLContextAttrs *ctxAttrs = NULL); + const wxGLContext *other = nullptr, + const wxGLContextAttrs *ctxAttrs = nullptr); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const override; @@ -60,7 +60,7 @@ public: explicit wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -82,7 +82,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPalette& palette = wxNullPalette); virtual ~wxGLCanvas(); @@ -101,10 +101,10 @@ public: // 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); + PIXELFORMATDESCRIPTOR* ppfd = nullptr); // Same as FindMatchingPixelFormat static int ChooseMatchingPixelFormat(HDC hdc, const int *attribList, - PIXELFORMATDESCRIPTOR *pfd = NULL); + PIXELFORMATDESCRIPTOR *pfd = nullptr); #if wxUSE_PALETTE // palette stuff diff --git a/include/wx/msw/helpbest.h b/include/wx/msw/helpbest.h index cb38514567..a9f4ab1619 100644 --- a/include/wx/msw/helpbest.h +++ b/include/wx/msw/helpbest.h @@ -20,11 +20,11 @@ class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase { public: - wxBestHelpController(wxWindow* parentWindow = NULL, + wxBestHelpController(wxWindow* parentWindow = nullptr, int style = wxHF_DEFAULT_STYLE) : wxHelpControllerBase(parentWindow), m_helpControllerType(wxUseNone), - m_helpController(NULL), + m_helpController(nullptr), m_style(style) { } @@ -93,9 +93,9 @@ public: } // Obtains the latest settings used by the help frame and the help frame. - virtual wxFrame *GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newFrameEachTime = NULL) override + virtual wxFrame *GetFrameParameters(wxSize *size = nullptr, + wxPoint *pos = nullptr, + bool *newFrameEachTime = nullptr) override { return m_helpController->GetFrameParameters( size, pos, newFrameEachTime ); diff --git a/include/wx/msw/helpchm.h b/include/wx/msw/helpchm.h index eb1c3de891..bee2fad544 100644 --- a/include/wx/msw/helpchm.h +++ b/include/wx/msw/helpchm.h @@ -18,7 +18,7 @@ class WXDLLIMPEXP_CORE wxCHMHelpController : public wxHelpControllerBase { public: - wxCHMHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) { } + wxCHMHelpController(wxWindow* parentWindow = nullptr): wxHelpControllerBase(parentWindow) { } // Must call this to set the filename virtual bool Initialize(const wxString& file) override; @@ -53,7 +53,7 @@ protected: static bool CallHtmlHelp(wxWindow *win, const wxChar *str, unsigned cmd, WXWPARAM param); static bool CallHtmlHelp(wxWindow *win, const wxChar *str, - unsigned cmd, const void *param = NULL) + unsigned cmd, const void *param = nullptr) { return CallHtmlHelp(win, str, cmd, reinterpret_cast(param)); } @@ -66,13 +66,13 @@ protected: cmd, param); } - bool CallHtmlHelp(unsigned cmd, const void *param = NULL) + bool CallHtmlHelp(unsigned cmd, const void *param = nullptr) { return CallHtmlHelp(cmd, reinterpret_cast(param)); } // wrapper around CallHtmlHelp(HH_DISPLAY_TEXT_POPUP): only one of text and - // contextId parameters can be non-NULL/non-zero + // contextId parameters can be non-null/non-zero static bool DoDisplayTextPopup(const wxChar *text, const wxPoint& pos, int contextId, diff --git a/include/wx/msw/helpwin.h b/include/wx/msw/helpwin.h index 1370093bdd..67cd68d658 100644 --- a/include/wx/msw/helpwin.h +++ b/include/wx/msw/helpwin.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase wxDECLARE_DYNAMIC_CLASS(wxWinHelpController); public: - wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} + wxWinHelpController(wxWindow* parentWindow = nullptr): wxHelpControllerBase(parentWindow) {} virtual ~wxWinHelpController() {} // Must call this to set the filename diff --git a/include/wx/msw/imaglist.h b/include/wx/msw/imaglist.h index 4300609ced..c3b85ccfab 100644 --- a/include/wx/msw/imaglist.h +++ b/include/wx/msw/imaglist.h @@ -119,7 +119,7 @@ public: bool SetDragCursorImage(int index, const wxPoint& hotSpot); // If successful, returns a pointer to the temporary image list that is used for dragging; - // otherwise, NULL. + // otherwise, nullptr. // dragPos: receives the current drag position. // hotSpot: receives the offset of the drag image relative to the drag position. static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); @@ -144,7 +144,7 @@ public: // The coordinates are relative to the window's upper left corner, so you must compensate // for the widths of window elements, such as the border, title bar, and menu bar, when // specifying the coordinates. - // If lockWindow is NULL, this function draws the image in the display context associated + // If lockWindow is null, this function draws the image in the display context associated // with the desktop window, and coordinates are relative to the upper left corner of the screen. // This function locks all other updates to the given window during the drag operation. // If you need to do any drawing during a drag operation, such as highlighting the target @@ -178,7 +178,7 @@ public: // These two functions could possibly be combined into one, since DragEnter is // a bit obscure. wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position - wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen + wxImageList::DragEnter(nullptr, wxPoint(x, y)); // nullptr assumes dragging across whole screen 3) Finishing dragging: @@ -212,7 +212,7 @@ private: void Init() { - m_hImageList = NULL; + m_hImageList = nullptr; m_useMask = false; } diff --git a/include/wx/msw/init.h b/include/wx/msw/init.h index ed136f64b4..d95af0168d 100644 --- a/include/wx/msw/init.h +++ b/include/wx/msw/init.h @@ -37,14 +37,14 @@ typedef char *wxCmdLineArgType; // parameters passed to WinMain() instead of those passed to main() extern WXDLLIMPEXP_CORE bool wxEntryStart(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, + HINSTANCE hPrevInstance = nullptr, + wxCmdLineArgType pCmdLine = nullptr, int nCmdShow = SW_SHOWNORMAL); extern WXDLLIMPEXP_CORE int wxEntry(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - wxCmdLineArgType pCmdLine = NULL, + HINSTANCE hPrevInstance = nullptr, + wxCmdLineArgType pCmdLine = nullptr, int nCmdShow = SW_SHOWNORMAL); #define wxIMPLEMENT_WXWIN_MAIN \ diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index cf489e52a6..9d7391cf6e 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -41,7 +41,7 @@ public: wxListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)) @@ -66,7 +66,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 4a3362bf84..f061f78c5f 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -304,7 +304,7 @@ public: // Determines which item (if any) is at the specified point, // giving details in 'flags' (see wxLIST_HITTEST_... flags above) // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = nullptr) const; // Inserts an item, returning the index of the new item if successful, // -1 otherwise. @@ -410,7 +410,7 @@ protected: // free memory taken by all internal data void FreeAllInternalData(); - // get the internal data object for this item (may return NULL) + // get the internal data object for this item (may return nullptr) wxMSWListItemData *MSWGetItemData(long item) const; // get the item attribute, either by querying it for virtual control, or by @@ -444,7 +444,7 @@ private: // initialize the (already created) m_textCtrl with the associated HWND void InitEditControl(WXHWND hWnd); - // destroy m_textCtrl if it's currently valid and reset it to NULL + // destroy m_textCtrl if it's currently valid and reset it to nullptr void DeleteEditControl(); // Update all image lists that we have. @@ -457,7 +457,7 @@ private: // Draw the sort arrow in the header. void DrawSortArrow(); - // Object using for header custom drawing if necessary, may be NULL. + // Object using for header custom drawing if necessary, may be null. wxMSWListHeaderCustomDraw* m_headerCustomDraw; diff --git a/include/wx/msw/mdi.h b/include/wx/msw/mdi.h index 55004e9ebc..e3e4ebb895 100644 --- a/include/wx/msw/mdi.h +++ b/include/wx/msw/mdi.h @@ -65,7 +65,7 @@ public: #if wxUSE_MENUS virtual void SetWindowMenu(wxMenu* menu) override; - virtual void DoMenuUpdates(wxMenu* menu = NULL) override; + virtual void DoMenuUpdates(wxMenu* menu = nullptr) override; // return the active child menu, if any virtual WXHMENU MSWGetActiveMenu() const override; @@ -137,7 +137,7 @@ private: void OnMDIChild(wxCommandEvent& event); - // add/remove window menu if we have it (i.e. m_windowMenu != NULL) + // add/remove window menu if we have it (i.e. m_windowMenu != nullptr) void AddWindowMenu(); void RemoveWindowMenu(); diff --git a/include/wx/msw/menu.h b/include/wx/msw/menu.h index de146172de..a88e9dcecf 100644 --- a/include/wx/msw/menu.h +++ b/include/wx/msw/menu.h @@ -53,7 +53,7 @@ public: // 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; } + WXHMENU MSWDetachHMENU() { WXHMENU m = m_hMenu; m_hMenu = nullptr; return m; } // Process WM_COMMAND. virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -136,7 +136,7 @@ private: // allows to find whether an item at the given position is part of the // group and also where its group starts and ends. // - // It is initially NULL and only allocated if we have any radio items. + // It is initially nullptr and only allocated if we have any radio items. wxMenuRadioItemsData *m_radioData; // if true, insert a break before appending the next item @@ -205,12 +205,12 @@ public: WXHMENU GetHMenu() const { return m_hMenu; } // if the menubar is modified, the display is not updated automatically, - // call this function to update it (m_menuBarFrame should be !NULL) + // call this function to update it (m_menuBarFrame should be non-null) void Refresh(); // To avoid compile warning void Refresh( bool eraseBackground, - const wxRect *rect = (const wxRect *) NULL ) override { wxWindow::Refresh(eraseBackground, rect); } + const wxRect *rect = nullptr ) override { wxWindow::Refresh(eraseBackground, rect); } // Get a top level menu position or wxNOT_FOUND from its handle. int MSWGetTopMenuPos(WXHMENU hMenu) const; diff --git a/include/wx/msw/menuitem.h b/include/wx/msw/menuitem.h index fa6f8babd8..dade71afc3 100644 --- a/include/wx/msw/menuitem.h +++ b/include/wx/msw/menuitem.h @@ -32,12 +32,12 @@ class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase { public: // ctor & dtor - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& name = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); virtual ~wxMenuItem(); // override base class virtuals diff --git a/include/wx/msw/metafile.h b/include/wx/msw/metafile.h index fe1ca8f438..78e4e53c7c 100644 --- a/include/wx/msw/metafile.h +++ b/include/wx/msw/metafile.h @@ -88,9 +88,9 @@ public: virtual void SetMapMode(wxMappingMode mode) override; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; // Implementation wxMetafile *GetMetaFile() const { return m_metaFile; } diff --git a/include/wx/msw/mfc.h b/include/wx/msw/mfc.h index f357258ed0..e76701c5a3 100644 --- a/include/wx/msw/mfc.h +++ b/include/wx/msw/mfc.h @@ -81,7 +81,7 @@ public: int ExitInstance() override { delete BaseApp::m_pMainWnd; - BaseApp::m_pMainWnd = NULL; + BaseApp::m_pMainWnd = nullptr; if ( wxTheApp ) wxTheApp->OnExit(); @@ -158,7 +158,7 @@ private: event.Skip(); delete BaseApp::m_pMainWnd; - BaseApp::m_pMainWnd = NULL; + BaseApp::m_pMainWnd = nullptr; } }; diff --git a/include/wx/msw/msgdlg.h b/include/wx/msw/msgdlg.h index ac937d7c77..6bd1036f0a 100644 --- a/include/wx/msw/msgdlg.h +++ b/include/wx/msw/msgdlg.h @@ -21,7 +21,7 @@ public: const wxPoint& WXUNUSED(pos) = wxDefaultPosition) : wxMessageDialogBase(parent, message, caption, style) { - m_hook = NULL; + m_hook = nullptr; } virtual int ShowModal() override; diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 8bb965239d..dbe9531e63 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -94,7 +94,7 @@ public: void SetTabSize(const wxSize& sz) override; // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; // calculate the size of the notebook from the size of its page virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const override; @@ -132,7 +132,7 @@ public: #endif // wxUSE_UXTHEME // translate wxWin styles to the Windows ones - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; protected: // common part of all ctors diff --git a/include/wx/msw/ole/access.h b/include/wx/msw/ole/access.h index a7dcda4d10..d572b58e5d 100644 --- a/include/wx/msw/ole/access.h +++ b/include/wx/msw/ole/access.h @@ -32,7 +32,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_CORE wxAccessible : public wxAccessibleBase { public: - wxAccessible(wxWindow *win = NULL); + wxAccessible(wxWindow *win = nullptr); virtual ~wxAccessible(); // Overridables diff --git a/include/wx/msw/ole/activex.h b/include/wx/msw/ole/activex.h index c0f933c040..e5fab4b666 100644 --- a/include/wx/msw/ole/activex.h +++ b/include/wx/msw/ole/activex.h @@ -74,15 +74,15 @@ class wxAutoOleInterface public: typedef I Interface; - explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) + explicit wxAutoOleInterface(I *pInterface = nullptr) : m_interface(pInterface) {} - wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL) + wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(nullptr) { QueryInterface(riid, pUnk); } - wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL) + wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(nullptr) { QueryInterface(riid, pDispatch); } - wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL) + wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(nullptr) { CreateInstance(clsid, riid); } - wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(NULL) + wxAutoOleInterface(const wxAutoOleInterface& ti) : m_interface(nullptr) { operator=(ti); } wxAutoOleInterface& operator=(const wxAutoOleInterface& ti) @@ -107,13 +107,13 @@ public: { if ( m_interface ) m_interface->Release(); - m_interface = NULL; + m_interface = nullptr; } HRESULT QueryInterface(REFIID riid, IUnknown *pUnk) { Free(); - wxASSERT(pUnk != NULL); + wxASSERT(pUnk != nullptr); return pUnk->QueryInterface(riid, (void **)&m_interface); } @@ -123,7 +123,7 @@ public: return CoCreateInstance ( clsid, - NULL, + nullptr, CLSCTX_ALL, riid, (void **)&m_interface @@ -134,7 +134,7 @@ public: I* operator->() {return m_interface; } I** GetRef() {return &m_interface; } bool Ok() const { return IsOk(); } - bool IsOk() const { return m_interface != NULL; } + bool IsOk() const { return m_interface != nullptr; } protected: I *m_interface; @@ -248,7 +248,7 @@ typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&); #define wxActiveXEventHandler(func) \ wxEVENT_HANDLER_CAST( wxActiveXEventFunction, func ) -#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), NULL ), +#define EVT_ACTIVEX(id, fn) wxDECLARE_EVENT_TABLE_ENTRY(wxEVT_ACTIVEX, id, -1, wxActiveXEventHandler( fn ), nullptr ), #endif // wxUSE_ACTIVEX diff --git a/include/wx/msw/ole/automtn.h b/include/wx/msw/ole/automtn.h index 250aaefdd2..bbab938719 100644 --- a/include/wx/msw/ole/automtn.h +++ b/include/wx/msw/ole/automtn.h @@ -48,13 +48,13 @@ enum wxAutomationInstanceFlags class WXDLLIMPEXP_CORE wxAutomationObject: public wxObject { public: - wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); + wxAutomationObject(WXIDISPATCH* dispatchPtr = nullptr); virtual ~wxAutomationObject(); // Set/get dispatch pointer void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; } WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; } - bool IsOk() const { return m_dispatchPtr != NULL; } + bool IsOk() const { return m_dispatchPtr != nullptr; } // Get a dispatch pointer from the current object associated // with a ProgID, such as "Excel.Application" @@ -67,7 +67,7 @@ public: // Low-level invocation function. Pass either an array of variants, // or an array of pointers to variants. bool Invoke(const wxString& member, int action, - wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = NULL) const; + wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = nullptr) const; // Invoke a member function wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); @@ -80,7 +80,7 @@ public: const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant); // Get/Put property - wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = nullptr) const; wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const; wxVariant GetProperty(const wxString& property, const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant, @@ -103,7 +103,7 @@ public: // A way of initialising another wxAutomationObject with a dispatch object, // without having to deal with nasty IDispatch pointers. - bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const; + bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = nullptr) const; bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const; // Returns the locale identifier used in automation calls. The default is diff --git a/include/wx/msw/ole/comimpl.h b/include/wx/msw/ole/comimpl.h index 731f8035c6..213edc0bfd 100644 --- a/include/wx/msw/ole/comimpl.h +++ b/include/wx/msw/ole/comimpl.h @@ -21,15 +21,15 @@ // General purpose functions and macros // ============================================================================ -// release the interface pointer (if !NULL) +// release the interface pointer (if non-null) inline void ReleaseInterface(IUnknown *pIUnk) { - if ( pIUnk != NULL ) + if ( pIUnk != nullptr ) pIUnk->Release(); } -// release the interface pointer (if !NULL) and make it NULL -#define RELEASE_AND_NULL(p) if ( (p) != NULL ) { p->Release(); p = NULL; }; +// release the interface pointer (if non-null) and set it to nullptr +#define RELEASE_AND_NULL(p) if ( (p) != nullptr ) { p->Release(); p = nullptr; }; // return true if the iid is in the array extern WXDLLIMPEXP_CORE bool IsIidFromList(REFIID riid, const IID *aIids[], size_t nCount); @@ -113,7 +113,7 @@ private: return S_OK; \ } \ else { \ - *ppv = NULL; \ + *ppv = nullptr; \ \ return (HRESULT) E_NOINTERFACE; \ } \ diff --git a/include/wx/msw/ole/dataobj2.h b/include/wx/msw/ole/dataobj2.h index 248568df62..23f57dced7 100644 --- a/include/wx/msw/ole/dataobj2.h +++ b/include/wx/msw/ole/dataobj2.h @@ -29,7 +29,7 @@ public: { SetFormat(wxDF_DIB); - m_data = NULL; + m_data = nullptr; } // implement base class pure virtuals diff --git a/include/wx/msw/ole/dropsrc.h b/include/wx/msw/ole/dropsrc.h index 52271b448e..6a27b90202 100644 --- a/include/wx/msw/ole/dropsrc.h +++ b/include/wx/msw/ole/dropsrc.h @@ -43,12 +43,12 @@ public: // // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK // compatibility, as well as both icon parameters - wxDropSource(wxWindow *win = NULL, + wxDropSource(wxWindow *win = nullptr, const wxCursor &cursorCopy = wxNullCursor, const wxCursor &cursorMove = wxNullCursor, const wxCursor &cursorStop = wxNullCursor); wxDropSource(wxDataObject& data, - wxWindow *win = NULL, + wxWindow *win = nullptr, const wxCursor &cursorCopy = wxNullCursor, const wxCursor &cursorMove = wxNullCursor, const wxCursor &cursorStop = wxNullCursor); diff --git a/include/wx/msw/ole/droptgt.h b/include/wx/msw/ole/droptgt.h index 6dd6ac2055..554c9254ba 100644 --- a/include/wx/msw/ole/droptgt.h +++ b/include/wx/msw/ole/droptgt.h @@ -35,7 +35,7 @@ class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase { public: // ctor & dtor - wxDropTarget(wxDataObject *dataObject = NULL); + wxDropTarget(wxDataObject *dataObject = nullptr); virtual ~wxDropTarget(); // normally called by wxWindow on window creation/destruction, but might be diff --git a/include/wx/msw/ole/oleutils.h b/include/wx/msw/ole/oleutils.h index 2393e74d2c..435e734e69 100644 --- a/include/wx/msw/ole/oleutils.h +++ b/include/wx/msw/ole/oleutils.h @@ -39,7 +39,7 @@ inline bool wxOleInitialize() { const HRESULT - hr = ::OleInitialize(NULL); + hr = ::OleInitialize(nullptr); // 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 @@ -66,8 +66,8 @@ inline void wxOleUninitialize() class WXDLLIMPEXP_CORE wxBasicString { public: - // Constructs with the owned BSTR set to NULL - wxBasicString() : m_bstrBuf(NULL) {} + // Constructs with the owned BSTR set to nullptr + wxBasicString() : m_bstrBuf(nullptr) {} // Constructs with the owned BSTR created from a wxString wxBasicString(const wxString& str) @@ -91,7 +91,7 @@ public: BSTR Copy() const { return SysAllocString(m_bstrBuf); } // Returns the address of the owned BSTR, not to be called - // when wxBasicString already contains a non-NULL BSTR + // when wxBasicString already contains a non-null BSTR BSTR* ByRef(); // Sets its BSTR to a copy of the BSTR owned by bstr @@ -168,7 +168,7 @@ private: class WXDLLIMPEXP_CORE wxVariantDataSafeArray : public wxVariantData { public: - explicit wxVariantDataSafeArray(SAFEARRAY* value = NULL) + explicit wxVariantDataSafeArray(SAFEARRAY* value = nullptr) { m_value = value; } diff --git a/include/wx/msw/ole/safearray.h b/include/wx/msw/ole/safearray.h index 02d052d54f..01a027622d 100644 --- a/include/wx/msw/ole/safearray.h +++ b/include/wx/msw/ole/safearray.h @@ -35,7 +35,7 @@ public: SAFEARRAY* Detach(); // Returns true if has a valid SAFEARRAY. - bool HasArray() const { return m_array != NULL; } + bool HasArray() const { return m_array != nullptr; } // Returns the number of dimensions. size_t GetDim() const; @@ -54,7 +54,7 @@ protected: // it's only used as a base class of wxSafeArray<>. wxSafeArrayBase() { - m_array = NULL; + m_array = nullptr; } bool Lock(); @@ -113,7 +113,7 @@ struct wxSafeArrayConvertor if ( !bstr && !from.empty() ) { - // BSTR can be NULL for empty strings but if the string was + // BSTR can be null for empty strings but if the string was // not empty, it means we failed to allocate memory for it. return false; } @@ -158,7 +158,7 @@ public: // Default constructor. wxSafeArray() { - m_array = NULL; + m_array = nullptr; } // Creates and locks a zero-based one-dimensional SAFEARRAY with the given diff --git a/include/wx/msw/ole/uuid.h b/include/wx/msw/ole/uuid.h index c712b79dd2..dd1544489e 100644 --- a/include/wx/msw/ole/uuid.h +++ b/include/wx/msw/ole/uuid.h @@ -51,7 +51,7 @@ private: void UuidToCForm(); // function used to set initial state by all ctors - void Init() { m_pszUuid = NULL; m_pszCForm = NULL; } + void Init() { m_pszUuid = nullptr; m_pszCForm = nullptr; } public: // ctors & dtor diff --git a/include/wx/msw/ownerdrawnbutton.h b/include/wx/msw/ownerdrawnbutton.h index 725f050bee..0e49439f42 100644 --- a/include/wx/msw/ownerdrawnbutton.h +++ b/include/wx/msw/ownerdrawnbutton.h @@ -24,7 +24,7 @@ class WXDLLIMPEXP_CORE wxMSWOwnerDrawnButtonBase { protected: - // Ctor takes the back pointer to the real window, must be non-NULL. + // Ctor takes the back pointer to the real window, must be non-null. wxMSWOwnerDrawnButtonBase(wxWindow* win) : m_win(win) { diff --git a/include/wx/msw/popupwin.h b/include/wx/msw/popupwin.h index 9cd329c6fd..df31fe77c1 100644 --- a/include/wx/msw/popupwin.h +++ b/include/wx/msw/popupwin.h @@ -18,7 +18,7 @@ class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase { public: - wxPopupWindow() { m_owner = NULL; } + wxPopupWindow() { m_owner = nullptr; } wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) { (void)Create(parent, flags); } diff --git a/include/wx/msw/printdlg.h b/include/wx/msw/printdlg.h index da9c5d486e..b379edf2d5 100644 --- a/include/wx/msw/printdlg.h +++ b/include/wx/msw/printdlg.h @@ -37,7 +37,7 @@ public: virtual bool Ok() const override { return IsOk(); } virtual bool IsOk() const override; - void InitializeDevMode(const wxString &printerName = wxEmptyString, WinPrinter* printer = NULL); + void InitializeDevMode(const wxString &printerName = wxEmptyString, WinPrinter* printer = nullptr); void* GetDevMode() const { return m_devMode; } void SetDevMode(void* data) { m_devMode = data; } void* GetDevNames() const { return m_devNames; } @@ -60,11 +60,11 @@ private: class WXDLLIMPEXP_CORE wxWindowsPrintDialog : public wxPrintDialogBase { public: - wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = nullptr); wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data); virtual ~wxWindowsPrintDialog(); - bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + bool Create(wxWindow *parent, wxPrintDialogData* data = nullptr); virtual int ShowModal() override; wxPrintDialogData& GetPrintDialogData() override { return m_printDialogData; } @@ -98,10 +98,10 @@ class WXDLLIMPEXP_CORE wxWindowsPageSetupDialog: public wxPageSetupDialogBase { public: wxWindowsPageSetupDialog(); - wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual ~wxWindowsPageSetupDialog(); - bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + bool Create(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual int ShowModal() override; bool ConvertToNative( wxPageSetupDialogData &data ); bool ConvertFromNative( wxPageSetupDialogData &data ); diff --git a/include/wx/msw/printwin.h b/include/wx/msw/printwin.h index 8249a03ede..e4667a9337 100644 --- a/include/wx/msw/printwin.h +++ b/include/wx/msw/printwin.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_CORE wxWindowsPrinter : public wxPrinterBase wxDECLARE_DYNAMIC_CLASS(wxWindowsPrinter); public: - wxWindowsPrinter(wxPrintDialogData *data = NULL); + wxWindowsPrinter(wxPrintDialogData *data = nullptr); virtual bool Print(wxWindow *parent, wxPrintout *printout, @@ -44,8 +44,8 @@ class WXDLLIMPEXP_CORE wxWindowsPrintPreview : public wxPrintPreviewBase { public: wxWindowsPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxWindowsPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index a1cd37ed21..7109a83fa4 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -35,7 +35,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase; #endif // Many MSW functions have parameters which are "reserved". Passing them this -// constant is more clear than just using "0" or "NULL". +// constant is more clear than just using "0" or "nullptr". #define wxRESERVED_PARAM 0 // --------------------------------------------------------------------------- @@ -426,8 +426,8 @@ private: class ScreenHDC { public: - ScreenHDC() { m_hdc = ::GetDC(NULL); } - ~ScreenHDC() { ::ReleaseDC(NULL, m_hdc); } + ScreenHDC() { m_hdc = ::GetDC(nullptr); } + ~ScreenHDC() { ::ReleaseDC(nullptr, m_hdc); } operator HDC() const { return m_hdc; } @@ -437,12 +437,12 @@ private: wxDECLARE_NO_COPY_CLASS(ScreenHDC); }; -// the same as ScreenHDC but for window DCs (and if HWND is NULL, then exactly +// the same as ScreenHDC but for window DCs (and if HWND is null, then exactly // the same as it) class WindowHDC { public: - WindowHDC() : m_hwnd(NULL), m_hdc(NULL) { } + WindowHDC() : m_hwnd(nullptr), m_hdc(nullptr) { } WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); } ~WindowHDC() { if ( m_hdc ) { ::ReleaseDC(m_hwnd, m_hdc); } } @@ -460,7 +460,7 @@ private: class MemoryHDC { public: - MemoryHDC(HDC hdc = NULL) { m_hdc = ::CreateCompatibleDC(hdc); } + MemoryHDC(HDC hdc = nullptr) { m_hdc = ::CreateCompatibleDC(hdc); } ~MemoryHDC() { ::DeleteDC(m_hdc); } operator HDC() const { return m_hdc; } @@ -486,7 +486,7 @@ private: void DoInit(HGDIOBJ hgdiobj) { m_hgdiobj = ::SelectObject(m_hdc, hgdiobj); } public: - SelectInHDC() : m_hdc(NULL), m_hgdiobj(NULL) { } + SelectInHDC() : m_hdc(nullptr), m_hgdiobj(nullptr) { } SelectInHDC(HDC hdc, HGDIOBJ hgdiobj) : m_hdc(hdc) { DoInit(hgdiobj); } void Init(HDC hdc, HGDIOBJ hgdiobj) @@ -501,7 +501,7 @@ public: ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } // return true if the object was successfully selected - operator bool() const { return m_hgdiobj != NULL; } + operator bool() const { return m_hgdiobj != nullptr; } private: HDC m_hdc; @@ -514,7 +514,7 @@ private: class AutoGDIObject { protected: - AutoGDIObject() { m_gdiobj = NULL; } + AutoGDIObject() { m_gdiobj = nullptr; } AutoGDIObject(HGDIOBJ gdiobj) : m_gdiobj(gdiobj) { } ~AutoGDIObject() { if ( m_gdiobj ) ::DeleteObject(m_gdiobj); } @@ -596,7 +596,7 @@ class MonoBitmap : public AutoHBITMAP { public: MonoBitmap(int w, int h) - : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, NULL)) + : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, nullptr)) { } }; @@ -652,7 +652,7 @@ public: ~HDCClipper() { - ::SelectClipRgn(m_hdc, NULL); + ::SelectClipRgn(m_hdc, nullptr); } private: @@ -698,7 +698,7 @@ public: // default ctor, call Init() later GlobalPtr() { - m_hGlobal = NULL; + m_hGlobal = nullptr; } // allocates a block of given size @@ -728,7 +728,7 @@ public: HGLOBAL Release() { HGLOBAL h = m_hGlobal; - m_hGlobal = NULL; + m_hGlobal = nullptr; return h; } @@ -748,15 +748,15 @@ class GlobalPtrLock { public: // default ctor, use Init() later -- should only be used if the HGLOBAL can - // be NULL (in which case Init() shouldn't be called) + // be null (in which case Init() shouldn't be called) GlobalPtrLock() { - m_hGlobal = NULL; - m_ptr = NULL; + m_hGlobal = nullptr; + m_ptr = nullptr; } // initialize the object, may be only called if we were created using the - // default ctor; HGLOBAL must not be NULL + // default ctor; HGLOBAL must not be null void Init(HGLOBAL hGlobal) { m_hGlobal = hGlobal; @@ -770,7 +770,7 @@ public: } } - // initialize the object, HGLOBAL must not be NULL + // initialize the object, HGLOBAL must not be null GlobalPtrLock(HGLOBAL hGlobal) { Init(hGlobal); @@ -1042,7 +1042,7 @@ extern WXDLLIMPEXP_CORE int wxGetWindowId(WXHWND hWnd); // // wndProc parameter is unused and only kept for compatibility extern WXDLLIMPEXP_CORE -bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC wndProc = NULL); +bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC wndProc = nullptr); // Does this window style specify any border? inline bool wxStyleHasBorder(long style) @@ -1134,14 +1134,14 @@ inline wxLayoutDirection wxGetEditLayoutDirection(WXHWND hWnd) // ---------------------------------------------------------------------------- // this function simply checks whether the given hwnd corresponds to a wxWindow -// and returns either that window if it does or NULL otherwise +// and returns either that window if it does or nullptr otherwise extern WXDLLIMPEXP_CORE wxWindow* wxFindWinFromHandle(HWND hwnd); // find the window for HWND which is part of some wxWindow, i.e. unlike // wxFindWinFromHandle() above it will also work for "sub controls" of a // wxWindow. // -// returns the wxWindow corresponding to the given HWND or NULL. +// returns the wxWindow corresponding to the given HWND or nullptr. extern WXDLLIMPEXP_CORE wxWindow *wxGetWindowFromHWND(WXHWND hwnd); // Get the size of an icon diff --git a/include/wx/msw/private/comptr.h b/include/wx/msw/private/comptr.h index db8c9bcf95..ef0d826e9d 100644 --- a/include/wx/msw/private/comptr.h +++ b/include/wx/msw/private/comptr.h @@ -21,7 +21,7 @@ public: typedef T element_type; wxCOMPtr() - : m_ptr(NULL) + : m_ptr(nullptr) { } @@ -45,7 +45,7 @@ public: m_ptr->Release(); } - void reset(T* ptr = NULL) + void reset(T* ptr = nullptr) { if ( m_ptr != ptr) { diff --git a/include/wx/msw/private/comstream.h b/include/wx/msw/private/comstream.h index 96dbc31fc3..f5b628c44d 100644 --- a/include/wx/msw/private/comstream.h +++ b/include/wx/msw/private/comstream.h @@ -33,7 +33,7 @@ public: return S_OK; } - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } diff --git a/include/wx/msw/private/cotaskmemptr.h b/include/wx/msw/private/cotaskmemptr.h index 96d54c42ed..90a1c07195 100644 --- a/include/wx/msw/private/cotaskmemptr.h +++ b/include/wx/msw/private/cotaskmemptr.h @@ -24,7 +24,7 @@ public: typedef T element_type; wxCoTaskMemPtr() - : m_ptr(NULL) + : m_ptr(nullptr) {} explicit wxCoTaskMemPtr(T* ptr) @@ -41,7 +41,7 @@ public: ::CoTaskMemFree(m_ptr); } - void reset(T* ptr = NULL) + void reset(T* ptr = nullptr) { if ( m_ptr != ptr ) { @@ -72,7 +72,7 @@ public: { T* ptr(m_ptr); - m_ptr = NULL; + m_ptr = nullptr; return ptr; } diff --git a/include/wx/msw/private/customdraw.h b/include/wx/msw/private/customdraw.h index 3d2a10f19e..05bd9b1192 100644 --- a/include/wx/msw/private/customdraw.h +++ b/include/wx/msw/private/customdraw.h @@ -42,7 +42,7 @@ private: // Return true if we need custom drawing at all. virtual bool HasCustomDrawnItems() const = 0; - // Return the attribute to use for the given item, can return NULL if this + // Return the attribute to use for the given item, can return nullptr if this // item doesn't need to be custom-drawn. virtual const wxItemAttr* GetItemAttr(DWORD_PTR dwItemSpec) const = 0; diff --git a/include/wx/msw/private/event.h b/include/wx/msw/private/event.h index 27825e49a7..b163531764 100644 --- a/include/wx/msw/private/event.h +++ b/include/wx/msw/private/event.h @@ -38,7 +38,7 @@ public: // the same semantics. bool Create(Kind kind = AutomaticReset, InitialState initialState = Nonsignaled, - const wxChar* name = NULL); + const wxChar* name = nullptr); bool Set(); bool Reset(); @@ -61,7 +61,7 @@ wxWinAPI::Event::Create(wxWinAPI::Event::Kind kind, { wxCHECK_MSG( !IsOk(), false, wxS("Event can't be created twice") ); - WXHANDLE handle = ::CreateEvent(NULL, + WXHANDLE handle = ::CreateEvent(nullptr, kind == ManualReset, initialState == Signaled, name); diff --git a/include/wx/msw/private/filedialog.h b/include/wx/msw/private/filedialog.h index 72f48a5134..c803d1e9f0 100644 --- a/include/wx/msw/private/filedialog.h +++ b/include/wx/msw/private/filedialog.h @@ -47,7 +47,7 @@ public: explicit wxIFileDialog(const CLSID& clsid); // If this returns false, the dialog can't be used at all. - bool IsOk() const { return m_fileDialog.Get() != NULL; } + bool IsOk() const { return m_fileDialog.Get() != nullptr; } // Set the dialog title. void SetTitle(const wxString& title); diff --git a/include/wx/msw/private/fswatcher.h b/include/wx/msw/private/fswatcher.h index 508f8ada90..5d2e6f86a3 100644 --- a/include/wx/msw/private/fswatcher.h +++ b/include/wx/msw/private/fswatcher.h @@ -82,11 +82,11 @@ private: FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, + nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, - NULL); + nullptr); if (handle == INVALID_HANDLE_VALUE) { wxLogSysError(_("Failed to open directory \"%s\" for monitoring."), @@ -137,7 +137,7 @@ public: // associate with IOCP HANDLE ret = CreateIoCompletionPort(watch->GetHandle(), m_iocp, (ULONG_PTR)watch.get(), 0); - if (ret == NULL) + if (ret == nullptr) { wxLogSysError(_("Unable to associate handle with " "I/O completion port")); @@ -207,7 +207,7 @@ public: wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); // The special values of 0 will make GetStatus() return Status_Exit. - const int ret = PostQueuedCompletionStatus(m_iocp, 0, 0, NULL); + const int ret = PostQueuedCompletionStatus(m_iocp, 0, 0, nullptr); if (!ret) { wxLogSysError(_("Unable to post completion status")); @@ -242,7 +242,7 @@ public: 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" ); + "Output parameters can't be null" ); const int ret = GetQueuedCompletionStatus(m_iocp, count, (ULONG_PTR *)watch, overlapped, INFINITE); @@ -267,12 +267,12 @@ public: protected: bool Init() { - m_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0); - if (m_iocp == NULL) + m_iocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 0); + if (m_iocp == nullptr) { wxLogSysError(_("Unable to create I/O completion port")); } - return m_iocp != NULL; + return m_iocp != nullptr; } HANDLE m_iocp; diff --git a/include/wx/msw/private/hiddenwin.h b/include/wx/msw/private/hiddenwin.h index 3b52b60983..66e154ab2d 100644 --- a/include/wx/msw/private/hiddenwin.h +++ b/include/wx/msw/private/hiddenwin.h @@ -21,7 +21,7 @@ Windows class unregistration). pclassname is a pointer to a caller stored classname, which must initially be - NULL. classname is the desired wndclass classname. If function successfully + nullptr. classname is the desired wndclass classname. If function successfully registers the class, pclassname will be set to classname. */ extern "C" WXDLLIMPEXP_BASE HWND diff --git a/include/wx/msw/private/keyboard.h b/include/wx/msw/private/keyboard.h index 002303e967..9e85921d45 100644 --- a/include/wx/msw/private/keyboard.h +++ b/include/wx/msw/private/keyboard.h @@ -29,12 +29,12 @@ namespace wxMSWKeyboard // for dead keys and in this case uc will be WXK_NONE too) or if the key // corresponds to a non-Latin-1 character in which case uc is filled with its // Unicode value. -WXDLLIMPEXP_CORE int VKToWX(WXWORD vk, WXLPARAM lParam = 0, wchar_t *uc = NULL); +WXDLLIMPEXP_CORE int VKToWX(WXWORD vk, WXLPARAM lParam = 0, wchar_t *uc = nullptr); // Translate wxKeyCode enum element (passed as int for compatibility reasons) // to MSW virtual key code. isExtended is set to true if the key corresponds to // a non-numpad version of a key that exists both on numpad and outside it. -WXDLLIMPEXP_CORE WXWORD WXToVK(int id, bool *isExtended = NULL); +WXDLLIMPEXP_CORE WXWORD WXToVK(int id, bool *isExtended = nullptr); } // namespace wxMSWKeyboard diff --git a/include/wx/msw/private/msgdlg.h b/include/wx/msw/private/msgdlg.h index cb56df484b..93b5e80d35 100644 --- a/include/wx/msw/private/msgdlg.h +++ b/include/wx/msw/private/msgdlg.h @@ -33,7 +33,7 @@ namespace wxMSWMessageDialog wxMSWTaskDialogConfig() : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS]), - parent(NULL), + parent(nullptr), iconId(0), style(0), useCustomLabels(false) diff --git a/include/wx/msw/private/textmeasure.h b/include/wx/msw/private/textmeasure.h index bd6ce2c0ed..13bd033030 100644 --- a/include/wx/msw/private/textmeasure.h +++ b/include/wx/msw/private/textmeasure.h @@ -19,13 +19,13 @@ class wxTextMeasure : public wxTextMeasureBase { public: - explicit wxTextMeasure(const wxDC *dc, const wxFont *font = NULL) + explicit wxTextMeasure(const wxDC *dc, const wxFont *font = nullptr) : wxTextMeasureBase(dc, font) { Init(); } - explicit wxTextMeasure(const wxWindow *win, const wxFont *font = NULL) + explicit wxTextMeasure(const wxWindow *win, const wxFont *font = nullptr) : wxTextMeasureBase(win, font) { Init(); @@ -40,8 +40,8 @@ protected: virtual void DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL) override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr) override; virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths, diff --git a/include/wx/msw/private/webview_ie.h b/include/wx/msw/private/webview_ie.h index e4e465fd91..3259d7a31d 100644 --- a/include/wx/msw/private/webview_ie.h +++ b/include/wx/msw/private/webview_ie.h @@ -161,7 +161,7 @@ private: class wxIEContainer : public wxActiveXContainer { public: - wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk, DocHostUIHandler* uiHandler = NULL); + wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk, DocHostUIHandler* uiHandler = nullptr); virtual ~wxIEContainer(); virtual bool QueryClientSiteInterface(REFIID iid, void **_interface, const char *&desc) override; private: diff --git a/include/wx/msw/progdlg.h b/include/wx/msw/progdlg.h index a375935799..ff70212885 100644 --- a/include/wx/msw/progdlg.h +++ b/include/wx/msw/progdlg.h @@ -18,13 +18,13 @@ class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog public: wxProgressDialog(const wxString& title, const wxString& message, int maximum = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE); virtual ~wxProgressDialog(); - virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL) override; - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL) override; + virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = nullptr) override; + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = nullptr) override; virtual void Resume() override; diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 5262ef88ad..9b6356650f 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -29,7 +29,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, @@ -65,7 +65,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, @@ -126,7 +126,7 @@ public: // ------------------------------- // This function can be used to check if the given radio button HWND - // belongs to one of our radio boxes. If it doesn't, NULL is returned. + // belongs to one of our radio boxes. If it doesn't, nullptr is returned. static wxRadioBox *GetFromRadioButtonHWND(WXHWND hwnd); virtual bool MSWCommand(WXUINT param, WXWORD id) override; diff --git a/include/wx/msw/registry.h b/include/wx/msw/registry.h index 482f49f05c..abfedfe7cb 100644 --- a/include/wx/msw/registry.h +++ b/include/wx/msw/registry.h @@ -131,13 +131,13 @@ public: WOW64ViewMode GetView() const { return m_viewMode; } // return true if the key exists bool Exists() const; - // get the info about key (any number of these pointers may be NULL) + // 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 length of subkey name size_t *pnValues, // number of values size_t *pnMaxValueLen) const; // return true if the key is opened - bool IsOpened() const { return m_hKey != NULL; } + bool IsOpened() const { return m_hKey != nullptr; } // for "if ( !key ) wxLogError(...)" kind of expressions operator bool() const { return m_dwLastError == 0; } @@ -248,7 +248,7 @@ private: // common part of all ctors void Init() { - m_hKey = (WXHKEY) NULL; + m_hKey = (WXHKEY) nullptr; m_dwLastError = 0; } diff --git a/include/wx/msw/slider.h b/include/wx/msw/slider.h index 94a28e7a38..63715f6337 100644 --- a/include/wx/msw/slider.h +++ b/include/wx/msw/slider.h @@ -94,7 +94,7 @@ public: virtual bool SetForegroundColour(const wxColour& colour) override; virtual bool SetBackgroundColour(const wxColour& colour) override; - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; protected: // common part of all ctors @@ -106,12 +106,12 @@ protected: // get the boundig box for the slider and possible labels wxRect GetBoundingBox() const; - // Get the height and, if the pointers are non NULL, widths of both labels. + // Get the height and, if the pointers are non null, widths of both labels. // // Notice that the return value will be 0 if we don't have wxSL_LABELS // style but we do fill widthMin and widthMax even if we don't have // wxSL_MIN_MAX_LABELS style set so the caller should account for it. - int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const; + int GetLabelsSize(int *widthMin = nullptr, int *widthMax = nullptr) const; // overridden base class virtuals diff --git a/include/wx/msw/sound.h b/include/wx/msw/sound.h index 4577ddf7e2..18770d8e03 100644 --- a/include/wx/msw/sound.h +++ b/include/wx/msw/sound.h @@ -27,12 +27,12 @@ public: // Create from data bool Create(size_t size, const void* data); - bool IsOk() const { return m_data != NULL; } + bool IsOk() const { return m_data != nullptr; } static void Stop(); protected: - void Init() { m_data = NULL; } + void Init() { m_data = nullptr; } bool CheckCreatedOk(); void Free(); diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 19f2e66880..f508cfa48d 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -67,7 +67,7 @@ public: virtual bool SetBase(int base); virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = nullptr ) override; // implementation only from now on // ------------------------------- @@ -104,7 +104,7 @@ public: // get the subclassed window proc of the buddy text WXWNDPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - // return the spinctrl object whose buddy is the given window or NULL + // return the spinctrl object whose buddy is the given window or nullptr static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); // process a WM_COMMAND generated by the buddy text control diff --git a/include/wx/msw/stackwalk.h b/include/wx/msw/stackwalk.h index 830c91f7ec..47b4e21e29 100644 --- a/include/wx/msw/stackwalk.h +++ b/include/wx/msw/stackwalk.h @@ -94,7 +94,7 @@ class WXDLLIMPEXP_BASE wxStackWalker : public wxStackWalkerBase public: // we don't use ctor argument, it is for compatibility with Unix version // only - wxStackWalker(const char * WXUNUSED(argv0) = NULL) { } + wxStackWalker(const char * WXUNUSED(argv0) = nullptr) { } virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) override; #if wxUSE_ON_FATAL_EXCEPTION diff --git a/include/wx/msw/stattext.h b/include/wx/msw/stattext.h index ffd34d62e0..cabc8491b9 100644 --- a/include/wx/msw/stattext.h +++ b/include/wx/msw/stattext.h @@ -39,7 +39,7 @@ public: virtual void SetLabel(const wxString& label) override; virtual bool SetFont( const wxFont &font ) override; - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; protected: // implement/override some base class virtuals diff --git a/include/wx/msw/statusbar.h b/include/wx/msw/statusbar.h index ffe012b8a1..f314d8ca7e 100644 --- a/include/wx/msw/statusbar.h +++ b/include/wx/msw/statusbar.h @@ -28,7 +28,7 @@ public: long style = wxSTB_DEFAULT_STYLE, const wxString& name = wxASCII_STR(wxStatusBarNameStr)) { - m_pDC = NULL; + m_pDC = nullptr; (void)Create(parent, id, style, name); } @@ -40,7 +40,7 @@ public: virtual ~wxStatusBar(); // implement base class methods - virtual void SetFieldsCount(int number = 1, const int *widths = NULL) override; + virtual void SetFieldsCount(int number = 1, const int *widths = nullptr) override; virtual void SetStatusWidths(int n, const int widths_field[]) override; virtual void SetStatusStyles(int n, const int styles[]) override; virtual void SetMinHeight(int height) override; @@ -61,7 +61,7 @@ protected: virtual void DoUpdateStatusText(int number) override; // override some base class virtuals - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; virtual wxSize DoGetBestSize() const override; virtual void DoMoveWindow(int x, int y, int width, int height) override; #if wxUSE_TOOLTIPS diff --git a/include/wx/msw/subwin.h b/include/wx/msw/subwin.h index 038bf303f0..e364ddd0b2 100644 --- a/include/wx/msw/subwin.h +++ b/include/wx/msw/subwin.h @@ -120,7 +120,7 @@ public: wxSetWindowFont(m_hwnds[n], font); // otherwise the window might not be redrawn correctly - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + ::InvalidateRect(m_hwnds[n], nullptr, FALSE /* don't erase bg */); } } } @@ -132,7 +132,7 @@ public: { if ( m_hwnds[n] ) { - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + ::InvalidateRect(m_hwnds[n], nullptr, FALSE /* don't erase bg */); } } } @@ -160,8 +160,8 @@ private: void Init() { m_count = 0; - m_hwnds = NULL; - m_ids = NULL; + m_hwnds = nullptr; + m_ids = nullptr; } // number of elements in m_hwnds array diff --git a/include/wx/msw/textentry.h b/include/wx/msw/textentry.h index 9b570c53f2..7d36a19b38 100644 --- a/include/wx/msw/textentry.h +++ b/include/wx/msw/textentry.h @@ -108,7 +108,7 @@ private: virtual void MSWProcessSpecialKey(wxKeyEvent& event); // Check if we really have auto-complete data. This is not the same as just - // checking if m_autoCompleteData is NULL, see the code for more details. + // checking if m_autoCompleteData is null, see the code for more details. bool MSWHasAutoCompleteData() const; // Check that we have auto-complete data, creating it if necessary. Returns diff --git a/include/wx/msw/tglbtn.h b/include/wx/msw/tglbtn.h index 1bf1988a43..53055dc773 100644 --- a/include/wx/msw/tglbtn.h +++ b/include/wx/msw/tglbtn.h @@ -52,7 +52,7 @@ public: protected: virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; } - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const override; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const override; virtual bool MSWIsPushed() const override; diff --git a/include/wx/msw/toolbar.h b/include/wx/msw/toolbar.h index 4c49acb371..bf6be9c5ff 100644 --- a/include/wx/msw/toolbar.h +++ b/include/wx/msw/toolbar.h @@ -91,7 +91,7 @@ public: const wxBitmapBundle& bmpNormal, const wxBitmapBundle& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) override; @@ -130,7 +130,7 @@ protected: // should be called whenever the toolbar size changes void UpdateSize(); - // create m_disabledImgList (but doesn't fill it), set it to NULL if it is + // create m_disabledImgList (but doesn't fill it), set it to nullptr if it is // unneeded void CreateDisabledImageList(); @@ -146,7 +146,7 @@ protected: // the big bitmap containing all bitmaps of the toolbar buttons WXHBITMAP m_hBitmap; - // the image list with disabled images, may be NULL if we use + // the image list with disabled images, may be null if we use // system-provided versions of them wxImageList *m_disabledImgList; diff --git a/include/wx/msw/tooltip.h b/include/wx/msw/tooltip.h index 4c3be08cec..06c2eb0407 100644 --- a/include/wx/msw/tooltip.h +++ b/include/wx/msw/tooltip.h @@ -109,7 +109,7 @@ private: wxString m_text; // tooltip text wxWindow* m_window; // main window we're associated with - wxToolTipOtherWindows *m_others; // other windows associated with it or NULL + wxToolTipOtherWindows *m_others; // other windows associated with it or nullptr wxRect m_rect; // the rect of the window for which this tooltip is shown // (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) diff --git a/include/wx/msw/toplevel.h b/include/wx/msw/toplevel.h index 53f8ba7f1b..e97d584fcd 100644 --- a/include/wx/msw/toplevel.h +++ b/include/wx/msw/toplevel.h @@ -91,7 +91,7 @@ public: // // The pointer returned by this method belongs to the window and will be // deleted when the window itself is, do not delete it yourself. May return - // NULL if getting the system menu failed. + // nullptr if getting the system menu failed. wxMenu *MSWGetSystemMenu() const; // Enable or disable the close button of the specified window. @@ -188,7 +188,7 @@ protected: bool m_fsIsShowing; // Save the current focus to m_winLastFocused if we're not iconized (the - // focus is always NULL when we're iconized). + // focus is always null when we're iconized). void DoSaveLastFocus(); // Restore focus to m_winLastFocused if possible and needed. @@ -204,7 +204,7 @@ private: void DoSetIcons(); - // The system menu: initially NULL but can be set (once) by + // The system menu: initially nullptr but can be set (once) by // MSWGetSystemMenu(). Owned by this window. wxMenu *m_menuSystem; diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 1d1b863fd3..879c76c274 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -143,7 +143,7 @@ public: virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual void Delete(const wxTreeItemId& item) override; virtual void DeleteChildren(const wxTreeItemId& item) override; @@ -235,7 +235,7 @@ protected: const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const override; // obtain the user data for the lParam member of TV_ITEM diff --git a/include/wx/msw/uxtheme.h b/include/wx/msw/uxtheme.h index a0a2df4d8c..bab5335172 100644 --- a/include/wx/msw/uxtheme.h +++ b/include/wx/msw/uxtheme.h @@ -204,7 +204,7 @@ public: // But the face name must be converted from Unicode. WideCharToMultiByte(CP_ACP, 0, m_lfW.lfFaceName, -1, m_lfA.lfFaceName, sizeof(m_lfA.lfFaceName), - NULL, NULL); + nullptr, nullptr); } return m_lfA; diff --git a/include/wx/msw/webview_edge.h b/include/wx/msw/webview_edge.h index 8d27d40a89..ba186e2971 100644 --- a/include/wx/msw/webview_edge.h +++ b/include/wx/msw/webview_edge.h @@ -88,8 +88,8 @@ public: virtual bool SetUserAgent(const wxString& userAgent) override; - virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const override; - virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const override; + virtual bool RunScript(const wxString& javascript, wxString* output = nullptr) const override; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = nullptr) const override; virtual bool AddScriptMessageHandler(const wxString& name) override; virtual bool RemoveScriptMessageHandler(const wxString& name) override; virtual bool AddUserScript(const wxString& javascript, diff --git a/include/wx/msw/webview_ie.h b/include/wx/msw/webview_ie.h index 7f04eef8ed..faaf2bac45 100644 --- a/include/wx/msw/webview_ie.h +++ b/include/wx/msw/webview_ie.h @@ -131,7 +131,7 @@ public: virtual wxString GetSelectedSource() const override; virtual void ClearSelection() override; - virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const override; + virtual bool RunScript(const wxString& javascript, wxString* output = nullptr) const override; //Virtual Filesystem Support virtual void RegisterHandler(wxSharedPtr handler) override; diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 06e772b3b7..50f325bc58 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -54,7 +54,7 @@ public: long style = 0, const wxString& name = wxASCII_STR(wxPanelNameStr)) { - return CreateUsingMSWClass(NULL, parent, id, pos, size, style, name); + return CreateUsingMSWClass(nullptr, parent, id, pos, size, style, name); } // Non-portable, MSW-specific Create() variant allowing to create the @@ -107,7 +107,7 @@ public: virtual bool EnableTouchEvents(int eventsMask) override; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = nullptr ) override; virtual void Update() override; virtual void SetWindowStyleFlag(long style) override; @@ -125,7 +125,7 @@ public: virtual int GetScrollThumb( int orient ) const override; virtual int GetScrollRange( int orient ) const override; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) override; + const wxRect* rect = nullptr ) override; virtual bool ScrollLines(int lines) override; virtual bool ScrollPages(int pages) override; @@ -222,9 +222,9 @@ public: // return true if the window is of a standard (i.e. not wxWidgets') class // // to understand why does it work, look at SubclassWin() code and comments - bool IsOfStandardClass() const { return m_oldWndProc != NULL; } + bool IsOfStandardClass() const { return m_oldWndProc != nullptr; } - wxWindow *FindItem(long id, WXHWND hWnd = NULL) const; + wxWindow *FindItem(long id, WXHWND hWnd = nullptr) const; wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; // MSW only: true if this control is part of the main control @@ -232,7 +232,7 @@ public: #if wxUSE_TOOLTIPS // MSW only: true if this window or any of its children have a tooltip - virtual bool HasToolTips() const { return GetToolTip() != NULL; } + virtual bool HasToolTips() const { return GetToolTip() != nullptr; } #endif // wxUSE_TOOLTIPS // translate wxWidgets style flags for this control into the Windows style @@ -240,13 +240,13 @@ public: // // this is the function that should be overridden in the derived classes, // but you will mostly use MSWGetCreateWindowFlags() below - virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const ; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = nullptr) const ; // get the MSW window flags corresponding to wxWidgets ones // // the functions returns the flags (WS_XXX) directly and puts the ext - // (WS_EX_XXX) flags into the provided pointer if not NULL - WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = NULL) const + // (WS_EX_XXX) flags into the provided pointer if not null + WXDWORD MSWGetCreateWindowFlags(WXDWORD *exflags = nullptr) const { return MSWGetStyle(GetWindowStyle(), exflags); } // update the real underlying window style flags to correspond to the @@ -268,7 +268,7 @@ public: // // returns true if the window has been created, false if creation failed bool MSWCreate(const wxChar *wclass, - const wxChar *title = NULL, + const wxChar *title = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, WXDWORD style = 0, @@ -400,7 +400,7 @@ public: // The main body of common window proc for all wxWindow objects. It tries // to handle the given message and returns true if it was handled (the - // appropriate return value is then put in result, which must be non-NULL) + // appropriate return value is then put in result, which must be non-null) // or false if it wasn't. // // This function should be overridden in any new code instead of @@ -446,7 +446,7 @@ public: // This needs to be overridden for scrolled windows to ensure that the // scrolling of their associated DC is taken into account. // - // Both parameters must be non-NULL. + // Both parameters must be non-null. virtual void MSWAdjustBrushOrg(int* WXUNUSED(xOrg), int* WXUNUSED(yOrg)) const { @@ -455,7 +455,7 @@ public: // The brush returned from here must remain valid at least until the next // event loop iteration. Returning 0, as is done by default, indicates // there is no custom background brush. - virtual WXHBRUSH MSWGetCustomBgBrush() { return NULL; } + virtual WXHBRUSH MSWGetCustomBgBrush() { return nullptr; } // this function should return the brush to paint the children controls // background or 0 if this window doesn't impose any particular background @@ -464,7 +464,7 @@ public: // the hDC parameter is the DC background will be drawn on, it can be used // to call SetBrushOrgEx() on it if the returned brush is a bitmap one // - // child parameter is never NULL, it can be this window itself or one of + // child parameter is never null, it can be this window itself or one of // its (grand)children // // the base class version returns a solid brush if we have a non default @@ -524,8 +524,8 @@ public: #ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK // allows the child to hook into its parent WM_ERASEBKGND processing: call - // MSWSetEraseBgHook() with a non-NULL window to make parent call - // MSWEraseBgHook() on this window (don't forget to reset it to NULL + // MSWSetEraseBgHook() with a non-null window to make parent call + // MSWEraseBgHook() on this window (don't forget to reset it to nullptr // afterwards) // // this hack is used by wxToolBar, see comments there @@ -576,7 +576,7 @@ public: virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); #endif // wxUSE_MENUS && !__WXUNIVERSAL__ - // Return the default button for the TLW containing this window or NULL if + // Return the default button for the TLW containing this window or nullptr if // none. static wxButton* MSWGetDefaultButtonFor(wxWindow* win); @@ -641,9 +641,9 @@ protected: // 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 override; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) const override; static void MSWDoClientToScreen( WXHWND hWnd, int *x, int *y ); static void MSWDoScreenToClient( WXHWND hWnd, int *x, int *y ); virtual void DoClientToScreen( int *x, int *y ) const override; @@ -740,7 +740,7 @@ protected: // This is used by FindItem() and is overridden in wxControl, see there. virtual wxWindow* MSWFindItem(long WXUNUSED(id), WXHWND WXUNUSED(hWnd)) const { - return NULL; + return nullptr; } private: @@ -788,7 +788,7 @@ protected: m_pendingSize = wxDefaultSize; } - // current defer window position operation handle (may be NULL) + // current defer window position operation handle (may be null) WXHANDLE m_hDWP; // When deferred positioning is done these hold the pending changes, and diff --git a/include/wx/msw/wrl/event.h b/include/wx/msw/wrl/event.h index 71a2d86770..c01d3c0bcf 100644 --- a/include/wx/msw/wrl/event.h +++ b/include/wx/msw/wrl/event.h @@ -28,7 +28,7 @@ public: return S_OK; } - *ppvObj = NULL; + *ppvObj = nullptr; return E_NOINTERFACE; } ULONG STDMETHODCALLTYPE AddRef() override diff --git a/include/wx/notebook.h b/include/wx/notebook.h index 4b0074a80b..76389df640 100644 --- a/include/wx/notebook.h +++ b/include/wx/notebook.h @@ -63,7 +63,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[]; class WXDLLEXPORT wxNotebookPageInfo : public wxObject { public: - wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; } + wxNotebookPageInfo() { m_page = nullptr; m_imageId = -1; m_selected = false; } virtual ~wxNotebookPageInfo() { } bool Create(wxNotebookPage *page, diff --git a/include/wx/notifmsg.h b/include/wx/notifmsg.h index 523af49a43..662b9b07df 100644 --- a/include/wx/notifmsg.h +++ b/include/wx/notifmsg.h @@ -36,7 +36,7 @@ public: // latter may be empty in which case only the title will be shown) wxNotificationMessageBase(const wxString& title, const wxString& message = wxEmptyString, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int flags = wxICON_INFORMATION) { Init(); @@ -96,7 +96,7 @@ protected: // Common part of all ctors. void Create(const wxString& title = wxEmptyString, const wxString& message = wxEmptyString, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int flags = wxICON_INFORMATION) { SetTitle(title); @@ -111,7 +111,7 @@ private: void Init() { - m_impl = NULL; + m_impl = nullptr; } wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase); @@ -152,7 +152,7 @@ public: wxNotificationMessage() { Init(); } wxNotificationMessage(const wxString& title, const wxString& message = wxString(), - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int flags = wxICON_INFORMATION) { Init(); @@ -164,7 +164,7 @@ public: const wxString& shortcutPath = wxString(), const wxString& appId = wxString()); - // returns the task bar icon which was used previously (may be NULL) + // 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) diff --git a/include/wx/numformatter.h b/include/wx/numformatter.h index 5e0f795dbe..a56f22860c 100644 --- a/include/wx/numformatter.h +++ b/include/wx/numformatter.h @@ -50,7 +50,7 @@ public: // Parse a string representing a number, possibly with thousands separator. // // Return true on success and stores the result in the provided location - // which must be a valid non-NULL pointer. + // which must be a valid non-null pointer. static bool FromString(wxString s, long *val); #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG static bool FromString(wxString s, wxLongLong_t *val); diff --git a/include/wx/object.h b/include/wx/object.h index c84d8795ef..a3c2b770d5 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -36,7 +36,7 @@ class WXDLLIMPEXP_BASE const_iterator \ \ const_iterator(Node* node, wxHashTable* table) \ : m_node(node), m_table(table) { } \ - const_iterator() : m_node(NULL), m_table(NULL) { } \ + const_iterator() : m_node(nullptr), m_table(nullptr) { } \ value_type operator*() const; \ itor& operator++(); \ const itor operator++(int); \ @@ -150,7 +150,7 @@ name##PluginSentinel m_pluginsentinel // The 'this' pointer is always true, so use this version // to cast the this pointer and avoid compiler warnings. #define wxDynamicCastThis(className) \ - (IsKindOf(&className::ms_classInfo) ? (className*)this : NULL) + (IsKindOf(&className::ms_classInfo) ? (className*)this : nullptr) template inline T *wxCheckCast(const void *ptr) @@ -268,7 +268,7 @@ class wxObjectDataPtr public: typedef T element_type; - explicit wxObjectDataPtr(T *ptr = NULL) : m_ptr(ptr) {} + explicit wxObjectDataPtr(T *ptr = nullptr) : m_ptr(ptr) {} // copy ctor wxObjectDataPtr(const wxObjectDataPtr &tocopy) @@ -300,18 +300,18 @@ public: typedef T *(wxObjectDataPtr::*unspecified_bool_type)() const; operator unspecified_bool_type() const { - return m_ptr ? &wxObjectDataPtr::get : NULL; + return m_ptr ? &wxObjectDataPtr::get : nullptr; } T& operator*() const { - wxASSERT(m_ptr != NULL); + wxASSERT(m_ptr != nullptr); return *(m_ptr); } T *operator->() const { - wxASSERT(m_ptr != NULL); + wxASSERT(m_ptr != nullptr); return get(); } @@ -325,7 +325,7 @@ public: T* release() { T* const ptr = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return ptr; } @@ -377,7 +377,7 @@ class WXDLLIMPEXP_BASE wxObject #endif public: - wxObject() { m_refData = NULL; } + wxObject() { m_refData = nullptr; } virtual ~wxObject() { UnRef(); } wxObject(const wxObject& other) @@ -401,7 +401,7 @@ public: // Turn on the correct set of new and delete operators #ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT - void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); + void *operator new ( size_t size, const wxChar *fileName = nullptr, int lineNum = 0 ); #endif #ifdef _WX_WANT_DELETE_VOID @@ -413,7 +413,7 @@ public: #endif #ifdef _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT - void *operator new[] ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 ); + void *operator new[] ( size_t size, const wxChar *fileName = nullptr, int lineNum = 0 ); #endif #ifdef _WX_WANT_ARRAY_DELETE_VOID @@ -471,7 +471,7 @@ protected: inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) { - return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL; + return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : nullptr; } #include "wx/xti2.h" diff --git a/include/wx/odcombo.h b/include/wx/odcombo.h index 0a49096f65..2de64edec2 100644 --- a/include/wx/odcombo.h +++ b/include/wx/odcombo.h @@ -367,7 +367,7 @@ protected: // OnDrawItem. virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const; - // NULL popup can be used to indicate default interface + // null popup can be used to indicate default interface virtual void DoSetPopupControl(wxComboPopup* popup) override; // clears all allocated client data diff --git a/include/wx/osx/appprogress.h b/include/wx/osx/appprogress.h index 31f19f0c92..1e2418523d 100644 --- a/include/wx/osx/appprogress.h +++ b/include/wx/osx/appprogress.h @@ -16,7 +16,7 @@ class WXDLLIMPEXP_CORE wxAppProgressIndicator : public wxAppProgressIndicatorBase { public: - wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + wxAppProgressIndicator(wxWindow* parent = nullptr, int maxValue = 100); virtual ~wxAppProgressIndicator(); virtual bool IsAvailable() const override; diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h index 0a8325e46b..ba874f27bf 100644 --- a/include/wx/osx/bitmap.h +++ b/include/wx/osx/bitmap.h @@ -145,7 +145,7 @@ public: // virtual bool Create( WXHICON icon) ; virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) override; - virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const override; + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = nullptr) const override; const wxBitmapRefData *GetBitmapData() const { return (const wxBitmapRefData *)m_refData; } @@ -184,7 +184,7 @@ public: bool UseAlpha(bool use = true) override; // returns the 'native' implementation, a GWorldPtr for the content and one for the mask - WXHBITMAP GetHBITMAP( WXHBITMAP * mask = NULL ) const; + WXHBITMAP GetHBITMAP( WXHBITMAP * mask = nullptr ) const; // returns a CGImageRef which must released after usage with CGImageRelease CGImageRef CreateCGImage() const ; diff --git a/include/wx/osx/checklst.h b/include/wx/osx/checklst.h index b3044f6fbe..c019b09731 100644 --- a/include/wx/osx/checklst.h +++ b/include/wx/osx/checklst.h @@ -22,7 +22,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString *choices = NULL, + const wxString *choices = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)) @@ -50,7 +50,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString *choices = NULL, + const wxString *choices = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/osx/choice.h b/include/wx/osx/choice.h index e210554ead..6eb66065b9 100644 --- a/include/wx/osx/choice.h +++ b/include/wx/osx/choice.h @@ -33,7 +33,7 @@ public: wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)) @@ -54,7 +54,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)); diff --git a/include/wx/osx/cocoa/dataview.h b/include/wx/osx/cocoa/dataview.h index 7b7e19fae3..686a8a84d1 100644 --- a/include/wx/osx/cocoa/dataview.h +++ b/include/wx/osx/cocoa/dataview.h @@ -86,7 +86,7 @@ class wxCocoaDataViewControl; class wxDataViewColumnNativeData { public: - wxDataViewColumnNativeData() : m_NativeColumnPtr(NULL) + wxDataViewColumnNativeData() : m_NativeColumnPtr(nullptr) { } @@ -118,19 +118,19 @@ class wxDataViewRendererNativeData { public: wxDataViewRendererNativeData() - : m_Object(NULL), m_ColumnCell(NULL), m_ItemCell(NULL) + : m_Object(nullptr), m_ColumnCell(nullptr), m_ItemCell(nullptr) { Init(); } wxDataViewRendererNativeData(NSCell* initColumnCell) - : m_Object(NULL), m_ColumnCell([initColumnCell retain]), m_ItemCell(NULL) + : m_Object(nullptr), m_ColumnCell([initColumnCell retain]), m_ItemCell(nullptr) { Init(); } wxDataViewRendererNativeData(NSCell* initColumnCell, id initObject) - : m_Object([initObject retain]), m_ColumnCell([initColumnCell retain]), m_ItemCell(NULL) + : m_Object([initObject retain]), m_ColumnCell([initColumnCell retain]), m_ItemCell(nullptr) { Init(); } @@ -176,7 +176,7 @@ public: m_Object = newObject; } - // The original cell font and text colour stored here are NULL by default + // The original cell font and text colour stored here are null by default // and are only initialized to the values retrieved from the cell when we // change them from wxCocoaOutlineView:willDisplayCell:forTableColumn:item: // which calls our SaveOriginalXXX() methods before changing the cell @@ -230,7 +230,7 @@ private: NSTableColumn* m_TableColumnPtr; // column NOT owned by renderer - // we own those if they're non-NULL + // we own those if they're non-null NSFont *m_origFont; NSColor *m_origTextColour; NSColor *m_origBackgroundColour; diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index cbbd93f757..c9e9145dee 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -112,7 +112,7 @@ public : virtual void GetSize( int &width, int &height ) const override; virtual void SetControlSize( wxWindowVariant variant ) override; virtual void GetLayoutInset(int &left , int &top , int &right, int &bottom) const override; - virtual void SetNeedsDisplay( const wxRect* where = NULL ) override; + virtual void SetNeedsDisplay( const wxRect* where = nullptr ) override; virtual bool GetNeedsDisplay() const override; virtual void EnableFocusRing(bool enabled) override; @@ -159,7 +159,7 @@ public : void SetFont(const wxFont & font) override; void SetToolTip( wxToolTip* tooltip ) override; - void InstallEventHandler( WXWidget control = NULL ) override; + void InstallEventHandler( WXWidget control = nullptr ) override; bool EnableTouchEvents(int eventsMask) override; virtual bool ShouldHandleKeyNavigation(const wxKeyEvent &event) const; @@ -171,7 +171,7 @@ public : virtual void DoNotifyFocusLost(); virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); - virtual void SetupKeyEvent(wxKeyEvent &wxevent, NSEvent * nsEvent, NSString* charString = NULL); + virtual void SetupKeyEvent(wxKeyEvent &wxevent, NSEvent * nsEvent, NSString* charString = nullptr); virtual void SetupMouseEvent(wxMouseEvent &wxevent, NSEvent * nsEvent); void SetupCoordinates(wxCoord &x, wxCoord &y, NSEvent *nsEvent); virtual bool SetupCursor(NSEvent* event); diff --git a/include/wx/osx/cocoa/private/markuptoattr.h b/include/wx/osx/cocoa/private/markuptoattr.h index 2a50707f1b..ae06ee6648 100644 --- a/include/wx/osx/cocoa/private/markuptoattr.h +++ b/include/wx/osx/cocoa/private/markuptoattr.h @@ -24,7 +24,7 @@ protected: // font larger than it) to it and so it must be valid. wxMarkupToAttrStringBase(const wxFont& font) : wxMarkupParserAttrOutput(font, wxColour(), wxColour()), - m_attrString(NULL) + m_attrString(nullptr) {} void Parse(const wxFont& font, const wxString& markup) diff --git a/include/wx/osx/colordlg.h b/include/wx/osx/colordlg.h index f381a661c9..72f2c7198c 100644 --- a/include/wx/osx/colordlg.h +++ b/include/wx/osx/colordlg.h @@ -23,9 +23,9 @@ class WXDLLIMPEXP_CORE wxColourDialog: public wxDialog wxDECLARE_DYNAMIC_CLASS(wxColourDialog); public: wxColourDialog(); - wxColourDialog(wxWindow *parent, const wxColourData *data = NULL); + wxColourDialog(wxWindow *parent, const wxColourData *data = nullptr); - bool Create(wxWindow *parent, const wxColourData *data = NULL); + bool Create(wxWindow *parent, const wxColourData *data = nullptr); int ShowModal() override; wxColourData& GetColourData() { return m_colourData; } diff --git a/include/wx/osx/combobox.h b/include/wx/osx/combobox.h index 089baf818b..bf3b53b4e1 100644 --- a/include/wx/osx/combobox.h +++ b/include/wx/osx/combobox.h @@ -44,7 +44,7 @@ class WXDLLIMPEXP_CORE wxComboBox : const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)) @@ -68,7 +68,7 @@ class WXDLLIMPEXP_CORE wxComboBox : const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); diff --git a/include/wx/osx/core/cfdataref.h b/include/wx/osx/core/cfdataref.h index 8917451b16..f1933e2ef4 100644 --- a/include/wx/osx/core/cfdataref.h +++ b/include/wx/osx/core/cfdataref.h @@ -26,7 +26,7 @@ class wxCFDataRef : public wxCFRef< CFDataRef > { public: /*! @method wxCFDataRef - @abstract Creates a NULL data ref + @abstract Creates a null data ref */ wxCFDataRef() {} @@ -35,7 +35,7 @@ public: /*! @method wxCFDataRef @abstract Assumes ownership of r and creates a reference to it. - @param r The data reference to assume ownership of. May be NULL. + @param r The data reference to assume ownership of. May be null. @discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends to transfer ownership of that reference to this ref holder. If the object comes from a Create or Copy method then this is the correct behaviour. If the object comes from diff --git a/include/wx/osx/core/cfdictionary.h b/include/wx/osx/core/cfdictionary.h index b516240fe1..686588095b 100644 --- a/include/wx/osx/core/cfdictionary.h +++ b/include/wx/osx/core/cfdictionary.h @@ -36,7 +36,7 @@ public: /*! @method wxCFDictionaryRef @abstract Assumes ownership of r and creates a reference to it. - @param r The dictionary reference to assume ownership of. May be NULL. + @param r The dictionary reference to assume ownership of. May be null. @discussion Like shared_ptr, it is assumed that the caller has a strong reference to r and intends to transfer ownership of that reference to this ref holder. If the object comes from a Create or Copy method then this is the correct behaviour. If the object comes from diff --git a/include/wx/osx/core/cfref.h b/include/wx/osx/core/cfref.h index ab2a8b4d8a..902f21d964 100644 --- a/include/wx/osx/core/cfref.h +++ b/include/wx/osx/core/cfref.h @@ -16,8 +16,6 @@ #ifndef _WX_MAC_COREFOUNDATION_CFREF_H__ #define _WX_MAC_COREFOUNDATION_CFREF_H__ -// Include unistd to ensure that NULL is defined -#include // Include Availability for __AVAILABILITY_INTERNAL_DEPRECATED #include @@ -48,32 +46,32 @@ CFTypeRef CFAutorelease(CFTypeRef cf); /*! @function wxCFRelease - @abstract A CFRelease variant that checks for NULL before releasing. + @abstract A CFRelease variant that checks for nullptr before releasing. @discussion The parameter is template not for type safety but to ensure the argument is a raw pointer and not a ref holder of any type. */ template inline void wxCFRelease(Type *r) { - if ( r != NULL ) + if ( r != nullptr ) ::CFRelease((CFTypeRef)r); } /*! @function wxCFAutorelease - @abstract A CFAutorelease variant that checks for NULL before releasing. + @abstract A CFAutorelease variant that checks for nullptr before releasing. @discussion The parameter is template not for type safety but to ensure the argument is a raw pointer and not a ref holder of any type. */ template inline Type* wxCFAutorelease(Type *r) { - if ( r != NULL ) + if ( r != nullptr ) r = const_cast(static_cast(::CFAutorelease(static_cast(r)))); return r; } /*! @function wxCFRetain - @abstract A typesafe CFRetain variant that checks for NULL. + @abstract A typesafe CFRetain variant that checks for nullptr. */ template inline Type* wxCFRetain(Type *r) @@ -81,7 +79,7 @@ inline Type* wxCFRetain(Type *r) // NOTE(DE): Setting r to the result of CFRetain improves efficiency on both x86 and PPC // Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h // and not any possibly templated/overloaded CFRetain. - if ( r != NULL ) + if ( r != nullptr ) r = const_cast(static_cast(::CFRetain(static_cast(r)))); return r; } @@ -106,16 +104,16 @@ class wxCFWeakRef friend wxCFWeakRef static_cfref_cast(const wxCFRef &otherRef); public: /*! @method wxCFWeakRef - @abstract Creates a NULL reference + @abstract Creates a null reference */ wxCFWeakRef() - : m_ptr(NULL) + : m_ptr(nullptr) {} // Default copy constructor is fine. - // Default destructor is fine but we'll set NULL to avoid bugs + // Default destructor is fine but we'll set the pointer to nullptr to avoid bugs ~wxCFWeakRef() - { m_ptr = NULL; } + { m_ptr = nullptr; } // Do not implement a raw-pointer constructor. @@ -159,7 +157,7 @@ protected: /*! @method wxCFWeakRef @abstract Constructs a weak reference to the raw pointer @templatefield otherType Any type. - @param p The raw pointer to assume ownership of. May be NULL. + @param p The raw pointer to assume ownership of. May be null. @discussion This method is private so that the friend static_cfref_cast can use it */ template @@ -183,15 +181,15 @@ class wxCFRef { public: /*! @method wxCFRef - @abstract Creates a NULL reference + @abstract Creates a null reference */ wxCFRef() - : m_ptr(NULL) + : m_ptr(nullptr) {} /*! @method wxCFRef @abstract Assumes ownership of p and creates a reference to it. - @param p The raw core foundation reference to assume ownership of. May be NULL. + @param p The raw core foundation reference to assume ownership of. May be null. @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends to transfer ownership of that reference to this ref holder. If the object comes from a Create or Copy method then this is the correct behaviour. If the object comes from @@ -205,7 +203,7 @@ public: /*! @method wxCFRef @abstract Assumes ownership of p and creates a reference to it. @templatefield otherType Any type. - @param p The raw pointer to assume ownership of. May be NULL. + @param p The raw pointer to assume ownership of. May be null. @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends to transfer ownership of that reference to this ref holder. If the object comes from a Create or Copy method then this is the correct behaviour. If the object comes from @@ -329,7 +327,7 @@ public: void reset() { wxCFRelease(m_ptr); - m_ptr = NULL; + m_ptr = nullptr; } /*! @method reset @@ -353,7 +351,7 @@ public: refType release() { refType p = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return p; } @@ -361,7 +359,7 @@ public: refType autorelease() { refType p = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return wxCFAutorelease(p); } @@ -374,7 +372,7 @@ protected: /*! @function wxCFRefFromGet @abstract Factory function to create wxCFRef from a raw pointer obtained from a Get-rule function - @param p The pointer to retain and create a wxCFRef from. May be NULL. + @param p The pointer to retain and create a wxCFRef from. May be null. @discussion Unlike the wxCFRef raw pointer constructor, this function explicitly retains its argument. This can be used for functions such as CFDictionaryGetValue() or CFAttributedStringGetString() which return a temporary reference (Get-rule functions). diff --git a/include/wx/osx/core/cfstring.h b/include/wx/osx/core/cfstring.h index 6468713139..d8b819c934 100644 --- a/include/wx/osx/core/cfstring.h +++ b/include/wx/osx/core/cfstring.h @@ -78,7 +78,7 @@ private: /*! @function wxCFStringRefFromGet @abstract Factory function to create wxCFStringRefRef from a CFStringRef obtained from a Get-rule function - @param p The CFStringRef to retain and create a wxCFStringRefRef from. May be NULL. + @param p The CFStringRef to retain and create a wxCFStringRefRef from. May be null. @discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its argument. This can be used for functions ) which return a temporary reference (Get-rule functions). */ @@ -90,7 +90,7 @@ inline wxCFStringRef wxCFStringRefFromGet(CFStringRef p) #ifdef __WXMAC__ /*! @function wxCFStringRefFromGet @abstract Factory function to create wxCFStringRefRef from a NSString* obtained from a Get-rule function - @param p The NSString pointer to retain and create a wxCFStringRefRef from. May be NULL. + @param p The NSString pointer to retain and create a wxCFStringRefRef from. May be null. @discussion Unlike the wxCFStringRef raw pointer constructor, this function explicitly retains its argument. This can be used for functions ) which return a temporary reference (Get-rule functions). */ diff --git a/include/wx/osx/core/cftype.h b/include/wx/osx/core/cftype.h index 0b6fbc4c2f..c3ababfb57 100644 --- a/include/wx/osx/core/cftype.h +++ b/include/wx/osx/core/cftype.h @@ -117,12 +117,12 @@ class wxCFNumberRef : public wxCFTypeRef { public: wxCFNumberRef(CGFloat v) - : wxCFTypeRef(CFNumberCreate(NULL, kCFNumberCGFloatType, &v)) + : wxCFTypeRef(CFNumberCreate(nullptr, kCFNumberCGFloatType, &v)) { } wxCFNumberRef(int v) - : wxCFTypeRef(CFNumberCreate(NULL, kCFNumberIntType, &v)) + : wxCFTypeRef(CFNumberCreate(nullptr, kCFNumberIntType, &v)) { } }; diff --git a/include/wx/osx/core/dataview.h b/include/wx/osx/core/dataview.h index c9b7bde6ae..d25cca2174 100644 --- a/include/wx/osx/core/dataview.h +++ b/include/wx/osx/core/dataview.h @@ -29,7 +29,7 @@ wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wx // for the carbon and cocoa environment. // ATTENTION // All methods assume that the passed column pointers are -// valid (unless a NULL pointer is explicitly allowed +// valid (unless a null pointer is explicitly allowed // to be passed)! // ATTENTION // --------------------------------------------------------- @@ -61,7 +61,7 @@ public: virtual bool Add (wxDataViewItem const& parent, wxDataViewItem const& item) = 0; // adds an item to the native control virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& items) = 0; // adds items to the native control virtual void Collapse (wxDataViewItem const& item) = 0; // collapses the passed item in the native control - virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be NULL) + virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // ensures that the passed item's value in the passed column is visible (column pointer can be null) virtual unsigned int GetCount() const = 0; // returns the number of items in the native control virtual int GetCountPerPage() const = 0; // get number of items that fit into a single page virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr) = 0; // returns the rectangle that is used by the passed item and column in the native control diff --git a/include/wx/osx/core/hid.h b/include/wx/osx/core/hid.h index 045b6deb4f..b8a8c04b80 100644 --- a/include/wx/osx/core/hid.h +++ b/include/wx/osx/core/hid.h @@ -55,7 +55,7 @@ extern "C" { class WXDLLIMPEXP_CORE wxHIDDevice { public: - wxHIDDevice() : m_ppDevice(NULL), m_ppQueue(NULL), m_pCookies(NULL) {} + wxHIDDevice() : m_ppDevice(nullptr), m_ppQueue(nullptr), m_pCookies(nullptr) {} bool Create (int nClass = -1, int nType = -1, int nDev = 1); diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 429c8f7401..2fb0e312ad 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -49,7 +49,7 @@ void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); -WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); +WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = nullptr ); WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); @@ -124,9 +124,9 @@ WXDLLIMPEXP_CORE double wxOSXGetMainScreenContentScaleFactor(); // UI CGSize WXDLLIMPEXP_CORE wxOSXGetImageSize(WXImage image); -CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromImage( WXImage nsimage, double *scale = NULL ); +CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromImage( WXImage nsimage, double *scale = nullptr ); CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromImage( WXImage nsimage, CGRect* r, CGContextRef cg); -CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate = NULL); +CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate = nullptr); WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false); double WXDLLIMPEXP_CORE wxOSXGetImageScaleFactor(WXImage image); @@ -254,7 +254,7 @@ public : wxWindowMac* GetWXPeer() const { return m_wxPeer; } - bool IsOk() const { return GetWXWidget() != NULL; } + bool IsOk() const { return GetWXWidget() != nullptr; } // not only the control itself, but also all its parents must be visible // in order for this function to return true @@ -302,7 +302,7 @@ public : // native view coordinates are topleft to bottom right (flipped regarding CoreGraphics origin) virtual bool IsFlipped() const { return true; } - virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0; + virtual void SetNeedsDisplay( const wxRect* where = nullptr ) = 0; virtual bool GetNeedsDisplay() const = 0; virtual void EnableFocusRing(bool WXUNUSED(enabled)) {} @@ -362,7 +362,7 @@ public : // state changing logic is required from the outside virtual bool ButtonClickDidStateChange() = 0; - virtual void InstallEventHandler( WXWidget control = NULL ) = 0; + virtual void InstallEventHandler( WXWidget control = nullptr ) = 0; virtual bool EnableTouchEvents(int eventsMask) = 0; @@ -666,7 +666,7 @@ public: virtual void ListScrollTo( unsigned int n ) = 0; virtual int ListGetTopItem() const = 0; virtual int ListGetCountPerPage() const = 0; - virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = nullptr ) = 0; virtual void UpdateLineToEnd( unsigned int n) = 0; // accessing content @@ -1043,7 +1043,7 @@ public: typedef T element_type; wxNSObjRef() - : m_ptr(NULL) + : m_ptr(nullptr) { } @@ -1095,7 +1095,7 @@ public: return m_ptr; } - void reset( T p = NULL ) + void reset( T p = nullptr ) { wxMacCocoaRelease(m_ptr); m_ptr = p; // Automatic conversion should occur @@ -1105,7 +1105,7 @@ public: T release() { T p = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return p; } diff --git a/include/wx/osx/dataview.h b/include/wx/osx/dataview.h index 68f092b1e3..e4f542cfed 100644 --- a/include/wx/osx/dataview.h +++ b/include/wx/osx/dataview.h @@ -169,13 +169,13 @@ public: virtual bool PrependColumn (wxDataViewColumn* columnPtr) override; virtual void Collapse( const wxDataViewItem& item) override; - virtual void EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn* columnPtr=NULL) override; + virtual void EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn* columnPtr=nullptr) override; virtual bool IsExpanded(const wxDataViewItem & item) const override; virtual unsigned int GetCount() const; virtual int GetCountPerPage() const override; virtual wxRect GetItemRect(const wxDataViewItem& item, - const wxDataViewColumn* columnPtr = NULL) const override; + const wxDataViewColumn* columnPtr = nullptr) const override; virtual int GetSelectedItemsCount() const override; virtual int GetSelections(wxDataViewItemArray& sel) const override; diff --git a/include/wx/osx/dcmemory.h b/include/wx/osx/dcmemory.h index b2debe1e5e..01c9711bbe 100644 --- a/include/wx/osx/dcmemory.h +++ b/include/wx/osx/dcmemory.h @@ -24,7 +24,7 @@ public: virtual void DoGetSize( int *width, int *height ) const override; virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const override - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } + { return subrect == nullptr ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } virtual void DoSelect(const wxBitmap& bitmap) override; virtual const wxBitmap& GetSelectedBitmap() const override diff --git a/include/wx/osx/dnd.h b/include/wx/osx/dnd.h index 61c907de56..5b43630c68 100644 --- a/include/wx/osx/dnd.h +++ b/include/wx/osx/dnd.h @@ -50,7 +50,7 @@ class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase { public: - wxDropTarget(wxDataObject *dataObject = NULL ); + wxDropTarget(wxDataObject *dataObject = nullptr ); virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) override; virtual bool OnDrop(wxCoord x, wxCoord y) override; @@ -77,7 +77,7 @@ public: // // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK // compatibility, as well as both icon parameters - wxDropSource( wxWindow *win = NULL, + wxDropSource( wxWindow *win = nullptr, const wxCursor &cursorCopy = wxNullCursor, const wxCursor &cursorMove = wxNullCursor, const wxCursor &cursorStop = wxNullCursor); diff --git a/include/wx/osx/evtloopsrc.h b/include/wx/osx/evtloopsrc.h index 291ce0f1e4..0b5de0fb44 100644 --- a/include/wx/osx/evtloopsrc.h +++ b/include/wx/osx/evtloopsrc.h @@ -24,7 +24,7 @@ public: wxCFEventLoopSource(wxEventLoopSourceHandler *handler, int flags) : wxEventLoopSource(handler, flags) { - m_cfSocket = NULL; + m_cfSocket = nullptr; } // Finish initialization of the event loop source by providing the diff --git a/include/wx/osx/glcanvas.h b/include/wx/osx/glcanvas.h index 4b8e1c9717..1971c82b07 100644 --- a/include/wx/osx/glcanvas.h +++ b/include/wx/osx/glcanvas.h @@ -32,9 +32,9 @@ WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context ); WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext(); WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context); -WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs = NULL, +WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs = nullptr, int n1 = 0, - const int *ctxAttrs = NULL, + const int *ctxAttrs = nullptr, int n2 = 0); WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ); @@ -42,8 +42,8 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: wxGLContext(wxGLCanvas *win, - const wxGLContext *other = NULL, - const wxGLContextAttrs *ctxAttrs = NULL); + const wxGLContext *other = nullptr, + const wxGLContextAttrs *ctxAttrs = nullptr); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const override; @@ -71,7 +71,7 @@ public: wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -93,7 +93,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPalette& palette = wxNullPalette); virtual ~wxGLCanvas(); diff --git a/include/wx/osx/iphone/private.h b/include/wx/osx/iphone/private.h index 24c0738c10..2852f48191 100644 --- a/include/wx/osx/iphone/private.h +++ b/include/wx/osx/iphone/private.h @@ -67,7 +67,7 @@ public : virtual void SetControlSize( wxWindowVariant variant ); virtual double GetContentScaleFactor() const ; - virtual void SetNeedsDisplay( const wxRect* where = NULL ); + virtual void SetNeedsDisplay( const wxRect* where = nullptr ); virtual bool GetNeedsDisplay() const; virtual bool CanFocus() const; @@ -109,7 +109,7 @@ public : void SetFont(const wxFont & font); - void InstallEventHandler( WXWidget control = NULL ); + void InstallEventHandler( WXWidget control = nullptr ); bool EnableTouchEvents(int WXUNUSED(eventsMask)) { return false; } virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); diff --git a/include/wx/osx/listbox.h b/include/wx/osx/listbox.h index 5c262c7a3f..fc8f684fd0 100644 --- a/include/wx/osx/listbox.h +++ b/include/wx/osx/listbox.h @@ -46,7 +46,7 @@ public: wxWindowID winid, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)) @@ -73,7 +73,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/osx/menu.h b/include/wx/osx/menu.h index 4324cc10f0..c97357f0ea 100644 --- a/include/wx/osx/menu.h +++ b/include/wx/osx/menu.h @@ -150,13 +150,13 @@ public: // implementation from now on // returns TRUE if we're attached to a frame - bool IsAttached() const { return m_menuBarFrame != NULL; } + bool IsAttached() const { return m_menuBarFrame != nullptr; } // get the frame we live in wxFrame *GetFrame() const { return m_menuBarFrame; } // if the menubar is modified, the display is not updated automatically, - // call this function to update it (m_menuBarFrame should be !NULL) - void Refresh(bool eraseBackground = true, const wxRect *rect = NULL) override; + // call this function to update it (m_menuBarFrame should be non-null) + void Refresh(bool eraseBackground = true, const wxRect *rect = nullptr) override; wxMenu *OSXGetAppleMenu() const { return m_appleMenu; } diff --git a/include/wx/osx/menuitem.h b/include/wx/osx/menuitem.h index f4ecfade12..6ec09040dd 100644 --- a/include/wx/osx/menuitem.h +++ b/include/wx/osx/menuitem.h @@ -28,12 +28,12 @@ class WXDLLIMPEXP_CORE wxMenuItem: public wxMenuItemBase { public: // ctor & dtor - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& name = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); virtual ~wxMenuItem(); // override base class virtuals diff --git a/include/wx/osx/notebook.h b/include/wx/osx/notebook.h index cd26e3194a..04cc14e460 100644 --- a/include/wx/osx/notebook.h +++ b/include/wx/osx/notebook.h @@ -79,7 +79,7 @@ public: virtual void SetTabSize(const wxSize& sz) override; // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; // calculate size for wxNotebookSizer wxSize CalcSizeFromPage(const wxSize& sizePage) const override; diff --git a/include/wx/osx/printdlg.h b/include/wx/osx/printdlg.h index 2aef596118..b209200ec6 100644 --- a/include/wx/osx/printdlg.h +++ b/include/wx/osx/printdlg.h @@ -28,11 +28,11 @@ class WXDLLIMPEXP_CORE wxMacPrintDialog: public wxPrintDialogBase { public: wxMacPrintDialog(); - wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = nullptr); wxMacPrintDialog(wxWindow *parent, wxPrintData* data ); virtual ~wxMacPrintDialog(); - bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + bool Create(wxWindow *parent, wxPrintDialogData* data = nullptr); virtual int ShowModal() override; virtual wxPrintDialogData& GetPrintDialogData() override { return m_printDialogData; } @@ -57,12 +57,12 @@ private: class WXDLLIMPEXP_CORE wxMacPageSetupDialog: public wxPageSetupDialogBase { public: - wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual ~wxMacPageSetupDialog(); virtual wxPageSetupDialogData& GetPageSetupDialogData() override; - bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + bool Create(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual int ShowModal() override; private: diff --git a/include/wx/osx/printmac.h b/include/wx/osx/printmac.h index 77b2baf5d8..36f8baddfd 100644 --- a/include/wx/osx/printmac.h +++ b/include/wx/osx/printmac.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_CORE wxMacPrinter: public wxPrinterBase wxDECLARE_DYNAMIC_CLASS(wxMacPrinter); public: - wxMacPrinter(wxPrintDialogData *data = NULL); + wxMacPrinter(wxPrintDialogData *data = nullptr); virtual ~wxMacPrinter(); virtual bool Print(wxWindow *parent, @@ -44,8 +44,8 @@ class WXDLLIMPEXP_CORE wxMacPrintPreview: public wxPrintPreviewBase public: wxMacPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/osx/private/webrequest_urlsession.h b/include/wx/osx/private/webrequest_urlsession.h index 4b1111ef72..19dbc42a41 100644 --- a/include/wx/osx/private/webrequest_urlsession.h +++ b/include/wx/osx/private/webrequest_urlsession.h @@ -41,7 +41,7 @@ public: private: wxWebRequestURLSession& m_request; - WX_NSURLCredential m_cred = NULL; + WX_NSURLCredential m_cred = nullptr; wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeURLSession); }; diff --git a/include/wx/osx/radiobox.h b/include/wx/osx/radiobox.h index 3520ee346b..4b91335b44 100644 --- a/include/wx/osx/radiobox.h +++ b/include/wx/osx/radiobox.h @@ -26,7 +26,7 @@ public: wxRadioBox(); wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, const wxString& name = wxASCII_STR(wxRadioBoxNameStr)) { @@ -45,7 +45,7 @@ public: virtual ~wxRadioBox(); bool Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, const wxString& name = wxASCII_STR(wxRadioBoxNameStr)); bool Create(wxWindow *parent, wxWindowID id, const wxString& title, diff --git a/include/wx/osx/radiobut.h b/include/wx/osx/radiobut.h index 35c4b7b704..de83f0bf58 100644 --- a/include/wx/osx/radiobut.h +++ b/include/wx/osx/radiobut.h @@ -65,7 +65,7 @@ class WXDLLIMPEXP_CORE wxBitmapRadioButton: public wxRadioButton protected: wxBitmap *theButtonBitmap; public: - wxBitmapRadioButton() { theButtonBitmap = NULL; } + wxBitmapRadioButton() { theButtonBitmap = nullptr; } wxBitmapRadioButton(wxWindow *parent, wxWindowID id, const wxBitmap *label, const wxPoint& pos = wxDefaultPosition, diff --git a/include/wx/osx/sound.h b/include/wx/osx/sound.h index 16f8b45b6a..c7714495af 100644 --- a/include/wx/osx/sound.h +++ b/include/wx/osx/sound.h @@ -52,7 +52,7 @@ public: // Create from data bool Create(size_t size, const void* data); - bool IsOk() const { return m_data != NULL; } + bool IsOk() const { return m_data != nullptr; } // Stop playing any sound static void Stop(); diff --git a/include/wx/osx/statline.h b/include/wx/osx/statline.h index 6401a77fed..83f85db81d 100644 --- a/include/wx/osx/statline.h +++ b/include/wx/osx/statline.h @@ -20,7 +20,7 @@ class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase { public: // constructors and pseudo-constructors - wxStaticLine() : m_statbox(NULL) { } + wxStaticLine() : m_statbox(nullptr) { } wxStaticLine( wxWindow *parent, wxWindowID id = wxID_ANY, @@ -28,7 +28,7 @@ public: const wxSize &size = wxDefaultSize, long style = wxLI_HORIZONTAL, const wxString &name = wxASCII_STR(wxStaticLineNameStr) ) - : m_statbox(NULL) + : m_statbox(nullptr) { Create(parent, id, pos, size, style, name); } diff --git a/include/wx/osx/textentry.h b/include/wx/osx/textentry.h index 7ea1725c93..b2dd1d4708 100644 --- a/include/wx/osx/textentry.h +++ b/include/wx/osx/textentry.h @@ -100,7 +100,7 @@ protected: virtual bool DoAutoCompleteStrings(const wxArrayString& choices) override; virtual bool DoAutoCompleteCustom(wxTextCompleter *completer) override; - // The object providing auto-completions or NULL if none. + // The object providing auto-completions or nullptr if none. wxTextCompleter *m_completer; bool m_editable; diff --git a/include/wx/osx/toolbar.h b/include/wx/osx/toolbar.h index 334d406f28..645c2a9a52 100644 --- a/include/wx/osx/toolbar.h +++ b/include/wx/osx/toolbar.h @@ -86,7 +86,7 @@ public: const wxBitmapBundle& bmpNormal, const wxBitmapBundle& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) override; virtual wxToolBarToolBase *CreateTool(wxControl *control, diff --git a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h index 0a28e9a71b..32580e03c4 100644 --- a/include/wx/osx/webview_webkit.h +++ b/include/wx/osx/webview_webkit.h @@ -95,7 +95,7 @@ public: virtual void SetEditable(bool enable = true) override; virtual bool IsEditable() const override; - virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const override; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = nullptr) const override; virtual bool AddScriptMessageHandler(const wxString& name) override; virtual bool RemoveScriptMessageHandler(const wxString& name) override; virtual bool AddUserScript(const wxString& javascript, diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index 2290a09077..6945b46467 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -78,7 +78,7 @@ public: virtual bool EnableTouchEvents(int eventsMask) override; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = NULL ) override; + const wxRect *rect = nullptr ) override; virtual void Update() override; virtual void ClearBackground() override; @@ -89,7 +89,7 @@ public: virtual bool SetForegroundColour( const wxColour &colour ) override; virtual bool SetBackgroundStyle(wxBackgroundStyle style) override; - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const override; + virtual bool IsTransparentBackgroundSupported(wxString* reason = nullptr) const override; virtual int GetCharHeight() const override; virtual int GetCharWidth() const override; @@ -102,7 +102,7 @@ public: virtual int GetScrollThumb( int orient ) const override; virtual int GetScrollRange( int orient ) const override; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) override; + const wxRect* rect = nullptr ) override; virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true) override; virtual bool IsScrollbarAlwaysShown(int orient) const override { @@ -261,7 +261,7 @@ public: // return true unless DontCreatePeer() had been called bool ShouldCreatePeer() const; - // sets the native implementation wrapper, can replace an existing peer, use peer = NULL to + // sets the native implementation wrapper, can replace an existing peer, use peer = nullptr to // release existing peer void SetPeer(wxOSXWidgetImpl* peer); @@ -348,9 +348,9 @@ protected: // implement the base class pure virtuals virtual void DoGetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL ) const override; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *theFont = nullptr ) const override; virtual void DoEnable( bool enable ) override; #if wxUSE_MENUS diff --git a/include/wx/peninfobase.h b/include/wx/peninfobase.h index f66bb14362..70e309d8d7 100644 --- a/include/wx/peninfobase.h +++ b/include/wx/peninfobase.h @@ -106,7 +106,7 @@ protected: : m_colour(colour) { m_nb_dashes = 0; - m_dash = NULL; + m_dash = nullptr; m_join = wxJOIN_ROUND; m_cap = wxCAP_ROUND; m_style = style; diff --git a/include/wx/persist.h b/include/wx/persist.h index 757fad0355..915183f0a7 100644 --- a/include/wx/persist.h +++ b/include/wx/persist.h @@ -78,7 +78,7 @@ public: wxPersistentObject *Register(void *obj, wxPersistentObject *po); // check if the object is registered and return the associated - // wxPersistentObject if it is or NULL otherwise + // wxPersistentObject if it is or nullptr otherwise wxPersistentObject *Find(void *obj) const; // unregister the object, this is called by wxPersistentObject itself so diff --git a/include/wx/persist/dataview.h b/include/wx/persist/dataview.h index dbd57a3b44..950a07660d 100644 --- a/include/wx/persist/dataview.h +++ b/include/wx/persist/dataview.h @@ -50,7 +50,7 @@ public: { wxDataViewCtrl* const control = Get(); - const wxDataViewColumn* sortColumn = NULL; + const wxDataViewColumn* sortColumn = nullptr; for ( unsigned int col = 0; col < control->GetColumnCount(); col++ ) { @@ -151,7 +151,7 @@ private: return wxString::Format(wxASCII_STR("/Columns/%s/"), column->GetTitle()); } - // Return the column with the given title or NULL. + // Return the column with the given title or nullptr. static wxDataViewColumn* GetColumnByTitle(wxDataViewCtrl* control, const wxString& title) { @@ -161,7 +161,7 @@ private: return control->GetColumn(col); } - return NULL; + return nullptr; } }; diff --git a/include/wx/pickerbase.h b/include/wx/pickerbase.h index fa230c872f..b9d7ea3634 100644 --- a/include/wx/pickerbase.h +++ b/include/wx/pickerbase.h @@ -36,7 +36,7 @@ class WXDLLIMPEXP_CORE wxPickerBase : public wxNavigationEnabled { public: // ctor: text is the associated text control - wxPickerBase() : m_text(NULL), m_picker(NULL), m_sizer(NULL) + wxPickerBase() : m_text(nullptr), m_picker(nullptr), m_sizer(nullptr) { } virtual ~wxPickerBase() {} @@ -87,7 +87,7 @@ public: // public API } bool HasTextCtrl() const - { return m_text != NULL; } + { return m_text != nullptr; } wxTextCtrl *GetTextCtrl() { return m_text; } wxControl *GetPickerCtrl() @@ -155,7 +155,7 @@ protected: void PostCreation(); protected: - wxTextCtrl *m_text; // can be NULL + wxTextCtrl *m_text; // can be null wxControl *m_picker; wxBoxSizer *m_sizer; diff --git a/include/wx/popupwin.h b/include/wx/popupwin.h index 9b13efe370..1c310a134f 100644 --- a/include/wx/popupwin.h +++ b/include/wx/popupwin.h @@ -86,8 +86,8 @@ class WXDLLIMPEXP_CORE wxPopupTransientWindowBase : public wxPopupWindow { public: // popup the window (this will show it too) and keep focus at winFocus - // (or itself if it's NULL), dismiss the popup if we lose focus - virtual void Popup(wxWindow *focus = NULL) = 0; + // (or itself if it's nullptr), dismiss the popup if we lose focus + virtual void Popup(wxWindow *focus = nullptr) = 0; // hide the window virtual void Dismiss() = 0; @@ -131,7 +131,7 @@ public: { Create(parent, style); } // Implement base class pure virtuals. - virtual void Popup(wxWindow *focus = NULL) override; + virtual void Popup(wxWindow *focus = nullptr) override; virtual void Dismiss() override; // Override to handle WM_NCACTIVATE. @@ -165,7 +165,7 @@ public: virtual ~wxPopupTransientWindow(); // Implement base class pure virtuals. - virtual void Popup(wxWindow *focus = NULL) override; + virtual void Popup(wxWindow *focus = nullptr) override; virtual void Dismiss() override; // Overridden to grab the input on some platforms @@ -197,7 +197,7 @@ protected: friend class wxPopupWindowHandler; friend class wxPopupFocusHandler; - // the handlers we created, may be NULL (if not, must be deleted) + // the handlers we created, may be null (if not, must be deleted) wxPopupWindowHandler *m_handlerPopup; wxPopupFocusHandler *m_handlerFocus; @@ -220,7 +220,7 @@ class WXDLLIMPEXP_FWD_CORE wxComboCtrl; class WXDLLIMPEXP_CORE wxPopupComboWindow : public wxPopupTransientWindow { public: - wxPopupComboWindow() { m_combo = NULL; } + wxPopupComboWindow() { m_combo = nullptr; } wxPopupComboWindow(wxComboCtrl *parent); bool Create(wxComboCtrl *parent); diff --git a/include/wx/printdlg.h b/include/wx/printdlg.h index ecb2ce8819..4b29362072 100644 --- a/include/wx/printdlg.h +++ b/include/wx/printdlg.h @@ -52,7 +52,7 @@ private: class WXDLLIMPEXP_CORE wxPrintDialog : public wxObject { public: - wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = nullptr); wxPrintDialog(wxWindow *parent, wxPrintData* data); virtual ~wxPrintDialog(); @@ -99,7 +99,7 @@ private: class WXDLLIMPEXP_CORE wxPageSetupDialog: public wxObject { public: - wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual ~wxPageSetupDialog(); int ShowModal(); diff --git a/include/wx/private/addremovectrl.h b/include/wx/private/addremovectrl.h index 10532ec3d0..3bab41e42b 100644 --- a/include/wx/private/addremovectrl.h +++ b/include/wx/private/addremovectrl.h @@ -111,7 +111,7 @@ public: : wxAddRemoveImplBase(adaptor, parent, ctrlItems) { m_btnAdd = - m_btnRemove = NULL; + m_btnRemove = nullptr; } virtual void SetButtonsToolTips(const wxString& addtip, diff --git a/include/wx/private/display.h b/include/wx/private/display.h index b4b51d2a5d..29d73003b9 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -70,7 +70,7 @@ public: // return the display for the given window or wxNOT_FOUND // - // the window pointer must not be NULL (i.e. caller should check it) + // the window pointer must not be null (i.e. caller should check it) virtual int GetFromWindow(const wxWindow *window); // Trigger recreation of wxDisplayImpl when they're needed the next time. @@ -79,7 +79,7 @@ public: protected: // create a new display object // - // it can return a NULL pointer if the display creation failed + // it can return a null pointer if the display creation failed virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; private: diff --git a/include/wx/private/extfield.h b/include/wx/private/extfield.h index 01451e83eb..93a0ee0b3f 100644 --- a/include/wx/private/extfield.h +++ b/include/wx/private/extfield.h @@ -58,7 +58,7 @@ public: static FieldType* FromObject(ObjectType* obj) { const typename MapType::const_iterator it = ms_map.find(obj); - return it == ms_map.end() ? NULL : it->second; + return it == ms_map.end() ? nullptr : it->second; } // Erase the object used for the corresponding window, return true if there diff --git a/include/wx/private/fdiodispatcher.h b/include/wx/private/fdiodispatcher.h index 234175941e..827dc7038d 100644 --- a/include/wx/private/fdiodispatcher.h +++ b/include/wx/private/fdiodispatcher.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_BASE wxFDIODispatcher public: enum { TIMEOUT_INFINITE = -1 }; - // return the global dispatcher to be used for IO events, can be NULL only + // return the global dispatcher to be used for IO events, can be null only // if wxSelectDispatcher wasn't compiled into the library at all as // creating it never fails // @@ -66,7 +66,7 @@ struct wxFDIOHandlerEntry { wxFDIOHandlerEntry() { - handler = NULL; + handler = nullptr; flags = 0; } @@ -97,7 +97,7 @@ WX_DECLARE_HASH_MAP( class WXDLLIMPEXP_BASE wxMappedFDIODispatcher : public wxFDIODispatcher { public: - // find the handler for the given fd, return NULL if none + // find the handler for the given fd, return nullptr if none wxFDIOHandler *FindHandler(int fd) const; // register handler for the given descriptor with the dispatcher, return diff --git a/include/wx/private/fileback.h b/include/wx/private/fileback.h index 286e4d338a..09c602693f 100644 --- a/include/wx/private/fileback.h +++ b/include/wx/private/fileback.h @@ -34,13 +34,13 @@ public: size_t bufsize = DefaultBufSize, const wxString& prefix = wxT("wxbf")); - wxBackingFile() : m_impl(NULL) { } + wxBackingFile() : m_impl(nullptr) { } ~wxBackingFile(); wxBackingFile(const wxBackingFile& backer); wxBackingFile& operator=(const wxBackingFile& backer); - operator bool() const { return m_impl != NULL; } + operator bool() const { return m_impl != nullptr; } private: class wxBackingFileImpl *m_impl; diff --git a/include/wx/private/filename.h b/include/wx/private/filename.h index a4ed481020..34dfc397c5 100644 --- a/include/wx/private/filename.h +++ b/include/wx/private/filename.h @@ -27,13 +27,13 @@ #if wxUSE_FILE wxString wxCreateTempFileName(const wxString& prefix, wxFile *fileTemp, - bool *deleteOnClose = NULL); + bool *deleteOnClose = nullptr); #endif #if wxUSE_FFILE wxString wxCreateTempFileName(const wxString& prefix, wxFFile *fileTemp, - bool *deleteOnClose = NULL); + bool *deleteOnClose = nullptr); #endif // Returns an open temp file, if possible either an unlinked open file or one diff --git a/include/wx/private/fontmgr.h b/include/wx/private/fontmgr.h index 2d603ac1a2..0a40ea2d0c 100644 --- a/include/wx/private/fontmgr.h +++ b/include/wx/private/fontmgr.h @@ -115,7 +115,7 @@ public: }; /// Returns true if the given face is available - bool HasFace(FaceType type) const { return m_faces[type] != NULL; } + bool HasFace(FaceType type) const { return m_faces[type] != nullptr; } /** Returns font face object that can be used to render font of given type. diff --git a/include/wx/private/graphics.h b/include/wx/private/graphics.h index 363311eb0d..1cc38f8ae3 100644 --- a/include/wx/private/graphics.h +++ b/include/wx/private/graphics.h @@ -55,8 +55,8 @@ public : wxDouble tx=0.0, wxDouble ty=0.0) = 0; // gets the component values 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 = 0; + virtual void Get(wxDouble* a=nullptr, wxDouble* b=nullptr, wxDouble* c=nullptr, + wxDouble* d=nullptr, wxDouble* tx=nullptr, wxDouble* ty=nullptr) const = 0; // makes this the inverse matrix virtual void Invert() = 0; diff --git a/include/wx/private/localeset.h b/include/wx/private/localeset.h index a977247d6b..0320d34e9f 100644 --- a/include/wx/private/localeset.h +++ b/include/wx/private/localeset.h @@ -19,7 +19,7 @@ class wxLocaleSetter { public: wxLocaleSetter(const char *loc) - : m_locOld(wxStrdupA(setlocale(LC_ALL, NULL))) + : m_locOld(wxStrdupA(setlocale(LC_ALL, nullptr))) { setlocale(LC_ALL, loc); } diff --git a/include/wx/private/markupparserattr.h b/include/wx/private/markupparserattr.h index e09e19060d..921bfc0c3e 100644 --- a/include/wx/private/markupparserattr.h +++ b/include/wx/private/markupparserattr.h @@ -75,7 +75,7 @@ public: const wxColour& foreground, const wxColour& background) { - m_attrs.push(Attr(NULL, font, foreground, background)); + m_attrs.push(Attr(nullptr, font, foreground, background)); } // Indicates the change of the font and/or colours used. Any of the diff --git a/include/wx/private/notifmsg.h b/include/wx/private/notifmsg.h index 3f02a29e72..f2fc42eee8 100644 --- a/include/wx/private/notifmsg.h +++ b/include/wx/private/notifmsg.h @@ -41,7 +41,7 @@ public: virtual void Detach() { if (m_active) - m_notification = NULL; + m_notification = nullptr; else delete this; } diff --git a/include/wx/private/richtooltip.h b/include/wx/private/richtooltip.h index eae0f569fb..e9dbf942c1 100644 --- a/include/wx/private/richtooltip.h +++ b/include/wx/private/richtooltip.h @@ -33,7 +33,7 @@ public: virtual void SetTipKind(wxTipKind tipKind) = 0; virtual void SetTitleFont(const wxFont& font) = 0; - virtual void ShowFor(wxWindow* win, const wxRect* rect = NULL) = 0; + virtual void ShowFor(wxWindow* win, const wxRect* rect = nullptr) = 0; virtual ~wxRichToolTipImpl() { } diff --git a/include/wx/private/sckaddr.h b/include/wx/private/sckaddr.h index 376812d6d7..7dee7b3646 100644 --- a/include/wx/private/sckaddr.h +++ b/include/wx/private/sckaddr.h @@ -257,7 +257,7 @@ private: T *Get() const { wxCHECK_MSG( static_cast(m_family) == AddressFamily::value, - NULL, + nullptr, "socket address family mismatch" ); return reinterpret_cast(m_addr); @@ -266,7 +266,7 @@ private: void InitUnspec() { m_family = FAMILY_UNSPEC; - m_addr = NULL; + m_addr = nullptr; m_len = 0; } @@ -286,7 +286,7 @@ private: } else // no address to copy { - m_addr = NULL; + m_addr = nullptr; m_len = 0; } } diff --git a/include/wx/private/socket.h b/include/wx/private/socket.h index d9d4ac61e2..39f5cd6872 100644 --- a/include/wx/private/socket.h +++ b/include/wx/private/socket.h @@ -263,7 +263,7 @@ public: // flags defines what kind of conditions we're interested in, the return // value is composed of a (possibly empty) subset of the bits set in flags wxSocketEventFlags Select(wxSocketEventFlags flags, - wxTimeVal_t *timeout = NULL); + wxTimeVal_t *timeout = nullptr); // convenient wrapper calling Select() with our default timeout wxSocketEventFlags SelectWithTimeout(wxSocketEventFlags flags) @@ -273,7 +273,7 @@ public: // just a wrapper for accept(): it is called to create a new wxSocketImpl // corresponding to a new server connection represented by the given - // wxSocketBase, returns NULL on error (including immediately if there are + // wxSocketBase, returns nullptr on error (including immediately if there are // no pending connections as our sockets are non-blocking) wxSocketImpl *Accept(wxSocketBase& wxsocket); @@ -365,7 +365,7 @@ private: int SendDgram(const void *buffer, int size); - // set in ctor and never changed except that it's reset to NULL when the + // set in ctor and never changed except that it's reset to nullptr when the // socket is shut down wxSocketBase *m_wxsocket; diff --git a/include/wx/private/streamtempinput.h b/include/wx/private/streamtempinput.h index 8a0401cd8b..ededf9de18 100644 --- a/include/wx/private/streamtempinput.h +++ b/include/wx/private/streamtempinput.h @@ -42,8 +42,8 @@ class wxStreamTempInputBuffer public: wxStreamTempInputBuffer() { - m_stream = NULL; - m_buffer = NULL; + m_stream = nullptr; + m_buffer = nullptr; m_size = 0; } @@ -119,10 +119,10 @@ public: size_t GetSize() const { return m_size; } private: - // the stream we're buffering, if NULL we don't do anything at all + // the stream we're buffering, if nullptr we don't do anything at all wxPipeInputStream *m_stream; - // the buffer of size m_size (NULL if m_size == 0) + // the buffer of size m_size (nullptr if m_size == 0) void *m_buffer; // the size of the buffer diff --git a/include/wx/private/textmeasure.h b/include/wx/private/textmeasure.h index 123fd448ba..416f553a13 100644 --- a/include/wx/private/textmeasure.h +++ b/include/wx/private/textmeasure.h @@ -21,9 +21,9 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; class wxTextMeasureBase { public: - // The first ctor argument must be non-NULL, i.e. each object of this class + // The first ctor argument must be non-null, i.e. each object of this class // is associated with either a valid wxDC or a valid wxWindow. The font can - // be NULL to use the current DC/window font or can be specified explicitly. + // be null to use the current DC/window font or can be specified explicitly. wxTextMeasureBase(const wxDC *dc, const wxFont *theFont); wxTextMeasureBase(const wxWindow *win, const wxFont *theFont); @@ -36,14 +36,14 @@ public: void GetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL); + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr); // The same for a multiline (with '\n') string. void GetMultiLineTextExtent(const wxString& text, wxCoord *width, wxCoord *height, - wxCoord *heightOneLine = NULL); + wxCoord *heightOneLine = nullptr); // Find the dimensions of the largest string. wxSize GetLargestStringExtent(size_t n, const wxString* strings); @@ -102,13 +102,13 @@ protected: // The main function of this class, to be implemented in platform-specific // way used by all our public methods. // - // The width and height pointers here are never NULL and the input string + // The width and height pointers here are never null and the input string // is not empty. virtual void DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL) = 0; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr) = 0; // The real implementation of GetPartialTextExtents(). // @@ -125,8 +125,8 @@ protected: void CallGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL); + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr); // Get line height: used when the line is empty because CallGetTextExtent() // would just return (0, 0) in this case. @@ -137,7 +137,7 @@ protected: wxFont GetFont() const; - // Exactly one of m_dc and m_win is non-NULL for any given object of this + // Exactly one of m_dc and m_win is non-null for any given object of this // class. const wxDC* const m_dc; const wxWindow* const m_win; @@ -152,7 +152,7 @@ protected: // implementation of text measuring itself. bool m_useDCImpl; - // This one can be NULL or not. + // This one can be null or not. const wxFont* const m_font; wxDECLARE_NO_COPY_CLASS(wxTextMeasureBase); diff --git a/include/wx/private/threadinfo.h b/include/wx/private/threadinfo.h index 27a71674b0..cbdc6df98d 100644 --- a/include/wx/private/threadinfo.h +++ b/include/wx/private/threadinfo.h @@ -34,7 +34,7 @@ public: // Return this thread's instance. static wxThreadSpecificInfo& Get(); - // the thread-specific logger or NULL if the thread is using the global one + // the thread-specific logger or nullptr if the thread is using the global one // (this is not used for the main thread which always uses the global // logger) wxLog *logger; @@ -60,7 +60,7 @@ public: #endif private: - wxThreadSpecificInfo() : logger(NULL), loggingDisabled(false) {} + wxThreadSpecificInfo() : logger(nullptr), loggingDisabled(false) {} }; #define wxThreadInfo wxThreadSpecificInfo::Get() diff --git a/include/wx/private/uilocale.h b/include/wx/private/uilocale.h index 55ca4f9b56..bd814c89fe 100644 --- a/include/wx/private/uilocale.h +++ b/include/wx/private/uilocale.h @@ -34,18 +34,18 @@ public: // object used by default, i.e. if wxUILocale::UseDefault() is not called. // This object corresponds to the traditional "C" locale. // - // It should never return NULL. + // It should never return nullptr. static wxUILocaleImpl* CreateStdC(); // Similarly, this one returns the object corresponding to the default user // locale settings which is used if wxUILocale::UseDefault() was called. // - // It may return NULL in case of failure. + // It may return nullptr in case of failure. static wxUILocaleImpl* CreateUserDefault(); // Create locale object for the given locale. // - // It may return NULL in case of failure. + // It may return nullptr in case of failure. static wxUILocaleImpl* CreateForLocale(const wxLocaleIdent& locId); // This function exists only for wxLocale compatibility and creates the @@ -58,7 +58,7 @@ public: // The language passed to this function is a valid language, i.e. neither // wxLANGUAGE_UNKNOWN nor wxLANGUAGE_DEFAULT. // - // It may return NULL in case of failure, but never does so for English + // It may return nullptr in case of failure, but never does so for English // languages because wxLocale(wxLANGUAGE_ENGLISH) is always supposed to // work, so it just falls back on CreateStdC() if it fails to create it. static wxUILocaleImpl* CreateForLanguage(const wxLanguageInfo& info); diff --git a/include/wx/private/wxprintf.h b/include/wx/private/wxprintf.h index 05be4142ca..e82af1a0af 100644 --- a/include/wx/private/wxprintf.h +++ b/include/wx/private/wxprintf.h @@ -192,7 +192,7 @@ void wxPrintfConvSpec::Init() m_nMaxWidth = INT_MAX; m_pos = 0; m_bAlignLeft = false; - m_pArgPos = m_pArgEnd = NULL; + m_pArgPos = m_pArgEnd = nullptr; m_type = wxPAT_INVALID; memset(m_szFlags, 0, sizeof(m_szFlags)); diff --git a/include/wx/prntbase.h b/include/wx/prntbase.h index 078f198f81..db7d726e1a 100644 --- a/include/wx/prntbase.h +++ b/include/wx/prntbase.h @@ -81,19 +81,19 @@ public: virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ) = 0; + wxPrintout *printout = nullptr, + wxPrintDialogData *data = nullptr ) = 0; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout, wxPrintData *data ) = 0; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ) = 0; + wxPrintDialogData *data = nullptr ) = 0; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, wxPrintData *data ) = 0; virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ) = 0; + wxPageSetupDialogData * data = nullptr ) = 0; virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0; @@ -125,19 +125,19 @@ public: virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) override; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, - wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ) override; + wxPrintout *printout = nullptr, + wxPrintDialogData *data = nullptr ) override; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout, wxPrintData *data ) override; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ) override; + wxPrintDialogData *data = nullptr ) override; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, wxPrintData *data ) override; virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ) override; + wxPageSetupDialogData * data = nullptr ) override; virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) override; @@ -190,7 +190,7 @@ private: class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject { public: - wxPrinterBase(wxPrintDialogData *data = NULL); + wxPrinterBase(wxPrintDialogData *data = nullptr); virtual ~wxPrinterBase(); virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); @@ -230,7 +230,7 @@ private: class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase { public: - wxPrinter(wxPrintDialogData *data = NULL); + wxPrinter(wxPrintDialogData *data = nullptr); virtual ~wxPrinter(); virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout) override; @@ -323,7 +323,7 @@ public: virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; } wxPrintPreview *GetPreview() const { return m_preview; } - virtual bool IsPreview() const { return GetPreview() != NULL; } + virtual bool IsPreview() const { return GetPreview() != nullptr; } private: wxString m_printoutTitle; @@ -580,8 +580,8 @@ class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject { public: wxPrintPreviewBase(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); @@ -691,8 +691,8 @@ class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase { public: wxPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/process.h b/include/wx/process.h index 7d334f2cc5..48e9fcd96a 100644 --- a/include/wx/process.h +++ b/include/wx/process.h @@ -47,17 +47,17 @@ public: // asynchronously and allows the caller to get the streams connected to its // std{in|out|err} // - // on error NULL is returned, in any case the process object will be + // on error nullptr is returned, in any case the process object will be // deleted automatically when the process terminates and should *not* be // deleted by the caller static wxProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); // ctors - wxProcess(wxEvtHandler *parent = NULL, int nId = wxID_ANY) + wxProcess(wxEvtHandler *parent = nullptr, int nId = wxID_ANY) { Init(parent, nId, wxPROCESS_DEFAULT); } - wxProcess(int flags) { Init(NULL, wxID_ANY, flags); } + wxProcess(int flags) { Init(nullptr, wxID_ANY, flags); } virtual ~wxProcess(); @@ -90,7 +90,7 @@ public: wxOutputStream *GetOutputStream() const { return m_outputStream; } // close the output stream indicating that nothing more will be written - void CloseOutput() { delete m_outputStream; m_outputStream = NULL; } + void CloseOutput() { delete m_outputStream; m_outputStream = nullptr; } // return true if the child process stdout is not closed bool IsInputOpened() const; diff --git a/include/wx/progdlg.h b/include/wx/progdlg.h index 087c75a3d1..f06aef1c9a 100644 --- a/include/wx/progdlg.h +++ b/include/wx/progdlg.h @@ -47,7 +47,7 @@ public: wxProgressDialog( const wxString& title, const wxString& message, int maximum = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ) : wxGenericProgressDialog( title, message, maximum, parent, style ) diff --git a/include/wx/propgrid/advprops.h b/include/wx/propgrid/advprops.h index 624be4eae4..c62425928b 100644 --- a/include/wx/propgrid/advprops.h +++ b/include/wx/propgrid/advprops.h @@ -202,7 +202,7 @@ public: // custom colour tables etc. virtual wxColour GetColour( int index ) const; - wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const; + wxColourPropertyValue GetVal( const wxVariant* pVariant = nullptr ) const; protected: diff --git a/include/wx/propgrid/editors.h b/include/wx/propgrid/editors.h index 9a42ef491e..d6d2afaded 100644 --- a/include/wx/propgrid/editors.h +++ b/include/wx/propgrid/editors.h @@ -27,7 +27,7 @@ class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid; class wxPGWindowList { public: - wxPGWindowList(wxWindow* primary, wxWindow* secondary = NULL) + wxPGWindowList(wxWindow* primary, wxWindow* secondary = nullptr) : m_primary(primary) , m_secondary(secondary) { @@ -67,7 +67,7 @@ public: // Constructor. wxPGEditor() : wxObject() - , m_clientData(NULL) + , m_clientData(nullptr) { } @@ -192,7 +192,7 @@ wxString CLASSNAME::GetName() const \ { \ return wxS(#EDITOR); \ } \ -wxPGEditor* wxPGEditor_##EDITOR = NULL; +wxPGEditor* wxPGEditor_##EDITOR = nullptr; // @@ -399,7 +399,7 @@ public: // Editor class registration macro (mostly for internal use) #define wxPGRegisterEditorClass(EDITOR) \ - if ( wxPGEditor_##EDITOR == NULL ) \ + if ( wxPGEditor_##EDITOR == nullptr ) \ { \ wxPGEditor_##EDITOR = wxPropertyGrid::RegisterEditorClass( \ new wxPG##EDITOR##Editor ); \ @@ -418,7 +418,7 @@ class WXDLLIMPEXP_PROPGRID wxPGEditorDialogAdapter : public wxObject public: wxPGEditorDialogAdapter() : wxObject() - , m_clientData(NULL) + , m_clientData(nullptr) { } diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index 069cd66b0d..4ab85efc27 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -194,14 +194,14 @@ public: // bmp - Bitmap bundle image for toolbar. If it's null then a built-in // default bitmap bundle is used. // pageObj - wxPropertyGridPage instance. Manager will take ownership of this object. - // NULL indicates that a default page instance should be created. + // nullptr indicates that a default page instance should be created. // Returns pointer to created page. // If toolbar is used, it is highly recommended that the pages are // added when the toolbar is not turned off using window style flag // switching. wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, const wxBitmapBundle& bmp = wxBitmapBundle(), - wxPropertyGridPage* pageObj = NULL ) + wxPropertyGridPage* pageObj = nullptr ) { return InsertPage(-1, label, bmp, pageObj); } @@ -271,7 +271,7 @@ public: // failure. Please only iterate through individual pages or use // CreateVIterator(). wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL ) + wxPGProperty* firstProp = nullptr ) { wxFAIL_MSG( wxS("Please only iterate through individual pages ") wxS("or use CreateVIterator()") ); @@ -280,7 +280,7 @@ public: wxPropertyGridConstIterator GetIterator(int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL) const + wxPGProperty* firstProp = nullptr) const { wxFAIL_MSG( wxS("Please only iterate through individual pages ") wxS("or use CreateVIterator()") ); @@ -380,12 +380,12 @@ public: // bmp - Bitmap bundle for toolbar. If it's null, then a built-in // default bitmap bundle is used. // pageObj - wxPropertyGridPage instance. Manager will take ownership of this object. - // If NULL, default page object is constructed. + // If nullptr, default page object is constructed. // Returns pointer to created page. virtual wxPropertyGridPage* InsertPage( int index, const wxString& label, const wxBitmapBundle& bmp = wxBitmapBundle(), - wxPropertyGridPage* pageObj = NULL ); + wxPropertyGridPage* pageObj = nullptr ); // Returns true if any property on any page has been modified by the user. bool IsAnyModified() const; diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 03e947c8be..46086119c9 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -23,7 +23,7 @@ // ----------------------------------------------------------------------- -#define wxNullProperty ((wxPGProperty*)NULL) +#define wxNullProperty ((wxPGProperty*)nullptr) // Contains information relayed to property's OnCustomPaint. @@ -101,7 +101,7 @@ public: int flags ) const = 0; // Returns size of the image in front of the editable area. - // If property is NULL, then this call is for a custom value. + // If property is null, then this call is for a custom value. // In that case the item is index to wxPropertyGrid's custom values. virtual wxSize GetImageSize( const wxPGProperty* property, int column, @@ -124,7 +124,7 @@ public: const wxString& text ) const; // Utility to draw editor's value, or vertically - // aligned text if editor is NULL. + // aligned text if editor is null. void DrawEditorValue( wxDC& dc, const wxRect& rect, int xOffset, const wxString& text, wxPGProperty* property, @@ -278,7 +278,7 @@ public: // to have default values when attached to a grid. bool IsInvalid() const { - return ( m_refData == NULL ); + return ( m_refData == nullptr ); } private: @@ -710,7 +710,7 @@ protected: virtual ~wxPGChoicesData(); }; -#define wxPGChoicesEmptyData ((wxPGChoicesData*)NULL) +#define wxPGChoicesEmptyData ((wxPGChoicesData*)nullptr) // Helper class for managing choices of wxPropertyGrid properties. @@ -750,8 +750,8 @@ public: // Constructor. // count - Number of labels. // labels - Labels themselves. - // values - Values for choices. If NULL, indexes are used. - wxPGChoices(size_t count, const wxString* labels, const long* values = NULL) + // values - Values for choices. If nullptr, indexes are used. + wxPGChoices(size_t count, const wxString* labels, const long* values = nullptr) { Init(); Add(count, labels, values); @@ -759,9 +759,9 @@ public: // Constructor overload taking wxChar strings, provided mostly for // compatibility. - // labels - Labels for choices, NULL-terminated. - // values - Values for choices. If NULL, indexes are used. - wxPGChoices( const wxChar* const* labels, const long* values = NULL ) + // labels - Labels for choices, nullptr-terminated. + // values - Values for choices. If nullptr, indexes are used. + wxPGChoices( const wxChar* const* labels, const long* values = nullptr ) { Init(); Add(labels,values); @@ -794,12 +794,12 @@ public: // Adds to current. // If did not have own copies, creates them now. If was empty, identical // to set except that creates copies. - void Add(size_t count, const wxString* labels, const long* values = NULL); + void Add(size_t count, const wxString* labels, const long* values = nullptr); // Overload taking wxChar strings, provided mostly for compatibility. - // labels - Labels for added choices, NULL-terminated. + // labels - Labels for added choices, nullptr-terminated. // values - Values for added choices. If empty, relevant entry indexes are used. - void Add( const wxChar* const* labels, const ValArrItem* values = NULL ); + void Add( const wxChar* const* labels, const ValArrItem* values = nullptr ); // Version that works with wxArrayString and wxArrayInt. void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() ); @@ -879,9 +879,9 @@ public: wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const; // Returns array of indices matching given strings. Unmatching strings - // are added to 'unmatched', if not NULL. + // are added to 'unmatched', if not null. wxArrayInt GetIndicesForStrings( const wxArrayString& strings, - wxArrayString* unmatched = NULL ) const; + wxArrayString* unmatched = nullptr ) const; // Returns index of item with given label. int Index( const wxString& str ) const; @@ -922,13 +922,13 @@ public: // Sets contents from lists of strings and values. // Does not create copies for itself. // TODO: Deprecate. - void Set(size_t count, const wxString* labels, const long* values = NULL) + void Set(size_t count, const wxString* labels, const long* values = nullptr) { Free(); Add(count, labels, values); } - void Set( const wxChar* const* labels, const long* values = NULL ) + void Set( const wxChar* const* labels, const long* values = nullptr ) { Free(); Add(labels,values); @@ -1152,7 +1152,7 @@ public: virtual const wxPGEditor* DoGetEditorClass() const; // Returns pointer to the wxValidator that should be used - // with the editor of this property (NULL for no validator). + // with the editor of this property (nullptr for no validator). // Setting validator explicitly via SetPropertyValidator // will override this. // You can get common filename validator by returning @@ -1224,12 +1224,12 @@ public: // Returns value of an attribute. // Override if custom handling of attributes is needed. - // Default implementation simply return NULL variant. + // Default implementation simply return nullptr variant. virtual wxVariant DoGetAttribute( const wxString& name ) const; // Returns instance of a new wxPGEditorDialogAdapter instance, which is // used when user presses the (optional) button next to the editor control; - // Default implementation returns NULL (ie. no action is generated when + // Default implementation returns nullptr (ie. no action is generated when // button is pressed). virtual wxPGEditorDialogAdapter* GetEditorDialog() const; @@ -1453,10 +1453,10 @@ public: return m_value.GetType(); } - // Returns editor used for given column. NULL for no editor. + // Returns editor used for given column. nullptr for no editor. const wxPGEditor* GetColumnEditor( int column ) const { - return column == 1 ? GetEditorClass() : NULL; + return column == 1 ? GetEditorClass() : nullptr; } // Returns common value selected for this property. -1 for none. @@ -1481,7 +1481,7 @@ public: bool IsCategory() const { return (m_flags & wxPG_PROP_CATEGORY) != 0; } // Returns true if this property is actually a wxRootProperty. - bool IsRoot() const { return (m_parent == NULL); } + bool IsRoot() const { return (m_parent == nullptr); } // Returns true if this is a sub-property. bool IsSubProperty() const @@ -1510,7 +1510,7 @@ public: // Determines, recursively, if all children are not unspecified. // pendingList - Assumes members in this wxVariant list as pending // replacement values. - bool AreAllChildrenSpecified( const wxVariant* pendingList = NULL ) const; + bool AreAllChildrenSpecified( const wxVariant* pendingList = nullptr ) const; // Updates composed values of parent non-category properties, recursively. // Returns topmost property updated. @@ -1523,7 +1523,7 @@ public: return (m_flags & wxPG_PROP_AUTO_UNSPECIFIED) != 0; } - // Returns bitmap that appears next to value text. Only returns non-@NULL + // Returns bitmap that appears next to value text. Only returns non-null // bitmap if one was set with SetValueImage(). wxBitmap* GetValueImage() const; @@ -1674,7 +1674,7 @@ public: // indicate which children should be marked as modified. // flags - Various flags (for instance, wxPG_SETVAL_REFRESH_EDITOR, which // is enabled by default). - void SetValue( wxVariant value, wxVariant* pList = NULL, + void SetValue( wxVariant value, wxVariant* pList = nullptr, int flags = wxPG_SETVAL_REFRESH_EDITOR ); // Set wxBitmap in front of the value. This bitmap may be ignored @@ -1738,8 +1738,8 @@ public: // Sets property's value to unspecified (i.e. Null variant). void SetValueToUnspecified() { - wxVariant val; // Create NULL variant - SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR); + wxVariant val; // Create null variant + SetValue(val, nullptr, wxPG_SETVAL_REFRESH_EDITOR); } // Helper function (for wxPython bindings and such) for settings protected @@ -1869,7 +1869,7 @@ public: // Returns property at given virtual y coordinate. wxPGProperty* GetItemAtY( unsigned int y ) const; - // Returns (direct) child property with given name (or NULL if not found). + // Returns (direct) child property with given name (or nullptr if not found). wxPGProperty* GetPropertyByName( const wxString& name ) const; // Returns various display-related information for given column @@ -1932,7 +1932,7 @@ protected: // Makes sure m_cells has size of column+1 (or more). void EnsureCells( unsigned int column ); - // Returns (direct) child property with given name (or NULL if not found), + // Returns (direct) child property with given name (or nullptr if not found), // with hint index. // hintIndex - Start looking for the child at this index. // Does not support scope (i.e. Parent.Child notation). @@ -1946,8 +1946,8 @@ protected: void DoGenerateComposedValue( wxString& text, int argFlags = wxPG_VALUE_IS_CURRENT, - const wxVariantList* valueOverrides = NULL, - wxPGHashMapS2S* childResults = NULL ) const; + const wxVariantList* valueOverrides = nullptr, + wxPGHashMapS2S* childResults = nullptr ) const; bool DoHide( bool hide, int flags ); diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index c3965ed4b1..9e8b307a5f 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -597,7 +597,7 @@ enum wxPG_INTERNAL_FLAGS // to prevent change from taking place, if necessary. // EVT_PG_HIGHLIGHTED(id, func) // Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse -// moves over a property. Event's property is NULL if hovered area does +// moves over a property. Event's property is null if hovered area does // not belong to any property. // EVT_PG_RIGHT_CLICK(id, func) // Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is @@ -811,8 +811,8 @@ public: wxRect GetImageRect( wxPGProperty* p, int item ) const; // Returns size of the custom paint image in front of property. - // If no argument is given (p is NULL), returns preferred size. - wxSize GetImageSize( wxPGProperty* p = NULL, int item = -1 ) const; + // If no argument is given (p is null), returns preferred size. + wxSize GetImageSize( wxPGProperty* p = nullptr, int item = -1 ) const; // Returns last item which could be iterated using given flags. wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) @@ -991,7 +991,7 @@ public: DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT); } - // Returns currently active label editor, NULL if none. + // Returns currently active label editor, nullptr if none. wxTextCtrl* GetLabelEditor() const { return m_labelEditor; @@ -1074,7 +1074,7 @@ public: m_sortFunction = sortFunction; } - // Returns the property sort function (default is NULL). + // Returns the property sort function (default is null). wxPGSortCallback GetSortFunction() const { return m_sortFunction; @@ -1141,7 +1141,7 @@ public: const wxPGCommonValue* GetCommonValue( unsigned int i ) const { - wxCHECK_MSG( i < m_commonValues.size(), NULL, "Invalid item index" ); + wxCHECK_MSG( i < m_commonValues.size(), nullptr, "Invalid item index" ); return m_commonValues[i]; } @@ -1229,7 +1229,7 @@ public: wxRect GetPropertyRect( const wxPGProperty* p1, const wxPGProperty* p2 ) const; - // Returns pointer to current active primary editor control (NULL if none). + // Returns pointer to current active primary editor control (nullptr if none). wxWindow* GetEditorControl() const; wxWindow* GetPrimaryEditor() const @@ -1237,7 +1237,7 @@ public: return GetEditorControl(); } - // Returns pointer to current active secondary editor control (NULL if + // Returns pointer to current active secondary editor control (nullptr if // none). wxWindow* GetEditorControlSecondary() const { @@ -1271,7 +1271,7 @@ public: double value, int precision, bool removeZeroes, - wxString* precTemplate = NULL ); + wxString* precTemplate = nullptr ); #endif // WXWIN_COMPATIBILITY_3_0 // Call this from wxPGProperty::OnEvent() to cause property value to be @@ -1431,7 +1431,7 @@ public: wxPGProperty* GetItemAtY( int y ) const { return DoGetItemAtY(y); } virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = (const wxRect *) nullptr ) override; virtual bool SetFont( const wxFont& font ) override; virtual void SetExtraStyle( long exStyle ) override; virtual bool Reparent( wxWindowBase *newParent ) override; @@ -1642,7 +1642,7 @@ protected: // handling mess). wxWindow* m_curFocused; - // Event currently being sent - NULL if none at the moment + // Event currently being sent - nullptr if none at the moment wxPropertyGridEvent* m_processedEvent; // Last known top-level parent @@ -1766,7 +1766,7 @@ protected: bool AddToSelectionFromInputEvent( wxPGProperty* prop, unsigned int colIndex, - wxMouseEvent* event = NULL, + wxMouseEvent* event = nullptr, int selFlags = 0 ); // Adjust the centering of the bitmap icons (collapse / expand) when the @@ -1815,14 +1815,14 @@ protected: void DrawItems( wxDC& dc, unsigned int topItemY, unsigned int bottomItemY, - const wxRect* itemsRect = NULL ); + const wxRect* itemsRect = nullptr ); // Translate wxKeyEvent to wxPG_ACTION_XXX int KeyEventToActions(wxKeyEvent &event, int* pSecond) const; int KeyEventToAction(wxKeyEvent &event) const { - return KeyEventToActions(event, NULL); + return KeyEventToActions(event, nullptr); } void ImprovedClientToScreen( int* px, int* py ) const; @@ -1901,7 +1901,7 @@ protected: // Send event from the property grid. // Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event bool SendEvent( wxEventType eventType, wxPGProperty* p, - wxVariant* pValue = NULL, + wxVariant* pValue = nullptr, unsigned int selFlags = wxPG_SEL_NOVALIDATE, unsigned int column = 1 ); @@ -1978,20 +1978,20 @@ wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent); #ifndef SWIG typedef void (wxEvtHandler::*wxPropertyGridEventFunction)(wxPropertyGridEvent&); -#define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), -#define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ), +#define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), +#define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), nullptr ), #define wxPropertyGridEventHandler(fn) \ wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ) @@ -2027,7 +2027,7 @@ public: wxPGProperty* GetMainParent() const { - wxCHECK_MSG(m_property, NULL, "Property cannot be NULL"); + wxCHECK_MSG(m_property, nullptr, "Property cannot be null"); return m_property->GetMainParent(); } @@ -2179,7 +2179,7 @@ public: const wxString& propLabel, const wxString& propName, const wxString* propValue, - wxPGChoices* pChoices = NULL ); + wxPGChoices* pChoices = nullptr ); // Pushes property to the back of parent array (ie it becomes bottommost // parent), and starts scanning/adding children for it. diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index 6f71db61e3..f5a2ce6459 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -33,7 +33,7 @@ public: wxPGPropArgCls( const wxString& str ) { m_name = str; - m_property = NULL; + m_property = nullptr; m_isProperty = false; } wxPGPropArgCls( const wxPGPropArgCls& id ) @@ -47,32 +47,32 @@ public: { m_name = *str; delete str; // we own this string - m_property = NULL; + m_property = nullptr; m_isProperty = false; } wxPGProperty* GetPtr() const { - wxCHECK( m_isProperty, NULL ); + wxCHECK( m_isProperty, nullptr ); return m_property; } #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING wxPGPropArgCls( const char* str ) { m_name = str; - m_property = NULL; + m_property = nullptr; m_isProperty = false; } #endif // !wxNO_IMPLICIT_WXSTRING_ENCODING wxPGPropArgCls( const wchar_t* str ) { m_name = str; - m_property = NULL; + m_property = nullptr; m_isProperty = false; } - // This constructor is required for NULL. + // This constructor is required for null. wxPGPropArgCls( int ) { - m_property = NULL; + m_property = nullptr; m_isProperty = true; } wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const; @@ -254,17 +254,17 @@ public: // Returns iterator class instance. // flags - See wxPG_ITERATOR_FLAGS. Value wxPG_ITERATE_DEFAULT causes // iteration over everything except private child properties. - // firstProp - Property to start iteration from. If NULL, then first + // firstProp - Property to start iteration from. If nullptr, then first // child of root is used. wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL ) + wxPGProperty* firstProp = nullptr ) { return wxPropertyGridIterator( m_pState, flags, firstProp ); } wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL ) const + wxPGProperty* firstProp = nullptr ) const { return wxPropertyGridConstIterator( m_pState, flags, firstProp ); } @@ -298,7 +298,7 @@ public: } // Returns pointer to a property with given name (case-sensitive). - // If there is no property with such name, NULL pointer is returned. + // If there is no property with such name, null pointer is returned. // Properties which have non-category, non-root parent // cannot be accessed globally by their name. Instead, use // "." instead of "". @@ -340,27 +340,27 @@ public: } // Returns pointer of property's nearest parent category. If no category - // found, returns NULL. + // found, returns nullptr. wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const { - wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(NULL) + wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(nullptr) return m_pState->GetPropertyCategory(p); } // Returns client data (void*) of a property. void* GetPropertyClientData( wxPGPropArg id ) const { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(nullptr) return p->GetClientData(); } // Returns first property which label matches given string. - // NULL if none found. Note that this operation is extremely slow when + // nullptr if none found. Note that this operation is extremely slow when // compared to GetPropertyByName(). wxPGProperty* GetPropertyByLabel( const wxString& label ) const; // Returns pointer to a property with given name (case-sensitive). - // If there is no property with such name, @NULL pointer is returned. + // If there is no property with such name, null pointer is returned. wxPGProperty* GetPropertyByName( const wxString& name ) const; // Returns child property 'subname' of property 'name'. Same as @@ -371,7 +371,7 @@ public: // Returns property's editor. const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(nullptr) return p->GetEditorClass(); } @@ -382,10 +382,10 @@ public: return p->GetHelpString(); } - // Returns property's custom value image (NULL of none). + // Returns property's custom value image (nullptr if none). wxBitmap* GetPropertyImage( wxPGPropArg id ) const { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(nullptr) return p->GetValueImage(); } @@ -414,7 +414,7 @@ public: // can pass to any number of SetPropertyValidator. wxValidator* GetPropertyValidator( wxPGPropArg id ) { - wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL) + wxPG_PROP_ARG_CALL_PROLOG_RETVAL(nullptr) return p->GetValidator(); } #endif @@ -457,12 +457,12 @@ public: // Each attribute will be stored as list variant named // "@@attr." wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, - wxPGProperty* baseparent = NULL, long flags = 0 ) const + wxPGProperty* baseparent = nullptr, long flags = 0 ) const { return m_pState->DoGetPropertyValues(listname, baseparent, flags); } - // Returns currently selected property. NULL if none. + // Returns currently selected property. nullptr if none. // When wxPG_EX_MULTIPLE_SELECTION extra style is used, this // member function returns the focused property, that is the // one which can have active editor. @@ -598,7 +598,7 @@ public: void LimitPropertyEditing( wxPGPropArg id, bool limit = true ); // If state is shown in it's grid, refresh it now. - virtual void RefreshGrid( wxPropertyGridPageState* state = NULL ); + virtual void RefreshGrid( wxPropertyGridPageState* state = nullptr ); #if wxPG_INCLUDE_ADVPROPS // Initializes additional property editors (SpinCtrl etc.). Causes @@ -778,7 +778,7 @@ public: void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor ) { wxPG_PROP_ARG_CALL_PROLOG() - wxCHECK_RET( editor, wxS("unknown/NULL editor") ); + wxCHECK_RET( editor, wxS("unknown/null editor") ); p->SetEditor(editor); RefreshProperty(p); } @@ -1067,7 +1067,7 @@ protected: // Returns page state data for given (sub) page (-1 means current page). virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const { - return pageIndex <= 0 ? m_pState : NULL; + return pageIndex <= 0 ? m_pState : nullptr; } virtual bool DoSelectPage( int WXUNUSED(index) ) { return true; } @@ -1091,13 +1091,13 @@ private: // Cannot be GetGrid() due to ambiguity issues. wxPropertyGrid* GetPropertyGrid() { - return m_pState ? m_pState->GetGrid() : NULL; + return m_pState ? m_pState->GetGrid() : nullptr; } // Cannot be GetGrid() due to ambiguity issues. const wxPropertyGrid* GetPropertyGrid() const { - return m_pState ? m_pState->GetGrid() : NULL; + return m_pState ? m_pState->GetGrid() : nullptr; } }; diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h index 6c98b65f5c..c56e4b8a92 100644 --- a/include/wx/propgrid/propgridpagestate.h +++ b/include/wx/propgrid/propgridpagestate.h @@ -26,7 +26,7 @@ class WXDLLIMPEXP_PROPGRID wxPropertyGridHitTestResult friend class wxPropertyGridPageState; public: wxPropertyGridHitTestResult() - : m_property(NULL) + : m_property(nullptr) , m_column(-1) , m_splitter(-1) , m_splitterHitOffset(0) @@ -40,7 +40,7 @@ public: // Returns column hit. -1 for margin. int GetColumn() const { return m_column; } - // Returns property hit. NULL if empty space below + // Returns property hit. nullptr if empty space below // properties was hit instead. wxPGProperty* GetProperty() const { @@ -55,7 +55,7 @@ public: int GetSplitterHitOffset() const { return m_splitterHitOffset; } private: - // Property. NULL if empty space below properties was hit. + // Property. nullptr if empty space below properties was hit. wxPGProperty* m_property; // Column. -1 for margin. @@ -169,7 +169,7 @@ public: void Assign( const wxPropertyGridIteratorBase& it ); - bool AtEnd() const { return m_property == NULL; } + bool AtEnd() const { return m_property == nullptr; } // Get current property. wxPGProperty* GetProperty() const { return m_property; } @@ -214,7 +214,7 @@ class wxPGIterator : public wxPropertyGridIteratorBase { public: wxPGIterator(STATE* state, int flags = wxPG_ITERATE_DEFAULT, - PROPERTY* property = NULL, int dir = 1) + PROPERTY* property = nullptr, int dir = 1) : wxPropertyGridIteratorBase() { Init(const_cast(state), flags, const_cast(property), dir); @@ -227,7 +227,7 @@ public: wxPGIterator() : wxPropertyGridIteratorBase() { - m_property = NULL; + m_property = nullptr; } wxPGIterator(const wxPGIterator& it) : wxPropertyGridIteratorBase() @@ -250,7 +250,7 @@ public: wxPGIterator operator--(int) { wxPGIterator it = *this; Prev(); return it; } PROPERTY* operator *() const { return const_cast(m_property); } static PROPERTY* OneStep(STATE* state, int flags = wxPG_ITERATE_DEFAULT, - PROPERTY* property = NULL, int dir = 1) + PROPERTY* property = nullptr, int dir = 1) { wxPGIterator it(state, flags, property, dir); if ( property ) @@ -292,7 +292,7 @@ protected: class WXDLLIMPEXP_PROPGRID wxPGVIterator { public: - wxPGVIterator() { m_pIt = NULL; } + wxPGVIterator() { m_pIt = nullptr; } wxPGVIterator( wxPGVIteratorBase* obj ) { m_pIt = obj; } ~wxPGVIterator() { UnRef(); } void UnRef() { if (m_pIt) m_pIt->DecRef(); } @@ -417,7 +417,7 @@ public: // Returns currently selected property. wxPGProperty* GetSelection() const { - return m_selection.empty()? NULL: m_selection[0]; + return m_selection.empty()? nullptr: m_selection[0]; } wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const; @@ -425,7 +425,7 @@ public: #if WXWIN_COMPATIBILITY_3_0 wxDEPRECATED_MSG("don't refer directly to wxPropertyGridPageState::GetPropertyByLabel") wxPGProperty* GetPropertyByLabel( const wxString& name, - wxPGProperty* parent = NULL ) const; + wxPGProperty* parent = nullptr ) const; #endif // WXWIN_COMPATIBILITY_3_0 // Returns combined width of margin and all the columns @@ -471,7 +471,7 @@ protected: bool DoClearSelection() { - return DoSelectProperty(NULL); + return DoSelectProperty(nullptr); } void DoRemoveFromSelection(wxPGProperty* prop); @@ -527,7 +527,7 @@ protected: // Returns property by its label. wxPGProperty* BaseGetPropertyByLabel( const wxString& label, - const wxPGProperty* parent = NULL ) const; + const wxPGProperty* parent = nullptr ) const; // Unselect sub-properties. void DoRemoveChildrenFromSelection(wxPGProperty* p, bool recursive, @@ -599,7 +599,7 @@ protected: void SetVirtualWidth(int width); // If visible, then this is pointer to wxPropertyGrid. - // This shall *never* be NULL to indicate that this state is not visible. + // This shall *never* be null to indicate that this state is not visible. wxPropertyGrid* m_pPropGrid; // Pointer to currently used array. diff --git a/include/wx/propgrid/props.h b/include/wx/propgrid/props.h index 8f2251f1fd..053a16f45f 100644 --- a/include/wx/propgrid/props.h +++ b/include/wx/propgrid/props.h @@ -48,7 +48,7 @@ WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(NAME, T, EDITOR) // // These macros help creating DoGetValidator #define WX_PG_DOGETVALIDATOR_ENTRY() \ - static wxValidator* s_ptr = NULL; \ + static wxValidator* s_ptr = nullptr; \ if ( s_ptr ) return s_ptr; // Common function exit @@ -66,7 +66,7 @@ class WXDLLIMPEXP_PROPGRID wxPGInDialogValidator public: wxPGInDialogValidator() { - m_textCtrl = NULL; + m_textCtrl = nullptr; } ~wxPGInDialogValidator() @@ -350,7 +350,7 @@ public: // ----------------------------------------------------------------------- // If set, then selection of choices is static and should not be -// changed (i.e. returns NULL in GetPropertyChoices). +// changed (i.e. returns nullptr in GetPropertyChoices). #define wxPG_PROP_STATIC_CHOICES wxPG_PROP_CLASS_SPECIFIC_1 // Represents a single selection from a list of choices @@ -367,8 +367,8 @@ public: #ifndef SWIG wxEnumProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxChar* const* labels = NULL, - const long* values = NULL, + const wxChar* const* labels = nullptr, + const long* values = nullptr, int value = 0 ); wxEnumProperty( const wxString& label, const wxString& name, @@ -436,12 +436,12 @@ protected: const wxString& text, int argFlags ) const { - return ValueFromString_(value, NULL, text, argFlags); + return ValueFromString_(value, nullptr, text, argFlags); } wxDEPRECATED_MSG("use ValueFromInt_(wxVariant&, int*, int, int) function instead") bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const { - return ValueFromInt_(value, NULL, intVal, argFlags); + return ValueFromInt_(value, nullptr, intVal, argFlags); } wxDEPRECATED_MSG("don't use ResetNextIndex() function") static void ResetNextIndex() { } @@ -523,7 +523,7 @@ public: wxFlagsProperty( const wxString& label, const wxString& name, const wxChar* const* labels, - const long* values = NULL, + const long* values = nullptr, long value = 0 ); wxFlagsProperty( const wxString& label, const wxString& name, @@ -814,7 +814,7 @@ WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(PROPNAME, \ DELIMCHAR, \ CUSTBUTTXT) \ wxValidator* PROPNAME::DoGetValidator () const \ -{ return NULL; } +{ return nullptr; } // ----------------------------------------------------------------------- @@ -878,7 +878,7 @@ public: // Note: Dialog frees the validator. virtual wxValidator* GetTextCtrlValidator() const { - return NULL; + return nullptr; } // Returns true if array was actually modified diff --git a/include/wx/protocol/protocol.h b/include/wx/protocol/protocol.h index 89a56d3e42..2c465ed223 100644 --- a/include/wx/protocol/protocol.h +++ b/include/wx/protocol/protocol.h @@ -98,15 +98,15 @@ public: // set the logger, deleting the old one and taking ownership of this one void SetLog(wxProtocolLog *log); - // return the current logger, may be NULL + // return the current logger, may be null wxProtocolLog *GetLog() const { return m_log; } // detach the existing logger without deleting it, the caller is - // responsible for deleting the returned pointer if it's non-NULL + // responsible for deleting the returned pointer if it's non-null wxProtocolLog *DetachLog() { wxProtocolLog * const log = m_log; - m_log = NULL; + m_log = nullptr; return log; } diff --git a/include/wx/qt/bitmap.h b/include/wx/qt/bitmap.h index 9b7a44b420..eb1e265ca1 100644 --- a/include/wx/qt/bitmap.h +++ b/include/wx/qt/bitmap.h @@ -50,7 +50,7 @@ public: virtual wxBitmap GetSubBitmap(const wxRect& rect) const override; virtual bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const override; + const wxPalette *palette = nullptr) const override; virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) override; #if wxUSE_PALETTE diff --git a/include/wx/qt/calctrl.h b/include/wx/qt/calctrl.h index 7ca840139d..85f3506c43 100644 --- a/include/wx/qt/calctrl.h +++ b/include/wx/qt/calctrl.h @@ -63,7 +63,7 @@ public: // day attributes virtual wxCalendarDateAttr *GetAttr(size_t day) const override; virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) override; - virtual void ResetAttr(size_t day) override { SetAttr(day, NULL); } + virtual void ResetAttr(size_t day) override { SetAttr(day, nullptr); } virtual void SetWindowStyleFlag(long style) override; diff --git a/include/wx/qt/checklst.h b/include/wx/qt/checklst.h index f611a06e2f..f291eb4176 100644 --- a/include/wx/qt/checklst.h +++ b/include/wx/qt/checklst.h @@ -16,7 +16,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString *choices = (const wxString *)NULL, + const wxString *choices = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); @@ -34,7 +34,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/qt/choice.h b/include/wx/qt/choice.h index a2dfc65cdb..1a29c1e76d 100644 --- a/include/wx/qt/choice.h +++ b/include/wx/qt/choice.h @@ -18,7 +18,7 @@ public: wxChoice( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr) ); @@ -34,7 +34,7 @@ public: bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr) ); diff --git a/include/wx/qt/colordlg.h b/include/wx/qt/colordlg.h index cd2871a238..98736ebc9f 100644 --- a/include/wx/qt/colordlg.h +++ b/include/wx/qt/colordlg.h @@ -17,9 +17,9 @@ class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog public: wxColourDialog() { } wxColourDialog(wxWindow *parent, - const wxColourData *data = NULL) { Create(parent, data); } + const wxColourData *data = nullptr) { Create(parent, data); } - bool Create(wxWindow *parent, const wxColourData *data = NULL); + bool Create(wxWindow *parent, const wxColourData *data = nullptr); wxColourData &GetColourData(); diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h index 79d71f2e06..aecf5d82b1 100644 --- a/include/wx/qt/combobox.h +++ b/include/wx/qt/combobox.h @@ -21,7 +21,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); @@ -39,7 +39,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); diff --git a/include/wx/qt/dataview.h b/include/wx/qt/dataview.h index 3846d15c41..cd26b23824 100644 --- a/include/wx/qt/dataview.h +++ b/include/wx/qt/dataview.h @@ -108,12 +108,12 @@ public: virtual void UnselectAll(); virtual void EnsureVisible( const wxDataViewItem& item, - const wxDataViewColumn *column = NULL ); + const wxDataViewColumn *column = nullptr ); virtual void HitTest( const wxPoint &point, wxDataViewItem &item, wxDataViewColumn *&column ) const; virtual wxRect GetItemRect( const wxDataViewItem &item, - const wxDataViewColumn *column = NULL ) const; + const wxDataViewColumn *column = nullptr ) const; virtual void Collapse( const wxDataViewItem & item ); virtual bool IsExpanded( const wxDataViewItem & item ) const; diff --git a/include/wx/qt/dc.h b/include/wx/qt/dc.h index c8d05624cb..f63bef960e 100644 --- a/include/wx/qt/dc.h +++ b/include/wx/qt/dc.h @@ -44,9 +44,9 @@ public: virtual wxCoord GetCharWidth() const override; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; virtual void Clear() override; diff --git a/include/wx/qt/dcprint.h b/include/wx/qt/dcprint.h index 1713f73a5f..90edf4622a 100644 --- a/include/wx/qt/dcprint.h +++ b/include/wx/qt/dcprint.h @@ -40,9 +40,9 @@ public: virtual wxCoord GetCharWidth() const override; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const override; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const override; virtual void Clear() override; diff --git a/include/wx/qt/dnd.h b/include/wx/qt/dnd.h index b70fe69cf9..6d88f4e508 100644 --- a/include/wx/qt/dnd.h +++ b/include/wx/qt/dnd.h @@ -13,7 +13,7 @@ class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase { public: - wxDropTarget(wxDataObject *dataObject = NULL); + wxDropTarget(wxDataObject *dataObject = nullptr); virtual ~wxDropTarget(); virtual bool OnDrop(wxCoord x, wxCoord y) override; @@ -35,7 +35,7 @@ private: class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase { public: - wxDropSource(wxWindow *win = NULL, + wxDropSource(wxWindow *win = nullptr, const wxCursor © = wxNullCursor, const wxCursor &move = wxNullCursor, const wxCursor &none = wxNullCursor); diff --git a/include/wx/qt/frame.h b/include/wx/qt/frame.h index 353cac9a89..de9a508dc3 100644 --- a/include/wx/qt/frame.h +++ b/include/wx/qt/frame.h @@ -64,7 +64,7 @@ private: // Common part of all ctors. void Init() { - m_qtToolBar = NULL; + m_qtToolBar = nullptr; } diff --git a/include/wx/qt/glcanvas.h b/include/wx/qt/glcanvas.h index 58c16e80a5..2fd3409e8d 100644 --- a/include/wx/qt/glcanvas.h +++ b/include/wx/qt/glcanvas.h @@ -18,8 +18,8 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: wxGLContext(wxGLCanvas *win, - const wxGLContext *other = NULL, - const wxGLContextAttrs *ctxAttrs = NULL); + const wxGLContext *other = nullptr, + const wxGLContextAttrs *ctxAttrs = nullptr); /// virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const override; @@ -47,7 +47,7 @@ public: explicit wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -71,7 +71,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPalette& palette = wxNullPalette); virtual bool SwapBuffers() override; diff --git a/include/wx/qt/listbox.h b/include/wx/qt/listbox.h index f6844b5947..8d317704ce 100644 --- a/include/wx/qt/listbox.h +++ b/include/wx/qt/listbox.h @@ -19,7 +19,7 @@ public: wxListBox(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); @@ -37,7 +37,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/qt/listctrl.h b/include/wx/qt/listctrl.h index e58744ea7b..dc5414cd87 100644 --- a/include/wx/qt/listctrl.h +++ b/include/wx/qt/listctrl.h @@ -224,7 +224,7 @@ public: // Determines which item (if any) is at the specified point, // giving details in 'flags' (see wxLIST_HITTEST_... flags above) // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = nullptr) const; // Inserts an item, returning the index of the new item if successful, // -1 otherwise. diff --git a/include/wx/qt/menuitem.h b/include/wx/qt/menuitem.h index 6067ffed1c..92ca51f34a 100644 --- a/include/wx/qt/menuitem.h +++ b/include/wx/qt/menuitem.h @@ -19,12 +19,12 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase { public: - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); virtual void SetItemLabel(const wxString& str) override; virtual void SetCheckable(bool checkable) override; diff --git a/include/wx/qt/printdlg.h b/include/wx/qt/printdlg.h index 0793642b44..d370db5c75 100644 --- a/include/wx/qt/printdlg.h +++ b/include/wx/qt/printdlg.h @@ -44,9 +44,9 @@ class WXDLLIMPEXP_CORE wxQtPageSetupDialog: public wxPageSetupDialogBase { public: wxQtPageSetupDialog(); - wxQtPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL); + wxQtPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = nullptr); - bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL); + bool Create(wxWindow *parent, wxPageSetupDialogData *data = nullptr); virtual wxPageSetupDialogData& GetPageSetupDialogData() override; diff --git a/include/wx/qt/printqt.h b/include/wx/qt/printqt.h index 0f76ee473f..36221c14ad 100644 --- a/include/wx/qt/printqt.h +++ b/include/wx/qt/printqt.h @@ -13,7 +13,7 @@ class WXDLLIMPEXP_CORE wxQtPrinter : public wxPrinterBase { public: - wxQtPrinter( wxPrintDialogData *data = NULL ); + wxQtPrinter( wxPrintDialogData *data = nullptr ); virtual bool Setup(wxWindow *parent) override; virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) override; @@ -27,8 +27,8 @@ class WXDLLIMPEXP_CORE wxQtPrintPreview : public wxPrintPreviewBase { public: wxQtPrintPreview(wxPrintout *printout, - wxPrintout *printoutForPrinting = NULL, - wxPrintDialogData *data = NULL); + wxPrintout *printoutForPrinting = nullptr, + wxPrintDialogData *data = nullptr); wxQtPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data); diff --git a/include/wx/qt/private/pointer.h b/include/wx/qt/private/pointer.h index 6079a66cd8..16ca8b56d7 100644 --- a/include/wx/qt/private/pointer.h +++ b/include/wx/qt/private/pointer.h @@ -12,7 +12,7 @@ // Extend QPointer with the ability to delete the object in its destructor. The // normal behaviour of the QPointer makes sure that this is safe, because if somebody -// has deleted the object, then data() returns NULL and delete does nothing. +// has deleted the object, then data() returns nullptr and delete does nothing. template < typename T > class wxQtPointer : public QPointer< T > diff --git a/include/wx/qt/private/treeitemdelegate.h b/include/wx/qt/private/treeitemdelegate.h index 4ec514c14e..64617d47ca 100644 --- a/include/wx/qt/private/treeitemdelegate.h +++ b/include/wx/qt/private/treeitemdelegate.h @@ -23,13 +23,13 @@ class wxQTTreeItemDelegate : public QStyledItemDelegate public: explicit wxQTTreeItemDelegate(wxWindow* parent) : m_parent(parent), - m_textCtrl(NULL) + m_textCtrl(nullptr) { } QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &WXUNUSED(option), const QModelIndex &index) const override { - if ( m_textCtrl != NULL ) + if ( m_textCtrl != nullptr ) destroyEditor(m_textCtrl->GetHandle(), m_currentModelIndex); m_currentModelIndex = index; @@ -40,11 +40,11 @@ public: void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const override { - if ( m_textCtrl != NULL ) + if ( m_textCtrl != nullptr ) { m_currentModelIndex = QModelIndex(); // invalidate the index wxTheApp->ScheduleForDestruction(m_textCtrl); - m_textCtrl = NULL; + m_textCtrl = nullptr; } } diff --git a/include/wx/qt/private/treeitemfactory.h b/include/wx/qt/private/treeitemfactory.h index 2004ad0752..1db02f2dab 100644 --- a/include/wx/qt/private/treeitemfactory.h +++ b/include/wx/qt/private/treeitemfactory.h @@ -80,7 +80,7 @@ class wxQtTreeItemEditorFactory : public QItemEditorFactory public: explicit wxQtTreeItemEditorFactory(wxWindow* parent) : m_parent(parent), - m_textCtrl(NULL) + m_textCtrl(nullptr) { } @@ -93,7 +93,7 @@ public: QWidget* createEditor(int WXUNUSED(userType), QWidget* parent) const override { - if (m_textCtrl != NULL) + if (m_textCtrl != nullptr) ClearEditor(); m_textCtrl = new wxQtListTextCtrl(m_parent, parent); @@ -109,7 +109,7 @@ public: void ClearEditor() const { delete m_textCtrl; - m_textCtrl = NULL; + m_textCtrl = nullptr; } private: diff --git a/include/wx/qt/private/winevent.h b/include/wx/qt/private/winevent.h index 89b45fec97..e28fd85470 100644 --- a/include/wx/qt/private/winevent.h +++ b/include/wx/qt/private/winevent.h @@ -54,7 +54,7 @@ class wxQtEventSignalHandler : public Widget, public wxQtSignalHandler< Handler { public: wxQtEventSignalHandler( wxWindow *parent, Handler *handler ) - : Widget( parent != NULL ? parent->GetHandle() : NULL ) + : Widget( parent != nullptr ? parent->GetHandle() : nullptr ) , wxQtSignalHandler< Handler >( handler ) { // Set immediately as it is used to check if wxWindow is alive @@ -76,7 +76,7 @@ public: // Only process the signal / event if the wxWindow is not destroyed if ( !wxWindow::QtRetrieveWindowPointer( this ) ) { - return NULL; + return nullptr; } else return wxQtSignalHandler< Handler >::GetHandler(); diff --git a/include/wx/qt/radiobox.h b/include/wx/qt/radiobox.h index f46923d462..be32fa4a23 100644 --- a/include/wx/qt/radiobox.h +++ b/include/wx/qt/radiobox.h @@ -22,7 +22,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, @@ -44,7 +44,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, diff --git a/include/wx/qt/statusbar.h b/include/wx/qt/statusbar.h index 7ce1ae87c6..38a4eba722 100644 --- a/include/wx/qt/statusbar.h +++ b/include/wx/qt/statusbar.h @@ -32,7 +32,7 @@ public: virtual int GetBorderX() const override; virtual int GetBorderY() const override; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = nullptr ) override; QStatusBar *GetQStatusBar() const { return m_qtStatusBar; } QWidget *GetHandle() const override; diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index 5a8b1d832f..a2ef3ce9b2 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -53,7 +53,7 @@ public: const wxBitmapBundle& bmpNormal, const wxBitmapBundle& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) override; diff --git a/include/wx/qt/treectrl.h b/include/wx/qt/treectrl.h index b1d8d5248c..77c49072a8 100644 --- a/include/wx/qt/treectrl.h +++ b/include/wx/qt/treectrl.h @@ -86,7 +86,7 @@ public: virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual void Delete(const wxTreeItemId& item) override; virtual void DeleteChildren(const wxTreeItemId& item) override; @@ -131,7 +131,7 @@ protected: const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) override; + wxTreeItemData *data = nullptr) override; virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const override; diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 51a5396223..c557b05e37 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -99,7 +99,7 @@ public: virtual void Update() override; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = nullptr ) override; virtual bool SetCursor( const wxCursor &cursor ) override; virtual bool SetFont(const wxFont& font) override; @@ -120,14 +120,14 @@ public: // scroll window to the specified position virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) override; + const wxRect* rect = nullptr ) override; // Styles virtual void SetWindowStyleFlag( long style ) override; virtual void SetExtraStyle( long exStyle ) override; virtual bool SetBackgroundStyle(wxBackgroundStyle style) override; - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const override; + virtual bool IsTransparentBackgroundSupported(wxString* reason = nullptr) const override; virtual bool SetTransparent(wxByte alpha) override; virtual bool CanSetTransparent() override { return true; } @@ -184,9 +184,9 @@ public: protected: virtual void DoGetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const override; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) const override; // coordinates translation virtual void DoClientToScreen( int *x, int *y ) const override; @@ -227,7 +227,7 @@ protected: private: void Init(); - QScrollArea *m_qtContainer; // either NULL or the same as m_qtWindow pointer + QScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated @@ -238,7 +238,7 @@ private: QWidget *QtGetClientWidget() const; QScrollBar *QtGetScrollBar( int orientation ) const; - QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=NULL ); + QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=nullptr ); bool QtSetBackgroundStyle(); diff --git a/include/wx/quantize.h b/include/wx/quantize.h index b3a722df8c..90dd3c61f9 100644 --- a/include/wx/quantize.h +++ b/include/wx/quantize.h @@ -52,13 +52,13 @@ public: // If you pass a palette pointer, you must free the palette yourself. static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, - unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + unsigned char** eightBitData = nullptr, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); // This version sets a palette in the destination image so you don't // have to manage it yourself. static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, - unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + unsigned char** eightBitData = nullptr, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); //// Helpers diff --git a/include/wx/radiobox.h b/include/wx/radiobox.h index c11c9eb713..d9b8005159 100644 --- a/include/wx/radiobox.h +++ b/include/wx/radiobox.h @@ -58,9 +58,9 @@ public: // set the tooltip text for a radio item, empty string unsets any tooltip void SetItemToolTip(unsigned int item, const wxString& text); - // get the individual items tooltip; returns NULL if none + // get the individual items tooltip; returns nullptr if none wxToolTip *GetItemToolTip(unsigned int item) const - { return m_itemsTooltips ? (*m_itemsTooltips)[item] : NULL; } + { return m_itemsTooltips ? (*m_itemsTooltips)[item] : nullptr; } #endif // wxUSE_TOOLTIPS #if wxUSE_HELP @@ -94,7 +94,7 @@ protected: m_majorDim = 0; #if wxUSE_TOOLTIPS - m_itemsTooltips = NULL; + m_itemsTooltips = nullptr; #endif // wxUSE_TOOLTIPS } @@ -111,7 +111,7 @@ protected: #if wxUSE_TOOLTIPS // called from SetItemToolTip() to really set the tooltip for the specified - // item in the box (or, if tooltip is NULL, to remove any existing one). + // item in the box (or, if tooltip is null, to remove any existing one). // // NB: this function should really be pure virtual but to avoid breaking // the build of the ports for which it's not implemented yet we provide @@ -119,7 +119,7 @@ protected: virtual void DoSetItemToolTip(unsigned int item, wxToolTip *tooltip); // returns true if we have any item tooltips - bool HasItemToolTips() const { return m_itemsTooltips != NULL; } + bool HasItemToolTips() const { return m_itemsTooltips != nullptr; } #endif // wxUSE_TOOLTIPS #if wxUSE_HELP @@ -141,7 +141,7 @@ private: #if wxUSE_TOOLTIPS // array of tooltips for the individual items // - // this array is initially NULL and initialized on first use + // this array is initially null and initialized on first use wxToolTipArray *m_itemsTooltips; #endif diff --git a/include/wx/rawbmp.h b/include/wx/rawbmp.h index ebc5691ef6..4aaff1327a 100644 --- a/include/wx/rawbmp.h +++ b/include/wx/rawbmp.h @@ -353,12 +353,12 @@ struct wxPixelDataOut } else // alpha is not used at all { - m_pAlpha = NULL; + m_pAlpha = nullptr; } } // true if the iterator is valid - bool IsOk() const { return m_pRGB != NULL; } + bool IsOk() const { return m_pRGB != nullptr; } // navigation @@ -439,7 +439,7 @@ struct wxPixelDataOut // pointer into RGB buffer unsigned char *m_pRGB; - // pointer into alpha buffer or NULL if alpha isn't used + // pointer into alpha buffer or nullptr if alpha isn't used unsigned char *m_pAlpha; }; @@ -551,11 +551,11 @@ struct wxPixelDataOut // default constructor Iterator() { - m_ptr = NULL; + m_ptr = nullptr; } // return true if this iterator is valid - bool IsOk() const { return m_ptr != NULL; } + bool IsOk() const { return m_ptr != nullptr; } // navigation @@ -780,12 +780,12 @@ struct wxPixelDataOut // default constructor Iterator() { - m_ptr = NULL; - // m_bit doesn't need to be set until m_ptr != NULL + m_ptr = nullptr; + // m_bit doesn't need to be set until m_ptr != nullptr } // return true if this iterator is valid - bool IsOk() const { return m_ptr != NULL; } + bool IsOk() const { return m_ptr != nullptr; } // navigation diff --git a/include/wx/rearrangectrl.h b/include/wx/rearrangectrl.h index 22c768ec42..78935f1a3f 100644 --- a/include/wx/rearrangectrl.h +++ b/include/wx/rearrangectrl.h @@ -228,7 +228,7 @@ public: private: // common part of all ctors - void Init() { m_ctrl = NULL; } + void Init() { m_ctrl = nullptr; } wxRearrangeCtrl *m_ctrl; diff --git a/include/wx/regex.h b/include/wx/regex.h index e94714a055..b3e79b9e40 100644 --- a/include/wx/regex.h +++ b/include/wx/regex.h @@ -85,7 +85,7 @@ public: } // return true if this is a valid compiled regular expression - bool IsValid() const { return m_impl != NULL; } + bool IsValid() const { return m_impl != nullptr; } // compile the string into regular expression, return true if ok or false // if string has a syntax error diff --git a/include/wx/renderer.h b/include/wx/renderer.h index ef6582093e..8c009b70ae 100644 --- a/include/wx/renderer.h +++ b/include/wx/renderer.h @@ -192,7 +192,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; + wxHeaderButtonParams* params=nullptr) = 0; // Draw the contents of a header control button (label, sort arrows, etc.) @@ -202,7 +202,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params=NULL) = 0; + wxHeaderButtonParams* params=nullptr) = 0; // Returns the default height of a header button, either a fixed platform // height if available, or a generic height based on the window's font. @@ -399,14 +399,14 @@ public: #if wxUSE_DYNLIB_CLASS // load the renderer from the specified DLL, the returned pointer must be - // deleted by caller if not NULL when it is not used any more + // deleted by caller if not null when it is not used any more static wxRendererNative *Load(const wxString& name); #endif // wxUSE_DYNLIB_CLASS - // set the renderer to use, passing NULL reverts to using the default + // set the renderer to use, passing nullptr reverts to using the default // renderer // - // return the previous renderer used with Set() or NULL if none + // return the previous renderer used with Set() or nullptr if none static wxRendererNative *Set(wxRendererNative *renderer); @@ -441,7 +441,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override + wxHeaderButtonParams* params = nullptr) override { return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); } virtual int DrawHeaderButtonContents(wxWindow *win, @@ -449,7 +449,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override + wxHeaderButtonParams* params = nullptr) override { return m_rendererNative.DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); } virtual int GetHeaderButtonHeight(wxWindow *win) override diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index f9949134fe..b7d9677391 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -58,7 +58,7 @@ class WXDLLIMPEXP_RIBBON wxRibbonBarEvent : public wxNotifyEvent public: wxRibbonBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonPage* page = NULL) + wxRibbonPage* page = nullptr) : wxNotifyEvent(command_type, win_id) , m_page(page) { @@ -165,7 +165,7 @@ protected: virtual wxSize DoGetBestSize() const override; wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; } - wxRibbonPageTabInfo* HitTestTabs(wxPoint position, int* index = NULL); + wxRibbonPageTabInfo* HitTestTabs(wxPoint position, int* index = nullptr); void HitTestRibbonButton(const wxRect& rect, const wxPoint& position, bool &hover_flag); void CommonInit(long style); diff --git a/include/wx/ribbon/buttonbar.h b/include/wx/ribbon/buttonbar.h index 0bb9ccd41a..8dcec9664c 100644 --- a/include/wx/ribbon/buttonbar.h +++ b/include/wx/ribbon/buttonbar.h @@ -223,8 +223,8 @@ class WXDLLIMPEXP_RIBBON wxRibbonButtonBarEvent : public wxCommandEvent public: wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonButtonBar* bar = NULL, - wxRibbonButtonBarButtonBase* button = NULL) + wxRibbonButtonBar* bar = nullptr, + wxRibbonButtonBarButtonBase* button = nullptr) : wxCommandEvent(command_type, win_id) , m_bar(bar), m_button(button) { diff --git a/include/wx/ribbon/control.h b/include/wx/ribbon/control.h index 4fd3e50509..3069a541ca 100644 --- a/include/wx/ribbon/control.h +++ b/include/wx/ribbon/control.h @@ -69,7 +69,7 @@ protected: wxSize relative_to) const; private: - void Init() { m_art = NULL; } + void Init() { m_art = nullptr; } #ifndef SWIG wxDECLARE_CLASS(wxRibbonControl); diff --git a/include/wx/ribbon/gallery.h b/include/wx/ribbon/gallery.h index 18bdb50c80..603a576c80 100644 --- a/include/wx/ribbon/gallery.h +++ b/include/wx/ribbon/gallery.h @@ -127,8 +127,8 @@ class WXDLLIMPEXP_RIBBON wxRibbonGalleryEvent : public wxCommandEvent public: wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonGallery* gallery = NULL, - wxRibbonGalleryItem* item = NULL) + wxRibbonGallery* gallery = nullptr, + wxRibbonGalleryItem* item = nullptr) : wxCommandEvent(command_type, win_id) , m_gallery(gallery), m_item(item) { diff --git a/include/wx/ribbon/panel.h b/include/wx/ribbon/panel.h index aba5a0ee1e..4f21282b24 100644 --- a/include/wx/ribbon/panel.h +++ b/include/wx/ribbon/panel.h @@ -145,7 +145,7 @@ class WXDLLIMPEXP_RIBBON wxRibbonPanelEvent : public wxCommandEvent public: wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonPanel* panel = NULL) + wxRibbonPanel* panel = nullptr) : wxCommandEvent(command_type, win_id) , m_panel(panel) { diff --git a/include/wx/ribbon/toolbar.h b/include/wx/ribbon/toolbar.h index a6cd66df71..2388cf76df 100644 --- a/include/wx/ribbon/toolbar.h +++ b/include/wx/ribbon/toolbar.h @@ -85,7 +85,7 @@ public: const wxBitmap& bitmap_disabled = wxNullBitmap, const wxString& help_string = wxEmptyString, wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, - wxObject* client_data = NULL); + wxObject* client_data = nullptr); virtual wxRibbonToolBarToolBase* AddSeparator(); @@ -121,7 +121,7 @@ public: const wxBitmap& bitmap_disabled = wxNullBitmap, const wxString& help_string = wxEmptyString, wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, - wxObject* client_data = NULL); + wxObject* client_data = nullptr); virtual wxRibbonToolBarToolBase* InsertSeparator(size_t pos); @@ -206,7 +206,7 @@ class WXDLLIMPEXP_RIBBON wxRibbonToolBarEvent : public wxCommandEvent public: wxRibbonToolBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonToolBar* bar = NULL) + wxRibbonToolBar* bar = nullptr) : wxCommandEvent(command_type, win_id) , m_bar(bar) { diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 907b6909a4..13ade6faf1 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -386,7 +386,7 @@ public: /** Apply the dimension, but not those identical to @a compareWith if present. */ - bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = NULL); + bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of which attributes are absent in some objects and which clash in some objects. @@ -520,7 +520,7 @@ public: Apply to 'this', but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = NULL); + bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -612,7 +612,7 @@ public: /** Apply to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = NULL); + bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -883,7 +883,7 @@ public: Applies the border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL); + bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -1066,7 +1066,7 @@ public: /** Applies border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL); + bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -1157,7 +1157,7 @@ public: Applies the border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = NULL); + bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -1347,11 +1347,11 @@ public: bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const; /** - Merges the given attributes. If @a compareWith is non-NULL, then it will be used + Merges the given attributes. If @a compareWith is non-null, then it will be used to mask out those attributes that are the same in style and @a compareWith, for situations where we don't want to explicitly set inherited attributes. */ - bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = NULL); + bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -1797,10 +1797,10 @@ public: /** Merges the given attributes. If @a compareWith - is non-NULL, then it will be used to mask out those attributes that are the same in style + is non-null, then it will be used to mask out those attributes that are the same in style and @a compareWith, for situations where we don't want to explicitly set inherited attributes. */ - bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL); + bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -2041,7 +2041,7 @@ public: /** Returns @true if the font table is valid. */ - bool IsOk() const { return m_refData != NULL; } + bool IsOk() const { return m_refData != nullptr; } /** Finds a font for the given attribute object. @@ -2257,7 +2257,7 @@ public: /** Resets the selection. */ - void Reset() { m_ranges.Clear(); m_container = NULL; } + void Reset() { m_ranges.Clear(); m_container = nullptr; } /** Sets the selection. @@ -2404,7 +2404,7 @@ public: wxRichTextDrawingContext(wxRichTextBuffer* buffer); void Init() - { m_buffer = NULL; m_enableVirtualAttributes = true; m_enableImages = true; m_layingOut = false; m_enableDelayedImageLoading = false; } + { m_buffer = nullptr; m_enableVirtualAttributes = true; m_enableImages = true; m_layingOut = false; m_enableDelayedImageLoading = false; } /** Does this object have virtual attributes? @@ -2529,7 +2529,7 @@ public: /** Constructor, taking an optional parent pointer. */ - wxRichTextObject(wxRichTextObject* parent = NULL); + wxRichTextObject(wxRichTextObject* parent = nullptr); virtual ~wxRichTextObject(); @@ -2585,13 +2585,13 @@ public: is invalid for this object. */ - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const = 0; /** Do a split from @a pos, returning an object containing the second part, and setting the first part in 'this'. */ - virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return NULL; } + virtual wxRichTextObject* DoSplit(long WXUNUSED(pos)) { return nullptr; } /** Calculates the range of the object. By default, guess that the object is 1 unit long. @@ -2861,7 +2861,7 @@ public: /** Returns the top-level container of this object. - Returns a different container than itself, unless there's no parent, in which case it will return NULL. + Returns a different container than itself, unless there's no parent, in which case it will return nullptr. */ virtual wxRichTextParagraphLayoutBox* GetParentContainer() const { return GetParent() ? GetParent()->GetContainer() : GetContainer(); } @@ -2994,7 +2994,7 @@ public: /** Clones the object. */ - virtual wxRichTextObject* Clone() const { return NULL; } + virtual wxRichTextObject* Clone() const { return nullptr; } /** Copies the object. @@ -3043,7 +3043,7 @@ public: Draws the borders and background for the given rectangle and attributes. @a boxRect is taken to be the outer margin box, not the box around the content. */ - static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL); + static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = nullptr); /** Draws a border. @@ -3115,7 +3115,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextCompositeObject: public wxRichTextObject public: // Constructors - wxRichTextCompositeObject(wxRichTextObject* parent = NULL); + wxRichTextCompositeObject(wxRichTextObject* parent = nullptr); virtual ~wxRichTextCompositeObject(); // Overridables @@ -3130,7 +3130,7 @@ public: virtual wxString GetTextForRange(const wxRichTextRange& range) const override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual void Dump(wxTextOutputStream& stream) override; @@ -3235,7 +3235,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextParagraphLayoutBox: public wxRichTextCompos public: // Constructors - wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL); + wxRichTextParagraphLayoutBox(wxRichTextObject* parent = nullptr); wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextCompositeObject() { Init(); Copy(obj); } ~wxRichTextParagraphLayoutBox(); @@ -3247,7 +3247,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual bool DeleteRange(const wxRichTextRange& range) override; @@ -3376,17 +3376,17 @@ public: /** Convenience function to add a paragraph of text. */ - virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = nullptr); /** Convenience function to add an image. */ - virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = nullptr); /** Adds multiple paragraphs, based on newlines. */ - virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = nullptr); /** Returns the line at the given position. If @a caretPosition is true, the position is @@ -3603,11 +3603,11 @@ public: - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used. - @a def can be NULL to indicate that the existing list style should be used. + @a def can be null to indicate that the existing list style should be used. @see SetListStyle(), PromoteList(), ClearListStyle() */ - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); //@} @@ -3628,13 +3628,13 @@ public: @see SetListStyle(), SetListStyle(), ClearListStyle() */ - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); //@} /** Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously - @a def can be NULL/empty to indicate that the existing list style should be used. + @a def can be null/empty to indicate that the existing list style should be used. */ virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); @@ -3668,7 +3668,7 @@ public: /** Sets with undo the properties for the given object. */ - virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = NULL); + virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = nullptr); /** Test if this whole range has character attributes of the specified kind. If any @@ -3778,11 +3778,11 @@ public: virtual void InvalidateHierarchy(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); /** - Gather information about floating objects. If untilObj is non-NULL, + Gather information about floating objects. If untilObj is non-null, will stop getting information if the current object is this, since we will collect the rest later. */ - virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = NULL); + virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = nullptr); /** Get invalid range, rounding to entire paragraphs if argument is true. @@ -3844,7 +3844,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextBox(wxRichTextObject* parent = NULL); + wxRichTextBox(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -3926,7 +3926,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = NULL); + wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -3940,7 +3940,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual wxString GetXMLNodeName() const override { return wxT("field"); } @@ -4038,7 +4038,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const = 0; /** Returns @true if we can edit the object's properties via a GUI. @@ -4206,7 +4206,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; /** Get the size of the field, given the label, font size, and so on. @@ -4362,7 +4362,7 @@ public: // Constructors wxRichTextLine(wxRichTextParagraph* parent); - wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); } + wxRichTextLine(const wxRichTextLine& obj) { Init( nullptr); Copy(obj); } virtual ~wxRichTextLine() {} // Overridables @@ -4499,11 +4499,11 @@ public: /** Constructor taking a parent and style. */ - wxRichTextParagraph(wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + wxRichTextParagraph(wxRichTextObject* parent = nullptr, wxRichTextAttr* style = nullptr); /** Constructor taking a text string, a parent and paragraph and character attributes. */ - wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxRichTextAttr* paraStyle = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = nullptr, wxRichTextAttr* paraStyle = nullptr, wxRichTextAttr* charStyle = nullptr); virtual ~wxRichTextParagraph(); wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextCompositeObject() { Copy(obj); } @@ -4515,7 +4515,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart) override; @@ -4560,9 +4560,9 @@ public: /** Splits an object at this position if necessary, and returns - the previous object, or NULL if inserting at the beginning. + the previous object, or nullptr if inserting at the beginning. */ - virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL); + virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = nullptr); /** Moves content to a list from this point. @@ -4686,7 +4686,7 @@ public: /** Constructor. */ - wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = nullptr, wxRichTextAttr* style = nullptr); /** Copy constructor. @@ -4701,7 +4701,7 @@ public: virtual bool AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingContext& context) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual wxString GetTextForRange(const wxRichTextRange& range) const override; @@ -4898,9 +4898,9 @@ public: void SetImageType(wxBitmapType imageType) { m_imageType = imageType; } /** - Returns @true if the data is non-NULL. + Returns @true if the data is non-null. */ - bool IsOk() const { return GetData() != NULL; } + bool IsOk() const { return GetData() != nullptr; } bool Ok() const { return IsOk(); } /** @@ -4960,17 +4960,17 @@ public: /** Default constructor. */ - wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { Init(); } + wxRichTextImage(wxRichTextObject* parent = nullptr): wxRichTextObject(parent) { Init(); } /** Creates a wxRichTextImage from a wxImage. */ - wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextImage(const wxImage& image, wxRichTextObject* parent = nullptr, wxRichTextAttr* charStyle = nullptr); /** Creates a wxRichTextImage from an image block. */ - wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = nullptr, wxRichTextAttr* charStyle = nullptr); /** Copy constructor. @@ -4993,7 +4993,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; /** Returns the 'natural' size for this object - the image size. @@ -5267,7 +5267,7 @@ public: /** Convenience function to add a paragraph of text. */ - virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL) override { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = nullptr) override { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } /** Begin collapsing undo/redo commands. Note that this may not work properly @@ -5719,7 +5719,7 @@ public: it will be filled with the file type corresponding to each filter. This can be used to determine the type to pass to LoadFile given a selected filter. */ - static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL); + static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = nullptr); /** Clean up file handlers. @@ -5934,7 +5934,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextCell(wxRichTextObject* parent = NULL); + wxRichTextCell(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -6012,7 +6012,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextTable(wxRichTextObject* parent = NULL); + wxRichTextTable(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -6032,7 +6032,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style) override; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const override; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const override; virtual bool DeleteRange(const wxRichTextRange& range) override; @@ -6431,7 +6431,7 @@ public: */ void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false, const wxRect& oldFloatRect = wxRect(), - wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL, + wxArrayInt* optimizationLineCharPositions = nullptr, wxArrayInt* optimizationLineYPositions = nullptr, bool isDoCmd = true); /** @@ -6908,7 +6908,7 @@ public: The constructor doesn't copy the pointer, so it shouldn't go away while this object is alive. */ - wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = NULL); + wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = nullptr); virtual ~wxRichTextBufferDataObject(); /** @@ -7042,7 +7042,7 @@ WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRich WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); /// Apply one style to another -WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); +WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = nullptr); // Remove attributes WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style); diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index 34d0b7805b..e1b35f30eb 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -824,7 +824,7 @@ public: @see SetListStyle(), PromoteList(), ClearListStyle(). */ - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); //@} @@ -845,7 +845,7 @@ public: @see SetListStyle(), @see SetListStyle(), ClearListStyle(). */ - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); //@} @@ -1429,7 +1429,7 @@ public: Please note that this does not update the current editing style from the new position; to do that, call wxRichTextCtrl::SetInsertionPoint instead. */ - virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL); + virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = nullptr); /** Moves right. @@ -1649,7 +1649,7 @@ public: /** Applies the style sheet to the buffer, for example if the styles have changed. */ - bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); + bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = nullptr); /** Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy. @@ -1969,7 +1969,7 @@ public: Internal function to position the visible caret according to the current caret position. */ - virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL); + virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = nullptr); /** Helper function for extending the selection, returning @true if the selection @@ -2001,7 +2001,7 @@ public: Overrides standard refresh in order to provoke delayed image loading. */ virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) override; + const wxRect *rect = (const wxRect *) nullptr ) override; /** Sets the caret position. @@ -2050,7 +2050,7 @@ public: 2-element list (ok, rect). @endWxPerlOnly */ - bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL); + bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = nullptr); /** Internal helper function returning the line for the visible caret position. @@ -2075,7 +2075,7 @@ public: list (ok, newPos). @endWxPerlOnly */ - virtual bool DeleteSelectedContent(long* newPos= NULL); + virtual bool DeleteSelectedContent(long* newPos= nullptr); /** Transforms logical (unscrolled) position to physical window position. @@ -2299,8 +2299,8 @@ protected: virtual WXHWND GetEditHWND() const { return GetHWND(); } #endif #ifdef __WXGTK__ - virtual GtkEditable *GetEditable() const { return NULL; } - virtual GtkEntry *GetEntry() const { return NULL; } + virtual GtkEditable *GetEditable() const { return nullptr; } + virtual GtkEntry *GetEntry() const { return nullptr; } #endif #endif // !__WXUNIVERSAL__ @@ -2540,8 +2540,8 @@ public: */ wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) : wxNotifyEvent(commandType, winid), - m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL), - m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL) + m_flags(0), m_position(-1), m_oldStyleSheet(nullptr), m_newStyleSheet(nullptr), + m_char((wxChar) 0), m_container(nullptr), m_oldContainer(nullptr) { } /** @@ -2690,27 +2690,27 @@ typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); #define wxRichTextEventHandler(func) \ wxEVENT_HANDLER_CAST(wxRichTextEventFunction, func) -#define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_CONSUMING_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONSUMING_CHARACTER, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_LEFT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_CLICK, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RIGHT_CLICK, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_MIDDLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_MIDDLE_CLICK, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_LEFT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_LEFT_DCLICK, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_RETURN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_RETURN, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CHARACTER, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_CONSUMING_CHARACTER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONSUMING_CHARACTER, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_DELETE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_DELETE, id, -1, wxRichTextEventHandler( fn ), nullptr ), -#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_STYLESHEET_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGING, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_STYLESHEET_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_CHANGED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_STYLESHEET_REPLACING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACING, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_STYLESHEET_REPLACED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLESHEET_REPLACED, id, -1, wxRichTextEventHandler( fn ), nullptr ), -#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_PROPERTIES_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_PROPERTIES_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ), -#define EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ), +#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_PROPERTIES_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_PROPERTIES_CHANGED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), nullptr ), +#define EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED, id, -1, wxRichTextEventHandler( fn ), nullptr ), // old wxEVT_COMMAND_* constants #define wxEVT_COMMAND_RICHTEXT_LEFT_CLICK wxEVT_RICHTEXT_LEFT_CLICK diff --git a/include/wx/richtext/richtextformatdlg.h b/include/wx/richtext/richtextformatdlg.h index af56a6e122..4d1b844cfb 100644 --- a/include/wx/richtext/richtextformatdlg.h +++ b/include/wx/richtext/richtextformatdlg.h @@ -227,11 +227,11 @@ public: /// Set the dimension into the value and units controls. Optionally pass units to /// specify the ordering of units in the combobox. - static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL); + static void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = nullptr); /// Get the dimension from the value and units controls Optionally pass units to /// specify the ordering of units in the combobox. - static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = NULL); + static void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units = nullptr); /// Convert from a string to a dimension integer. static bool ConvertFromString(const wxString& str, int& ret, int unit); diff --git a/include/wx/richtext/richtextprint.h b/include/wx/richtext/richtextprint.h index 096d75eac9..51d83d0e8d 100644 --- a/include/wx/richtext/richtextprint.h +++ b/include/wx/richtext/richtextprint.h @@ -160,7 +160,7 @@ private: class WXDLLIMPEXP_RICHTEXT wxRichTextPrinting : public wxObject { public: - wxRichTextPrinting(const wxString& name = wxGetTranslation("Printing"), wxWindow *parentWindow = NULL); + wxRichTextPrinting(const wxString& name = wxGetTranslation("Printing"), wxWindow *parentWindow = nullptr); virtual ~wxRichTextPrinting(); /// Preview the file or buffer diff --git a/include/wx/richtext/richtextstyledlg.h b/include/wx/richtext/richtextstyledlg.h index fdb28beb6c..ce3f0b61ee 100644 --- a/include/wx/richtext/richtextstyledlg.h +++ b/include/wx/richtext/richtextstyledlg.h @@ -132,7 +132,7 @@ public: wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; /// Apply the style - bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); + bool ApplyStyle(wxRichTextCtrl* ctrl = nullptr); /// Should we show tooltips? static bool ShowToolTips() { return sm_showToolTips; } diff --git a/include/wx/richtext/richtextstyles.h b/include/wx/richtext/richtextstyles.h index 0c421a9a82..cb2eada7da 100644 --- a/include/wx/richtext/richtextstyles.h +++ b/include/wx/richtext/richtextstyles.h @@ -230,15 +230,15 @@ public: /// Combine the base and list style with a paragraph style, using the given indent (from which /// an appropriate level is found) - wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = nullptr); /// Combine the base and list style, using the given indent (from which /// an appropriate level is found) - wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = nullptr); /// Combine the base and list style, using the given level from which /// an appropriate level is found) - wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = nullptr); /// Gets the number of available levels int GetLevelCount() const { return 10; } @@ -487,8 +487,8 @@ public: void Init() { - m_styleSheet = NULL; - m_richTextCtrl = NULL; + m_styleSheet = nullptr; + m_richTextCtrl = nullptr; m_applyOnSelection = false; m_styleType = wxRICHTEXT_STYLE_PARAGRAPH; m_autoSetSelection = true; @@ -595,8 +595,8 @@ public: /// Member initialisation void Init() { - m_styleListBox = NULL; - m_styleChoice = NULL; + m_styleListBox = nullptr; + m_styleChoice = nullptr; m_dontUpdate = false; } @@ -668,7 +668,7 @@ public: virtual wxString GetStringValue() const override; /// Can we set the selection based on the editor caret position? - // virtual bool CanAutoSetSelection() { return ((m_combo == NULL) || !m_combo->IsPopupShown()); } + // virtual bool CanAutoSetSelection() { return ((m_combo == nullptr) || !m_combo->IsPopupShown()); } virtual bool CanAutoSetSelection() override { return false; } // @@ -717,7 +717,7 @@ public: void Init() { - m_stylePopup = NULL; + m_stylePopup = nullptr; } bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, diff --git a/include/wx/richtext/richtextuicustomization.h b/include/wx/richtext/richtextuicustomization.h index 381bb0a2a0..f4b24bc3d9 100644 --- a/include/wx/richtext/richtextuicustomization.h +++ b/include/wx/richtext/richtextuicustomization.h @@ -53,7 +53,7 @@ public: wxRichTextHelpInfo() { m_helpTopic = -1; - m_uiCustomization = NULL; + m_uiCustomization = nullptr; } virtual ~wxRichTextHelpInfo() {} @@ -81,7 +81,7 @@ public: bool HasHelpId() const { return m_helpTopic != -1; } /// Is there a valid customization object? - bool HasUICustomization() const { return m_uiCustomization != NULL; } + bool HasUICustomization() const { return m_uiCustomization != nullptr; } protected: wxRichTextUICustomization* m_uiCustomization; diff --git a/include/wx/richtooltip.h b/include/wx/richtooltip.h index f63166f1fe..a18560117c 100644 --- a/include/wx/richtooltip.h +++ b/include/wx/richtooltip.h @@ -87,7 +87,7 @@ public: void SetTitleFont(const wxFont& font); // Show the tooltip for the given window and optionally a specified area. - void ShowFor(wxWindow* win, const wxRect* rect = NULL); + void ShowFor(wxWindow* win, const wxRect* rect = nullptr); // Non-virtual dtor as this class is not supposed to be derived from. ~wxRichToolTip(); diff --git a/include/wx/rtti.h b/include/wx/rtti.h index a30a3edb10..e04a39f67c 100644 --- a/include/wx/rtti.h +++ b/include/wx/rtti.h @@ -62,14 +62,14 @@ public: ~wxClassInfo(); wxObject *CreateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : NULL; } - bool IsDynamic() const { return (NULL != m_objectConstructor); } + { return m_objectConstructor ? (*m_objectConstructor)() : nullptr; } + bool IsDynamic() const { return (nullptr != m_objectConstructor); } const wxChar *GetClassName() const { return m_className; } const wxChar *GetBaseClassName1() const - { return m_baseInfo1 ? m_baseInfo1->GetClassName() : NULL; } + { return m_baseInfo1 ? m_baseInfo1->GetClassName() : nullptr; } const wxChar *GetBaseClassName2() const - { return m_baseInfo2 ? m_baseInfo2->GetClassName() : NULL; } + { return m_baseInfo2 ? m_baseInfo2->GetClassName() : nullptr; } const wxClassInfo *GetBaseClass1() const { return m_baseInfo1; } const wxClassInfo *GetBaseClass2() const { return m_baseInfo2; } int GetSize() const { return m_objectSize; } @@ -176,7 +176,7 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); { return &name::ms_classInfo; } #define wxIMPLEMENT_CLASS_COMMON1(name, basename, func) \ - wxIMPLEMENT_CLASS_COMMON(name, basename, NULL, func) + wxIMPLEMENT_CLASS_COMMON(name, basename, nullptr, func) #define wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, func) \ wxIMPLEMENT_CLASS_COMMON(name, basename1, &basename2::ms_classInfo, func) @@ -204,11 +204,11 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); // Single inheritance with one base class #define wxIMPLEMENT_ABSTRACT_CLASS(name, basename) \ - wxIMPLEMENT_CLASS_COMMON1(name, basename, NULL) + wxIMPLEMENT_CLASS_COMMON1(name, basename, nullptr) // Multiple inheritance with two base classes #define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ - wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, NULL) + wxIMPLEMENT_CLASS_COMMON2(name, basename1, basename2, nullptr) // ----------------------------------- // XTI-compatible macros diff --git a/include/wx/sckipc.h b/include/wx/sckipc.h index ebe23a996e..3e81461cac 100644 --- a/include/wx/sckipc.h +++ b/include/wx/sckipc.h @@ -67,7 +67,7 @@ public: // implement base class pure virtual methods virtual const void *Request(const wxString& item, - size_t *size = NULL, + size_t *size = nullptr, wxIPCFormat format = wxIPC_TEXT) override; virtual bool StartAdvise(const wxString& item) override; virtual bool StopAdvise(const wxString& item) override; @@ -142,7 +142,7 @@ public: virtual bool ValidHost(const wxString& host) override; - // Call this to make a connection. Returns NULL if cannot. + // Call this to make a connection. Returns nullptr if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) override; diff --git a/include/wx/scopedarray.h b/include/wx/scopedarray.h index 02455d7385..30e3c9b2d5 100644 --- a/include/wx/scopedarray.h +++ b/include/wx/scopedarray.h @@ -24,7 +24,7 @@ class wxScopedArray public: typedef T element_type; - explicit wxScopedArray(T * array = NULL) : m_array(array) { } + explicit wxScopedArray(T * array = nullptr) : m_array(array) { } explicit wxScopedArray(size_t count) : m_array(new T[count]) { } ~wxScopedArray() { delete [] m_array; } @@ -34,10 +34,10 @@ public: typedef T *(wxScopedArray::*unspecified_bool_type)() const; operator unspecified_bool_type() const { - return m_array ? &wxScopedArray::get : NULL; + return m_array ? &wxScopedArray::get : nullptr; } - void reset(T *array = NULL) + void reset(T *array = nullptr) { if ( array != m_array ) { @@ -77,15 +77,15 @@ private: \ name & operator=(name const &); \ \ public: \ - explicit name(T * p = NULL) : m_ptr(p) \ + explicit name(T * p = nullptr) : m_ptr(p) \ {} \ \ ~name(); \ - void reset(T * p = NULL); \ + void reset(T * p = nullptr); \ \ T & operator[](long int i) const\ { \ - wxASSERT(m_ptr != NULL); \ + wxASSERT(m_ptr != nullptr); \ wxASSERT(i >= 0); \ return m_ptr[i]; \ } \ diff --git a/include/wx/scopedptr.h b/include/wx/scopedptr.h index a6bd239c25..d316f3f47f 100644 --- a/include/wx/scopedptr.h +++ b/include/wx/scopedptr.h @@ -40,7 +40,7 @@ class wxScopedPtr public: typedef T element_type; - explicit wxScopedPtr(T * ptr = NULL) : m_ptr(ptr) { } + explicit wxScopedPtr(T * ptr = nullptr) : m_ptr(ptr) { } ~wxScopedPtr() { wxCHECKED_DELETE(m_ptr); } @@ -50,10 +50,10 @@ public: operator unspecified_bool_type() const { - return m_ptr ? &wxScopedPtr::get : NULL; + return m_ptr ? &wxScopedPtr::get : nullptr; } - void reset(T * ptr = NULL) + void reset(T * ptr = nullptr) { if ( ptr != m_ptr ) { @@ -65,19 +65,19 @@ public: T *release() { T *ptr = m_ptr; - m_ptr = NULL; + m_ptr = nullptr; return ptr; } T & operator*() const { - wxASSERT(m_ptr != NULL); + wxASSERT(m_ptr != nullptr); return *m_ptr; } T * operator->() const { - wxASSERT(m_ptr != NULL); + wxASSERT(m_ptr != nullptr); return m_ptr; } @@ -118,29 +118,29 @@ private: \ name & operator=(name const &); \ \ public: \ - explicit name(T * ptr = NULL) \ + explicit name(T * ptr = nullptr) \ : m_ptr(ptr) { } \ \ ~name(); \ \ - void reset(T * ptr = NULL); \ + void reset(T * ptr = nullptr); \ \ T *release() \ { \ T *ptr = m_ptr; \ - m_ptr = NULL; \ + m_ptr = nullptr; \ return ptr; \ } \ \ T & operator*() const \ { \ - wxASSERT(m_ptr != NULL); \ + wxASSERT(m_ptr != nullptr); \ return *m_ptr; \ } \ \ T * operator->() const \ { \ - wxASSERT(m_ptr != NULL); \ + wxASSERT(m_ptr != nullptr); \ return m_ptr; \ } \ \ diff --git a/include/wx/scopeguard.h b/include/wx/scopeguard.h index 676ffbdf1e..643c63dac5 100644 --- a/include/wx/scopeguard.h +++ b/include/wx/scopeguard.h @@ -400,7 +400,7 @@ public: ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); } - void Execute() { m_var = NULL; } + void Execute() { m_var = nullptr; } private: T& m_var; diff --git a/include/wx/scrolwin.h b/include/wx/scrolwin.h index bb762cc99a..417a901597 100644 --- a/include/wx/scrolwin.h +++ b/include/wx/scrolwin.h @@ -222,7 +222,7 @@ public: virtual void DoPrepareDC(wxDC& dc) override; // are we generating the autoscroll events? - bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } + bool IsAutoScrolling() const { return m_timerAutoScroll != nullptr; } // stop generating the scroll events when mouse is held outside the window void StopAutoScrolling(); @@ -246,10 +246,10 @@ public: void HandleOnChildFocus(wxChildFocusEvent& event); protected: - // get pointer to our scroll rect if we use it or NULL + // get pointer to our scroll rect if we use it or nullptr const wxRect *GetScrollRect() const { - return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL; + return m_rectToScroll.width != 0 ? &m_rectToScroll : nullptr; } // get the size of the target window diff --git a/include/wx/secretstore.h b/include/wx/secretstore.h index d98ab75b50..3b9cdec6ed 100644 --- a/include/wx/secretstore.h +++ b/include/wx/secretstore.h @@ -36,7 +36,7 @@ class WXDLLIMPEXP_BASE wxSecretValue { public: // Creates an empty secret value (not the same as an empty password). - wxSecretValue() : m_impl(NULL) { } + wxSecretValue() : m_impl(nullptr) { } // Creates a secret value from the given data. wxSecretValue(size_t size, const void *data) @@ -57,7 +57,7 @@ public: ~wxSecretValue(); // Check if a secret is not empty. - bool IsOk() const { return m_impl != NULL; } + bool IsOk() const { return m_impl != nullptr; } // Compare with another secret. bool operator==(const wxSecretValue& other) const; @@ -128,7 +128,7 @@ public: // Check if this object is valid, i.e. can be used, and optionally fill in // the provided error message string if it isn't. - bool IsOk(wxString* errmsg = NULL) const; + bool IsOk(wxString* errmsg = nullptr) const; // Store a username/password combination. diff --git a/include/wx/selstore.h b/include/wx/selstore.h index 05e20bffb9..20dee1cd07 100644 --- a/include/wx/selstore.h +++ b/include/wx/selstore.h @@ -70,7 +70,7 @@ public: // individually) bool SelectRange(unsigned itemFrom, unsigned itemTo, bool select = true, - wxArrayInt *itemsChanged = NULL); + wxArrayInt *itemsChanged = nullptr); // return true if the given item is selected bool IsSelected(unsigned item) const; diff --git a/include/wx/settings.h b/include/wx/settings.h index eb32ec5336..cf51089518 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -216,7 +216,7 @@ public: static wxFont GetFont(wxSystemFont index); // get a system-dependent metric - static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL); + static int GetMetric(wxSystemMetric index, const wxWindow* win = nullptr); // get the object describing the current system appearance static wxSystemAppearance GetAppearance(); @@ -240,7 +240,7 @@ public: // some metrics are toolkit-dependent and provided by wxUniv, some are // lowlevel - static int GetMetric(wxSystemMetric index, const wxWindow* win = NULL); + static int GetMetric(wxSystemMetric index, const wxWindow* win = nullptr); #endif // __WXUNIVERSAL__ // Get system screen design (desktop, pda, ..) used for diff --git a/include/wx/sharedptr.h b/include/wx/sharedptr.h index 2513647dec..087dc17414 100644 --- a/include/wx/sharedptr.h +++ b/include/wx/sharedptr.h @@ -23,8 +23,8 @@ class wxSharedPtr public: typedef T element_type; - explicit wxSharedPtr( T* ptr = NULL ) - : m_ref(NULL) + explicit wxSharedPtr( T* ptr = nullptr ) + : m_ref(nullptr) { if (ptr) m_ref = new reftype(ptr); @@ -32,7 +32,7 @@ public: template explicit wxSharedPtr(T* ptr, Deleter d) - : m_ref(NULL) + : m_ref(nullptr) { if (ptr) m_ref = new reftype_with_deleter(ptr, d); @@ -70,29 +70,29 @@ public: if (m_ref && m_ref->m_ptr) return &wxSharedPtr::get; else - return NULL; + return nullptr; } T& operator*() const { - wxASSERT(m_ref != NULL); - wxASSERT(m_ref->m_ptr != NULL); + wxASSERT(m_ref != nullptr); + wxASSERT(m_ref->m_ptr != nullptr); return *(m_ref->m_ptr); } T* operator->() const { - wxASSERT(m_ref != NULL); - wxASSERT(m_ref->m_ptr != NULL); + wxASSERT(m_ref != nullptr); + wxASSERT(m_ref->m_ptr != nullptr); return m_ref->m_ptr; } T* get() const { - return m_ref ? m_ref->m_ptr : NULL; + return m_ref ? m_ref->m_ptr : nullptr; } - void reset( T* ptr = NULL ) + void reset( T* ptr = nullptr ) { Release(); if (ptr) @@ -149,7 +149,7 @@ private: m_ref->delete_ptr(); delete m_ref; } - m_ref = NULL; + m_ref = nullptr; } } }; diff --git a/include/wx/sizer.h b/include/wx/sizer.h index fc1669c7cb..968e482267 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -287,7 +287,7 @@ public: int proportion=0, int flag=0, int border=0, - wxObject* userData=NULL ); + wxObject* userData=nullptr ); // window with flags wxSizerItem(wxWindow *window, const wxSizerFlags& flags) @@ -302,7 +302,7 @@ public: int proportion=0, int flag=0, int border=0, - wxObject* userData=NULL ); + wxObject* userData=nullptr ); // sizer with flags wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) @@ -318,7 +318,7 @@ public: int proportion=0, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); // spacer with flags wxSizerItem(int width, int height, const wxSizerFlags& flags) @@ -334,11 +334,11 @@ public: virtual void DeleteWindows(); // Enable deleting the SizerItem without destroying the contained sizer. - void DetachSizer() { m_sizer = NULL; } + void DetachSizer() { m_sizer = nullptr; } // Enable deleting the SizerItem without resetting the sizer in the // contained window. - void DetachWindow() { m_window = NULL; m_kind = Item_None; } + void DetachWindow() { m_window = nullptr; m_kind = Item_None; } virtual wxSize GetSize() const; virtual wxSize CalcMin(); @@ -399,9 +399,9 @@ public: { return m_border; } wxWindow *GetWindow() const - { return m_kind == Item_Window ? m_window : NULL; } + { return m_kind == Item_Window ? m_window : nullptr; } wxSizer *GetSizer() const - { return m_kind == Item_Sizer ? m_sizer : NULL; } + { return m_kind == Item_Sizer ? m_sizer : nullptr; } wxSize GetSpacer() const; // This function behaves obviously for the windows and spacers but for the @@ -449,7 +449,7 @@ public: protected: // common part of several ctors - void Init() { m_userData = NULL; m_kind = Item_None; } + void Init() { m_userData = nullptr; m_kind = Item_None; } // common part of ctors taking wxSizerFlags void Init(const wxSizerFlags& flags); @@ -514,7 +514,7 @@ WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer { public: - wxSizer() { m_containingWindow = NULL; } + wxSizer() { m_containingWindow = nullptr; } virtual ~wxSizer(); // methods for adding elements to the sizer: there are Add/Insert/Prepend @@ -523,18 +523,18 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Add(wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Add(int width, int height, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); wxSizerItem* Add( int width, int height, const wxSizerFlags& flags); @@ -548,20 +548,20 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Insert(size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Insert(size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Insert(size_t index, wxWindow *window, const wxSizerFlags& flags); @@ -585,18 +585,18 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Prepend(wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Prepend(int width, int height, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags); @@ -605,7 +605,7 @@ public: wxSizerItem* PrependSpacer(int size); wxSizerItem* PrependStretchSpacer(int prop = 1); - // set (or possibly unset if window is NULL) or get the window this sizer + // set (or possibly unset if window is null) or get the window this sizer // is used in void SetContainingWindow(wxWindow *window); wxWindow *GetContainingWindow() const { return m_containingWindow; } @@ -753,7 +753,7 @@ protected: wxPoint m_position; wxSizerItemList m_children; - // the window this sizer is used in, can be NULL + // the window this sizer is used in, can be null wxWindow *m_containingWindow; wxSize GetMaxClientSize( wxWindow *window ) const; diff --git a/include/wx/snglinst.h b/include/wx/snglinst.h index 61213a86cf..b70ce4108e 100644 --- a/include/wx/snglinst.h +++ b/include/wx/snglinst.h @@ -80,9 +80,9 @@ public: private: // common part of all ctors - void Init() { m_impl = NULL; } + void Init() { m_impl = nullptr; } - // do check if another instance is running, called only if m_impl != NULL + // do check if another instance is running, called only if m_impl != nullptr bool DoIsAnotherRunning() const; // the implementation details (platform specific) diff --git a/include/wx/socket.h b/include/wx/socket.h index 74449f64e4..f5a112774f 100644 --- a/include/wx/socket.h +++ b/include/wx/socket.h @@ -129,7 +129,7 @@ public: // state bool Ok() const { return IsOk(); } - bool IsOk() const { return m_impl != NULL; } + bool IsOk() const { return m_impl != nullptr; } bool Error() const { return LastError() != wxSOCKET_NOERROR; } bool IsClosed() const { return m_closed; } bool IsConnected() const { return m_connected; } diff --git a/include/wx/sstream.h b/include/wx/sstream.h index f2e7a2d5a3..b5bab51385 100644 --- a/include/wx/sstream.h +++ b/include/wx/sstream.h @@ -62,7 +62,7 @@ public: // // Note that the conversion object should have the life time greater than // this stream. - explicit wxStringOutputStream(wxString *pString = NULL, + explicit wxStringOutputStream(wxString *pString = nullptr, wxMBConv& conv = wxConvUTF8); // get the string containing current output diff --git a/include/wx/stackwalk.h b/include/wx/stackwalk.h index 0cde0ea5ca..a7acd464aa 100644 --- a/include/wx/stackwalk.h +++ b/include/wx/stackwalk.h @@ -33,7 +33,7 @@ private: { return const_cast(this); } public: - wxStackFrameBase(size_t level, void *address = NULL) + wxStackFrameBase(size_t level, void *address = nullptr) { m_level = level; @@ -80,7 +80,7 @@ public: // get the name, type and value (in text form) of the given parameter // - // any pointer may be NULL + // any pointer may be null // // return true if at least some values could be retrieved virtual bool GetParam(size_t WXUNUSED(n), diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index d723bcd797..66f0926758 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -118,7 +118,7 @@ public: // set the number of fields and call SetStatusWidths(widths) if widths are // given - virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + virtual void SetFieldsCount(int number = 1, const int *widths = nullptr); int GetFieldsCount() const { return (int)m_panes.GetCount(); } // field text diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 3b8f3153ec..8fc7d79831 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -2891,7 +2891,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxSTCNameStr); - wxStyledTextCtrl() { m_swx = NULL; } + wxStyledTextCtrl() { m_swx = nullptr; } ~wxStyledTextCtrl(); #endif @@ -3006,7 +3006,7 @@ public: #ifdef SWIG wxString GetCurLine(int* OUTPUT); #else - wxString GetCurLine(int* linePos=NULL); + wxString GetCurLine(int* linePos=nullptr); #endif // Retrieve the position of the last correctly styled character. @@ -3565,7 +3565,7 @@ public: // Find some text in the document. int FindText(int minPos, int maxPos, const wxString& text, int flags=0, - int* findEnd=NULL); + int* findEnd=nullptr); // On Windows, will draw the document into a display context such as a printer. int FormatRange(bool doDraw, @@ -5213,7 +5213,7 @@ public: #ifdef SWIG wxCharBuffer GetCurLineRaw(int* OUTPUT); #else - wxCharBuffer GetCurLineRaw(int* linePos=NULL); + wxCharBuffer GetCurLineRaw(int* linePos=nullptr); #endif // Retrieve the contents of a line. @@ -5738,42 +5738,42 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define wxStyledTextEventHandler( func ) \ wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func ) -#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), #endif #endif // wxUSE_STC diff --git a/include/wx/strconv.h b/include/wx/strconv.h index 6e9debe0c4..211e03de04 100644 --- a/include/wx/strconv.h +++ b/include/wx/strconv.h @@ -50,7 +50,7 @@ public: // there is not enough space for everything, including the trailing NUL // character(s), in the output buffer, wxCONV_FAILED is returned. // - // In the special case when dst is NULL (the value of dstLen is ignored + // In the special case when dst is null (the value of dstLen is ignored // then) the return value is the length of the needed buffer but nothing // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and // including the trailing NUL(s), is converted, otherwise exactly srcLen @@ -58,7 +58,7 @@ public: // // Typical usage: // - // size_t dstLen = conv.ToWChar(NULL, 0, src); + // size_t dstLen = conv.ToWChar(nullptr, 0, src); // if ( dstLen == wxCONV_FAILED ) // ... handle error ... // wchar_t *wbuf = new wchar_t[dstLen]; @@ -93,7 +93,7 @@ public: // inLen is the length of the buffer including trailing NUL if any or // wxNO_LEN if the input is NUL-terminated. // - // outLen receives, if not NULL, the length of the converted string or 0 if + // outLen receives, if not null, the length of the converted string or 0 if // the conversion failed (returning 0 and not -1 in this case makes it // difficult to distinguish between failed conversion and empty input but // this is done for backwards compatibility). Notice that the rules for @@ -156,7 +156,7 @@ public: // On success, the return value is the length (i.e. the number of // characters, not bytes) not counting the trailing NUL(s) of the converted // string. On failure, (size_t)-1 is returned. In the special case when - // outputBuf is NULL the return value is the same one but nothing is + // outputBuf is null the return value is the same one but nothing is // written to the buffer. // // Note that outLen is the length of the output buffer, not the length of @@ -209,7 +209,7 @@ public: wxConvBrokenFileNames(const wxString& charset); wxConvBrokenFileNames(const wxConvBrokenFileNames& conv) : wxMBConv(), - m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL) + m_conv(conv.m_conv ? conv.m_conv->Clone() : nullptr) { } virtual ~wxConvBrokenFileNames() { delete m_conv; } @@ -526,12 +526,12 @@ private: // m_convReal. wxMBConv *DoCreate() const; - // Set the name (may be only called when m_name == NULL), makes copy of + // Set the name (may be only called when m_name == nullptr), makes copy of // the charset string. void SetName(const char *charset); // Set m_encoding field respecting the rules below, i.e. making sure it has - // a valid value if m_name == NULL (thus this should be always called after + // a valid value if m_name == nullptr (thus this should be always called after // SetName()). // // Input encoding may be valid or not. @@ -540,16 +540,16 @@ private: // The encoding we use is specified by the two fields below: // - // 1. If m_name != NULL, m_encoding corresponds to it if it's one of + // 1. If m_name != nullptr, m_encoding corresponds to it if it's one of // encodings we know about (i.e. member of wxFontEncoding) or is // wxFONTENCODING_SYSTEM otherwise. // - // 2. If m_name == NULL, m_encoding is always valid, i.e. not one of + // 2. If m_name == nullptr, m_encoding is always valid, i.e. not one of // wxFONTENCODING_{SYSTEM,DEFAULT,MAX}. char *m_name; wxFontEncoding m_encoding; - // The conversion object for our encoding or NULL if we failed to create it + // The conversion object for our encoding or nullptr if we failed to create it // in which case we fall back to hard-coded ISO8859-1 conversion. wxMBConv *m_convReal; }; @@ -699,8 +699,8 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; // these functions should be used when the conversions really, really have // to succeed (usually because we pass their results to a standard C - // function which would crash if we passed NULL to it), so these functions - // always return a valid pointer if their argument is non-NULL + // function which would crash if we passed nullptr to it), so these functions + // always return a valid pointer if their argument is non-null inline wxWCharBuffer wxSafeConvertMB2WX(const char *s) { diff --git a/include/wx/stream.h b/include/wx/stream.h index 8889c7faac..0a861c9c94 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -210,7 +210,7 @@ protected: // bytes read size_t GetWBack(void *buf, size_t size); - // write back buffer or NULL if none + // write back buffer or nullptr if none char *m_wback; // the size of the buffer @@ -496,7 +496,7 @@ public: bool IsFixed() const { return m_fixed; } bool IsFlushable() const { return m_flushable; } - // only for input/output buffers respectively, returns NULL otherwise + // only for input/output buffers respectively, returns nullptr otherwise wxInputStream *GetInputStream() const; wxOutputStream *GetOutputStream() const; @@ -553,10 +553,10 @@ class WXDLLIMPEXP_BASE wxBufferedInputStream : public wxFilterInputStream public: // create a buffered stream on top of the specified low-level stream // - // if a non NULL buffer is given to the stream, it will be deleted by it, + // if a non null buffer is given to the stream, it will be deleted by it, // otherwise a default 1KB buffer will be used wxBufferedInputStream(wxInputStream& stream, - wxStreamBuffer *buffer = NULL); + wxStreamBuffer *buffer = nullptr); // ctor allowing to specify the buffer size, it's just a more convenient // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) @@ -597,10 +597,10 @@ class WXDLLIMPEXP_BASE wxBufferedOutputStream : public wxFilterOutputStream public: // create a buffered stream on top of the specified low-level stream // - // if a non NULL buffer is given to the stream, it will be deleted by it, + // if a non null buffer is given to the stream, it will be deleted by it, // otherwise a default 1KB buffer will be used wxBufferedOutputStream(wxOutputStream& stream, - wxStreamBuffer *buffer = NULL); + wxStreamBuffer *buffer = nullptr); // ctor allowing to specify the buffer size, it's just a more convenient // alternative to creating wxStreamBuffer, calling its SetBufferIO(bufsize) diff --git a/include/wx/string.h b/include/wx/string.h index 955bdf2fbe..aba1ebb306 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -242,19 +242,19 @@ class WXDLLIMPEXP_BASE wxStringIteratorNode { public: wxStringIteratorNode() - : m_str(NULL), m_citer(NULL), m_iter(NULL), m_prev(NULL), m_next(NULL) {} + : m_str(nullptr), m_citer(nullptr), m_iter(nullptr), m_prev(nullptr), m_next(nullptr) {} wxStringIteratorNode(const wxString *str, wxStringImpl::const_iterator *citer) - { DoSet(str, citer, NULL); } + { DoSet(str, citer, nullptr); } wxStringIteratorNode(const wxString *str, wxStringImpl::iterator *iter) - { DoSet(str, NULL, iter); } + { DoSet(str, nullptr, iter); } ~wxStringIteratorNode() { clear(); } inline void set(const wxString *str, wxStringImpl::const_iterator *citer) - { clear(); DoSet(str, citer, NULL); } + { clear(); DoSet(str, citer, nullptr); } inline void set(const wxString *str, wxStringImpl::iterator *iter) - { clear(); DoSet(str, NULL, iter); } + { clear(); DoSet(str, nullptr, iter); } const wxString *m_str; wxStringImpl::const_iterator *m_citer; @@ -515,7 +515,7 @@ private: // code performance by ~5%, at least when using g++ 4.1 so do keep them here // unless tests show that it's not advantageous any more - // return the pointer to the cache element for this string or NULL if not + // return the pointer to the cache element for this string or nullptr if not // cached Cache::Element *FindCacheElement() const { @@ -524,10 +524,10 @@ private: // a lot of misses in this function...) Cache::Element * const cacheBegin = GetCacheBegin(); #ifndef wxHAS_COMPILER_TLS - // during destruction tls calls may return NULL, in this case return NULL + // during destruction tls calls may return nullptr, in this case return nullptr // immediately without accessing anything else - if ( cacheBegin == NULL ) - return NULL; + if ( cacheBegin == nullptr ) + return nullptr; #endif // gcc 7 warns about not being able to optimize this loop because of @@ -544,7 +544,7 @@ private: wxGCC_ONLY_WARNING_RESTORE(unsafe-loop-optimizations) - return NULL; + return nullptr; } // unlike FindCacheElement(), this one always returns a valid pointer to the @@ -1024,7 +1024,7 @@ public: // This is logically equivalent to strlen(str.mb_str()) but avoids // actually converting the string to multibyte and just computes the // length that it would have after conversion. - const size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length()); + const size_t ofs = wxConvLibc.FromWChar(nullptr, 0, str.wc_str(), str.length()); return ofs == wxCONV_FAILED ? 0 : static_cast(ofs); } @@ -1114,7 +1114,7 @@ private: : m_impl(src) {} static wxString FromImpl(const wxStringImpl& src) - { return wxString((CtorFromStringImplTag*)NULL, src); } + { return wxString((CtorFromStringImplTag*)nullptr, src); } #else #if !wxUSE_STL_BASED_WXSTRING wxString(const wxStringImpl& src) : m_impl(src) { } @@ -1595,7 +1595,7 @@ public: // // this is mostly/only useful for the template functions template - wxCharTypeBuffer tchar_str(size_t *len = NULL) const + wxCharTypeBuffer tchar_str(size_t *len = nullptr) const { #if wxUSE_UNICODE // we need a helper dispatcher depending on type @@ -1893,7 +1893,7 @@ public: { return operator=(wxUniChar(ch)); } wxString& operator=(wchar_t ch) { return operator=(wxUniChar(ch)); } - // from a C string - STL probably will crash on NULL, + // from a C string - STL probably will crash on nullptr, // so we need to compensate in that case #if wxUSE_STL_BASED_WXSTRING #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING @@ -2174,13 +2174,13 @@ public: { return Mid(start, len); } // check if the string starts with the given prefix and return the rest - // of the string in the provided pointer if it is not NULL; otherwise + // of the string in the provided pointer if it is not null; otherwise // return false - bool StartsWith(const wxString& prefix, wxString *rest = NULL) const; + bool StartsWith(const wxString& prefix, wxString *rest = nullptr) const; // check if the string ends with the given suffix and return the // beginning of the string before the suffix in the provided pointer if - // it is not NULL; otherwise return false - bool EndsWith(const wxString& suffix, wxString *rest = NULL) const; + // it is not null; otherwise return false + bool EndsWith(const wxString& suffix, wxString *rest = nullptr) const; // get first nCount characters wxString Left(size_t nCount) const; @@ -2188,12 +2188,12 @@ public: wxString Right(size_t nCount) const; // get all characters before the first occurrence of ch // (returns the whole string if ch not found) and also put everything - // following the first occurrence of ch into rest if it's non-NULL - wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const; + // following the first occurrence of ch into rest if it's non-null + wxString BeforeFirst(wxUniChar ch, wxString *rest = nullptr) const; // get all characters before the last occurrence of ch // (returns empty string if ch not found) and also put everything - // following the last occurrence of ch into rest if it's non-NULL - wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const; + // following the last occurrence of ch into rest if it's non-null + wxString BeforeLast(wxUniChar ch, wxString *rest = nullptr) const; // get all characters after the first occurrence of ch // (returns empty string if ch not found) wxString AfterFirst(wxUniChar ch) const; @@ -3559,8 +3559,8 @@ private: struct ConvertedBuffer { // notice that there is no need to initialize m_len here as it's unused - // as long as m_str is NULL - ConvertedBuffer() : m_str(NULL), m_len(0) {} + // as long as m_str is null + ConvertedBuffer() : m_str(nullptr), m_len(0) {} ~ConvertedBuffer() { free(m_str); } @@ -3590,7 +3590,7 @@ private: #if wxUSE_UNICODE // common mb_str() and wxCStrData::AsChar() helper: performs the conversion // and returns either m_convertedToChar.m_str (in which case its m_len is - // also updated) or NULL if it failed + // also updated) or nullptr if it failed // // there is an important exception: in wxUSE_UNICODE_UTF8 build if conv is a // UTF-8 one, we return m_impl.c_str() directly, without doing any conversion @@ -3620,9 +3620,9 @@ private: // when using wxCStrData without duplicating any code if ( !AsChar(conv) ) { - // although it would be probably more correct to return NULL buffer + // although it would be probably more correct to return nullptr buffer // from here if the conversion fails, a lot of existing code doesn't - // expect mb_str() (or wc_str()) to ever return NULL so return an + // expect mb_str() (or wc_str()) to ever return nullptr so return an // empty string otherwise to avoid crashes in it // // also, some existing code does check for the conversion success and @@ -3640,7 +3640,7 @@ private: #if !wxUSE_UNICODE_WCHAR // common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI // builds: converts the string contents into m_convertedToWChar and returns - // NULL if the conversion failed (this can only happen in ANSI build) + // nullptr if the conversion failed (this can only happen in ANSI build) // // NB: AsWChar() returns wchar_t* in any build, unlike wc_str() const wchar_t *AsWChar(const wxMBConv& conv) const; @@ -3664,7 +3664,7 @@ private: // keep track of all iterators and update them as necessary: struct wxStringIteratorNodeHead { - wxStringIteratorNodeHead() : ptr(NULL) {} + wxStringIteratorNodeHead() : ptr(nullptr) {} wxStringIteratorNode *ptr; // copying is disallowed as it would result in more than one pointer into @@ -3803,7 +3803,7 @@ public: typedef wxStringCharType CharType; wxStringInternalBuffer(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL) + : m_str(str), m_buf(nullptr) { m_buf = m_str.DoGetWriteBuf(lenWanted); } ~wxStringInternalBuffer() { m_str.DoUngetWriteBuf(); } @@ -3823,10 +3823,10 @@ public: typedef wxStringCharType CharType; wxStringInternalBufferLength(wxString& str, size_t lenWanted = 1024) - : m_str(str), m_buf(NULL), m_len(0), m_lenSet(false) + : m_str(str), m_buf(nullptr), m_len(0), m_lenSet(false) { m_buf = m_str.DoGetWriteBuf(lenWanted); - wxASSERT(m_buf != NULL); + wxASSERT(m_buf != nullptr); } ~wxStringInternalBufferLength() @@ -4007,7 +4007,7 @@ public: ~wxUTF8StringBuffer() { wxMBConvStrictUTF8 conv; - size_t wlen = conv.ToWChar(NULL, 0, m_buf); + size_t wlen = conv.ToWChar(nullptr, 0, m_buf); wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); wxStringInternalBuffer wbuf(m_str, wlen); @@ -4027,7 +4027,7 @@ public: wxCHECK_RET(m_lenSet, "length not set"); wxMBConvStrictUTF8 conv; - size_t wlen = conv.ToWChar(NULL, 0, m_buf, m_len); + size_t wlen = conv.ToWChar(nullptr, 0, m_buf, m_len); wxCHECK_RET( wlen != wxCONV_FAILED, "invalid UTF-8 data in string buffer?" ); wxStringInternalBufferLength wbuf(m_str, wlen); @@ -4268,9 +4268,9 @@ inline const wchar_t* wxCStrData::AsWChar() const #if !wxUSE_UNICODE if ( !p ) { - // if conversion fails, return empty string and not NULL to avoid + // if conversion fails, return empty string and not nullptr to avoid // crashes in code written with either wxWidgets 2 wxString or - // std::string behaviour in mind: neither of them ever returns NULL + // std::string behaviour in mind: neither of them ever returns nullptr // from its c_str() and so we shouldn't either // // notice that the same is done in AsChar() below and @@ -4373,7 +4373,7 @@ void wxStringIteratorNode::DoSet(const wxString *str, wxStringImpl::const_iterator *citer, wxStringImpl::iterator *iter) { - m_prev = NULL; + m_prev = nullptr; m_iter = iter; m_citer = citer; m_str = str; @@ -4386,7 +4386,7 @@ void wxStringIteratorNode::DoSet(const wxString *str, } else { - m_next = NULL; + m_next = nullptr; } } @@ -4399,10 +4399,10 @@ void wxStringIteratorNode::clear() else if ( m_str ) // first in the list const_cast(m_str)->m_iterators.ptr = m_next; - m_next = m_prev = NULL; - m_citer = NULL; - m_iter = NULL; - m_str = NULL; + m_next = m_prev = nullptr; + m_citer = nullptr; + m_iter = nullptr; + m_str = nullptr; } #endif // wxUSE_UNICODE_UTF8 diff --git a/include/wx/stringimpl.h b/include/wx/stringimpl.h index 705889aff2..b8ab191058 100644 --- a/include/wx/stringimpl.h +++ b/include/wx/stringimpl.h @@ -192,7 +192,7 @@ public: typedef ptr_type pointer; \ typedef int difference_type; \ \ - iterator_name() : m_ptr(NULL) { } \ + iterator_name() : m_ptr(nullptr) { } \ iterator_name(pointer ptr) : m_ptr(ptr) { } \ \ reference operator*() const { return *m_ptr; } \ diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index 8529e26c9c..e783b19556 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -131,20 +131,20 @@ class WXDLLIMPEXP_BASE wxFormatString public: #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING wxFormatString(const char *str) - : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} + : m_char(wxScopedCharBuffer::CreateNonOwned(str)), m_str(nullptr), m_cstr(nullptr) {} #endif wxFormatString(const wchar_t *str) - : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(NULL), m_cstr(NULL) {} + : m_wchar(wxScopedWCharBuffer::CreateNonOwned(str)), m_str(nullptr), m_cstr(nullptr) {} wxFormatString(const wxString& str) - : m_str(&str), m_cstr(NULL) {} + : m_str(&str), m_cstr(nullptr) {} wxFormatString(const wxCStrData& str) - : m_str(NULL), m_cstr(&str) {} + : m_str(nullptr), m_cstr(&str) {} #ifndef wxNO_IMPLICIT_WXSTRING_ENCODING wxFormatString(const wxScopedCharBuffer& str) - : m_char(str), m_str(NULL), m_cstr(NULL) {} + : m_char(str), m_str(nullptr), m_cstr(nullptr) {} #endif wxFormatString(const wxScopedWCharBuffer& str) - : m_wchar(str), m_str(NULL), m_cstr(NULL) {} + : m_wchar(str), m_str(nullptr), m_cstr(nullptr) {} // Possible argument types. These are or-combinable for wxASSERT_ARG_TYPE // convenience. Some of the values are or-combined with another value, this @@ -241,13 +241,13 @@ private: // arguments passed to a vararg template struct wxFormatStringArgument { - wxFormatStringArgument(const wxFormatString *s = NULL) : m_str(s) {} + wxFormatStringArgument(const wxFormatString *s = nullptr) : m_str(s) {} const wxFormatString *m_str; // overriding this operator allows us to reuse _WX_VARARG_JOIN macro wxFormatStringArgument operator,(const wxFormatStringArgument& a) const { - wxASSERT_MSG( m_str == NULL || a.m_str == NULL, + wxASSERT_MSG( m_str == nullptr || a.m_str == nullptr, "can't have two format strings in vararg function" ); return wxFormatStringArgument(m_str ? m_str : a.m_str); } @@ -441,7 +441,7 @@ template struct wxArgNormalizer { // Ctor. 'value' is the value passed as variadic argument, 'fmt' is pointer - // to printf-like format string or NULL if the variadic function doesn't + // to printf-like format string or nullptr if the variadic function doesn't // use format string and 'index' is index of 'value' in variadic arguments // list (starting at 1) wxArgNormalizer(T value, @@ -932,11 +932,11 @@ struct WXDLLIMPEXP_BASE wxArgNormalizedString { wxArgNormalizedString(const void* ptr) : m_ptr(ptr) {} - // returns true if non-NULL string was passed in - bool IsValid() const { return m_ptr != NULL; } + // returns true if non-null string was passed in + bool IsValid() const { return m_ptr != nullptr; } operator bool() const { return IsValid(); } - // extracts the string, returns empty string if NULL was passed in + // extracts the string, returns empty string if nullptr was passed in wxString GetString() const; operator wxString() const; diff --git a/include/wx/tarstrm.h b/include/wx/tarstrm.h index 063ca14d7a..bddc2df6d2 100644 --- a/include/wx/tarstrm.h +++ b/include/wx/tarstrm.h @@ -112,7 +112,7 @@ public: static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); + bool *pIsDir = nullptr); wxTarEntry *Clone() const { return new wxTarEntry(*this); } diff --git a/include/wx/taskbar.h b/include/wx/taskbar.h index 8287290a5c..8a537b2ba6 100644 --- a/include/wx/taskbar.h +++ b/include/wx/taskbar.h @@ -65,10 +65,10 @@ protected: // won't be called if GetPopupMenu() returns a non-null pointer. // creates menu to be displayed when user clicks on the icon - virtual wxMenu *CreatePopupMenu() { return NULL; } + virtual wxMenu *CreatePopupMenu() { return nullptr; } // same as CreatePopupMenu but the returned menu won't be destroyed - virtual wxMenu *GetPopupMenu() { return NULL; } + virtual wxMenu *GetPopupMenu() { return nullptr; } private: // default events handling, calls CreatePopupMenu: diff --git a/include/wx/taskbarbutton.h b/include/wx/taskbarbutton.h index e62db4bf5c..20a70d8609 100644 --- a/include/wx/taskbarbutton.h +++ b/include/wx/taskbarbutton.h @@ -42,7 +42,7 @@ enum wxTaskBarButtonState class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject { public: - wxThumbBarButton() : m_taskBarButtonParent(NULL) + wxThumbBarButton() : m_taskBarButtonParent(nullptr) { } wxThumbBarButton(int id, @@ -106,7 +106,7 @@ private: class WXDLLIMPEXP_CORE wxTaskBarButton { public: - // Factory function, may return NULL if task bar buttons are not supported + // Factory function, may return nullptr if task bar buttons are not supported // by the current system. static wxTaskBarButton* New(wxWindow* parent); @@ -148,7 +148,7 @@ enum wxTaskBarJumpListItemType class WXDLLIMPEXP_CORE wxTaskBarJumpListItem { public: - wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL, + wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = nullptr, wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR, const wxString& title = wxEmptyString, const wxString& filePath = wxEmptyString, @@ -192,7 +192,7 @@ typedef wxVector wxTaskBarJumpListItems; class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory { public: - wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL, + wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = nullptr, const wxString& title = wxEmptyString); virtual ~wxTaskBarJumpListCategory(); diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index 9576ff0a4d..fe1dfa6fd2 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -61,13 +61,13 @@ public: // ------------ // generic ctor for any kind of tool - wxToolBarToolBase(wxToolBarBase *tbar = NULL, + wxToolBarToolBase(wxToolBarBase *tbar = nullptr, int toolid = wxID_SEPARATOR, const wxString& label = wxEmptyString, const wxBitmapBundle& bmpNormal = wxBitmapBundle(), const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString) : m_label(label), @@ -201,12 +201,12 @@ public: } // add tool to/remove it from a toolbar - virtual void Detach() { m_tbar = NULL; } + virtual void Detach() { m_tbar = nullptr; } virtual void Attach(wxToolBarBase *tbar) { m_tbar = tbar; } #if wxUSE_MENUS // these methods are only for tools of wxITEM_DROPDOWN kind (but even such - // tools can have a NULL associated menu) + // tools can have a null associated menu) virtual void SetDropdownMenu(wxMenu *menu); wxMenu *GetDropdownMenu() const { return m_dropdownMenu; } #endif @@ -223,19 +223,19 @@ protected: m_id = toolid; m_kind = kind; - m_clientData = NULL; + m_clientData = nullptr; m_stretchable = false; m_toggled = false; m_enabled = true; #if wxUSE_MENUS - m_dropdownMenu = NULL; + m_dropdownMenu = nullptr; #endif } - wxToolBarBase *m_tbar; // the toolbar to which we belong (may be NULL) + wxToolBarBase *m_tbar; // the toolbar to which we belong (may be null) // tool parameters wxToolBarToolStyle m_toolStyle; @@ -301,7 +301,7 @@ public: wxItemKind kind = wxITEM_NORMAL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL) + wxObject *clientData = nullptr) { return DoAddTool(toolid, label, bitmap, bmpDisabled, kind, shortHelp, longHelp, clientData); @@ -324,7 +324,7 @@ public: const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL) + wxObject *clientData = nullptr) { return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, shortHelp, longHelp, clientData); @@ -338,7 +338,7 @@ public: const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL) + wxObject *clientData = nullptr) { return AddTool(toolid, label, bitmap, bmpDisabled, wxITEM_RADIO, shortHelp, longHelp, clientData); @@ -357,7 +357,7 @@ public: wxItemKind kind = wxITEM_NORMAL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL + wxObject *clientData = nullptr ); virtual wxToolBarToolBase *AddTool (wxToolBarToolBase *tool); @@ -375,7 +375,7 @@ public: InsertControl(size_t pos, wxControl *control, const wxString& label = wxEmptyString); - // get the control with the given id or return NULL + // get the control with the given id or return nullptr virtual wxControl *FindControl( int toolid ); // add a separator to the toolbar @@ -475,7 +475,7 @@ public: virtual wxSize GetToolSize() const { return GetToolBitmapSize(); } - // returns a (non separator) tool containing the point (x, y) or NULL if + // returns a (non separator) tool containing the point (x, y) or nullptr if // there is no tool at this point (coordinates are client) virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const = 0; @@ -524,7 +524,7 @@ public: const wxBitmapBundle& bmpNormal, const wxBitmapBundle& bmpDisabled = wxBitmapBundle(), wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString) = 0; @@ -538,7 +538,7 @@ public: return CreateTool(wxID_SEPARATOR, wxEmptyString, wxBitmapBundle(), wxBitmapBundle(), - wxITEM_SEPARATOR, NULL, + wxITEM_SEPARATOR, nullptr, wxEmptyString, wxEmptyString); } @@ -575,7 +575,7 @@ protected: wxItemKind kind, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, wxCoord xPos = wxDefaultCoord, wxCoord yPos = wxDefaultCoord ); @@ -620,7 +620,7 @@ protected: if ( !InsertTool(pos, tool) ) { delete tool; - return NULL; + return nullptr; } return tool; diff --git a/include/wx/testing.h b/include/wx/testing.h index 06daf09359..cc9304bf8d 100644 --- a/include/wx/testing.h +++ b/include/wx/testing.h @@ -315,9 +315,9 @@ public: // 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, + wxTestingModalHook(const char* file = nullptr, int line = 0, - const char* func = NULL) + const char* func = nullptr) : m_file(file), m_line(line), m_func(func) { Register(); diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index 01bcbfe3da..49011b7f39 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -510,9 +510,9 @@ public: } // Merges the given attributes. If compareWith - // is non-NULL, then it will be used to mask out those attributes that are the same in style + // is non-null, then it will be used to mask out those attributes that are the same in style // and compareWith, for situations where we don't want to explicitly set inherited attributes. - bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL); + bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = nullptr); // merges the attributes of the base and the overlay objects and returns // the result; the parameter attributes take precedence @@ -520,7 +520,7 @@ public: // WARNING: the order of arguments is the opposite of Combine() static wxTextAttr Merge(const wxTextAttr& base, const wxTextAttr& overlay) { - return Combine(overlay, base, NULL); + return Combine(overlay, base, nullptr); } // merges the attributes of this object and overlay diff --git a/include/wx/textentry.h b/include/wx/textentry.h index 17524ebee2..5d80a9c5c6 100644 --- a/include/wx/textentry.h +++ b/include/wx/textentry.h @@ -29,7 +29,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_CORE wxTextEntryBase { public: - wxTextEntryBase() { m_eventsBlock = 0; m_hintData = NULL; } + wxTextEntryBase() { m_eventsBlock = 0; m_hintData = nullptr; } virtual ~wxTextEntryBase(); @@ -126,7 +126,7 @@ public: // notice that we take ownership of the pointer and will delete it // - // if the pointer is NULL auto-completion is disabled + // if the pointer is null auto-completion is disabled bool AutoComplete(wxTextCompleter *completer) { return DoAutoCompleteCustom(completer); } diff --git a/include/wx/thread.h b/include/wx/thread.h index a11e192f0b..3d29a4053a 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -447,10 +447,10 @@ public: typedef void *ExitCode; // static functions - // Returns the wxThread object for the calling thread. NULL is returned + // Returns the wxThread object for the calling thread. nullptr is returned // if the caller is the main thread (but it's recommended to use // IsMain() and only call This() for threads other than the main one - // because NULL is also returned on error). If the thread wasn't + // because nullptr is also returned on error). If the thread wasn't // created with wxThread class, the returned value is undefined. static wxThread *This(); @@ -521,8 +521,8 @@ public: // periodically - the thread will only be deleted the next time it // does it! // - // will fill the rc pointer with the thread exit code if it's !NULL - wxThreadError Delete(ExitCode *rc = NULL, + // will fill the rc pointer with the thread exit code if it's non-null + wxThreadError Delete(ExitCode *rc = nullptr, wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); // waits for a joinable thread to finish and returns its exit code @@ -596,7 +596,7 @@ protected: bool SetName(const wxString &name); // exits from the current thread - can be called only from this thread - void Exit(ExitCode exitcode = NULL); + void Exit(ExitCode exitcode = nullptr); // entry point for the thread - called by Run() and executes in the context // of this thread. @@ -678,9 +678,9 @@ private: void KillThread() { // If wxThreadHelperThread is detached and is about to finish, it will - // set m_thread to NULL so don't delete it then. + // set m_thread to nullptr so don't delete it then. // But if KillThread is called before wxThreadHelperThread (in detached mode) - // sets it to NULL, then the thread object still exists and can be killed + // sets it to nullptr, then the thread object still exists and can be killed wxCriticalSectionLocker locker(m_critSection); if ( m_thread ) @@ -690,14 +690,14 @@ private: if ( m_kind == wxTHREAD_JOINABLE ) delete m_thread; - m_thread = NULL; + m_thread = nullptr; } } public: - // constructor only initializes m_thread to NULL + // constructor only initializes m_thread to nullptr wxThreadHelper(wxThreadKind kind = wxTHREAD_JOINABLE) - : m_thread(NULL), m_kind(kind) { } + : m_thread(nullptr), m_kind(kind) { } // destructor deletes m_thread virtual ~wxThreadHelper() { KillThread(); } @@ -749,7 +749,7 @@ inline void *wxThreadHelperThread::Entry() // And that wxThreadHelper::KillThread will not try to kill // an already deleted thread if ( m_owner.m_kind == wxTHREAD_DETACHED ) - m_owner.m_thread = NULL; + m_owner.m_thread = nullptr; return result; } diff --git a/include/wx/thrimpl.cpp b/include/wx/thrimpl.cpp index ca18dc2297..72d1b7380d 100644 --- a/include/wx/thrimpl.cpp +++ b/include/wx/thrimpl.cpp @@ -21,7 +21,7 @@ wxMutex::wxMutex(wxMutexType mutexType) if ( !m_internal->IsOk() ) { delete m_internal; - m_internal = NULL; + m_internal = nullptr; } } @@ -32,7 +32,7 @@ wxMutex::~wxMutex() bool wxMutex::IsOk() const { - return m_internal != NULL; + return m_internal != nullptr; } wxMutexError wxMutex::Lock() @@ -235,7 +235,7 @@ wxCondition::wxCondition(wxMutex& mutex) if ( !m_internal->IsOk() ) { delete m_internal; - m_internal = NULL; + m_internal = nullptr; } } @@ -246,7 +246,7 @@ wxCondition::~wxCondition() bool wxCondition::IsOk() const { - return m_internal != NULL; + return m_internal != nullptr; } wxCondError wxCondition::Wait() @@ -291,7 +291,7 @@ wxSemaphore::wxSemaphore(int initialcount, int maxcount) if ( !m_internal->IsOk() ) { delete m_internal; - m_internal = NULL; + m_internal = nullptr; } } @@ -302,7 +302,7 @@ wxSemaphore::~wxSemaphore() bool wxSemaphore::IsOk() const { - return m_internal != NULL; + return m_internal != nullptr; } wxSemaError wxSemaphore::Wait() diff --git a/include/wx/time.h b/include/wx/time.h index 918da125b8..b66b1988e5 100644 --- a/include/wx/time.h +++ b/include/wx/time.h @@ -48,7 +48,7 @@ wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); #ifdef WX_GETTIMEOFDAY_NO_TZ #define wxGetTimeOfDay(tv) gettimeofday(tv) #else - #define wxGetTimeOfDay(tv) gettimeofday((tv), NULL) + #define wxGetTimeOfDay(tv) gettimeofday((tv), nullptr) #endif #endif // HAVE_GETTIMEOFDAY diff --git a/include/wx/timectrl.h b/include/wx/timectrl.h index 4e4a7a3758..05a32f2002 100644 --- a/include/wx/timectrl.h +++ b/include/wx/timectrl.h @@ -75,11 +75,11 @@ public: return true; } - // Get the current time components. All pointers must be non-NULL. + // Get the current time components. All pointers must be non-null. bool GetTime(int* hour, int* min, int* sec) const { wxCHECK_MSG( hour && min && sec, false, - wxS("Time component pointers must be non-NULL") ); + wxS("Time component pointers must be non-null") ); const wxDateTime::Tm tm = this->GetValue().GetTm(); *hour = tm.hour; diff --git a/include/wx/timer.h b/include/wx/timer.h index 627d8ee8cf..5730deb2c2 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -179,7 +179,7 @@ public: #if WXWIN_COMPATIBILITY_3_0 wxDEPRECATED_MSG("wxTimerEvent not supposed to be created by user code") wxTimerEvent() - : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; } + : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=nullptr; } #endif // WXWIN_COMPATIBILITY_3_0 private: diff --git a/include/wx/tipwin.h b/include/wx/tipwin.h index d20d6e52f5..4a9b19dd7d 100644 --- a/include/wx/tipwin.h +++ b/include/wx/tipwin.h @@ -38,16 +38,16 @@ public: wxTipWindow(wxWindow *parent, const wxString& text, wxCoord maxLength = 100, - wxTipWindow** windowPtr = NULL, - wxRect *rectBound = NULL); + wxTipWindow** windowPtr = nullptr, + wxRect *rectBound = nullptr); virtual ~wxTipWindow(); - // If windowPtr is not NULL the given address will be NULLed when the + // If windowPtr is not null the given address will be nulled when the // window has closed void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; } - // If rectBound is not NULL, the window will disappear automatically when + // If rectBound is not null, the window will disappear automatically when // the mouse leave the specified rect: note that rectBound should be in the // screen coordinates! void SetBoundingRect(const wxRect& rectBound); diff --git a/include/wx/tls.h b/include/wx/tls.h index 7e7592286b..49d25397a5 100644 --- a/include/wx/tls.h +++ b/include/wx/tls.h @@ -67,7 +67,7 @@ // wxTlsValue represents a thread-specific value of type T but, unlike // with native compiler thread-specific variables, it behaves like a - // (never NULL) pointer to T and so needs to be dereferenced before use + // (never null) pointer to T and so needs to be dereferenced before use // // Note: T must be a POD! // @@ -93,7 +93,7 @@ ~wxTlsValue() { if ( m_key.Get() ) - m_key.Set(NULL); // this deletes the value + m_key.Set(nullptr); // this deletes the value } // access the object creating it on demand @@ -116,7 +116,7 @@ // slowly dying from out-of-memory errors which would // happen as the next access to this object would allocate // another ValueType instance and so on forever - value = NULL; + value = nullptr; } } diff --git a/include/wx/toolbook.h b/include/wx/toolbook.h index eb8c5209e5..757033da0b 100644 --- a/include/wx/toolbook.h +++ b/include/wx/toolbook.h @@ -78,7 +78,7 @@ public: virtual int ChangeSelection(size_t n) override { return DoSetSelection(n); } virtual bool DeleteAllPages() override; - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; // methods which are not part of base wxBookctrl API diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 1b09e0eac3..e11369c473 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -236,10 +236,10 @@ public: wxWindow *SetDefaultItem(wxWindow *win) { wxWindow *old = GetDefaultItem(); m_winDefault = win; return old; } - // return the temporary default item, can be NULL + // return the temporary default item, can be null wxWindow *GetTmpDefaultItem() const { return m_winTmpDefault; } - // set a temporary default item, SetTmpDefaultItem(NULL) should be called + // set a temporary default item, SetTmpDefaultItem(nullptr) should be called // soon after a call to SetTmpDefaultItem(window), return the old default wxWindow *SetTmpDefaultItem(wxWindow *win) { wxWindow *old = GetDefaultItem(); m_winTmpDefault = win; return old; } @@ -346,10 +346,10 @@ protected: // the frame icon wxIconBundle m_icons; - // a default window (usually a button) or NULL + // a default window (usually a button) or nullptr wxWindowRef m_winDefault; - // a temporary override of m_winDefault, use the latter if NULL + // a temporary override of m_winDefault, use the latter if nullptr wxWindowRef m_winTmpDefault; bool m_modified; diff --git a/include/wx/tracker.h b/include/wx/tracker.h index d8f272822c..656d343547 100644 --- a/include/wx/tracker.h +++ b/include/wx/tracker.h @@ -19,12 +19,12 @@ class wxEventConnectionRef; class WXDLLIMPEXP_BASE wxTrackerNode { public: - wxTrackerNode() : m_nxt(NULL) { } + wxTrackerNode() : m_nxt(nullptr) { } virtual ~wxTrackerNode() { } virtual void OnObjectDestroy() = 0; - virtual wxEventConnectionRef *ToEventConnection() { return NULL; } + virtual wxEventConnectionRef *ToEventConnection() { return nullptr; } private: wxTrackerNode *m_nxt; @@ -63,11 +63,11 @@ protected: // this class is only supposed to be used as a base class but never be // created nor destroyed directly so all ctors and dtor are protected - wxTrackable() : m_first(NULL) { } + wxTrackable() : m_first(nullptr) { } // copy ctor and assignment operator intentionally do not copy m_first: the // objects which track the original trackable shouldn't track the new copy - wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(NULL) { } + wxTrackable(const wxTrackable& WXUNUSED(other)) : m_first(nullptr) { } wxTrackable& operator=(const wxTrackable& WXUNUSED(other)) { return *this; } // dtor is not virtual: this class is not supposed to be used diff --git a/include/wx/translation.h b/include/wx/translation.h index a54a46958e..07c425885d 100644 --- a/include/wx/translation.h +++ b/include/wx/translation.h @@ -91,7 +91,7 @@ public: #endif // load the catalog from disk or from data; caller is responsible for - // deleting them if not NULL + // deleting them if not null static wxMsgCatalog *CreateFromFile(const wxString& filename, const wxString& domain); @@ -101,19 +101,19 @@ public: // get name of the catalog wxString GetDomain() const { return m_domain; } - // get the translated string: returns NULL if not found + // get the translated string: returns nullptr if not found const wxString *GetString(const wxString& sz, unsigned n = UINT_MAX, const wxString& ct = wxEmptyString) const; protected: wxMsgCatalog(const wxString& domain) - : m_pNext(NULL), m_domain(domain) + : m_pNext(nullptr), m_domain(domain) #if !wxUSE_UNICODE - , m_conv(NULL) + , m_conv(nullptr) #endif {} private: - // variable pointing to the next element in a linked list (or NULL) + // variable pointing to the next element in a linked list (or nullptr) wxMsgCatalog *m_pNext; friend class wxTranslations; @@ -140,9 +140,9 @@ public: wxTranslations(); ~wxTranslations(); - // returns current translations object, may return NULL + // returns current translations object, may return nullptr static wxTranslations *Get(); - // sets current translations object (takes ownership; may be NULL) + // sets current translations object (takes ownership; may be null) static void Set(wxTranslations *t); // changes loader to non-default one; takes ownership of 'loader' @@ -196,7 +196,7 @@ private: // perform loading of the catalog via m_loader bool LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang); - // find catalog by name in a linked list, return NULL if !found + // find catalog by name in a linked list, return nullptr if !found wxMsgCatalog *FindCatalog(const wxString& domain) const; // same as Set(), without taking ownership; only for wxLocale @@ -261,7 +261,7 @@ protected: virtual wxString GetResourceType() const { return wxASCII_STR("MOFILE"); } // returns module to load resources from - virtual WXHINSTANCE GetModule() const { return NULL; } + virtual WXHINSTANCE GetModule() const { return nullptr; } }; #endif // __WINDOWS__ @@ -277,7 +277,7 @@ inline const wxString& wxGetTranslation(const wxString& str, { wxTranslations *trans = wxTranslations::Get(); const wxString *transStr = trans ? trans->GetTranslatedString(str, domain, context) - : NULL; + : nullptr; if ( transStr ) return *transStr; else @@ -294,7 +294,7 @@ inline const wxString& wxGetTranslation(const wxString& str1, { wxTranslations *trans = wxTranslations::Get(); const wxString *transStr = trans ? trans->GetTranslatedString(str1, n, domain, context) - : NULL; + : nullptr; if ( transStr ) return *transStr; else diff --git a/include/wx/treebook.h b/include/wx/treebook.h index eb8f88bccf..7901306ee2 100644 --- a/include/wx/treebook.h +++ b/include/wx/treebook.h @@ -63,7 +63,7 @@ public: // Page insertion operations // ------------------------- - // Notice that page pointer may be NULL in which case the next non NULL + // Notice that page pointer may be null in which case the next non null // page (usually the first child page of a node) is shown when this page is // selected @@ -131,7 +131,7 @@ public: virtual bool SetPageImage(size_t n, int imageId) override; virtual int SetSelection(size_t n) override { return DoSetSelection(n, SetSelection_SendEvent); } virtual int ChangeSelection(size_t n) override { return DoSetSelection(n); } - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; virtual bool DeleteAllPages() override; protected: @@ -140,7 +140,7 @@ protected: virtual void OnImagesChanged() override; - // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) + // This subclass of wxBookCtrlBase accepts null page pointers (empty pages) virtual bool AllowNullPage() const override { return true; } virtual wxWindow *TryGetNonNullPage(size_t page) override; diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 1a91916cf7..24fb5c4956 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -181,7 +181,7 @@ public: // get the root tree item virtual wxTreeItemId GetRootItem() const = 0; - // get the item currently selected (may return NULL if no selection) + // get the item currently selected (may return nullptr if no selection) virtual wxTreeItemId GetSelection() const = 0; // get the items currently selected, return the number of such item @@ -201,7 +201,7 @@ public: virtual void SetFocusedItem(const wxTreeItemId& item) = 0; - // get the parent of this item (may return NULL if root) + // get the parent of this item (may return nullptr if root) virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const = 0; // for this enumeration function you must pass in a "cookie" parameter @@ -239,13 +239,13 @@ public: // add the root node to the tree virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; + wxTreeItemData *data = nullptr) = 0; // insert a new item in as the first child of the parent wxTreeItemId PrependItem(const wxTreeItemId& parent, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) + wxTreeItemData *data = nullptr) { return DoInsertItem(parent, 0u, text, image, selImage, data); } @@ -255,7 +255,7 @@ public: const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) + wxTreeItemData *data = nullptr) { return DoInsertAfter(parent, idPrevious, text, image, selImage, data); } @@ -265,7 +265,7 @@ public: size_t pos, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) + wxTreeItemData *data = nullptr) { return DoInsertItem(parent, pos, text, image, selImage, data); } @@ -274,7 +274,7 @@ public: wxTreeItemId AppendItem(const wxTreeItemId& parent, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) + wxTreeItemData *data = nullptr) { return DoInsertItem(parent, (size_t)-1, text, image, selImage, data); } @@ -335,7 +335,7 @@ public: virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) = 0; // returns the same pointer as StartEdit() if the item is being edited, - // NULL otherwise (it's assumed that no more than one item may be + // nullptr otherwise (it's assumed that no more than one item may be // edited simultaneously) virtual wxTextCtrl *GetEditControl() const = 0; // end editing and accept or discard the changes to item label @@ -415,7 +415,7 @@ protected: const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL) = 0; + wxTreeItemData *data = nullptr) = 0; // real HitTest() implementation: again, can't be called just HitTest() // because it's overloaded and so the non-virtual overload would be hidden diff --git a/include/wx/treelist.h b/include/wx/treelist.h index bece6cce60..9748097cbc 100644 --- a/include/wx/treelist.h +++ b/include/wx/treelist.h @@ -65,7 +65,7 @@ enum class wxTreeListItem : public wxItemId { public: - wxTreeListItem(wxTreeListModelNode* item = NULL) + wxTreeListItem(wxTreeListModelNode* item = nullptr) : wxItemId(item) { } @@ -202,7 +202,7 @@ public: const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL) + wxClientData* data = nullptr) { return DoInsertItem(parent, wxTLI_LAST, text, imageClosed, imageOpened, data); @@ -213,7 +213,7 @@ public: const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL) + wxClientData* data = nullptr) { return DoInsertItem(parent, previous, text, imageClosed, imageOpened, data); @@ -223,7 +223,7 @@ public: const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL) + wxClientData* data = nullptr) { return DoInsertItem(parent, wxTLI_FIRST, text, imageClosed, imageOpened, data); @@ -367,7 +367,7 @@ public: // parameters with the column which is currently used for sorting and // whether we sort using ascending or descending order. Otherwise, i.e. if // the control contents is unsorted, simply return false. - bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL); + bool GetSortColumn(unsigned* col, bool* ascendingOrder = nullptr); // Set the object to use for comparing the items. It will be called when // the control is being sorted because the user clicked on a sortable @@ -375,7 +375,7 @@ public: // // The provided pointer is stored by the control so the object it points to // must have a life-time equal or greater to that of the control itself. In - // addition, the pointer can be NULL to stop using custom comparator and + // addition, the pointer can be null to stop using custom comparator and // revert to the default alphabetical comparison. void SetItemComparator(wxTreeListItemComparator* comparator); diff --git a/include/wx/uilocale.h b/include/wx/uilocale.h index bcf641b57d..039c6c2411 100644 --- a/include/wx/uilocale.h +++ b/include/wx/uilocale.h @@ -172,7 +172,7 @@ public: // Retrieve the language info struct for the given language // - // Returns NULL if no info found, pointer must *not* be deleted by caller + // Returns nullptr if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo* GetLanguageInfo(int lang); // Returns language name in English or empty string if the language @@ -187,14 +187,14 @@ public: // canonical ISO 2 letter language code ("xx"), a language code followed by // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") // - // Returns NULL if no info found, pointer must *not* be deleted by caller + // Returns nullptr if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo* FindLanguageInfo(const wxString& locale); // Find the language for the given locale string which may be either a // canonical ISO 2 letter language code ("xx"), a language code followed by // the country code ("xx_XX") or a Windows full language name ("Xxxxx...") // - // Returns NULL if no info found, pointer must *not* be deleted by caller + // Returns nullptr if no info found, pointer must *not* be deleted by caller static const wxLanguageInfo* FindLanguageInfo(const wxLocaleIdent& locId); // Add custom language to the list of known languages. @@ -222,7 +222,7 @@ public: private: // This ctor is private and exists only for implementation reasons. // It takes ownership of the provided pointer. - explicit wxUILocale(wxUILocaleImpl* impl = NULL) : m_impl(impl) { } + explicit wxUILocale(wxUILocaleImpl* impl = nullptr) : m_impl(impl) { } // Creates the global tables of languages and scripts called by CreateLanguagesDB static void InitLanguagesDB(); diff --git a/include/wx/unichar.h b/include/wx/unichar.h index efdf0951c9..1f9d3874ca 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -69,7 +69,7 @@ public: // Returns true if the character is representable as a single byte in the // current locale encoding and return this byte in output argument c (which - // must be non-NULL) + // must be non-null) bool GetAsChar(char *c) const { #if wxUSE_UNICODE diff --git a/include/wx/univ/anybutton.h b/include/wx/univ/anybutton.h index d168e2d3b0..765a0c9745 100644 --- a/include/wx/univ/anybutton.h +++ b/include/wx/univ/anybutton.h @@ -80,7 +80,7 @@ public: virtual bool HandleActivation(wxInputConsumer *consumer, bool activated) override; private: - // the window (button) which has capture or NULL and the flag telling if + // the window (button) which has capture or nullptr and the flag telling if // the mouse is inside the button which captured it or not wxWindow *m_winCapture; bool m_winHasMouse; diff --git a/include/wx/univ/checklst.h b/include/wx/univ/checklst.h index e79d6b9dfc..20fc11b211 100644 --- a/include/wx/univ/checklst.h +++ b/include/wx/univ/checklst.h @@ -32,7 +32,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)) @@ -55,7 +55,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString choices[] = (const wxString *) NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/univ/choice.h b/include/wx/univ/choice.h index 512e317e3d..983a283435 100644 --- a/include/wx/univ/choice.h +++ b/include/wx/univ/choice.h @@ -22,7 +22,7 @@ public: wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)) @@ -40,7 +40,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxChoiceNameStr)); diff --git a/include/wx/univ/combobox.h b/include/wx/univ/combobox.h index d32ebfe8a9..4ed97cd92d 100644 --- a/include/wx/univ/combobox.h +++ b/include/wx/univ/combobox.h @@ -46,7 +46,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = (const wxString *) NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)) @@ -72,7 +72,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = (const wxString *) NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxComboBoxNameStr)); diff --git a/include/wx/univ/inpcons.h b/include/wx/univ/inpcons.h index 033d17b0ce..6a0b466ecb 100644 --- a/include/wx/univ/inpcons.h +++ b/include/wx/univ/inpcons.h @@ -37,7 +37,7 @@ typedef wxString wxControlAction; class WXDLLIMPEXP_CORE wxInputConsumer { public: - wxInputConsumer() { m_inputHandler = NULL; } + wxInputConsumer() { m_inputHandler = nullptr; } virtual ~wxInputConsumer() { } // get the input handler @@ -65,7 +65,7 @@ public: // // the parameter is the default input handler which should receive all // unprocessed input (i.e. typically handlerDef is passed to - // wxStdInputHandler ctor) or it may be NULL + // wxStdInputHandler ctor) or it may be null // // the returned pointer will not be deleted by caller so it must either // point to a static object or be deleted on program termination @@ -125,7 +125,7 @@ private: // When we add an event table entry (= use a member pointer) pointing to // wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the // version of "this" that belongs to wxControl, not wxIC! In our particular -// case, the effect is that m_handler is NULL (probably same memory +// case, the effect is that m_handler is null (probably same memory // area as the_other_vtable's_this->m_refObj) and input handling doesn't work.) #define WX_FORWARD_TO_INPUT_CONSUMER(classname) \ void classname::OnMouse(wxMouseEvent& event) \ diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index c36fc1e2fa..1d5771bff9 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -56,7 +56,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr) ) @@ -81,7 +81,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxASCII_STR(wxListBoxNameStr)); diff --git a/include/wx/univ/menu.h b/include/wx/univ/menu.h index bbf3924bed..6ac8249c3d 100644 --- a/include/wx/univ/menu.h +++ b/include/wx/univ/menu.h @@ -93,7 +93,7 @@ protected: // forget old menu geometry info void InvalidateGeometryInfo(); - // return either the menubar or the invoking window, normally never NULL + // return either the menubar or the invoking window, normally never null wxWindow *GetRootWindow() const; // get the renderer we use for drawing: either the one of the menu bar or @@ -117,7 +117,7 @@ private: // which is opaque and defined by the renderer wxMenuGeometryInfo *m_geometry; - // the menu shown on screen or NULL if not currently shown + // the menu shown on screen or nullptr if not currently shown wxPopupMenuWindow *m_popupMenu; #if wxUSE_ACCEL @@ -163,11 +163,11 @@ public: // 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 + // 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; + bool *unique = nullptr) const; // called by wxFrame to set focus to or open the given menu void SelectMenu(size_t pos); @@ -210,7 +210,7 @@ protected: virtual wxSize DoGetBestClientSize() const override; // has the menubar been created already? - bool IsCreated() const { return m_frameLast != NULL; } + bool IsCreated() const { return m_frameLast != nullptr; } // "fast" version of GetMenuCount() size_t GetCount() const { return m_menuInfos.GetCount(); } @@ -240,7 +240,7 @@ protected: void DismissMenu(); // do we show a menu currently? - bool IsShowingMenu() const { return m_menuShown != 0; } + bool IsShowingMenu() const { return m_menuShown != nullptr; } // we don't want to have focus except while selecting from menu void GiveAwayFocus(); @@ -255,14 +255,14 @@ protected: int m_current; private: - // the last frame to which we were attached, NULL initially + // the last frame to which we were attached, nullptr initially wxFrame *m_frameLast; - // the currently shown menu or NULL + // the currently shown menu or nullptr 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 + // nullptr 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; diff --git a/include/wx/univ/menuitem.h b/include/wx/univ/menuitem.h index 13a71fa1c6..7bcf460aa7 100644 --- a/include/wx/univ/menuitem.h +++ b/include/wx/univ/menuitem.h @@ -19,12 +19,12 @@ class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase { public: // ctor & dtor - wxMenuItem(wxMenu *parentMenu = NULL, + wxMenuItem(wxMenu *parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& name = wxEmptyString, const wxString& help = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); + wxMenu *subMenu = nullptr); virtual ~wxMenuItem(); // override base class virtuals to update the item appearance on screen diff --git a/include/wx/univ/notebook.h b/include/wx/univ/notebook.h index c285e09434..cec4332179 100644 --- a/include/wx/univ/notebook.h +++ b/include/wx/univ/notebook.h @@ -103,7 +103,7 @@ public: // hit testing // ----------- - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const override; + virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override; // input handling // -------------- diff --git a/include/wx/univ/radiobox.h b/include/wx/univ/radiobox.h index d02c88a0c8..538fc5dce4 100644 --- a/include/wx/univ/radiobox.h +++ b/include/wx/univ/radiobox.h @@ -34,7 +34,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString *choices = NULL, + int n = 0, const wxString *choices = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, @@ -61,7 +61,7 @@ public: const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString *choices = NULL, + int n = 0, const wxString *choices = nullptr, int majorDim = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, diff --git a/include/wx/univ/renderer.h b/include/wx/univ/renderer.h index e5bbb452a7..4ac118b939 100644 --- a/include/wx/univ/renderer.h +++ b/include/wx/univ/renderer.h @@ -81,7 +81,7 @@ public: const wxColour& col, const wxRect& rect, int flags, - wxWindow *window = NULL) = 0; + wxWindow *window = nullptr) = 0; // draw the button surface virtual void DrawButtonSurface(wxDC& dc, @@ -97,7 +97,7 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) = 0; + wxRect *rectBounds = nullptr) = 0; // same but also draw a bitmap if it is valid virtual void DrawButtonLabel(wxDC& dc, @@ -107,7 +107,7 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) = 0; + wxRect *rectBounds = nullptr) = 0; // draw the border and optionally return the rectangle containing the @@ -116,7 +116,7 @@ public: wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) = 0; + wxRect *rectIn = nullptr) = 0; // draw text control border (I hate to have a separate method for this but // it is needed to accommodate GTK+) @@ -124,13 +124,13 @@ public: wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) = 0; + wxRect *rectIn = nullptr) = 0; // draw push button border and return the rectangle left for the label virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) = 0; + wxRect *rectIn = nullptr) = 0; // draw a horizontal line virtual void DrawHorizontalLine(wxDC& dc, @@ -252,7 +252,7 @@ public: wxOrientation orient, int flags = 0, long style = 0, - wxRect *rectShaft = NULL) = 0; + wxRect *rectShaft = nullptr) = 0; // draw the slider thumb virtual void DrawSliderThumb(wxDC& dc, @@ -501,7 +501,7 @@ public: const wxColour& col, const wxRect& rect, int flags, - wxWindow *window = NULL ) override + wxWindow *window = nullptr ) override { m_renderer->DrawBackground(dc, col, rect, flags, window ); } virtual void DrawButtonSurface(wxDC& dc, const wxColour& col, @@ -516,7 +516,7 @@ public: int flags = 0, int align = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) override + wxRect *rectBounds = nullptr) override { m_renderer->DrawLabel(dc, label, rect, flags, align, indexAccel, rectBounds); } virtual void DrawButtonLabel(wxDC& dc, @@ -526,25 +526,25 @@ public: int flags = 0, int align = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) override + wxRect *rectBounds = nullptr) override { m_renderer->DrawButtonLabel(dc, label, image, rect, flags, align, indexAccel, rectBounds); } virtual void DrawBorder(wxDC& dc, wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) override + wxRect *rectIn = nullptr) override { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); } virtual void DrawTextBorder(wxDC& dc, wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) override + wxRect *rectIn = nullptr) override { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); } virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) override + wxRect *rectIn = nullptr) override { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); } virtual void DrawFrame(wxDC& dc, const wxString& label, @@ -653,7 +653,7 @@ public: wxOrientation orient, int flags = 0, long style = 0, - wxRect *rectShaft = NULL) override + wxRect *rectShaft = nullptr) override { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); } virtual void DrawSliderThumb(wxDC& dc, const wxRect& rect, @@ -845,7 +845,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override + wxHeaderButtonParams* params = nullptr) override { return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); } virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, diff --git a/include/wx/univ/scrolbar.h b/include/wx/univ/scrolbar.h index 6f1b6ad877..2946dd0d98 100644 --- a/include/wx/univ/scrolbar.h +++ b/include/wx/univ/scrolbar.h @@ -254,7 +254,7 @@ protected: void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event); - // the window (scrollbar) which has capture or NULL and the flag telling if + // the window (scrollbar) which has capture or nullptr and the flag telling if // the mouse is inside the element which captured it or not wxWindow *m_winCapture; bool m_winHasMouse; diff --git a/include/wx/univ/scrthumb.h b/include/wx/univ/scrthumb.h index 3da2e716e4..0565b2895d 100644 --- a/include/wx/univ/scrthumb.h +++ b/include/wx/univ/scrthumb.h @@ -58,7 +58,7 @@ public: private: // do we have the mouse capture? - bool HasCapture() const { return m_captureData != NULL; } + bool HasCapture() const { return m_captureData != nullptr; } // get the coord of this event in the direction we're interested in (y for // vertical shaft or x for horizontal ones) diff --git a/include/wx/univ/slider.h b/include/wx/univ/slider.h index ec3cf3b48b..64d0b3e7c0 100644 --- a/include/wx/univ/slider.h +++ b/include/wx/univ/slider.h @@ -177,7 +177,7 @@ protected: wxRect GetShaftRect() const; // calc the current thumb position using the shaft rect (if the pointer is - // NULL, we calculate it here too) + // null, we calculate it here too) void CalcThumbRect(const wxRect *rectShaft, wxRect *rectThumbOut, wxRect *rectLabelOut, diff --git a/include/wx/univ/statusbr.h b/include/wx/univ/statusbr.h index 58d1a5be6b..4f6f338ac7 100644 --- a/include/wx/univ/statusbr.h +++ b/include/wx/univ/statusbr.h @@ -39,7 +39,7 @@ public: const wxString& name = wxASCII_STR(wxPanelNameStr)); // implement base class methods - virtual void SetFieldsCount(int number = 1, const int *widths = NULL) override; + virtual void SetFieldsCount(int number = 1, const int *widths = nullptr) override; virtual void SetStatusWidths(int n, const int widths[]) override; virtual bool GetFieldRect(int i, wxRect& rect) const override; diff --git a/include/wx/univ/stdrend.h b/include/wx/univ/stdrend.h index 7bcd29cb1d..8c5caa1a3f 100644 --- a/include/wx/univ/stdrend.h +++ b/include/wx/univ/stdrend.h @@ -30,7 +30,7 @@ public: const wxColour& col, const wxRect& rect, int flags = 0, - wxWindow *window = NULL) override; + wxWindow *window = nullptr) override; virtual void DrawButtonSurface(wxDC& dc, const wxColour& col, const wxRect& rect, @@ -45,7 +45,7 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) override; + wxRect *rectBounds = nullptr) override; virtual void DrawButtonLabel(wxDC& dc, const wxString& label, const wxBitmap& image, @@ -53,19 +53,19 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL) override; + wxRect *rectBounds = nullptr) override; virtual void DrawBorder(wxDC& dc, wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) override; + wxRect *rectIn = nullptr) override; virtual void DrawTextBorder(wxDC& dc, wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL) override; + wxRect *rectIn = nullptr) override; virtual void DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2) override; diff --git a/include/wx/univ/textctrl.h b/include/wx/univ/textctrl.h index b1c9025465..55d082b5fb 100644 --- a/include/wx/univ/textctrl.h +++ b/include/wx/univ/textctrl.h @@ -334,12 +334,12 @@ protected: // start of line) is wxTextCoord GetRowInLine(wxTextCoord line, wxTextCoord col, - wxTextCoord *colRowStart = NULL) const; + wxTextCoord *colRowStart = nullptr) const; // find the number of characters of a line before it wraps // (and optionally also the real width of the line) size_t GetPartOfWrappedLine(const wxChar* text, - wxCoord *widthReal = NULL) const; + wxCoord *widthReal = nullptr) const; // get the start and end of the selection for this line: if the line is // outside the selection, both will be -1 and false will be returned diff --git a/include/wx/univ/theme.h b/include/wx/univ/theme.h index e50adbcdf0..740c140462 100644 --- a/include/wx/univ/theme.h +++ b/include/wx/univ/theme.h @@ -35,13 +35,13 @@ public: // create the default theme static bool CreateDefault(); - // create the theme by name (will return NULL if not found) + // create the theme by name (will return nullptr if not found) static wxTheme *Create(const wxString& name); // change the current scheme static wxTheme *Set(wxTheme *theme); - // get the current theme (never NULL) + // get the current theme (never null) static wxTheme *Get() { return ms_theme; } // the theme methods @@ -117,7 +117,7 @@ struct WXDLLIMPEXP_CORE wxThemeInfo // the function to create a theme object Constructor ctor; - // next node in the linked list or NULL + // next node in the linked list or nullptr wxThemeInfo *next; // constructor for the struct itself diff --git a/include/wx/univ/window.h b/include/wx/univ/window.h index b69eb80346..baab8504e0 100644 --- a/include/wx/univ/window.h +++ b/include/wx/univ/window.h @@ -82,8 +82,8 @@ public: int alignment = wxALIGN_CENTRE, wxStretch stretch = wxSTRETCH_NOT); - const wxBitmap& GetBackgroundBitmap(int *alignment = NULL, - wxStretch *stretch = NULL) const; + const wxBitmap& GetBackgroundBitmap(int *alignment = nullptr, + wxStretch *stretch = nullptr) const; // scrollbars: we (re)implement it ourselves using our own scrollbars // instead of the native ones @@ -99,7 +99,7 @@ public: virtual int GetScrollThumb(int orient) const override; virtual int GetScrollRange(int orient) const override; virtual void ScrollWindow(int dx, int dy, - const wxRect* rect = NULL) override; + const wxRect* rect = nullptr) override; // take into account the borders here virtual wxPoint GetClientAreaOrigin() const override; @@ -130,7 +130,7 @@ public: virtual bool SetCurrent(bool doit = true); #if wxUSE_SCROLLBAR - // get the scrollbar (may be NULL) for the given orientation + // get the scrollbar (may be null) for the given orientation wxScrollBar *GetScrollbar(int orient) const { return orient & wxVERTICAL ? m_scrollbarVert : m_scrollbarHorz; @@ -164,7 +164,7 @@ public: // scrolling helper: like ScrollWindow() except that it doesn't refresh the // uncovered window areas but returns the rectangle to update (don't call // this with both dx and dy non zero) - wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = NULL); + wxRect ScrollNoRefresh(int dx, int dy, const wxRect *rect = nullptr); // after scrollbars are added or removed they must be refreshed by calling // this function @@ -179,7 +179,7 @@ public: // the rect coordinates are, for us, in client coords, but if no rect is // specified, the entire window is refreshed virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL) override; + const wxRect *rect = nullptr) override; // we refresh the window when it is dis/enabled virtual bool Enable(bool enable = true) override; @@ -243,7 +243,7 @@ protected: void PositionScrollbars(); #if wxUSE_MENUS - // return the menubar of the parent frame or NULL + // return the menubar of the parent frame or nullptr wxMenuBar *GetParentFrameMenuBar() const; #endif // wxUSE_MENUS @@ -276,7 +276,7 @@ private: #endif // wxUSE_SCROLLBAR #if wxUSE_MENUS - // the current modal event loop for the popup menu we show or NULL + // the current modal event loop for the popup menu we show or nullptr static wxEventLoop *ms_evtLoopPopup; // the last window over which Alt was pressed (used by OnKeyUp) diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index 5ce97d6837..bb80e94e40 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -49,7 +49,7 @@ public: #endif // wxUSE_SOCKETS #if wxUSE_CONSOLE_EVENTLOOP && wxUSE_EVENTLOOP_SOURCE - // Return a non-NULL pointer to the object responsible for managing the + // Return a non-null pointer to the object responsible for managing the // event loop sources in this kind of application. virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); #endif // wxUSE_CONSOLE_EVENTLOOP && wxUSE_CONSOLE_EVENTLOOP diff --git a/include/wx/unix/apptrait.h b/include/wx/unix/apptrait.h index 635c25b42e..2d7e7cabd8 100644 --- a/include/wx/unix/apptrait.h +++ b/include/wx/unix/apptrait.h @@ -58,9 +58,9 @@ public: virtual void MutexGuiLeave() override; #endif - wxPortId GetToolkitVersion(int *majVer = NULL, - int *minVer = NULL, - int *microVer = NULL) const override; + wxPortId GetToolkitVersion(int *majVer = nullptr, + int *minVer = nullptr, + int *microVer = nullptr) const override; #ifdef __WXGTK__ virtual wxString GetDesktopEnvironment() const override; diff --git a/include/wx/unix/evtloop.h b/include/wx/unix/evtloop.h index 690a55f439..fa2e70a744 100644 --- a/include/wx/unix/evtloop.h +++ b/include/wx/unix/evtloop.h @@ -37,7 +37,7 @@ public: virtual bool Dispatch() override; virtual int DispatchTimeout(unsigned long timeout) override; virtual void WakeUp() override; - virtual bool IsOk() const override { return m_dispatcher != NULL; } + virtual bool IsOk() const override { return m_dispatcher != nullptr; } protected: virtual void OnNextIteration() override; diff --git a/include/wx/unix/fontutil.h b/include/wx/unix/fontutil.h index a3c7d538a8..4b0ad4bd76 100644 --- a/include/wx/unix/fontutil.h +++ b/include/wx/unix/fontutil.h @@ -28,7 +28,7 @@ wxLoadQueryNearestFont(double pointSize, bool underlined, const wxString &facename, wxFontEncoding encoding, - wxString* xFontName = NULL); + wxString* xFontName = nullptr); // returns the font specified by the given XLFD extern wxNativeFont wxLoadFont(const wxString& fontSpec); diff --git a/include/wx/unix/glegl.h b/include/wx/unix/glegl.h index f9e4d230a1..59e830e4da 100644 --- a/include/wx/unix/glegl.h +++ b/include/wx/unix/glegl.h @@ -36,8 +36,8 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: wxGLContext(wxGLCanvas *win, - const wxGLContext *other = NULL, - const wxGLContextAttrs *ctxAttrs = NULL); + const wxGLContext *other = nullptr, + const wxGLContextAttrs *ctxAttrs = nullptr); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const override; @@ -105,7 +105,7 @@ public: // not found static bool InitDefaultConfig(const int *attribList); - // get the default EGL Config (may be NULL, shouldn't be freed by caller) + // get the default EGL Config (may be null, shouldn't be freed by caller) static EGLConfig *GetDefaultConfig() { return ms_glEGLConfig; } // free the global GL visual, called by wxGLApp @@ -113,7 +113,7 @@ public: // initializes EGLConfig // - // returns NULL if EGLConfig couldn't be initialized, otherwise caller + // returns nullptr if EGLConfig couldn't be initialized, otherwise caller // is responsible for freeing the pointer static EGLConfig *InitConfig(const wxGLAttributes& dispAttrs); diff --git a/include/wx/unix/glx11.h b/include/wx/unix/glx11.h index 6201009937..b0e4c89cf9 100644 --- a/include/wx/unix/glx11.h +++ b/include/wx/unix/glx11.h @@ -23,8 +23,8 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: wxGLContext(wxGLCanvas *win, - const wxGLContext *other = NULL, - const wxGLContextAttrs *ctxAttrs = NULL); + const wxGLContext *other = nullptr, + const wxGLContextAttrs *ctxAttrs = nullptr); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const override; diff --git a/include/wx/unix/private/displayx11.h b/include/wx/unix/private/displayx11.h index c78b213b09..e6b0ff46b1 100644 --- a/include/wx/unix/private/displayx11.h +++ b/include/wx/unix/private/displayx11.h @@ -161,7 +161,7 @@ void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) int actual_format; unsigned long nitems; unsigned long bytes_after; - unsigned char* data = NULL; + unsigned char* data = nullptr; Status status = XGetWindowProperty( display, RootWindowOfScreen(screen), property, 0, 4, false, XA_CARDINAL, diff --git a/include/wx/unix/private/epolldispatcher.h b/include/wx/unix/private/epolldispatcher.h index 4dbd78fc6b..29c3f0431e 100644 --- a/include/wx/unix/private/epolldispatcher.h +++ b/include/wx/unix/private/epolldispatcher.h @@ -21,7 +21,7 @@ struct epoll_event; class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher { public: - // create a new instance of this class, can return NULL if + // create a new instance of this class, can return nullptr if // epoll() is not supported on this system // // the caller should delete the returned pointer diff --git a/include/wx/unix/private/execute.h b/include/wx/unix/private/execute.h index 156413cc42..7605761176 100644 --- a/include/wx/unix/private/execute.h +++ b/include/wx/unix/private/execute.h @@ -31,9 +31,9 @@ public: m_pid = 0; m_exitcode = -1; - m_process = NULL; + m_process = nullptr; - m_syncEventLoop = NULL; + m_syncEventLoop = nullptr; #if wxUSE_STREAMS m_fdOut = @@ -63,7 +63,7 @@ public: // The exit code of the process, set once the child terminates. int m_exitcode; - // the associated process object or NULL + // the associated process object or nullptr wxProcess *m_process; // Local event loop used to wait for the child process termination in diff --git a/include/wx/unix/private/executeiohandler.h b/include/wx/unix/private/executeiohandler.h index eeff9069c8..bb1e581931 100644 --- a/include/wx/unix/private/executeiohandler.h +++ b/include/wx/unix/private/executeiohandler.h @@ -125,7 +125,7 @@ private: virtual void DoDisable() override { delete m_source; - m_source = NULL; + m_source = nullptr; } wxEventLoopSource* m_source; diff --git a/include/wx/unix/private/sockunix.h b/include/wx/unix/private/sockunix.h index e8af094516..1e9dc568f4 100644 --- a/include/wx/unix/private/sockunix.h +++ b/include/wx/unix/private/sockunix.h @@ -118,7 +118,7 @@ class wxSocketFDBasedManager : public wxSocketManager public: wxSocketFDBasedManager() { - m_fdioManager = NULL; + m_fdioManager = nullptr; } virtual bool OnInit() override; diff --git a/include/wx/unix/private/timer.h b/include/wx/unix/private/timer.h index 2873a3573d..4c5a7927d4 100644 --- a/include/wx/unix/private/timer.h +++ b/include/wx/unix/private/timer.h @@ -91,7 +91,7 @@ public: if ( ms_instance ) { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } } diff --git a/include/wx/unix/private/uilocale.h b/include/wx/unix/private/uilocale.h index a371a51792..10e6b3a90f 100644 --- a/include/wx/unix/private/uilocale.h +++ b/include/wx/unix/private/uilocale.h @@ -44,7 +44,7 @@ public: explicit TempLocaleSetter(int localeCategory, const wxString& localeId = wxString()) : m_localeCategory(localeCategory), - m_localeOrig(strdup(setlocale(localeCategory, NULL))) + m_localeOrig(strdup(setlocale(localeCategory, nullptr))) { setlocale(localeCategory, localeId.mb_str()); } diff --git a/include/wx/unix/sound.h b/include/wx/unix/sound.h index 8acabb0c08..d1c9cd4380 100644 --- a/include/wx/unix/sound.h +++ b/include/wx/unix/sound.h @@ -67,7 +67,7 @@ public: // Create from data bool Create(size_t size, const void* data); - bool IsOk() const { return m_data != NULL; } + bool IsOk() const { return m_data != nullptr; } // Stop playing any sound static void Stop(); diff --git a/include/wx/unix/stackwalk.h b/include/wx/unix/stackwalk.h index 879ec4fe86..256fae7634 100644 --- a/include/wx/unix/stackwalk.h +++ b/include/wx/unix/stackwalk.h @@ -25,7 +25,7 @@ public: // // NB: we don't copy syminfo pointer so it should have lifetime at least as // long as ours - wxStackFrame(size_t level = 0, void *address = NULL, const char *syminfo = NULL) + wxStackFrame(size_t level = 0, void *address = nullptr, const char *syminfo = nullptr) : wxStackFrameBase(level, address) { m_syminfo = syminfo; @@ -62,7 +62,7 @@ public: // addr2line, normally we can retrieve it from wxTheApp but if wxTheApp // doesn't exist or doesn't have the correct value, the path may be given // explicitly - wxStackWalker(const char *argv0 = NULL) + wxStackWalker(const char *argv0 = nullptr) { ms_exepath = wxString::FromAscii(argv0); } diff --git a/include/wx/unix/utilsx11.h b/include/wx/unix/utilsx11.h index 1ccbef5da0..c6b3ebaaaf 100644 --- a/include/wx/unix/utilsx11.h +++ b/include/wx/unix/utilsx11.h @@ -60,14 +60,14 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow, class wxX11Display { public: - wxX11Display() { m_dpy = XOpenDisplay(NULL); } + wxX11Display() { m_dpy = XOpenDisplay(nullptr); } ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); } // Pseudo move ctor: steals the open display from the other object. explicit wxX11Display(wxX11Display& display) { m_dpy = display.m_dpy; - display.m_dpy = NULL; + display.m_dpy = nullptr; } operator Display *() const { return m_dpy; } diff --git a/include/wx/utils.h b/include/wx/utils.h index 28f52c18c8..d6b26c28ee 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -124,9 +124,9 @@ WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo(); WXDLLIMPEXP_BASE wxString wxGetOsDescription(); // Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL, - int *verMin = NULL, - int *verMicro = NULL); +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = nullptr, + int *verMin = nullptr, + int *verMicro = nullptr); // 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); @@ -383,17 +383,17 @@ struct wxExecuteEnv // failure and the PID of the launched process if ok. WXDLLIMPEXP_BASE long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); + wxProcess *process = nullptr, + const wxExecuteEnv *env = nullptr); WXDLLIMPEXP_BASE long wxExecute(const char* const* argv, int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); + wxProcess *process = nullptr, + const wxExecuteEnv *env = nullptr); #if wxUSE_UNICODE WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv, int flags = wxEXEC_ASYNC, - wxProcess *process = NULL, - const wxExecuteEnv *env = NULL); + wxProcess *process = nullptr, + const wxExecuteEnv *env = nullptr); #endif // wxUSE_UNICODE // execute the command capturing its output into an array line by line, this is @@ -401,14 +401,14 @@ WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv, WXDLLIMPEXP_BASE long wxExecute(const wxString& command, wxArrayString& output, int flags = 0, - const wxExecuteEnv *env = NULL); + const wxExecuteEnv *env = nullptr); // also capture stderr (also synchronous) WXDLLIMPEXP_BASE long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& error, int flags = 0, - const wxExecuteEnv *env = NULL); + const wxExecuteEnv *env = nullptr); #if defined(__WINDOWS__) && wxUSE_IPC // ask a DDE server to execute the DDE request with given parameters @@ -469,10 +469,10 @@ WXDLLIMPEXP_BASE bool wxShutdown(int flags = wxSHUTDOWN_POWEROFF); // send the given signal to the process (only NONE and KILL are supported under // Windows, all others mean TERM), return 0 if ok and -1 on error // -// return detailed error in rc if not NULL +// return detailed error in rc is not null WXDLLIMPEXP_BASE int wxKill(long pid, wxSignal sig = wxSIGTERM, - wxKillError *rc = NULL, + wxKillError *rc = nullptr, int flags = wxKILL_NOCHILDREN); // Execute a command in an interactive shell window (always synchronously) @@ -509,7 +509,7 @@ WXDLLIMPEXP_BASE bool wxHandleFatalExceptions(bool doit = true); // Environment variables // ---------------------------------------------------------------------------- -// returns true if variable exists (value may be NULL if you just want to check +// returns true if variable exists (value may be null if you just want to check // for this) WXDLLIMPEXP_BASE bool wxGetEnv(const wxString& var, wxString *value); @@ -566,8 +566,8 @@ WXDLLIMPEXP_BASE wxString wxGetUserHome(const wxString& user = wxEmptyString); // get number of total/free bytes on the disk where path belongs WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path, - wxDiskspaceSize_t *pTotal = NULL, - wxDiskspaceSize_t *pFree = NULL); + wxDiskspaceSize_t *pTotal = nullptr, + wxDiskspaceSize_t *pFree = nullptr); @@ -653,21 +653,21 @@ WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt); // NB: this function is obsolete, use wxWindow::FindWindowByLabel() instead // // Find the window/widget with the given title or label. -// Pass a parent to begin the search from, or NULL to look through +// Pass a parent to begin the search from, or nullptr to look through // all windows. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = NULL); +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByLabel(const wxString& title, wxWindow *parent = nullptr); // NB: this function is obsolete, use wxWindow::FindWindowByName() instead // // Find window by name, and if that fails, by label. -WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = NULL); +WXDLLIMPEXP_CORE wxWindow* wxFindWindowByName(const wxString& name, wxWindow *parent = nullptr); // ---------------------------------------------------------------------------- // Message/event queue helpers // ---------------------------------------------------------------------------- // Yield to other apps/messages and disable user input -WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = NULL, bool onlyIfNeeded = false); +WXDLLIMPEXP_CORE bool wxSafeYield(wxWindow *win = nullptr, bool onlyIfNeeded = false); // Enable or disable input to all top level windows WXDLLIMPEXP_CORE void wxEnableTopLevelWindows(bool enable = true); @@ -689,7 +689,7 @@ public: explicit wxWindowDisabler(bool disable = true); // ctor disables all windows except the given one(s) - explicit wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2 = NULL); + explicit wxWindowDisabler(wxWindow *winToSkip, wxWindow *winToSkip2 = nullptr); // dtor enables back all windows disabled by the ctor ~wxWindowDisabler(); @@ -702,7 +702,7 @@ private: void AfterDisable(wxWindow* winToSkip); void BeforeEnable(); - wxEventLoop* m_modalEventLoop = NULL; + wxEventLoop* m_modalEventLoop = nullptr; #endif wxVector m_windowsToSkip; bool m_disabled; @@ -822,18 +822,18 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); size_t *outLen, const wxString& resourceName, const wxChar* resourceType = wxUserResourceStr, - WXHINSTANCE module = NULL); + WXHINSTANCE module = nullptr); // This function allocates a new buffer and makes a copy of the resource // data, remember to delete[] the buffer. And avoid using it entirely if // the overload above can be used. // - // Returns NULL on failure. + // Returns nullptr on failure. WXDLLIMPEXP_BASE char* wxLoadUserResource(const wxString& resourceName, const wxChar* resourceType = wxUserResourceStr, - int* pLen = NULL, - WXHINSTANCE module = NULL); + int* pLen = nullptr, + WXHINSTANCE module = nullptr); #endif // __WINDOWS__ #endif diff --git a/include/wx/valgen.h b/include/wx/valgen.h index d839eec788..4a3f60882c 100644 --- a/include/wx/valgen.h +++ b/include/wx/valgen.h @@ -53,7 +53,7 @@ public: virtual ~wxGenericValidator(){} - // Make a clone of this validator (or return NULL) - currently necessary + // Make a clone of this validator (or return nullptr) - currently necessary // 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). diff --git a/include/wx/validate.h b/include/wx/validate.h index c80d063f85..422da6050b 100644 --- a/include/wx/validate.h +++ b/include/wx/validate.h @@ -43,12 +43,12 @@ public: } virtual ~wxValidator(); - // Make a clone of this validator (or return NULL) - currently necessary + // Make a clone of this validator (or return nullptr) - currently necessary // 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 NULL; } + { return nullptr; } bool Copy(const wxValidator& val) { m_validatorWindow = val.m_validatorWindow; return true; } diff --git a/include/wx/valnum.h b/include/wx/valnum.h index b14f352ffd..577e44a27e 100644 --- a/include/wx/valnum.h +++ b/include/wx/valnum.h @@ -71,7 +71,7 @@ protected: } // Get the text entry of the associated control. Normally shouldn't ever - // return NULL (and will assert if it does return it) but the caller should + // return nullptr (and will assert if it does return it) but the caller should // still test the return value for safety. wxTextEntry *GetTextEntry() const; @@ -340,7 +340,7 @@ public: // // Sets the range appropriately for the type, including setting 0 as the // minimal value for the unsigned types. - wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT) + wxIntegerValidator(ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT) : Base(value, style) { this->SetMin(std::numeric_limits::min()); @@ -458,7 +458,7 @@ public: // Ctor using implicit (maximal) precision for this type. - wxFloatingPointValidator(ValueType *value = NULL, + wxFloatingPointValidator(ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT) : Base(value, style) { @@ -469,7 +469,7 @@ public: // Ctor specifying an explicit precision. wxFloatingPointValidator(int precision, - ValueType *value = NULL, + ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT) : Base(value, style) { diff --git a/include/wx/valtext.h b/include/wx/valtext.h index f895ceba54..edf643ec35 100644 --- a/include/wx/valtext.h +++ b/include/wx/valtext.h @@ -48,12 +48,12 @@ enum wxTextValidatorStyle class WXDLLIMPEXP_CORE wxTextValidator: public wxValidator { public: - wxTextValidator(long style = wxFILTER_NONE, wxString *val = NULL); + wxTextValidator(long style = wxFILTER_NONE, wxString *val = nullptr); wxTextValidator(const wxTextValidator& val); virtual ~wxTextValidator(){} - // Make a clone of this validator (or return NULL) - currently necessary + // Make a clone of this validator (or return nullptr) - currently necessary // 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). diff --git a/include/wx/variant.h b/include/wx/variant.h index a77f889345..f7b306f2b8 100644 --- a/include/wx/variant.h +++ b/include/wx/variant.h @@ -73,11 +73,11 @@ public: // What type is it? Return a string name. virtual wxString GetType() const = 0; // If it based on wxObject return the ClassInfo. - virtual wxClassInfo* GetValueClassInfo() { return NULL; } + virtual wxClassInfo* GetValueClassInfo() { return nullptr; } // Implement this to make wxVariant::UnShare work. Returns // a copy of the data. - virtual wxVariantData* Clone() const { return NULL; } + virtual wxVariantData* Clone() const { return nullptr; } #if wxUSE_ANY // Converts value to wxAny, if possible. Return true if successful. @@ -143,7 +143,7 @@ public: // ensure that the data is exclusive to this variant, and not shared bool Unshare(); - // Make NULL (i.e. delete the data) + // Make null (i.e. delete the data) void MakeNull(); // Delete data and name @@ -570,7 +570,7 @@ bool classname##VariantData::Eq(wxVariantData& data) const \ #define wxGetVariantCast(var,classname) \ ((classname*)(var.IsValueKindOf(&classname::ms_classInfo) ?\ - var.GetWxObjectPtr() : NULL)); + var.GetWxObjectPtr() : nullptr)); // Replacement for using wxDynamicCast on a wxVariantData object #ifndef wxNO_RTTI diff --git a/include/wx/variantbase.h b/include/wx/variantbase.h index 8335415ee8..6a482552b7 100644 --- a/include/wx/variantbase.h +++ b/include/wx/variantbase.h @@ -83,7 +83,7 @@ public: virtual const wxTypeInfo* GetTypeInfo() const = 0; // If it based on wxObject return the ClassInfo. - virtual wxClassInfo* GetValueClassInfo() { return NULL; } + virtual wxClassInfo* GetValueClassInfo() { return nullptr; } int GetRefCount() const { return m_count; } @@ -132,7 +132,7 @@ public: //virtual wxVariantData* Clone() const { return new wxVariantDataT( Get() ); } // returns the type info of the contentc - virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ); } + virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) nullptr ); } private: T m_data; @@ -188,7 +188,7 @@ public: // destroy a reference void UnRef(); - // Make NULL (i.e. delete the data) + // Make null (i.e. delete the data) void MakeNull(); // write contents to a string (e.g. for debugging) @@ -210,7 +210,7 @@ public: const wxTypeInfo* GetTypeInfo() const { if (!m_data) - return NULL; + return nullptr; return m_data->GetTypeInfo(); } @@ -238,14 +238,14 @@ public: { const wxVariantDataT *dataptr = wx_dynamic_cast(const wxVariantDataT*, m_data); - return dataptr != NULL; + return dataptr != nullptr; } // returns this value as string wxString GetAsString() const; // gets the stored data casted to a wxObject*, - // returning NULL if cast is not possible + // returning nullptr if cast is not possible wxObject* GetAsObject(); protected: diff --git a/include/wx/vlbox.h b/include/wx/vlbox.h index 48d4bc4d39..29a8fbb932 100644 --- a/include/wx/vlbox.h +++ b/include/wx/vlbox.h @@ -77,7 +77,7 @@ public: size_t GetItemCount() const { return GetRowCount(); } // does this control use multiple selection? - bool HasMultipleSelection() const { return m_selStore != NULL; } + bool HasMultipleSelection() const { return m_selStore != nullptr; } // get the currently selected item or wxNOT_FOUND if there is no selection // @@ -283,7 +283,7 @@ protected: private: // the current item or wxNOT_FOUND // - // if m_selStore == NULL this is also the selected item, otherwise the + // if m_selStore == nullptr this is also the selected item, otherwise the // selections are managed by m_selStore int m_current; @@ -294,7 +294,7 @@ private: // always wxNOT_FOUND for single selection listboxes int m_anchor; - // the object managing our selected items if not NULL + // the object managing our selected items if not nullptr wxSelectionStore *m_selStore; // margins diff --git a/include/wx/weakref.h b/include/wx/weakref.h index 5ad02e8a79..d8e16358c4 100644 --- a/include/wx/weakref.h +++ b/include/wx/weakref.h @@ -31,11 +31,11 @@ public: typedef T element_type; // Default ctor - wxWeakRef() : m_pobj(NULL), m_ptbase(NULL) { } + wxWeakRef() : m_pobj(nullptr), m_ptbase(nullptr) { } // 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) : m_pobj(NULL), m_ptbase(NULL) + wxWeakRef(T *pobj) : m_pobj(nullptr), m_ptbase(nullptr) { this->Assign(pobj); } @@ -43,14 +43,14 @@ public: // When we have the full type here, static_cast<> will always work // (or give a straight compiler error). template - wxWeakRef(TDerived* pobj) : m_pobj(NULL), m_ptbase(NULL) + wxWeakRef(TDerived* pobj) : m_pobj(nullptr), m_ptbase(nullptr) { 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) : m_pobj(NULL), m_ptbase(NULL) + wxWeakRef(const wxWeakRef& wr) : m_pobj(nullptr), m_ptbase(nullptr) { this->Assign(wr.get()); } @@ -78,17 +78,17 @@ public: { // Remove ourselves from object tracker list m_ptbase->RemoveNode(this); - m_pobj = NULL; - m_ptbase = NULL; + m_pobj = nullptr; + m_ptbase = nullptr; } } virtual void OnObjectDestroy() override { // Tracked object itself removes us from list of trackers - wxASSERT(m_pobj != NULL); - m_pobj = NULL; - m_ptbase = NULL; + wxASSERT(m_pobj != nullptr); + m_pobj = nullptr; + m_ptbase = nullptr; } protected: @@ -137,7 +137,7 @@ template class wxWeakRefDynamic : public wxTrackerNode { public: - wxWeakRefDynamic() : m_pobj(NULL) { } + wxWeakRefDynamic() : m_pobj(nullptr) { } wxWeakRefDynamic(T* pobj) : m_pobj(pobj) { @@ -171,7 +171,7 @@ public: // Remove ourselves from object tracker list wxTrackable *pt = dynamic_cast(m_pobj); pt->RemoveNode(this); - m_pobj = NULL; + m_pobj = nullptr; } } @@ -179,7 +179,7 @@ public: { wxASSERT_MSG(m_pobj, "tracked object should have removed us itself"); - m_pobj = NULL; + m_pobj = nullptr; } protected: @@ -203,7 +203,7 @@ protected: else { // If the object we want to track does not support wxTackable, then - // log a message and keep the NULL object pointer. + // log a message and keep the null object pointer. wxFAIL_MSG( "Tracked class should inherit from wxTrackable" ); } } diff --git a/include/wx/webrequest.h b/include/wx/webrequest.h index 762c690d23..403a244f36 100644 --- a/include/wx/webrequest.h +++ b/include/wx/webrequest.h @@ -72,7 +72,7 @@ public: wxWebAuthChallenge& operator=(const wxWebAuthChallenge& other); ~wxWebAuthChallenge(); - bool IsOk() const { return m_impl.get() != NULL; } + bool IsOk() const { return m_impl.get() != nullptr; } Source GetSource() const; @@ -94,7 +94,7 @@ public: wxWebResponse& operator=(const wxWebResponse& other); ~wxWebResponse(); - bool IsOk() const { return m_impl.get() != NULL; } + bool IsOk() const { return m_impl.get() != nullptr; } wxFileOffset GetContentLength() const; @@ -150,7 +150,7 @@ public: wxWebRequest& operator=(const wxWebRequest& other); ~wxWebRequest(); - bool IsOk() const { return m_impl.get() != NULL; } + bool IsOk() const { return m_impl.get() != nullptr; } void SetHeader(const wxString& name, const wxString& value); diff --git a/include/wx/webview.h b/include/wx/webview.h index 9e0db1661e..b79e0c8e2f 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -227,8 +227,8 @@ public: virtual wxString GetUserAgent() const; // Script - virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const; - virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const; + virtual bool RunScript(const wxString& javascript, wxString* output = nullptr) const; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = nullptr) const; virtual bool AddScriptMessageHandler(const wxString& name) { wxUnusedVar(name); return false; } virtual bool RemoveScriptMessageHandler(const wxString& name) @@ -295,7 +295,7 @@ public: //Get the pointer to the underlying native engine. virtual void* GetNativeBackend() const = 0; - virtual void* GetNativeConfiguration() const { return NULL; } + virtual void* GetNativeConfiguration() const { return nullptr; } //Find function virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT); diff --git a/include/wx/window.h b/include/wx/window.h index 949051ba10..92072f9b52 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -298,7 +298,7 @@ public: void SetClientSize(const wxRect& rect) { SetClientSize( rect.width, rect.height ); } - // get the window position (pointers may be NULL): notice that it is in + // get the window position (pointers may be null): notice that it is in // client coordinates for child windows and screen coordinates for the // top level ones, use GetScreenPosition() if you need screen // coordinates for all kinds of windows @@ -321,7 +321,7 @@ public: return wxPoint(x, y); } - // get the window size (pointers may be NULL) + // get the window size (pointers may be null) void GetSize( int *w, int *h ) const { DoGetSize(w, h); } wxSize GetSize() const { @@ -576,7 +576,7 @@ public: class ChildrenRepositioningGuard { public: - // Notice that window can be NULL here, for convenience. In this case + // Notice that window can be null here, for convenience. In this case // this class simply doesn't do anything. explicit ChildrenRepositioningGuard(wxWindowBase* win) : m_win(win), @@ -688,7 +688,7 @@ public: // set focus to this window as the result of a keyboard action virtual void SetFocusFromKbd() { SetFocus(); } - // return the window which currently has the focus or NULL + // return the window which currently has the focus or nullptr static wxWindow *FindFocus(); static wxWindow *DoFindFocus() /* = 0: implement in derived classes */; @@ -785,7 +785,7 @@ public: const wxWindowList& GetWindowChildren() const { return GetChildren() ; } // get the window before/after this one in the parents children list, - // returns NULL if this is the first/last window + // returns nullptr if this is the first/last window wxWindow *GetPrevSibling() const { return DoGetSibling(OrderBefore); } wxWindow *GetNextSibling() const { return DoGetSibling(OrderAfter); } @@ -819,16 +819,16 @@ public: // ------------------- // find window among the descendants of this one either by id or by - // name (return NULL if not found) + // name (return nullptr if not found) wxWindow *FindWindow(long winid) const; wxWindow *FindWindow(const wxString& name) const; - // Find a window among any window (all return NULL if not found) - static wxWindow *FindWindowById( long winid, const wxWindow *parent = NULL ); + // Find a window among any window (all return nullptr if not found) + static wxWindow *FindWindowById( long winid, const wxWindow *parent = nullptr ); static wxWindow *FindWindowByName( const wxString& name, - const wxWindow *parent = NULL ); + const wxWindow *parent = nullptr ); static wxWindow *FindWindowByLabel( const wxString& label, - const wxWindow *parent = NULL ); + const wxWindow *parent = nullptr ); // event handler stuff // ------------------- @@ -1095,7 +1095,7 @@ public: void CaptureMouse(); void ReleaseMouse(); - // get the window which currently captures the mouse or NULL + // get the window which currently captures the mouse or nullptr static wxWindow *GetCapture(); // does this window have the capture? @@ -1115,7 +1115,7 @@ public: // mark the specified rectangle (or the whole window) as "dirty" so it // will be repainted virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ) = 0; + const wxRect *rect = nullptr ) = 0; // a less awkward wrapper for Refresh void RefreshRect(const wxRect& rect, bool eraseBackground = true) @@ -1239,10 +1239,10 @@ public: // Returns true if background transparency is supported for this // window, i.e. if calling SetBackgroundStyle(wxBG_STYLE_TRANSPARENT) - // has a chance of succeeding. If reason argument is non-NULL, returns a + // has a chance of succeeding. If reason argument is non-null, returns a // user-readable explanation of why it isn't supported if the return // value is false. - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; + virtual bool IsTransparentBackgroundSupported(wxString* reason = nullptr) const; // set/retrieve the font for the window (SetFont() returns true if the // font really changed) @@ -1262,7 +1262,7 @@ public: #if wxUSE_CARET // associate a caret with the window void SetCaret(wxCaret *caret); - // get the current caret (may be NULL) + // get the current caret (may be null) wxCaret *GetCaret() const { return m_caret; } #endif // wxUSE_CARET @@ -1274,9 +1274,9 @@ public: // font void GetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) const { DoGetTextExtent(string, x, y, descent, externalLeading, font); } @@ -1291,7 +1291,7 @@ public: // client <-> screen coords // ------------------------ - // translate to/from screen/client coordinates (pointers may be NULL) + // translate to/from screen/client coordinates (pointers may be null) void ClientToScreen( int *x, int *y ) const { DoClientToScreen(x, y); } void ScreenToClient( int *x, int *y ) const @@ -1380,7 +1380,7 @@ public: // scroll window to the specified position virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ) = 0; + const wxRect* rect = nullptr ) = 0; // scrolls window by line/page: note that not all controls support this // @@ -1441,21 +1441,21 @@ public: #if wxUSE_TOOLTIPS // the easiest way to set a tooltip for a window is to use this method void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); } - // attach a tooltip to the window, pointer can be NULL to remove + // attach a tooltip to the window, pointer can be null to remove // existing tooltip void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } - // more readable synonym for SetToolTip(NULL) - void UnsetToolTip() { SetToolTip(NULL); } - // get the associated tooltip or NULL if none + // more readable synonym for SetToolTip(nullptr) + void UnsetToolTip() { SetToolTip(nullptr); } + // get the associated tooltip or nullptr if none wxToolTip* GetToolTip() const { return m_tooltip; } wxString GetToolTipText() const; - // Use the same tool tip as the given one (which can be NULL to indicate + // Use the same tool tip as the given one (which can be null to indicate // that no tooltip should be used) for this window. This is currently only // used by wxCompositeWindow::DoSetToolTip() implementation and is not part // of the public wx API. // - // Returns true if tip was valid and we copied it or false if it was NULL + // Returns true if tip was valid and we copied it or false if it was nullptr // and we reset our own tooltip too. bool CopyToolTip(wxToolTip *tip); #else // !wxUSE_TOOLTIPS @@ -1469,7 +1469,7 @@ public: // ------------- #if wxUSE_DRAG_AND_DROP // set/retrieve the drop target associated with this window (may be - // NULL; it's owned by the window and will be deleted by it) + // null; it's owned by the window and will be deleted by it) virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0; virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; } @@ -1487,7 +1487,7 @@ public: // constraints and sizers // ---------------------- #if wxUSE_CONSTRAINTS - // set the constraints for this window or retrieve them (may be NULL) + // set the constraints for this window or retrieve them (may be null) void SetConstraints( wxLayoutConstraints *constraints ); wxLayoutConstraints *GetConstraints() const { return m_constraints; } @@ -1538,7 +1538,7 @@ public: // ---------------------- #if wxUSE_ACCESSIBILITY // Override to create a specific accessible object. - virtual wxAccessible* CreateAccessible() { return NULL; } + virtual wxAccessible* CreateAccessible() { return nullptr; } // Sets the accessible object. void SetAccessible(wxAccessible* accessible) ; @@ -1547,7 +1547,7 @@ public: wxAccessible* GetAccessible() { return m_accessible; } // Returns the accessible object, calling CreateAccessible if necessary. - // May return NULL, in which case system-provide accessible is used. + // May return nullptr, in which case system-provide accessible is used. wxAccessible* GetOrCreateAccessible() ; #endif @@ -1591,7 +1591,7 @@ public: // The optional sizer argument can be passed to use the given sizer for // laying out the window, which is useful if this function is called before // SetSizer(). By default the window sizer is used. - virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = NULL); + virtual void WXSetInitialFittingClientSize(int flags, wxSizer* sizer = nullptr); // get the handle of the window for the underlying window system: this // is only used for wxWin itself or for user code which wants to call @@ -1614,7 +1614,7 @@ public: // return true if we have a specific palette bool HasCustomPalette() const { return m_hasCustomPalette; } - // return the first parent window with a custom palette or NULL + // return the first parent window with a custom palette or nullptr wxWindow *GetAncestorWithCustomPalette() const; #endif // wxUSE_PALETTE @@ -1663,7 +1663,7 @@ public: } // This is an internal helper function implemented by text-like controls. - virtual const wxTextEntry* WXGetTextEntry() const { return NULL; } + virtual const wxTextEntry* WXGetTextEntry() const { return nullptr; } protected: // helper for the derived class Create() methods: the first overload, with @@ -1723,7 +1723,7 @@ protected: // its siblings unless it is wxID_ANY wxWindowIDRef m_windowId; - // the parent window of this window (or NULL) and the list of the children + // the parent window of this window (or nullptr) and the list of the children // of this window wxWindow *m_parent; wxWindowList m_children; @@ -1740,7 +1740,7 @@ protected: wxEvtHandler *m_eventHandler; #if wxUSE_VALIDATORS - // associated validator or NULL if none + // associated validator or nullptr if none wxValidator *m_windowValidator; #endif // wxUSE_VALIDATORS @@ -1767,14 +1767,14 @@ protected: wxAcceleratorTable m_acceleratorTable; #endif // wxUSE_ACCEL - // the tooltip for this window (may be NULL) + // the tooltip for this window (may be null) #if wxUSE_TOOLTIPS wxToolTip *m_tooltip; #endif // wxUSE_TOOLTIPS // constraints and sizers #if wxUSE_CONSTRAINTS - // the constraints for this window or NULL + // the constraints for this window or nullptr wxLayoutConstraints *m_constraints; // constraints this window is involved in @@ -1864,9 +1864,9 @@ protected: // text extent virtual void DoGetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *font = NULL) const = 0; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) const = 0; // coordinates translation virtual void DoClientToScreen( int *x, int *y ) const = 0; @@ -2054,7 +2054,7 @@ private: inline wxWindow *wxWindowBase::GetGrandParent() const { - return m_parent ? m_parent->GetParent() : NULL; + return m_parent ? m_parent->GetParent() : nullptr; } // ---------------------------------------------------------------------------- @@ -2068,7 +2068,7 @@ extern WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPointer(wxPoint& pt); // Get the current mouse position. extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition(); -// get the currently active window of this application or NULL +// get the currently active window of this application or nullptr extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); // get the (first) top level parent window @@ -2108,12 +2108,12 @@ public: virtual wxAccStatus GetChildCount(int* childCount) override; // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, + // If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. virtual wxAccStatus GetChild(int childId, wxAccessible** child) override; - // Gets the parent, or NULL. + // Gets the parent, or nullptr. virtual wxAccStatus GetParent(wxAccessible** parent) override; // Performs the default action. childId is 0 (the action for this object) @@ -2154,7 +2154,7 @@ public: virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) override; // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in + // If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) override; diff --git a/include/wx/windowptr.h b/include/wx/windowptr.h index b4ac928068..9d136b77fa 100644 --- a/include/wx/windowptr.h +++ b/include/wx/windowptr.h @@ -54,7 +54,7 @@ public: return operator=(wxWindowPtr(win)); } - void reset(T* ptr = NULL) + void reset(T* ptr = nullptr) { wxSharedPtr::reset(ptr, wxPrivate::wxWindowDeleter()); } diff --git a/include/wx/withimages.h b/include/wx/withimages.h index 3a1cf4f7b5..ec3677d29d 100644 --- a/include/wx/withimages.h +++ b/include/wx/withimages.h @@ -34,7 +34,7 @@ public: wxWithImages() { - m_imageList = NULL; + m_imageList = nullptr; m_ownsImageList = false; } @@ -106,7 +106,7 @@ public: // Avoid using it if possible. void TakeOwnership() { m_ownsImageList = true; } - // Get pointer (may be NULL) to the associated image list. + // Get pointer (may be null) to the associated image list. wxImageList* GetImageList() const { return m_imageList; } // This helper function can be used from OnImagesChanged() if the derived @@ -150,7 +150,7 @@ protected: // Return true if we have a valid image list. - bool HasImageList() const { return m_imageList != NULL; } + bool HasImageList() const { return m_imageList != nullptr; } // Return the image with the given index from the image list. // @@ -210,7 +210,7 @@ private: if ( m_ownsImageList ) { delete m_imageList; - m_imageList = NULL; + m_imageList = nullptr; // We don't own it any more. m_ownsImageList = false; @@ -221,7 +221,7 @@ private: // The images we use: if this vector is not empty, m_imageList is not used. Images m_images; - // The associated image list or NULL. + // The associated image list or nullptr. wxImageList* m_imageList; // False by default, if true then we delete m_imageList. diff --git a/include/wx/wizard.h b/include/wx/wizard.h index 52bac54e34..fb7a7f4845 100644 --- a/include/wx/wizard.h +++ b/include/wx/wizard.h @@ -46,7 +46,7 @@ class WXDLLIMPEXP_FWD_CORE wxWizard; // ---------------------------------------------------------------------------- // wxWizardPage is one of the wizards screen: it must know what are the -// following and preceding pages (which may be NULL for the first/last page). +// following and preceding pages (which may be null for the first/last page). // // Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be // used as such (i.e. controls may be placed directly on it &c). @@ -125,16 +125,16 @@ public: // ctor takes the previous and next pages wxWizardPageSimple(wxWizard *parent, - wxWizardPage *prev = NULL, - wxWizardPage *next = NULL, + wxWizardPage *prev = nullptr, + wxWizardPage *next = nullptr, const wxBitmapBundle& bitmap = wxBitmapBundle()) { Create(parent, prev, next, bitmap); } - bool Create(wxWizard *parent = NULL, // let it be default ctor too - wxWizardPage *prev = NULL, - wxWizardPage *next = NULL, + bool Create(wxWizard *parent = nullptr, // let it be default ctor too + wxWizardPage *prev = nullptr, + wxWizardPage *next = nullptr, const wxBitmapBundle& bitmap = wxBitmapBundle()) { m_prev = prev; @@ -158,7 +158,7 @@ public: static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second) { wxCHECK_RET( first && second, - wxT("NULL passed to wxWizardPageSimple::Chain") ); + wxT("null page passed to wxWizardPageSimple::Chain") ); first->SetNext(second); second->SetPrev(first); @@ -172,7 +172,7 @@ private: // common part of ctors: void Init() { - m_prev = m_next = NULL; + m_prev = m_next = nullptr; } // pointers are private, the derived classes shouldn't mess with them - @@ -207,7 +207,7 @@ public: // successfully finished, false if user cancelled it virtual bool RunWizard(wxWizardPage *firstPage) = 0; - // get the current page (NULL if RunWizard() isn't running) + // get the current page (nullptr if RunWizard() isn't running) virtual wxWizardPage *GetCurrentPage() const = 0; // set the min size which should be available for the pages: a @@ -238,10 +238,10 @@ public: // custom logic for determining the pages order virtual bool HasNextPage(wxWizardPage *page) - { return page->GetNext() != NULL; } + { return page->GetNext() != nullptr; } virtual bool HasPrevPage(wxWizardPage *page) - { return page->GetPrev() != NULL; } + { return page->GetPrev() != nullptr; } /// Override these functions to stop InitDialog from calling TransferDataToWindow /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call @@ -269,7 +269,7 @@ public: wxWizardEvent(wxEventType type = wxEVT_NULL, int id = wxID_ANY, bool direction = true, - wxWizardPage* page = NULL); + wxWizardPage* page = nullptr); // for EVT_WIZARD_PAGE_CHANGING, return true if we're going forward or // false otherwise and for EVT_WIZARD_PAGE_CHANGED return true if we came diff --git a/include/wx/wupdlock.h b/include/wx/wupdlock.h index 35003018c7..af22114424 100644 --- a/include/wx/wupdlock.h +++ b/include/wx/wupdlock.h @@ -21,7 +21,7 @@ class wxWindowUpdateLocker public: // Prefer using the ctor below if possible, this ctor is only useful if // Lock() must be called only conditionally. - wxWindowUpdateLocker() : m_win(NULL) { } + wxWindowUpdateLocker() : m_win(nullptr) { } // create an object preventing updates of the given window (which must have // a lifetime at least as great as ours) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index 553ed9cadc..8d9bfd93e1 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -26,7 +26,7 @@ // misc functions // ============================================================================ -/* checks whether the passed in pointer is NULL and if the string is empty */ +/* checks whether the passed in pointer is null and if the string is empty */ inline bool wxIsEmpty(const char *s) { return !s || !*s; } inline bool wxIsEmpty(const wchar_t *s) { return !s || !*s; } inline bool wxIsEmpty(const wxScopedCharBuffer& s) { return wxIsEmpty(s.data()); } @@ -72,7 +72,7 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); if(l) return const_cast(s); - return NULL; + return nullptr; } inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len) @@ -160,7 +160,7 @@ inline char* wxSetlocale(int category, const wxCStrData& locale) // string functions // ---------------------------------------------------------------------------- -/* safe version of strlen() (returns 0 if passed NULL pointer) */ +/* safe version of strlen() (returns 0 if passed null pointer) */ // NB: these are defined in wxcrtbase.h, see the comment there // inline size_t wxStrlen(const char *s) { return s ? strlen(s) : 0; } // inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_Strlen_(s) : 0; } @@ -691,19 +691,19 @@ inline const char *wxStrrchr(const char *s, char c) inline const wchar_t *wxStrrchr(const wchar_t *s, wchar_t c) { return wxCRT_StrrchrW(s, c); } inline const char *wxStrchr(const char *s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniChar& c) { return wxCRT_StrchrW(s, (wchar_t)c); } inline const char *wxStrrchr(const char *s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniChar& c) { return wxCRT_StrrchrW(s, (wchar_t)c); } inline const char *wxStrchr(const char *s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } inline const wchar_t *wxStrchr(const wchar_t *s, const wxUniCharRef& c) { return wxCRT_StrchrW(s, (wchar_t)c); } inline const char *wxStrrchr(const char *s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } inline const wchar_t *wxStrrchr(const wchar_t *s, const wxUniCharRef& c) { return wxCRT_StrrchrW(s, (wchar_t)c); } template @@ -736,13 +736,13 @@ inline const char* wxStrchr(const wxString& s, int c) inline const char* wxStrrchr(const wxString& s, int c) { return wxCRT_StrrchrA((const char*)s.c_str(), c); } inline const char* wxStrchr(const wxString& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : nullptr; } inline const char* wxStrrchr(const wxString& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : nullptr; } inline const char* wxStrchr(const wxString& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s.c_str(), c) : nullptr; } inline const char* wxStrrchr(const wxString& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s.c_str(), c) : nullptr; } #endif // wxNO_IMPLICIT_WXSTRING_ENCODING inline const wchar_t* wxStrchr(const wxString& s, wchar_t c) { return wxCRT_StrchrW((const wchar_t*)s.c_str(), c); } @@ -758,13 +758,13 @@ inline const char* wxStrchr(const wxCStrData& s, int c) inline const char* wxStrrchr(const wxCStrData& s, int c) { return wxCRT_StrrchrA(s.AsChar(), c); } inline const char* wxStrchr(const wxCStrData& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } inline const char* wxStrrchr(const wxCStrData& s, const wxUniChar& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } inline const char* wxStrchr(const wxCStrData& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrchrA(s, c) : nullptr; } inline const char* wxStrrchr(const wxCStrData& s, const wxUniCharRef& uc) - { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : NULL; } + { char c; return uc.GetAsChar(&c) ? wxCRT_StrrchrA(s, c) : nullptr; } #endif // wxNO_IMPLICIT_WXSTRING_ENCODING inline const wchar_t* wxStrchr(const wxCStrData& s, wchar_t c) { return wxCRT_StrchrW(s.AsWChar(), c); } @@ -943,8 +943,8 @@ template<> struct wxStrtoxCharType typedef const char* Type; /* this one is never used */ static char** AsPointer(int WXUNUSED_UNLESS_DEBUG(p)) { - wxASSERT_MSG( p == 0, "passing non-NULL int is invalid" ); - return NULL; + wxASSERT_MSG( p == 0, "passing non-null int is invalid" ); + return nullptr; } }; @@ -956,7 +956,7 @@ inline double wxStrtod(const wxString& nptr, T endptr) // when we don't care about endptr, use the string representation that // doesn't require any conversion (it doesn't matter for this function // even if its UTF-8): - wxStringCharType** p = NULL; + wxStringCharType** p = nullptr; return wxStrtod(nptr.wx_str(), p); } // note that it is important to use c_str() here and not mb_str() or @@ -973,16 +973,16 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr) #ifdef wxHAS_NULLPTR_T inline double wxStrtod(const wxString& nptr, std::nullptr_t) - { return wxStrtod(nptr.wx_str(), static_cast(NULL)); } + { return wxStrtod(nptr.wx_str(), static_cast(nullptr)); } inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) - { return wxStrtod(nptr.AsString(), static_cast(NULL)); } + { return wxStrtod(nptr.AsString(), static_cast(nullptr)); } #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ inline rettype name(const wxString& nptr, std::nullptr_t, int base) \ - { return name(nptr.wx_str(), static_cast(NULL), \ + { return name(nptr.wx_str(), static_cast(nullptr), \ base); } \ inline rettype name(const wxCStrData& nptr, std::nullptr_t, int base) \ - { return name(nptr.AsString(), static_cast(NULL), \ + { return name(nptr.AsString(), static_cast(nullptr), \ base); } #else // !wxHAS_NULLPTR_T @@ -1004,7 +1004,7 @@ inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) { \ if (!endptr) \ { \ - wxStringCharType** p = NULL; \ + wxStringCharType** p = nullptr; \ return name(nptr.wx_str(), p, base); \ } \ typedef typename wxStrtoxCharType::Type CharType; \ diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index 11c3569bcc..71b3f6299a 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -512,9 +512,9 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); /* _wtof doesn't exist */ #else #ifndef __VMS - #define wxCRT_AtofW(s) wcstod(s, NULL) + #define wxCRT_AtofW(s) wcstod(s, nullptr) #endif - #define wxCRT_AtolW(s) wcstol(s, NULL, 10) + #define wxCRT_AtolW(s) wcstol(s, nullptr, 10) /* wcstoi doesn't exist */ #endif @@ -630,7 +630,7 @@ WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, * for buffer.h and stringimpl.h (both of which must be included before * string.h, which is required by wxcrt.h) to have them here: */ -/* safe version of strlen() (returns 0 if passed NULL pointer) */ +/* safe version of strlen() (returns 0 if passed null pointer) */ inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; } inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; } #ifndef wxWCHAR_T_IS_WXCHAR16 diff --git a/include/wx/x11/app.h b/include/wx/x11/app.h index 5902ddd8bd..c674fae3eb 100644 --- a/include/wx/x11/app.h +++ b/include/wx/x11/app.h @@ -84,7 +84,7 @@ public: // with multiple display return m_visualInfo; } - virtual void* GetXVisualInfo() { return NULL; } + virtual void* GetXVisualInfo() { return nullptr; } public: static long sm_lastMessageTime; diff --git a/include/wx/x11/bitmap.h b/include/wx/x11/bitmap.h index c7cf0616ff..7aed4c21d1 100644 --- a/include/wx/x11/bitmap.h +++ b/include/wx/x11/bitmap.h @@ -94,7 +94,7 @@ public: wxBitmap GetSubBitmap( const wxRect& rect ) const; - bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const; + bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = nullptr ) const; bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); wxPalette *GetPalette() const; diff --git a/include/wx/x11/dataobj2.h b/include/wx/x11/dataobj2.h index aef39218d8..ef59426521 100644 --- a/include/wx/x11/dataobj2.h +++ b/include/wx/x11/dataobj2.h @@ -48,7 +48,7 @@ public: } protected: - void Init() { m_pngData = NULL; m_pngSize = 0; } + void Init() { m_pngData = nullptr; m_pngSize = 0; } void Clear() { free(m_pngData); } void ClearAll() { Clear(); Init(); } diff --git a/include/wx/x11/dcclient.h b/include/wx/x11/dcclient.h index d4febe9d69..ee0fc16be5 100644 --- a/include/wx/x11/dcclient.h +++ b/include/wx/x11/dcclient.h @@ -116,9 +116,9 @@ protected: // -------------- virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; + wxCoord *descent = nullptr, + wxCoord *externalLeading = nullptr, + const wxFont *theFont = nullptr) const; void Init(); diff --git a/include/wx/x11/font.h b/include/wx/x11/font.h index 478399a0bb..04190445b5 100644 --- a/include/wx/x11/font.h +++ b/include/wx/x11/font.h @@ -138,11 +138,11 @@ public: // Return font struct, and optionally the font list wxXFont *GetInternalFont(double scale = 1.0, - WXDisplay* display = NULL) const; + WXDisplay* display = nullptr) const; // Helper function for convenient access of the above. WXFontStructPtr GetFontStruct(double scale = 1.0, - WXDisplay* display = NULL) const; + WXDisplay* display = nullptr) const; #endif protected: diff --git a/include/wx/x11/glcanvas.h b/include/wx/x11/glcanvas.h index ec8b969547..baf89b67ed 100644 --- a/include/wx/x11/glcanvas.h +++ b/include/wx/x11/glcanvas.h @@ -29,7 +29,7 @@ public: explicit // avoid implicitly converting a wxWindow* to wxGLCanvas wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -51,7 +51,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxGLCanvasName, - const int *attribList = NULL, + const int *attribList = nullptr, const wxPalette& palette = wxNullPalette); // implement wxGLCanvasX11 methods diff --git a/include/wx/x11/palette.h b/include/wx/x11/palette.h index bc7840103b..f30e6c86fe 100644 --- a/include/wx/x11/palette.h +++ b/include/wx/x11/palette.h @@ -60,7 +60,7 @@ public: bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; // X-specific - WXColormap GetXColormap(WXDisplay* display = NULL) const; + WXColormap GetXColormap(WXDisplay* display = nullptr) 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); diff --git a/include/wx/x11/print.h b/include/wx/x11/print.h index 82970f765f..c177150263 100644 --- a/include/wx/x11/print.h +++ b/include/wx/x11/print.h @@ -22,7 +22,7 @@ class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase wxDECLARE_DYNAMIC_CLASS(wxPrinter); public: - wxPrinter(wxPrintData *data = NULL); + wxPrinter(wxPrintData *data = nullptr); virtual ~wxPrinter(); virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE); @@ -40,7 +40,7 @@ class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase wxDECLARE_CLASS(wxPrintPreview); public: - wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL); + wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = nullptr, wxPrintData *data = nullptr); virtual ~wxPrintPreview(); virtual bool Print(bool interactive); diff --git a/include/wx/x11/window.h b/include/wx/x11/window.h index 3be3669592..e311336c96 100644 --- a/include/wx/x11/window.h +++ b/include/wx/x11/window.h @@ -60,7 +60,7 @@ public: virtual void WarpPointer(int x, int y); virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); + const wxRect *rect = nullptr ); virtual void Update(); virtual bool SetBackgroundColour( const wxColour &colour ); @@ -72,7 +72,7 @@ public: virtual int GetCharHeight() const; virtual int GetCharWidth() const; - virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL ); + virtual void ScrollWindow( int dx, int dy, const wxRect* rect = nullptr ); #if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ); @@ -160,9 +160,9 @@ protected: // 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; + int *descent = nullptr, + int *externalLeading = nullptr, + const wxFont *font = nullptr) 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; diff --git a/include/wx/xlocale.h b/include/wx/xlocale.h index 317f4b9ccf..48c4516e09 100644 --- a/include/wx/xlocale.h +++ b/include/wx/xlocale.h @@ -78,7 +78,7 @@ class WXDLLIMPEXP_BASE wxXLocale { public: // Construct an uninitialized locale - wxXLocale() { m_locale = NULL; } + wxXLocale() { m_locale = nullptr; } #if wxUSE_INTL // Construct from a symbolic language constant @@ -97,7 +97,7 @@ public: // Check if the object represents a valid locale (notice that without // wxHAS_XLOCALE_SUPPORT the only valid locale is the "C" one) - bool IsOk() const { return m_locale != NULL; } + bool IsOk() const { return m_locale != nullptr; } // Get the type wxXLocale_t Get() const { return m_locale; } @@ -113,11 +113,11 @@ private: // Create from the given language string (called from ctors) void Init(const char *loc); - // Free the locale if it's non-NULL + // Free the locale if it's non-null void Free(); - // The corresponding locale handle, NULL if invalid + // The corresponding locale handle, nullptr if invalid wxXLocale_t m_locale; diff --git a/include/wx/xml/xml.h b/include/wx/xml/xml.h index cb0b1d1a79..04a906fa2e 100644 --- a/include/wx/xml/xml.h +++ b/include/wx/xml/xml.h @@ -63,9 +63,9 @@ enum wxXmlNodeType class WXDLLIMPEXP_XML wxXmlAttribute { public: - wxXmlAttribute() : m_next(NULL) {} + wxXmlAttribute() : m_next(nullptr) {} wxXmlAttribute(const wxString& name, const wxString& value, - wxXmlAttribute *next = NULL) + wxXmlAttribute *next = nullptr) : m_name(name), m_value(value), m_next(next) {} virtual ~wxXmlAttribute() {} @@ -96,20 +96,20 @@ class WXDLLIMPEXP_XML wxXmlNode { public: wxXmlNode() - : m_attrs(NULL), m_parent(NULL), m_children(NULL), m_next(NULL), + : m_attrs(nullptr), m_parent(nullptr), m_children(nullptr), m_next(nullptr), m_lineNo(-1), m_noConversion(false) { } wxXmlNode(wxXmlNode *parent, wxXmlNodeType type, const wxString& name, const wxString& content = wxEmptyString, - wxXmlAttribute *attrs = NULL, wxXmlNode *next = NULL, + wxXmlAttribute *attrs = nullptr, wxXmlNode *next = nullptr, int lineNo = -1); virtual ~wxXmlNode(); // copy ctor & operator=. Note that this does NOT copy siblings - // and parent pointer, i.e. m_parent and m_next will be NULL + // and parent pointer, i.e. m_parent and m_next will be null // after using copy ctor and are never unmodified by operator=. // On the other hand, it DOES copy children and attributes. wxXmlNode(const wxXmlNode& node); @@ -132,7 +132,7 @@ public: const wxString& GetContent() const { return m_content; } bool IsWhitespaceOnly() const; - int GetDepth(wxXmlNode *grandparent = NULL) const; + int GetDepth(wxXmlNode *grandparent = nullptr) const; // Gets node content from wxXML_ENTITY_NODE // The problem is, content is represented as @@ -250,7 +250,7 @@ public: virtual bool Save(const wxString& filename, int indentstep = 2) const; virtual bool Save(wxOutputStream& stream, int indentstep = 2) const; - bool IsOk() const { return GetRoot() != NULL; } + bool IsOk() const { return GetRoot() != nullptr; } // Returns root node of the document. wxXmlNode *GetRoot() const; @@ -270,7 +270,7 @@ public: wxString GetEOL() const { return m_eol; } // Write-access methods: - wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=NULL; return old; } + wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=nullptr; return old; } void SetDocumentNode(wxXmlNode *node) { wxDELETE(m_docNode); m_docNode = node; } wxXmlNode *DetachRoot(); void SetRoot(wxXmlNode *node); diff --git a/include/wx/xrc/xh_bmpbt.h b/include/wx/xrc/xh_bmpbt.h index 3db8bff71f..60efc48625 100644 --- a/include/wx/xrc/xh_bmpbt.h +++ b/include/wx/xrc/xh_bmpbt.h @@ -31,7 +31,7 @@ private: void SetBitmapIfSpecified(wxBitmapButton* button, BitmapSetter setter, const char* paramName, - const char* paramNameAlt = NULL); + const char* paramNameAlt = nullptr); }; #endif // wxUSE_XRC && wxUSE_BMPBUTTON diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 35f5a6194b..39e9b16eea 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -164,14 +164,14 @@ public: // definition. static void AddSubclassFactory(wxXmlSubclassFactory *factory); - // Loads menu from resource. Returns NULL on failure. + // Loads menu from resource. Returns nullptr on failure. wxMenu *LoadMenu(const wxString& name); - // Loads menubar from resource. Returns NULL on failure. + // Loads menubar from resource. Returns nullptr on failure. wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name); - // Loads menubar from resource. Returns NULL on failure. - wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(NULL, name); } + // Loads menubar from resource. Returns nullptr on failure. + wxMenuBar *LoadMenuBar(const wxString& name) { return LoadMenuBar(nullptr, name); } #if wxUSE_TOOLBAR // Loads a toolbar. @@ -248,7 +248,7 @@ public: // Attaches an unknown control to the given panel/window/dialog. // Unknown controls are used in conjunction with . bool AttachUnknownControl(const wxString& name, wxWindow *control, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); // Returns a numeric ID that is equivalent to the string ID used in an XML // resource. If an unknown str_id is requested (i.e. other than wxID_XXX @@ -293,7 +293,7 @@ public: // Gets the global resources object or creates one if none exists. static wxXmlResource *Get(); - // Sets the global resources object and returns a pointer to the previous one (may be NULL). + // Sets the global resources object and returns a pointer to the previous one (may be null). static wxXmlResource *Set(wxXmlResource *res); // Returns flags, which is a bitlist of wxXmlResourceFlags. @@ -308,7 +308,7 @@ public: // This function returns the wxXmlNode containing the definition of the - // object with the given name or NULL. + // object with the given name or nullptr. // // It can be used to access additional information defined in the XRC file // and not used by wxXmlResource itself. @@ -324,7 +324,7 @@ protected: const wxString& message); // Load the contents of a single file and returns its contents as a new - // wxXmlDocument (which will be owned by caller) on success or NULL. + // wxXmlDocument (which will be owned by caller) on success or nullptr. wxXmlDocument *DoLoadFile(const wxString& file); // Load XRC from the given document and returns true on success. @@ -338,11 +338,11 @@ protected: // Common implementation of GetResourceNode() and FindResource(): searches // all top-level or all (if recursive == true) nodes if all loaded XRC // files and returns the node, if found, as well as the path of the file it - // was found in if path is non-NULL + // was found in if path is non-null wxXmlNode *GetResourceNodeAndLocation(const wxString& name, const wxString& classname, bool recursive = false, - wxString *path = NULL) const; + wxString *path = nullptr) const; // Note that these functions are used outside of wxWidgets itself, e.g. @@ -355,7 +355,7 @@ protected: // (something const public function intentionally does not do) // Returns the node containing the resource with the given name and class - // name unless it's empty (then any class matches) or NULL if not found. + // name unless it's empty (then any class matches) or nullptr if not found. wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = false); @@ -364,13 +364,13 @@ protected: const wxString& classname, bool recursive) const; // Creates a resource from information in the given node - // (Uses only 'handlerToUse' if != NULL) + // (Uses only 'handlerToUse' if != nullptr) wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, - wxObject *instance = NULL, - wxXmlResourceHandler *handlerToUse = NULL) + wxObject *instance = nullptr, + wxXmlResourceHandler *handlerToUse = nullptr) { return node ? DoCreateResFromNode(*node, parent, instance, handlerToUse) - : NULL; + : nullptr; } // Helper of Load() and Unload(): returns the URL corresponding to the @@ -389,11 +389,11 @@ private: const wxXmlResourceDataRecords& Data() const { return *m_data; } // the real implementation of CreateResFromNode(): this should be only - // called if node is non-NULL + // called if node is non-null wxObject *DoCreateResFromNode(wxXmlNode& node, wxObject *parent, wxObject *instance, - wxXmlResourceHandler *handlerToUse = NULL); + wxXmlResourceHandler *handlerToUse = nullptr); // common part of LoadObject() and LoadObjectRecursively() wxObject *DoLoadObject(wxWindow *parent, @@ -468,7 +468,7 @@ private: // wxSizerItem* item = XRCSIZERITEM(*this, "area") #define XRCSIZERITEM(window, id) \ - ((window).GetSizer() ? (window).GetSizer()->GetItemById(XRCID(id)) : NULL) + ((window).GetSizer() ? (window).GetSizer()->GetItemById(XRCID(id)) : nullptr) // wxXmlResourceHandlerImpl is the back-end of the wxXmlResourceHander class to @@ -489,7 +489,7 @@ public: // Should check for validity. // parent is a higher-level object (usually window, dialog or panel) // that is often necessary to create the resource. - // If instance is non-NULL it should not create a new instance via 'new' but + // If instance is non-null it should not create a new instance via 'new' but // should rather use this one, and call its Create method. wxObject *CreateResource(wxXmlNode *node, wxObject *parent, wxObject *instance) override; @@ -516,7 +516,7 @@ public: // Check to see if a parameter exists. bool HasParam(const wxString& param) override; - // Finds the node or returns NULL. + // Finds the node or returns nullptr. wxXmlNode *GetParamNode(const wxString& param) override; // Finds the parameter value or returns the empty string. @@ -558,14 +558,14 @@ public: // Gets the size (may be in dialog units). wxSize GetSize(const wxString& param = wxT("size"), - wxWindow *windowToUse = NULL) override; + wxWindow *windowToUse = nullptr) override; // Gets the position (may be in dialog units). wxPoint GetPosition(const wxString& param = wxT("pos")) override; // Gets a dimension (may be in dialog units). wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, - wxWindow *windowToUse = NULL) override; + wxWindow *windowToUse = nullptr) override; // Gets a size which is not expressed in pixels, so not in dialog units. wxSize GetPairInts(const wxString& param) override; @@ -614,11 +614,11 @@ public: // Gets an animation creating it using the provided control (so that it // will be compatible with it) if any. wxAnimation* GetAnimation(const wxString& param = wxT("animation"), - wxAnimationCtrlBase* ctrl = NULL) override; + wxAnimationCtrlBase* ctrl = nullptr) override; #endif // Gets a font. - wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) override; + wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = nullptr) override; // Gets the value of a boolean attribute (only "0" and "1" are valid values) bool GetBoolAttr(const wxString& attr, bool defaultv) override; @@ -627,7 +627,7 @@ public: // it if wxXRC_USE_ENVVARS is in use. wxString GetFilePath(const wxXmlNode* node) override; - // Returns the window associated with the handler (may be NULL). + // Returns the window associated with the handler (may be null). wxWindow* GetParentAsWindow() const { return m_handler->GetParentAsWindow(); } // Sets common window options. @@ -637,11 +637,11 @@ public: void CreateChildren(wxObject *parent, bool this_hnd_only = false) override; // Helper function. - void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL) override; + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = nullptr) override; // Creates a resource from a node. wxObject *CreateResFromNode(wxXmlNode *node, - wxObject *parent, wxObject *instance = NULL) override; + wxObject *parent, wxObject *instance = nullptr) override; // helper #if wxUSE_FILESYSTEM @@ -660,7 +660,7 @@ public: // Programmer-friendly macros for writing XRC handlers: #define XRC_MAKE_INSTANCE(variable, classname) \ - classname *variable = NULL; \ + classname *variable = nullptr; \ if (m_instance) \ variable = wxStaticCast(m_instance, classname); \ if (!variable) \ @@ -681,7 +681,7 @@ WXDLLIMPEXP_XRC void wxXmlInitResourceModule(); class WXDLLIMPEXP_XRC wxXmlSubclassFactory { public: - // Try to create instance of given class and return it, return NULL on + // Try to create instance of given class and return it, return nullptr on // failure: virtual wxObject *Create(const wxString& className) = 0; virtual ~wxXmlSubclassFactory() {} diff --git a/include/wx/xrc/xmlreshandler.h b/include/wx/xrc/xmlreshandler.h index 606eedaa09..a2ca1613c0 100644 --- a/include/wx/xrc/xmlreshandler.h +++ b/include/wx/xrc/xmlreshandler.h @@ -78,10 +78,10 @@ public: virtual wxColour GetColour(const wxString& param, const wxColour& defaultv = wxNullColour) = 0; virtual wxSize GetSize(const wxString& param = wxT("size"), - wxWindow *windowToUse = NULL) = 0; + wxWindow *windowToUse = nullptr) = 0; virtual wxPoint GetPosition(const wxString& param = wxT("pos")) = 0; virtual wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, - wxWindow *windowToUse = NULL) = 0; + wxWindow *windowToUse = nullptr) = 0; virtual wxSize GetPairInts(const wxString& param) = 0; virtual wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT) = 0; virtual wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), @@ -108,18 +108,18 @@ public: #if wxUSE_ANIMATIONCTRL virtual wxAnimation* GetAnimation(const wxString& param = wxT("animation"), - wxAnimationCtrlBase* ctrl = NULL) = 0; + wxAnimationCtrlBase* ctrl = nullptr) = 0; #endif - virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = NULL) = 0; + virtual wxFont GetFont(const wxString& param = wxT("font"), wxWindow* parent = nullptr) = 0; virtual bool GetBoolAttr(const wxString& attr, bool defaultv) = 0; virtual wxString GetFilePath(const wxXmlNode* node) = 0; virtual void SetupWindow(wxWindow *wnd) = 0; virtual void CreateChildren(wxObject *parent, bool this_hnd_only = false) = 0; virtual void CreateChildrenPrivately(wxObject *parent, - wxXmlNode *rootnode = NULL) = 0; + wxXmlNode *rootnode = nullptr) = 0; virtual wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, - wxObject *instance = NULL) = 0; + wxObject *instance = nullptr) = 0; #if wxUSE_FILESYSTEM virtual wxFileSystem& GetCurFileSystem() = 0; @@ -151,13 +151,13 @@ public: // it, SetImpl() needs to be called as done by wxXmlResource::AddHandler(). wxXmlResourceHandler() { - m_node = NULL; + m_node = nullptr; m_parent = - m_instance = NULL; - m_parentAsWindow = NULL; - m_resource = NULL; + m_instance = nullptr; + m_parentAsWindow = nullptr; + m_resource = nullptr; - m_impl = NULL; + m_impl = nullptr; } // This should be called exactly once. @@ -305,7 +305,7 @@ protected: return GetImpl()->GetColour(param, defaultv); } wxSize GetSize(const wxString& param = wxT("size"), - wxWindow *windowToUse = NULL) + wxWindow *windowToUse = nullptr) { return GetImpl()->GetSize(param, windowToUse); } @@ -314,7 +314,7 @@ protected: return GetImpl()->GetPosition(param); } wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0, - wxWindow *windowToUse = NULL) + wxWindow *windowToUse = nullptr) { return GetImpl()->GetDimension(param, defaultv, windowToUse); } @@ -374,14 +374,14 @@ protected: #if wxUSE_ANIMATIONCTRL wxAnimation* GetAnimation(const wxString& param = wxT("animation"), - wxAnimationCtrlBase* ctrl = NULL) + wxAnimationCtrlBase* ctrl = nullptr) { return GetImpl()->GetAnimation(param, ctrl); } #endif wxFont GetFont(const wxString& param = wxT("font"), - wxWindow* parent = NULL) + wxWindow* parent = nullptr) { return GetImpl()->GetFont(param, parent); } @@ -401,12 +401,12 @@ protected: { GetImpl()->CreateChildren(parent, this_hnd_only); } - void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL) + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = nullptr) { GetImpl()->CreateChildrenPrivately(parent, rootnode); } wxObject *CreateResFromNode(wxXmlNode *node, - wxObject *parent, wxObject *instance = NULL) + wxObject *parent, wxObject *instance = nullptr) { return GetImpl()->CreateResFromNode(node, parent, instance); } @@ -440,7 +440,7 @@ protected: friend class wxXmlResourceHandlerImpl; private: - // This is supposed to never return NULL because SetImpl() should have been + // This is supposed to never return nullptr because SetImpl() should have been // called. wxXmlResourceHandlerImplBase* GetImpl() const; diff --git a/include/wx/xti.h b/include/wx/xti.h index ee8150ad76..1346c5cc50 100644 --- a/include/wx/xti.h +++ b/include/wx/xti.h @@ -112,15 +112,15 @@ public: wxVariantToObjectPtrConverter _PtrConverter1, wxVariantToObjectConverter _Converter2, wxObjectToVariantConverter _Converter3, - wxObjectStreamingCallback _streamingCallback = NULL) : + wxObjectStreamingCallback _streamingCallback = nullptr) : m_className(_ClassName), m_objectSize(size), m_objectConstructor(ctor), m_next(sm_first), m_firstPropertyFn(_Props), m_firstHandlerFn(_Handlers), - m_firstProperty(NULL), - m_firstHandler(NULL), + m_firstProperty(nullptr), + m_firstHandler(nullptr), m_firstInited(false), m_parents(_Parents), m_unitName(_UnitName), @@ -140,22 +140,22 @@ public: const wxClassInfo **_Parents) : m_className(_ClassName), m_objectSize(0), - m_objectConstructor(NULL), + m_objectConstructor(nullptr), m_next(sm_first), - m_firstPropertyFn(NULL), - m_firstHandlerFn(NULL), - m_firstProperty(NULL), - m_firstHandler(NULL), + m_firstPropertyFn(nullptr), + m_firstHandlerFn(nullptr), + m_firstProperty(nullptr), + m_firstHandler(nullptr), m_firstInited(true), m_parents(_Parents), m_unitName(_UnitName), - m_constructor(NULL), - m_constructorProperties(NULL), + m_constructor(nullptr), + m_constructorProperties(nullptr), m_constructorPropertiesCount(0), - m_variantOfPtrToObjectConverter(NULL), - m_variantToObjectConverter(NULL), - m_objectToVariantConverter(NULL), - m_streamingCallback(NULL) + m_variantOfPtrToObjectConverter(nullptr), + m_variantToObjectConverter(nullptr), + m_objectToVariantConverter(nullptr), + m_streamingCallback(nullptr) { sm_first = this; Register(); @@ -171,25 +171,25 @@ public: m_objectSize(size), m_objectConstructor(ctor), m_next(sm_first), - m_firstPropertyFn(NULL), - m_firstHandlerFn(NULL), - m_firstProperty(NULL), - m_firstHandler(NULL), + m_firstPropertyFn(nullptr), + m_firstHandlerFn(nullptr), + m_firstProperty(nullptr), + m_firstHandler(nullptr), m_firstInited(true), - m_parents(NULL), - m_unitName(NULL), - m_constructor(NULL), - m_constructorProperties(NULL), + m_parents(nullptr), + m_unitName(nullptr), + m_constructor(nullptr), + m_constructorProperties(nullptr), m_constructorPropertiesCount(0), - m_variantOfPtrToObjectConverter(NULL), - m_variantToObjectConverter(NULL), - m_objectToVariantConverter(NULL), - m_streamingCallback(NULL) + m_variantOfPtrToObjectConverter(nullptr), + m_variantToObjectConverter(nullptr), + m_objectToVariantConverter(nullptr), + m_streamingCallback(nullptr) { sm_first = this; m_parents[0] = _Parent1; m_parents[1] = _Parent2; - m_parents[2] = NULL; + m_parents[2] = nullptr; Register(); } @@ -211,14 +211,14 @@ public: const wxChar *GetClassName() const { return m_className; } const wxChar *GetBaseClassName1() const - { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } + { return m_parents[0] ? m_parents[0]->GetClassName() : nullptr; } const wxChar *GetBaseClassName2() const - { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } + { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : nullptr; } const wxClassInfo *GetBaseClass1() const { return m_parents[0]; } const wxClassInfo *GetBaseClass2() const - { return m_parents[0] ? m_parents[1] : NULL; } + { return m_parents[0] ? m_parents[1] : nullptr; } const wxChar *GetIncludeName() const { return m_unitName; } @@ -227,7 +227,7 @@ public: int GetSize() const { return m_objectSize; } bool IsDynamic() const - { return (NULL != m_objectConstructor); } + { return (nullptr != m_objectConstructor); } wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } @@ -338,9 +338,9 @@ protected: { if ( !m_firstInited) { - if ( m_firstPropertyFn != NULL) + if ( m_firstPropertyFn != nullptr) m_firstProperty = (*m_firstPropertyFn)(); - if ( m_firstHandlerFn != NULL) + if ( m_firstHandlerFn != nullptr) m_firstHandler = (*m_firstHandlerFn)(); m_firstInited = true; } diff --git a/include/wx/xti2.h b/include/wx/xti2.h index f153f17746..b780bc0f13 100644 --- a/include/wx/xti2.h +++ b/include/wx/xti2.h @@ -96,7 +96,7 @@ wxObject* wxConstructorFor##name() \ #define _DEFAULT_CONVERTERS(name) \ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ -{ return data.As( (name**)NULL ); } \ +{ return data.As( (name**)nullptr ); } \ wxAny wxObjectToVariantConverter##name ( wxObject *data ) \ { return wxAny( wx_dynamic_cast(name*, data) ); } @@ -111,12 +111,12 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ _DEFAULT_CONVERTERS(name) \ \ const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo, NULL }; \ +{ &basename::ms_classInfo, nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ name::GetPropertiesStatic, name::GetHandlersStatic, name::ms_constructor, \ name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ - wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ + wxVariantOfPtrToObjectConverter##name, nullptr, wxObjectToVariantConverter##name, \ callback); #define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ @@ -125,7 +125,7 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn ) \ { name o = data.As(); (*fn)( &o ); } \ \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ @@ -134,60 +134,60 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ wxObjectToVariantConverter##name, callback); #define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", nullptr ) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) \ const wxPropertyInfo *name::GetPropertiesStatic() \ -{ return (wxPropertyInfo*) NULL; } \ +{ return (wxPropertyInfo*) nullptr; } \ const wxHandlerInfo *name::GetHandlersStatic() \ -{ return (wxHandlerInfo*) NULL; } \ +{ return (wxHandlerInfo*) nullptr; } \ wxCONSTRUCTOR_DUMMY( name ) #define wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) \ - _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ + _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", nullptr ) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) \ wxPropertyInfo *name::GetPropertiesStatic() \ -{ return (wxPropertyInfo*) NULL; } \ +{ return (wxPropertyInfo*) nullptr; } \ wxHandlerInfo *name::GetHandlersStatic() \ -{ return (wxHandlerInfo*) NULL; } \ +{ return (wxHandlerInfo*) nullptr; } \ wxCONSTRUCTOR_DUMMY( name ) #define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \ - _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, nullptr ) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) #define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback )\ _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, &callback ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _TYPEINFO_CLASSES(name, nullptr, nullptr) #define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, nullptr ) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) #define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \ unit, toString, \ fromString ) \ - _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \ + _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, nullptr ) \ _TYPEINFO_CLASSES(name, toString, fromString) // this is for classes that do not derive from wxObject, there are no creators for these #define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) \ - const wxClassInfo* name::ms_classParents[] = { NULL }; \ + const wxClassInfo* name::ms_classParents[] = { nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ 0, 0, 0 ); \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _TYPEINFO_CLASSES(name, nullptr, nullptr) // this is for subclasses that still do not derive from wxObject #define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) \ - const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, NULL }; \ + const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ 0, 0, 0 ); \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _TYPEINFO_CLASSES(name, nullptr, nullptr) // Multiple inheritance with two base classes @@ -197,24 +197,24 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ _DEFAULT_CONVERTERS(name) \ \ const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo,&basename2::ms_classInfo, NULL }; \ +{ &basename::ms_classInfo,&basename2::ms_classInfo, nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \ name::GetPropertiesStatic,name::GetHandlersStatic,name::ms_constructor, \ name::ms_constructorProperties, name::ms_constructorPropertiesCount, \ - wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \ + wxVariantOfPtrToObjectConverter##name, nullptr, wxObjectToVariantConverter##name, \ callback); #define wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2) \ - _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", NULL) \ - _TYPEINFO_CLASSES(name, NULL, NULL) \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ + _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", nullptr) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) nullptr; } \ + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) nullptr; } \ wxCONSTRUCTOR_DUMMY( name ) #define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) \ - _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, NULL) \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, nullptr) \ + _TYPEINFO_CLASSES(name, nullptr, nullptr) @@ -228,18 +228,18 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ _DEFAULT_CONVERTERS(name) \ \ const wxClassInfo* name::ms_classParents[] = \ -{ &basename::ms_classInfo,NULL }; \ +{ &basename::ms_classInfo,nullptr }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \ wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \ name::GetPropertiesStatic,name::GetHandlersStatic, 0, 0, \ 0, wxVariantOfPtrToObjectConverter##name,0, \ wxObjectToVariantConverter##name); \ - _TYPEINFO_CLASSES(name, NULL, NULL) + _TYPEINFO_CLASSES(name, nullptr, nullptr) #define wxIMPLEMENT_ABSTRACT_CLASS( name, basename ) \ _IMPLEMENT_ABSTRACT_CLASS( name, basename ) \ - wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \ - wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } + wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) nullptr; } \ + wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) nullptr; } // Multiple inheritance with two base classes diff --git a/include/wx/xtictor.h b/include/wx/xtictor.h index 6969463f38..0f9c1f0c8b 100644 --- a/include/wx/xtictor.h +++ b/include/wx/xtictor.h @@ -68,13 +68,13 @@ struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator #define wxCONSTRUCTOR_0(klass) \ wxObjectAllocatorAndCreator_0 constructor##klass; \ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ - const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const wxChar *klass::ms_constructorProperties[] = { nullptr }; \ const int klass::ms_constructorPropertiesCount = 0; #define wxCONSTRUCTOR_DUMMY(klass) \ wxObjectAllocatorAndCreator_Dummy constructor##klass; \ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ - const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const wxChar *klass::ms_constructorProperties[] = { nullptr }; \ const int klass::ms_constructorPropertiesCount = 0; // direct constructor version @@ -85,14 +85,14 @@ struct wxDirectConstructorBridge_0 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( ); - return o != NULL; + return o != nullptr; } }; #define wxDIRECT_CONSTRUCTOR_0(klass) \ wxDirectConstructorBridge_0 constructor##klass; \ wxObjectAllocatorAndCreator* klass::ms_constructor = &constructor##klass; \ - const wxChar *klass::ms_constructorProperties[] = { NULL }; \ + const wxChar *klass::ms_constructorProperties[] = { nullptr }; \ const int klass::ms_constructorPropertiesCount = 0; @@ -105,7 +105,7 @@ struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)) ); } }; @@ -124,9 +124,9 @@ struct wxDirectConstructorBridge_1 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -147,8 +147,8 @@ struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)) ); } }; @@ -168,10 +168,10 @@ struct wxDirectConstructorBridge_2 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -192,9 +192,9 @@ struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)) ); } }; @@ -214,11 +214,11 @@ struct wxDirectConstructorBridge_3 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -239,10 +239,10 @@ struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)) ); } }; @@ -263,12 +263,12 @@ struct wxDirectConstructorBridge_4 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -290,11 +290,11 @@ struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)) ); } }; @@ -315,13 +315,13 @@ struct wxDirectConstructorBridge_5 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -343,12 +343,12 @@ struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)) ); } }; @@ -369,14 +369,14 @@ struct wxDirectConstructorBridge_6 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -398,13 +398,13 @@ struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)), - (args[6]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)), + (args[6]).As(static_cast(nullptr)) ); } }; @@ -425,15 +425,15 @@ struct wxDirectConstructorBridge_7 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)), - (args[6]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)), + (args[6]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; @@ -456,14 +456,14 @@ struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator { Class *obj = wx_dynamic_cast(Class*, o); return obj->Create( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)), - (args[6]).As(static_cast(NULL)), - (args[7]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)), + (args[6]).As(static_cast(nullptr)), + (args[7]).As(static_cast(nullptr)) ); } }; @@ -485,16 +485,16 @@ struct wxDirectConstructorBridge_8 : public wxObjectAllocator bool Create(wxObject * &o, wxAny *args) { o = new Class( - (args[0]).As(static_cast(NULL)), - (args[1]).As(static_cast(NULL)), - (args[2]).As(static_cast(NULL)), - (args[3]).As(static_cast(NULL)), - (args[4]).As(static_cast(NULL)), - (args[5]).As(static_cast(NULL)), - (args[6]).As(static_cast(NULL)), - (args[7]).As(static_cast(NULL)) + (args[0]).As(static_cast(nullptr)), + (args[1]).As(static_cast(nullptr)), + (args[2]).As(static_cast(nullptr)), + (args[3]).As(static_cast(nullptr)), + (args[4]).As(static_cast(nullptr)), + (args[5]).As(static_cast(nullptr)), + (args[6]).As(static_cast(nullptr)), + (args[7]).As(static_cast(nullptr)) ); - return o != NULL; + return o != nullptr; } }; diff --git a/include/wx/xtihandler.h b/include/wx/xtihandler.h index c63ddb3a36..e070f8dbc9 100644 --- a/include/wx/xtihandler.h +++ b/include/wx/xtihandler.h @@ -68,7 +68,7 @@ public: // get the handler function pointer wxObjectEventFunction GetEventFunction() const { return m_eventFunction; } - // returns NULL if this is the last handler of this class + // returns nullptr if this is the last handler of this class wxHandlerInfo* GetNext() const { return m_next; } // return the class this property is declared in @@ -99,7 +99,7 @@ private: wxHandlerInfo *theClass::GetHandlersStatic() \ { \ typedef theClass class_t; \ - static wxHandlerInfo* first = NULL; + static wxHandlerInfo* first = nullptr; #define wxEND_HANDLERS_TABLE() \ return first; } diff --git a/include/wx/xtiprop.h b/include/wx/xtiprop.h index d0d20039ac..4a596ab434 100644 --- a/include/wx/xtiprop.h +++ b/include/wx/xtiprop.h @@ -202,10 +202,10 @@ public: wxLogError( wxGetTranslation("GetPropertyCollection called w/o valid collection getter") ); } - virtual bool HasSetter() const { return m_setter != NULL; } - virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL; } - virtual bool HasGetter() const { return m_getter != NULL; } - virtual bool HasAdder() const { return m_adder != NULL; } + virtual bool HasSetter() const { return m_setter != nullptr; } + virtual bool HasCollectionGetter() const { return m_collectionGetter != nullptr; } + virtual bool HasGetter() const { return m_getter != nullptr; } + virtual bool HasAdder() const { return m_adder != nullptr; } virtual const wxString& GetCollectionGetterName() const { return m_collectionGetter->GetName(); } @@ -313,9 +313,9 @@ public: const wxString& groupString = wxEmptyString) : m_itsClass(itsClass), m_name(name), - m_typeInfo(NULL), + m_typeInfo(nullptr), m_typeName(typeName), - m_collectionElementTypeInfo(NULL), + m_collectionElementTypeInfo(nullptr), m_accessor(accessor), m_defaultValue(dv), m_flags(flags), @@ -337,7 +337,7 @@ public: m_itsClass(itsClass), m_name(name), m_typeInfo(type), - m_collectionElementTypeInfo(NULL), + m_collectionElementTypeInfo(nullptr), m_accessor(accessor), m_defaultValue(dv), m_flags(flags), @@ -357,9 +357,9 @@ public: const wxString& groupString = wxEmptyString) : m_itsClass(itsClass), m_name(name), - m_typeInfo(NULL), + m_typeInfo(nullptr), m_typeName(collectionTypeName), - m_collectionElementTypeInfo(NULL), + m_collectionElementTypeInfo(nullptr), m_collectionElementTypeName(elementTypeName), m_accessor(accessor), m_flags(flags), @@ -387,10 +387,10 @@ public: // returns the group string of this property const wxString& GetGroupString() const { return m_groupString; } - // return the element type info of this property (for collections, otherwise NULL) + // return the element type info of this property (for collections, otherwise nullptr) const wxTypeInfo * GetCollectionElementTypeInfo() const { - if ( m_collectionElementTypeInfo == NULL ) + if ( m_collectionElementTypeInfo == nullptr ) m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName); return m_collectionElementTypeInfo; } @@ -398,7 +398,7 @@ public: // return the type info of this property const wxTypeInfo * GetTypeInfo() const { - if ( m_typeInfo == NULL ) + if ( m_typeInfo == nullptr ) m_typeInfo = wxTypeInfo::FindType(m_typeName); return m_typeInfo; } @@ -406,7 +406,7 @@ public: // return the accessor for this property wxPropertyAccessor* GetAccessor() const { return m_accessor; } - // returns NULL if this is the last property of this class + // returns nullptr if this is the last property of this class wxPropertyInfo* GetNext() const { return m_next; } // returns the default value of this property, its kind may be wxT_VOID if it is not valid @@ -458,14 +458,14 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas wxPropertyInfo *theClass::GetPropertiesStatic() \ { \ typedef theClass class_t; \ - static wxPropertyInfo* first = NULL; + static wxPropertyInfo* first = nullptr; #define wxEND_PROPERTIES_TABLE() \ return first; } #define wxHIDE_PROPERTY( pname ) \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ - wxT(#pname), typeid(void).name(), NULL, wxAny(), wxPROP_DONT_STREAM, \ + wxT(#pname), typeid(void).name(), nullptr, wxAny(), wxPROP_DONT_STREAM, \ wxEmptyString, wxEmptyString ); #define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \ @@ -474,7 +474,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas wxPROPERTY_GETTER( pname, class_t, type, getter ) \ static wxPropertyGetter##pname _getter##pname; \ static wxPropertyAccessor _accessor##pname( &_setter##pname, \ - &_getter##pname, NULL, NULL ); \ + &_getter##pname, nullptr, nullptr ); \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(type).name(), &_accessor##pname, \ wxAny(defaultValue), flags, group, help ); @@ -486,7 +486,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas wxPROPERTY_GETTER( pname, class_t, type, getter ) \ static wxPropertyGetter##pname _getter##pname; \ static wxPropertyAccessor _accessor##pname( &_setter##pname, \ - &_getter##pname, NULL, NULL ); \ + &_getter##pname, nullptr, nullptr ); \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(flags).name(), &_accessor##pname, \ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group ); @@ -494,7 +494,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas #define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \ wxPROPERTY_GETTER( pname, class_t, type, getter ) \ static wxPropertyGetter##pname _getter##pname; \ - static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ + static wxPropertyAccessor _accessor##pname( nullptr, &_getter##pname, nullptr, nullptr ); \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(type).name(),&_accessor##pname, \ wxAny(defaultValue), flags, help, group ); @@ -503,7 +503,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas pflags, help, group) \ wxPROPERTY_GETTER( pname, class_t, type, getter ) \ static wxPropertyGetter##pname _getter##pname; \ - static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ + static wxPropertyAccessor _accessor##pname( nullptr, &_getter##pname, nullptr, nullptr ); \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(flags).name(),&_accessor##pname, \ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group ); @@ -514,7 +514,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas static wxPropertyCollectionAdder##pname _adder##pname; \ wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \ static wxPropertyCollectionGetter##pname _collectionGetter##pname; \ - static wxPropertyAccessor _accessor##pname( NULL, NULL,&_adder##pname, \ + static wxPropertyAccessor _accessor##pname( nullptr, nullptr,&_adder##pname, \ &_collectionGetter##pname ); \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \ @@ -524,7 +524,7 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas flags, help, group) \ wxPROPERTY_COLLECTION_GETTER( pname, class_t, colltype, getter ) \ static wxPropertyCollectionGetter##pname _collectionGetter##pname; \ - static wxPropertyAccessor _accessor##pname( NULL, NULL, NULL, \ + static wxPropertyAccessor _accessor##pname( nullptr, nullptr, nullptr, \ &_collectionGetter##pname ); \ static wxPropertyInfo _propertyInfo##pname( first,class_t::GetClassInfoStatic(), \ wxT(#pname), typeid(colltype).name(),typeid(addelemtype).name(), \ @@ -533,13 +533,13 @@ class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap : public wxStringToAnyHashMapBas #define wxEVENT_PROPERTY( name, eventType, eventClass ) \ static wxEventSourceTypeInfo _typeInfo##name( eventType, wxCLASSINFO( eventClass ) ); \ static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \ - wxT(#name), &_typeInfo##name, NULL, wxAny() ); + wxT(#name), &_typeInfo##name, nullptr, wxAny() ); #define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \ static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \ wxCLASSINFO( eventClass ) ); \ static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \ - wxT(#name), &_typeInfo##name, NULL, wxAny() ); + wxT(#name), &_typeInfo##name, nullptr, wxAny() ); // ---------------------------------------------------------------------------- // Implementation Helper for Simple Properties diff --git a/include/wx/xtitypes.h b/include/wx/xtitypes.h index c0a1bcc9e4..e6e93df9e9 100644 --- a/include/wx/xtitypes.h +++ b/include/wx/xtitypes.h @@ -53,7 +53,7 @@ public: // returns true if the member has been found and sets the int value // pointed to accordingly (if ptr != null ) // if not found returns false, value left unchanged - bool HasEnumMemberValue( const wxChar *name, int *value = NULL ) const; + bool HasEnumMemberValue( const wxChar *name, int *value = nullptr ) const; // returns the value of the member, if not found in debug mode an // assert is issued, in release 0 is returned @@ -83,7 +83,7 @@ private: #define wxENUM_MEMBER( v ) { wxT(#v), v }, #define wxEND_ENUM( e ) \ - { NULL, 0 } }; \ + { nullptr, 0 } }; \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString& s, e &data ) \ @@ -93,7 +93,7 @@ private: void FromLong##e( long data, wxAny& result ) \ { result = wxAny((e)data); } \ void ToLong##e( const wxAny& data, long &result ) \ - { result = (long) (data).As(static_cast(NULL)); } \ + { result = (long) (data).As(static_cast(nullptr)); } \ \ wxTO_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \ @@ -181,7 +181,7 @@ void wxSetToString( wxString &s, const wxBitset &data ) void FromLong##SetName( long data, wxAny& result ) \ { result = wxAny(SetName((unsigned long)data)); } \ void ToLong##SetName( const wxAny& data, long &result ) \ - { result = (long) (data).As(static_cast(NULL)).to_ulong(); } \ + { result = (long) (data).As(static_cast(nullptr)).to_ulong(); } \ wxTO_STRING_IMP( SetName ) \ wxFROM_STRING_IMP( SetName ) \ wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \ @@ -238,7 +238,7 @@ void wxFlagsToString( wxString &s, const e& data ) #define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast(v) }, #define wxEND_FLAGS( e ) \ - { NULL, 0 } }; \ + { nullptr, 0 } }; \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e*) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString &s, e &data ) \ @@ -248,7 +248,7 @@ void wxFlagsToString( wxString &s, const e& data ) void FromLong##e( long data, wxAny& result ) \ { result = wxAny(e(data)); } \ void ToLong##e( const wxAny& data, long &result ) \ - { result = (long) (data).As(static_cast(NULL)).m_data; } \ + { result = (long) (data).As(static_cast(nullptr)).m_data; } \ wxTO_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \ wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \ @@ -308,7 +308,7 @@ public: typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result ); wxTypeInfo(wxTypeKind kind, - wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, + wxVariant2StringFnc to = nullptr, wxString2VariantFnc from = nullptr, const wxString &name = wxEmptyString): m_toString(to), m_fromString(from), m_kind(kind), m_name(name) { @@ -346,7 +346,7 @@ public: bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR; } // can the content of this type be converted to and from strings ? - bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; } + bool HasStringConverters() const { return m_toString != nullptr && m_fromString != nullptr; } // convert a wxAny holding data of this type into a string void ConvertToString( const wxAny& data, wxString &result ) const @@ -368,7 +368,7 @@ public: // statics: - // looks for the corresponding type, will return NULL if not found + // looks for the corresponding type, will return nullptr if not found static wxTypeInfo *FindType( const wxString& typeName ); private: void Register(); @@ -387,8 +387,8 @@ private: class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo { public: - wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = NULL, - wxString2VariantFnc from = NULL, + wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to = nullptr, + wxString2VariantFnc from = nullptr, const wxString &name = wxEmptyString ) : wxTypeInfo( kind, to, from, name ) { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); } @@ -450,13 +450,13 @@ class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo { public: wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, - wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, + wxVariant2StringFnc to = nullptr, wxString2VariantFnc from = nullptr, const wxString &name = wxEmptyString); const wxClassInfo *GetClassInfo() const { return m_classInfo; } private: - wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL + wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be null }; class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo @@ -465,11 +465,11 @@ public: wxCollectionTypeInfo( const wxString &elementName, wxVariant2StringFnc to, wxString2VariantFnc from , const wxString &name) : wxTypeInfo( wxT_COLLECTION, to, from, name ) - { m_elementTypeName = elementName; m_elementType = NULL; } + { m_elementTypeName = elementName; m_elementType = nullptr; } const wxTypeInfo* GetElementType() const { - if ( m_elementType == NULL ) + if ( m_elementType == nullptr ) m_elementType = wxTypeInfo::FindType( m_elementTypeName ); return m_elementType; } @@ -483,10 +483,10 @@ class WXDLLIMPEXP_BASE wxEventSourceTypeInfo : public wxTypeInfo { public: wxEventSourceTypeInfo( int eventType, wxClassInfo* eventClass, - wxVariant2StringFnc to = NULL, - wxString2VariantFnc from = NULL ); + wxVariant2StringFnc to = nullptr, + wxString2VariantFnc from = nullptr ); wxEventSourceTypeInfo( int eventType, int lastEventType, wxClassInfo* eventClass, - wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL ); + wxVariant2StringFnc to = nullptr, wxString2VariantFnc from = nullptr ); int GetEventType() const { return m_eventType; } int GetLastEventType() const { return m_lastEventType; } @@ -519,7 +519,7 @@ template const wxTypeInfo* wxGetTypeInfo( T * ) #define wxCOLLECTION_TYPE_INFO( element, collection ) \ wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name(), \ - NULL, NULL, typeid(collection).name() ); + nullptr, nullptr, typeid(collection).name() ); // sometimes a compiler invents specializations that are nowhere called, // use this macro to satisfy the refs, currently we don't have to play diff --git a/include/wx/zipstrm.h b/include/wx/zipstrm.h index 57e49167dd..d5c34e6c43 100644 --- a/include/wx/zipstrm.h +++ b/include/wx/zipstrm.h @@ -194,7 +194,7 @@ public: static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, - bool *pIsDir = NULL); + bool *pIsDir = nullptr); // set is accessors void SetIsDir(bool isDir = true) override; @@ -422,11 +422,11 @@ private: bool AtHeader() const { return m_headerSize == 0; } bool AfterHeader() const { return m_headerSize > 0 && !m_decomp; } - bool IsOpened() const { return m_decomp != NULL; } + bool IsOpened() const { return m_decomp != nullptr; } wxZipStreamLink *MakeLink(wxZipOutputStream *out); - bool DoOpen(wxZipEntry *entry = NULL, bool raw = false); + bool DoOpen(wxZipEntry *entry = nullptr, bool raw = false); bool OpenDecompressor(bool raw = false); class wxStoredInputStream *m_store; diff --git a/interface/wx/aboutdlg.h b/interface/wx/aboutdlg.h index d3cf516ddd..2f67bfe7bf 100644 --- a/interface/wx/aboutdlg.h +++ b/interface/wx/aboutdlg.h @@ -355,7 +355,7 @@ public: @header{wx/aboutdlg.h} */ -void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); +void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); /** This function does the same thing as wxAboutBox() except that it always uses @@ -372,6 +372,6 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); @header{wx/aboutdlg.h} */ -void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); +void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); ///@} diff --git a/interface/wx/accel.h b/interface/wx/accel.h index fda689eb01..97e88b27c5 100644 --- a/interface/wx/accel.h +++ b/interface/wx/accel.h @@ -57,7 +57,7 @@ public: The menu item associated with this accelerator. */ wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, - wxMenuItem *item = NULL); + wxMenuItem *item = nullptr); /** Copy ctor. @@ -97,7 +97,7 @@ public: @param item The menu item associated with this accelerator. */ - void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL); + void Set(int flags, int keyCode, int cmd, wxMenuItem *item = nullptr); /** Returns @true if this object is correctly initialized. diff --git a/interface/wx/access.h b/interface/wx/access.h index 82b5031ba2..32bf7a5508 100644 --- a/interface/wx/access.h +++ b/interface/wx/access.h @@ -358,7 +358,7 @@ public: Constructor, taking an optional window. The object can be associated with a window later. */ - wxAccessible(wxWindow* win = NULL); + wxAccessible(wxWindow* win = nullptr); /** Destructor. diff --git a/interface/wx/addremovectrl.h b/interface/wx/addremovectrl.h index 75ef63029f..0177ca32c6 100644 --- a/interface/wx/addremovectrl.h +++ b/interface/wx/addremovectrl.h @@ -184,7 +184,7 @@ public: this window, i.e. wxAddRemoveAdaptor::GetItemsCtrl() must return a pointer to an existing child of this control. - The @a adaptor pointer must be non-NULL and heap-allocated as the + The @a adaptor pointer must be non-null and heap-allocated as the control takes ownership of it and will delete it later. */ void SetAdaptor(wxAddRemoveAdaptor* adaptor); diff --git a/interface/wx/affinematrix2d.h b/interface/wx/affinematrix2d.h index 0cd2bf6646..3527fb9230 100644 --- a/interface/wx/affinematrix2d.h +++ b/interface/wx/affinematrix2d.h @@ -30,7 +30,7 @@ public: @param mat2D The rotational components of the matrix (upper 2 x 2), must be - non-@NULL. + non-null. @param tr The translational components of the matrix, may be @NULL. */ diff --git a/interface/wx/affinematrix2dbase.h b/interface/wx/affinematrix2dbase.h index ad33633414..753b137a41 100644 --- a/interface/wx/affinematrix2dbase.h +++ b/interface/wx/affinematrix2dbase.h @@ -73,7 +73,7 @@ public: @param mat2D The rotational components of the matrix (upper 2 x 2), must be - non-@NULL. + non-null. @param tr The translational components of the matrix, may be @NULL. */ diff --git a/interface/wx/animate.h b/interface/wx/animate.h index e9bd8ec28b..c73130c9c3 100644 --- a/interface/wx/animate.h +++ b/interface/wx/animate.h @@ -83,7 +83,7 @@ public: of the animation is displayed. @param parent - Parent window, must be non-@NULL. + Parent window, must be non-null. @param id The identifier for the control. @param anim @@ -248,7 +248,7 @@ public: of the animation is displayed. @param parent - Parent window, must be non-@NULL. + Parent window, must be non-null. @param id The identifier for the control. @param anim diff --git a/interface/wx/any.h b/interface/wx/any.h index 733df20975..c18c7f5c62 100644 --- a/interface/wx/any.h +++ b/interface/wx/any.h @@ -333,7 +333,7 @@ union wxAnyValueBuffer // TODO: Free the data in buffer // It is important to clear the buffer like this // at the end of DeleteValue(). - buf.m_ptr = NULL; + buf.m_ptr = nullptr; } virtual void CopyBuffer(const wxAnyValueBuffer& src, diff --git a/interface/wx/app.h b/interface/wx/app.h index 3f264ec3d8..a9f388add9 100644 --- a/interface/wx/app.h +++ b/interface/wx/app.h @@ -97,7 +97,7 @@ public: by OnRun() and which dispatches all events sent from the native toolkit to the application (except when new event loops are temporarily set-up). The returned value maybe @NULL. Put initialization code which needs a - non-@NULL main event loop into OnEventLoopEnter(). + non-null main event loop into OnEventLoopEnter(). */ wxEventLoopBase* GetMainLoop() const; @@ -1004,7 +1004,7 @@ public: first frame or dialog (or better, any wxTopLevelWindow) in its top-level window list, when it needs to use the top window. If you previously called SetTopWindow() and now you need to restore this - automatic behaviour you can call @code wxApp::SetTopWindow(NULL) @endcode. + automatic behaviour you can call `wxApp::SetTopWindow(nullptr)`. @param window The new top window. @@ -1402,7 +1402,7 @@ bool wxYield(); @header{wx/app.h} */ -bool wxSafeYield(wxWindow* win = NULL, bool onlyIfNeeded = false); +bool wxSafeYield(wxWindow* win = nullptr, bool onlyIfNeeded = false); /** This function initializes wxWidgets in a platform-dependent way. Use this if you @@ -1441,8 +1441,8 @@ int wxEntry(int& argc, wxChar** argv); @header{wx/app.h} */ int wxEntry(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - char* pCmdLine = NULL, + HINSTANCE hPrevInstance = nullptr, + char* pCmdLine = nullptr, int nCmdShow = SW_SHOWNORMAL); ///@} diff --git a/interface/wx/appprogress.h b/interface/wx/appprogress.h index 1c1b961dfa..af3cde82f6 100644 --- a/interface/wx/appprogress.h +++ b/interface/wx/appprogress.h @@ -27,13 +27,13 @@ public: @param parent The parent window of wxAppProgressIndicator. Note that the - window should has taskbar button showing. If parent is NULL, + window should has taskbar button showing. If parent is @NULL, the progress will reflect on the taskbar buttons of all the top level windows. @param maxValue Integer range (maximum value) of the progress indicator. */ - wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + wxAppProgressIndicator(wxWindow* parent = nullptr, int maxValue = 100); /** Destructor, stops displaying progress and returns the indicator to its diff --git a/interface/wx/apptrait.h b/interface/wx/apptrait.h index b24285abc7..af2577f6ef 100644 --- a/interface/wx/apptrait.h +++ b/interface/wx/apptrait.h @@ -112,9 +112,9 @@ public: If a micro version is not available it will have a value of 0. */ - virtual wxPortId GetToolkitVersion(int* major = NULL, - int* minor = NULL, - int* micro = NULL) const = 0; + virtual wxPortId GetToolkitVersion(int* major = nullptr, + int* minor = nullptr, + int* micro = nullptr) const = 0; /** Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise. diff --git a/interface/wx/archive.h b/interface/wx/archive.h index 7f40f33e11..37d7f208de 100644 --- a/interface/wx/archive.h +++ b/interface/wx/archive.h @@ -174,7 +174,7 @@ public: @li GetSize(): guaranteed to be available after the entry has been read to Eof(), or CloseEntry() has been called; @li IsReadOnly(): guaranteed to be available after the end of the archive has - been reached, i.e. after GetNextEntry() returns NULL and Eof() is true. + been reached, i.e. after GetNextEntry() returns @NULL and Eof() is true. @library{wxbase} @category{archive,streams} diff --git a/interface/wx/arrstr.h b/interface/wx/arrstr.h index ebd47a5d2b..5a005dd822 100644 --- a/interface/wx/arrstr.h +++ b/interface/wx/arrstr.h @@ -504,7 +504,7 @@ int wxCmpNaturalGeneric(const wxString& s1, const wxString& s2); Splits the given wxString object using the separator @a sep and returns the result as a wxArrayString. - If the @a escape character is non-@NULL, then the occurrences of @a sep + If the @a escape character is non-null, then the occurrences of @a sep immediately prefixed with @a escape are not considered as separators. Note that empty tokens will be generated if there are two or more adjacent separators. @@ -520,7 +520,7 @@ wxArrayString wxSplit(const wxString& str, const wxChar sep, Concatenate all lines of the given wxArrayString object using the separator @a sep and returns the result as a wxString. - If the @a escape character is non-@NULL, then it's used as prefix for each + If the @a escape character is non-null, then it's used as prefix for each occurrence of @a sep in the strings contained in @a arr before joining them which is necessary in order to be able to recover the original array contents from the string later using wxSplit(). The @a escape characters diff --git a/interface/wx/artprov.h b/interface/wx/artprov.h index f10db17664..200f919774 100644 --- a/interface/wx/artprov.h +++ b/interface/wx/artprov.h @@ -356,7 +356,7 @@ public: @since 2.9.0 (@a win parameter is available only since 3.1.6) */ - static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetNativeSizeHint(const wxArtClient& client, wxWindow* win = nullptr); /** Returns a suitable size hint for the given @e wxArtClient in DIPs. @@ -378,7 +378,7 @@ public: Note that @a win parameter is only available since wxWidgets 3.1.6. */ - static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = NULL); + static wxSize GetSizeHint(const wxArtClient& client, wxWindow* win = nullptr); /** Query registered providers for icon bundle with given ID. diff --git a/interface/wx/aui/auibar.h b/interface/wx/aui/auibar.h index 3b6641b310..5be7fc0dd1 100644 --- a/interface/wx/aui/auibar.h +++ b/interface/wx/aui/auibar.h @@ -722,7 +722,7 @@ public: const wxBitmapBundle& bitmap, const wxBitmapBundle& disabled_bitmap, bool toggle = false, - wxObject* client_data = NULL, + wxObject* client_data = nullptr, const wxString& short_help_string = wxEmptyString, const wxString& long_help_string = wxEmptyString); diff --git a/interface/wx/aui/auibook.h b/interface/wx/aui/auibook.h index 670520604a..d308c887f5 100644 --- a/interface/wx/aui/auibook.h +++ b/interface/wx/aui/auibook.h @@ -537,7 +537,7 @@ public: void SetColour(const wxColour& colour); void SetActiveColour(const wxColour& colour); void DoShowHide(); - void SetRect(const wxRect& rect, wxWindow* wnd = NULL); + void SetRect(const wxRect& rect, wxWindow* wnd = nullptr); void RemoveButton(int id); void AddButton(int id, @@ -681,7 +681,7 @@ public: */ virtual void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count, - wxWindow* wnd = NULL) = 0; + wxWindow* wnd = nullptr) = 0; }; /** @@ -776,7 +776,7 @@ public: void SetFlags(unsigned int flags); void SetSizingInfo(const wxSize& tabCtrlSize, size_t tabCount, - wxWindow* wnd = NULL); + wxWindow* wnd = nullptr); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); @@ -882,7 +882,7 @@ public: void SetSizingInfo(const wxSize& tabCtrlSize, size_t tabCount, - wxWindow* wnd = NULL); + wxWindow* wnd = nullptr); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); diff --git a/interface/wx/aui/framemanager.h b/interface/wx/aui/framemanager.h index a4bcb586dd..262ff0d0e3 100644 --- a/interface/wx/aui/framemanager.h +++ b/interface/wx/aui/framemanager.h @@ -182,7 +182,7 @@ public: Specifies the frame management behaviour and visual effects with the ::wxAuiManagerOption's style flags. */ - wxAuiManager(wxWindow* managed_wnd = NULL, + wxAuiManager(wxWindow* managed_wnd = nullptr, unsigned int flags = wxAUI_MGR_DEFAULT); /** diff --git a/interface/wx/base64.h b/interface/wx/base64.h index c0a496e446..b8523662a1 100644 --- a/interface/wx/base64.h +++ b/interface/wx/base64.h @@ -128,7 +128,7 @@ size_t wxBase64EncodedSize(size_t len); white space characters are silently skipped instead. And if it is wxBase64DecodeMode_Relaxed, then all invalid characters are skipped. @param posErr - If this pointer is non-@NULL and an error occurs during decoding, it is + If this pointer is non-null and an error occurs during decoding, it is filled with the index of the invalid character. @header{wx/base64.h} @@ -137,7 +137,7 @@ size_t wxBase64Decode(void* dst, size_t dstLen, const char* src, size_t srcLen = wxNO_LEN, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); /** Decode a Base64-encoded wxString. @@ -154,7 +154,7 @@ size_t wxBase64Decode(void* dst, size_t dstLen, size_t wxBase64Decode(void* dst, size_t dstLen, const wxString& str, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); /** Decode a Base64-encoded string and return decoded contents in a buffer. @@ -170,7 +170,7 @@ size_t wxBase64Decode(void* dst, size_t dstLen, wxMemoryBuffer wxBase64Decode(const char* src, size_t srcLen = wxNO_LEN, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); /** Decode a Base64-encoded wxString and return decoded contents in a buffer. @@ -185,7 +185,7 @@ wxMemoryBuffer wxBase64Decode(const char* src, */ wxMemoryBuffer wxBase64Decode(const wxString& src, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, - size_t *posErr = NULL); + size_t *posErr = nullptr); ///@} diff --git a/interface/wx/bitmap.h b/interface/wx/bitmap.h index 070bd5cf95..8ab0897534 100644 --- a/interface/wx/bitmap.h +++ b/interface/wx/bitmap.h @@ -95,7 +95,7 @@ public: wxBITMAP_TYPE_BMP_RESOURCE as @a type), the light grey colour is considered to be transparent, for historical reasons. If you want to handle the light grey pixels normally instead, call - SetMask(NULL) after loading the bitmap. + `SetMask(nullptr)` after loading the bitmap. @param bitmap The bitmap object which is to be affected by this operation. @@ -133,7 +133,7 @@ public: @see wxBitmap::LoadFile, wxBitmap::SaveFile, LoadFile() */ virtual bool SaveFile(const wxBitmap* bitmap, const wxString& name, wxBitmapType type, - const wxPalette* palette = NULL) const; + const wxPalette* palette = nullptr) const; /** Sets the handler extension. @@ -913,7 +913,7 @@ public: @see LoadFile() */ virtual bool SaveFile(const wxString& name, wxBitmapType type, - const wxPalette* palette = NULL) const; + const wxPalette* palette = nullptr) const; /** @deprecated This function is deprecated since version 3.1.2, dimensions diff --git a/interface/wx/bmpbuttn.h b/interface/wx/bmpbuttn.h index 7d6c6c5511..ec112b077f 100644 --- a/interface/wx/bmpbuttn.h +++ b/interface/wx/bmpbuttn.h @@ -107,7 +107,7 @@ public: on a default-constructed wxBitmapButton object to achieve the same effect. - @param parent The button parent window, must be non-@NULL. + @param parent The button parent window, must be non-null. @param winid The identifier for the new button. @param name The name for the new button. @@ -125,7 +125,7 @@ public: provided to avoid the need to test for the current platform and creates the button with as native look as possible. - @param parent The button parent window, must be non-@NULL. + @param parent The button parent window, must be non-null. @param winid The identifier for the new button. @param name The name for the new button (available since wxWidgets 3.1.5) @return The new button. diff --git a/interface/wx/bmpcbox.h b/interface/wx/bmpcbox.h index ff1ee0ee8f..2773aa2924 100644 --- a/interface/wx/bmpcbox.h +++ b/interface/wx/bmpcbox.h @@ -91,7 +91,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxBitmapComboBoxNameStr); diff --git a/interface/wx/bookctrl.h b/interface/wx/bookctrl.h index 7d43331348..56e2d4a1a1 100644 --- a/interface/wx/bookctrl.h +++ b/interface/wx/bookctrl.h @@ -218,7 +218,7 @@ public: /** Returns the index of the tab at the specified position or @c wxNOT_FOUND - if none. If @a flags parameter is non-@NULL, the position of the point + if none. If @a flags parameter is non-null, the position of the point inside the tab is returned as well. @param pt @@ -232,7 +232,7 @@ public: @return Returns the zero-based tab index or @c wxNOT_FOUND if there is no tab at the specified position. */ - virtual int HitTest(const wxPoint& pt, long* flags = NULL) const; + virtual int HitTest(const wxPoint& pt, long* flags = nullptr) const; diff --git a/interface/wx/brush.h b/interface/wx/brush.h index 23c9633db9..d23d588828 100644 --- a/interface/wx/brush.h +++ b/interface/wx/brush.h @@ -153,7 +153,7 @@ public: /** Gets a pointer to the stipple bitmap. If the brush does not have a @c wxBRUSHSTYLE_STIPPLE - style, this bitmap may be non-@NULL but uninitialised (i.e. wxBitmap:IsOk() returns @false). + style, this bitmap may be non-null but uninitialised (i.e. wxBitmap:IsOk() returns @false). @see SetStipple() */ diff --git a/interface/wx/buffer.h b/interface/wx/buffer.h index e24089999f..ec81ec762e 100644 --- a/interface/wx/buffer.h +++ b/interface/wx/buffer.h @@ -48,7 +48,7 @@ public: /// Stored characters type. typedef T CharType; - /// Default constructor, creates NULL buffer. + /// Default constructor, creates null, empty buffer. wxScopedCharTypeBuffer(); /** @@ -106,7 +106,7 @@ public: */ CharType* release() const; - /// Resets the buffer to NULL, freeing the data if necessary. + /// Resets the buffer to empty, freeing the data if necessary. void reset(); /// Returns pointer to the stored data. @@ -163,7 +163,7 @@ public: @see wxScopedCharTypeBuffer::CreateOwned() */ - wxCharTypeBuffer(const CharType *str = NULL, size_t len = wxNO_LEN); + wxCharTypeBuffer(const CharType *str = nullptr, size_t len = wxNO_LEN); /** @@ -250,7 +250,7 @@ public: wxCharBuffer(const wxCharTypeBufferBase& buf); wxCharBuffer(const wxScopedCharTypeBufferBase& buf); - wxCharBuffer(const CharType *str = NULL); + wxCharBuffer(const CharType *str = nullptr); wxCharBuffer(size_t len); wxCharBuffer(const wxCStrData& cstr); }; @@ -269,7 +269,7 @@ public: wxWCharBuffer(const wxCharTypeBufferBase& buf); wxWCharBuffer(const wxScopedCharTypeBufferBase& buf); - wxWCharBuffer(const CharType *str = NULL); + wxWCharBuffer(const CharType *str = nullptr); wxWCharBuffer(size_t len); wxWCharBuffer(const wxCStrData& cstr); }; diff --git a/interface/wx/busyinfo.h b/interface/wx/busyinfo.h index 5334bb0f6a..209901be35 100644 --- a/interface/wx/busyinfo.h +++ b/interface/wx/busyinfo.h @@ -109,7 +109,7 @@ public: @note If @a parent is not @NULL you must ensure that it is not closed while the busy info is shown. */ - wxBusyInfo(const wxString& msg, wxWindow* parent = NULL); + wxBusyInfo(const wxString& msg, wxWindow* parent = nullptr); /** Update the information text. diff --git a/interface/wx/button.h b/interface/wx/button.h index a7c2e87c81..1d04e25964 100644 --- a/interface/wx/button.h +++ b/interface/wx/button.h @@ -187,7 +187,7 @@ public: The optional @a win argument is new since wxWidgets 3.1.3 and allows to get a per-monitor DPI specific size. */ - static wxSize GetDefaultSize(wxWindow* win = NULL); + static wxSize GetDefaultSize(wxWindow* win = nullptr); /** Returns the string label for the button. diff --git a/interface/wx/calctrl.h b/interface/wx/calctrl.h index cc37ea5433..b66940b0ac 100644 --- a/interface/wx/calctrl.h +++ b/interface/wx/calctrl.h @@ -448,8 +448,8 @@ public: Not implemented in wxGTK currently. */ virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, - wxDateTime* date = NULL, - wxDateTime::WeekDay* wd = NULL); + wxDateTime* date = nullptr, + wxDateTime::WeekDay* wd = nullptr); /** Clears any attributes associated with the given day (in the range @@ -553,11 +553,11 @@ public: @see SetDateRange() @param lowerdate - If non-@NULL, the value of the low limit for the dates shown by the + If non-null, the value of the low limit for the dates shown by the control is returned (which may be ::wxDefaultDateTime if no limit is set). @param upperdate - If non-@NULL, the value of the upper limit for the dates shown by + If non-null, the value of the upper limit for the dates shown by the control is returned (which may be ::wxDefaultDateTime if no limit is set). @return diff --git a/interface/wx/checklst.h b/interface/wx/checklst.h index a0d03fa2ba..a9488a84d8 100644 --- a/interface/wx/checklst.h +++ b/interface/wx/checklst.h @@ -70,7 +70,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listBox"); @@ -113,7 +113,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int nStrings = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); diff --git a/interface/wx/choicdlg.h b/interface/wx/choicdlg.h index eb2bce99ac..6f8d9e5b94 100644 --- a/interface/wx/choicdlg.h +++ b/interface/wx/choicdlg.h @@ -187,7 +187,7 @@ public: wxSingleChoiceDialog(wxWindow* parent, const wxString& message, const wxString& caption, int n, const wxString* choices, - void** clientData = NULL, + void** clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); /** @@ -223,7 +223,7 @@ public: const wxString& message, const wxString& caption, const wxArrayString& choices, - void** clientData = NULL, + void** clientData = nullptr, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); ///@} @@ -278,7 +278,7 @@ public: int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& aChoices, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -290,7 +290,7 @@ int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int n, const wxString& choices[], - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -303,13 +303,13 @@ int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int n, const wxString *choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); ///@} /** @addtogroup group_funcmacro_dialog */ @@ -338,7 +338,7 @@ int wxGetSingleChoiceIndex(const wxString& message, wxString wxGetSingleChoice(const wxString& message, const wxString& caption, const wxArrayString& aChoices, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -349,7 +349,7 @@ wxString wxGetSingleChoice(const wxString& message, const wxString& caption, int n, const wxString& choices[], - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -362,13 +362,13 @@ wxString wxGetSingleChoice(const wxString& message, const wxString& caption, const wxArrayString& choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); wxString wxGetSingleChoice(const wxString& message, const wxString& caption, int n, const wxString *choices, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); ///@} @@ -391,7 +391,7 @@ wxString wxGetSingleChoiceData(const wxString& message, const wxString& caption, const wxArrayString& aChoices, const wxString& client_data[], - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -404,7 +404,7 @@ wxString wxGetSingleChoiceData(const wxString& message, int n, const wxString& choices[], const wxString& client_data[], - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -417,14 +417,14 @@ void* wxGetSingleChoiceData(const wxString& message, const wxArrayString& choices, void **client_data, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); void* wxGetSingleChoiceData(const wxString& message, const wxString& caption, int n, const wxString *choices, void **client_data, int initialSelection, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); ///@} @@ -458,7 +458,7 @@ int wxGetSelectedChoices(wxArrayInt& selections, const wxString& message, const wxString& caption, const wxArrayString& aChoices, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, @@ -470,7 +470,7 @@ int wxGetSelectedChoices(wxArrayInt& selections, const wxString& caption, int n, const wxString& choices[], - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true, diff --git a/interface/wx/choice.h b/interface/wx/choice.h index da1a641894..24351b32b9 100644 --- a/interface/wx/choice.h +++ b/interface/wx/choice.h @@ -73,7 +73,7 @@ public: wxChoice( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr ); @@ -125,7 +125,7 @@ public: bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr ); diff --git a/interface/wx/clrpicker.h b/interface/wx/clrpicker.h index eca202adba..f674ece4c5 100644 --- a/interface/wx/clrpicker.h +++ b/interface/wx/clrpicker.h @@ -88,7 +88,7 @@ public: Creates a colour picker with the given arguments. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param colour diff --git a/interface/wx/cmdline.h b/interface/wx/cmdline.h index 42dc514c10..af65d1c8ab 100644 --- a/interface/wx/cmdline.h +++ b/interface/wx/cmdline.h @@ -717,7 +717,7 @@ public: { wxCMD_LINE_OPTION, "s", "size", "output block size", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "d", "date", "output file date", wxCMD_LINE_VAL_DATE }, - { wxCMD_LINE_PARAM, NULL, NULL, "input file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE }, + { wxCMD_LINE_PARAM, nullptr, nullptr, "input file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE }, { wxCMD_LINE_NONE } }; diff --git a/interface/wx/collpane.h b/interface/wx/collpane.h index 545c13b6d8..2fab0cebd3 100644 --- a/interface/wx/collpane.h +++ b/interface/wx/collpane.h @@ -127,7 +127,7 @@ public: /** @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param label diff --git a/interface/wx/colordlg.h b/interface/wx/colordlg.h index d2c52f63dc..d41ce3f30e 100644 --- a/interface/wx/colordlg.h +++ b/interface/wx/colordlg.h @@ -66,7 +66,7 @@ public: @see wxColourData */ - wxColourDialog(wxWindow* parent, const wxColourData* data = NULL); + wxColourDialog(wxWindow* parent, const wxColourData* data = nullptr); /** Destructor. @@ -76,7 +76,7 @@ public: /** Same as wxColourDialog(). */ - bool Create(wxWindow* parent, const wxColourData* data = NULL); + bool Create(wxWindow* parent, const wxColourData* data = nullptr); /** Returns the colour data associated with the colour dialog. @@ -161,7 +161,7 @@ wxEventType wxEVT_COLOUR_CHANGED; wxColour wxGetColourFromUser(wxWindow* parent, const wxColour& colInit, const wxString& caption = wxEmptyString, - wxColourData* data = NULL); + wxColourData* data = nullptr); ///@} diff --git a/interface/wx/combo.h b/interface/wx/combo.h index c5b8b9969f..74bcbe980a 100644 --- a/interface/wx/combo.h +++ b/interface/wx/combo.h @@ -77,13 +77,13 @@ public: When item matches an entry, but the entry's string representation is not exactly the same (case mismatch, for example), then the true item string should be written back to here, if it is not - a NULL pointer. + @NULL. @remarks Default implementation always return true and does not alter trueItem. */ - virtual bool FindItem(const wxString& item, wxString* trueItem=NULL); + virtual bool FindItem(const wxString& item, wxString* trueItem = nullptr); /** The derived class may implement this to return adjusted size for the diff --git a/interface/wx/combobox.h b/interface/wx/combobox.h index 35c069c3de..c541cff7f7 100644 --- a/interface/wx/combobox.h +++ b/interface/wx/combobox.h @@ -128,7 +128,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); @@ -184,7 +184,7 @@ public: const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = (const wxString *) NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); diff --git a/interface/wx/convauto.h b/interface/wx/convauto.h index 324b5b24e7..81e30b95c8 100644 --- a/interface/wx/convauto.h +++ b/interface/wx/convauto.h @@ -166,12 +166,12 @@ public: Return a pointer to the characters that makes up this BOM. The returned character count is 2, 3 or 4, or undefined if the return - value is NULL. + value is @NULL. @param bom A valid BOM type, i.e. not wxBOM_Unknown or wxBOM_None. @param count - A non-@NULL pointer receiving the number of characters in this BOM. + A non-null pointer receiving the number of characters in this BOM. @return Pointer to characters composing the BOM or @NULL if BOM is unknown or invalid. Notice that the returned string is not NUL-terminated diff --git a/interface/wx/cshelp.h b/interface/wx/cshelp.h index 3014a6de82..1827f1227f 100644 --- a/interface/wx/cshelp.h +++ b/interface/wx/cshelp.h @@ -142,7 +142,7 @@ public: Note that the instance doesn't own the help controller. The help controller should be deleted separately. */ - wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL); + wxHelpControllerHelpProvider(wxHelpControllerBase* hc = nullptr); /** Returns the help controller associated with this help provider. @@ -199,7 +199,7 @@ public: If @a window is @NULL, the top window is used. */ - wxContextHelp(wxWindow* window = NULL, bool doNow = true); + wxContextHelp(wxWindow* window = nullptr, bool doNow = true); /** Destroys the context help object. diff --git a/interface/wx/cursor.h b/interface/wx/cursor.h index f8bb6e9883..a2908742a4 100644 --- a/interface/wx/cursor.h +++ b/interface/wx/cursor.h @@ -114,7 +114,7 @@ public: */ wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, - const char maskBits[] = NULL); + const char maskBits[] = nullptr); /** Constructs a cursor by passing a string resource name or filename. diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 653ad43127..b722a430c5 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1398,7 +1398,7 @@ public: Call this to ensure that the given item is visible. */ virtual void EnsureVisible(const wxDataViewItem& item, - const wxDataViewColumn* column = NULL); + const wxDataViewColumn* column = nullptr); /** Expands the item. @@ -1470,7 +1470,7 @@ public: item (as opposed to being on the item as a whole), then this is the column that the focus is on. - Returns NULL if no column currently has focus. + Returns @NULL if no column currently has focus. @see GetCurrentItem() @@ -1496,12 +1496,12 @@ public: @param item A valid item. @param col - If non-@NULL, the rectangle returned corresponds to the + If non-null, the rectangle returned corresponds to the intersection of the item with the specified column. If @NULL, the rectangle spans all the columns. */ virtual wxRect GetItemRect(const wxDataViewItem& item, - const wxDataViewColumn* col = NULL) const; + const wxDataViewColumn* col = nullptr) const; /** Returns the window corresponding to the main area of the control. @@ -3100,14 +3100,14 @@ public: after adding any items to the control (or, conversely, items must not be added before the columns are set up). */ - void AppendItem( const wxVector &values, wxUIntPtr data = NULL ); + void AppendItem( const wxVector &values, wxUIntPtr data = nullptr ); /** Prepends an item (i.e.\ a row) to the control. See remarks for AppendItem() for preconditions of this method. */ - void PrependItem( const wxVector &values, wxUIntPtr data = NULL ); + void PrependItem( const wxVector &values, wxUIntPtr data = nullptr ); /** Inserts an item (i.e.\ a row) to the control. @@ -3117,7 +3117,7 @@ public: Additionally, @a row must be less than or equal to the current number of items in the control (see GetItemCount()). */ - void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = NULL ); + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = nullptr ); /** Delete the row at position @a row. @@ -3260,7 +3260,7 @@ public: const wxString& text, int icon = -1, int expanded = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Appends an item to the given @a parent. @@ -3268,7 +3268,7 @@ public: wxDataViewItem AppendItem(const wxDataViewItem& parent, const wxString& text, int icon = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Creates the control and a wxDataViewTreeStore as its internal model. @@ -3357,7 +3357,7 @@ public: const wxString& text, int icon = -1, int expanded = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Calls the same method from wxDataViewTreeStore but uses @@ -3367,7 +3367,7 @@ public: const wxDataViewItem& previous, const wxString& text, int icon = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Returns true if item is a container. @@ -3382,7 +3382,7 @@ public: const wxString& text, int icon = -1, int expanded = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Calls the same method from wxDataViewTreeStore but uses @@ -3391,7 +3391,7 @@ public: wxDataViewItem PrependItem(const wxDataViewItem& parent, const wxString& text, int icon = -1, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Sets the image list. @@ -3489,7 +3489,7 @@ public: in number and type. No (default) values are filled in automatically. */ - void AppendItem( const wxVector &values, wxUIntPtr data = NULL ); + void AppendItem( const wxVector &values, wxUIntPtr data = nullptr ); /** Prepends an item (=row) and fills it with @a values. @@ -3498,7 +3498,7 @@ public: in number and type. No (default) values are filled in automatically. */ - void PrependItem( const wxVector &values, wxUIntPtr data = NULL ); + void PrependItem( const wxVector &values, wxUIntPtr data = nullptr ); /** Inserts an item (=row) and fills it with @a values. @@ -3507,7 +3507,7 @@ public: in number and type. No (default) values are filled in automatically. */ - void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = NULL ); + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = nullptr ); /** Delete the item (=row) at position @a pos. @@ -3602,7 +3602,7 @@ public: const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), const wxBitmapBundle& expanded = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Append an item. @@ -3610,7 +3610,7 @@ public: wxDataViewItem AppendItem(const wxDataViewItem& parent, const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Delete all item in the model. @@ -3666,7 +3666,7 @@ public: const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), const wxBitmapBundle& expanded = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Inserts an item after @a previous. @@ -3675,7 +3675,7 @@ public: const wxDataViewItem& previous, const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Inserts a container before the first child item or @a parent. @@ -3684,7 +3684,7 @@ public: const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), const wxBitmapBundle& expanded = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Inserts an item before the first child item or @a parent. @@ -3692,7 +3692,7 @@ public: wxDataViewItem PrependItem(const wxDataViewItem& parent, const wxString& text, const wxBitmapBundle& icon = wxBitmapBundle(), - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Sets the client data associated with the item. diff --git a/interface/wx/datectrl.h b/interface/wx/datectrl.h index 84ec717924..a6bacc8033 100644 --- a/interface/wx/datectrl.h +++ b/interface/wx/datectrl.h @@ -106,7 +106,7 @@ public: constructor. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param dt diff --git a/interface/wx/datetime.h b/interface/wx/datetime.h index 4b2e32911e..1d723c82a4 100644 --- a/interface/wx/datetime.h +++ b/interface/wx/datetime.h @@ -977,7 +977,7 @@ public: Will be filled with the iterator pointing to the location where the parsing stopped if the function returns @true. If the entire string was consumed, it is set to @c date.end(). Notice that this argument - must be non-@NULL. + must be non-null. @return @true if at least part of the string was parsed successfully, @false otherwise. diff --git a/interface/wx/dc.h b/interface/wx/dc.h index 763daaf5bd..8095d867cd 100644 --- a/interface/wx/dc.h +++ b/interface/wx/dc.h @@ -514,7 +514,7 @@ public: void DrawLabel(const wxString& text, const wxBitmap& bitmap, const wxRect& rect, int alignment = wxALIGN_LEFT | wxALIGN_TOP, - int indexAccel = -1, wxRect* rectBounding = NULL); + int indexAccel = -1, wxRect* rectBounding = nullptr); /** @overload @@ -885,16 +885,16 @@ public: @remarks Clipping region is given in logical coordinates. - @param x If non-@NULL, filled in with the logical horizontal coordinate + @param x If non-null, filled in with the logical horizontal coordinate of the top left corner of the clipping region if the function returns true or 0 otherwise. - @param y If non-@NULL, filled in with the logical vertical coordinate + @param y If non-null, filled in with the logical vertical coordinate of the top left corner of the clipping region if the function returns true or 0 otherwise. - @param width If non-@NULL, filled in with the width of the clipping + @param width If non-null, filled in with the width of the clipping region if the function returns true or the device context width otherwise. - @param height If non-@NULL, filled in with the height of the clipping + @param height If non-null, filled in with the height of the clipping region if the function returns true or the device context height otherwise. @return @true if there is a clipping region or @false if there is no @@ -1014,8 +1014,8 @@ public: */ void GetMultiLineTextExtent(const wxString& string, wxCoord* w, wxCoord* h, - wxCoord* heightLine = NULL, - const wxFont* font = NULL) const; + wxCoord* heightLine = nullptr, + const wxFont* font = nullptr) const; /** Gets the dimensions of the string using the currently selected font. @a string is the text string to measure. @@ -1078,9 +1078,9 @@ public: GetMultiLineTextExtent() */ void GetTextExtent(const wxString& string, wxCoord* w, wxCoord* h, - wxCoord* descent = NULL, - wxCoord* externalLeading = NULL, - const wxFont* font = NULL) const; + wxCoord* descent = nullptr, + wxCoord* externalLeading = nullptr, + const wxFont* font = nullptr) const; /** @overload @@ -1823,7 +1823,7 @@ public: For example, on Windows the return value is an HDC, on macOS it is a CGContextRef and on wxGTK it will be a GdkDrawable. If the DC is a wxGCDC then the return value will be the value returned from - wxGraphicsContext::GetNativeContext. A value of NULL is returned if + wxGraphicsContext::GetNativeContext. A value of @NULL is returned if the DC does not have anything that fits the handle concept. @since 2.9.5 @@ -1834,7 +1834,7 @@ public: /** If supported by the platform and the type of DC, fetch the contents of the DC, or a subset of it, as a bitmap. */ - wxBitmap GetAsBitmap(const wxRect *subrect = NULL) const; + wxBitmap GetAsBitmap(const wxRect *subrect = nullptr) const; /** diff --git a/interface/wx/dcscreen.h b/interface/wx/dcscreen.h index a71cf2fd85..0e11afb8d6 100644 --- a/interface/wx/dcscreen.h +++ b/interface/wx/dcscreen.h @@ -80,6 +80,6 @@ public: that this function allows the screen to be refreshed afterwards, may be useful to some applications. */ - static bool StartDrawingOnTop(wxRect* rect = NULL); + static bool StartDrawingOnTop(wxRect* rect = nullptr); }; diff --git a/interface/wx/dcsvg.h b/interface/wx/dcsvg.h index d6ebf8f788..ec5d10f03d 100644 --- a/interface/wx/dcsvg.h +++ b/interface/wx/dcsvg.h @@ -83,7 +83,7 @@ public: or derive your own bitmap handler class and use it if you need to customize the bitmap handling further. - @param handler The new bitmap handler. If non-NULL, this object takes + @param handler The new bitmap handler. If non-null, this object takes ownership of this handler and will delete it when it is not needed any more. diff --git a/interface/wx/dialog.h b/interface/wx/dialog.h index f383d8acbf..d970d6b01b 100644 --- a/interface/wx/dialog.h +++ b/interface/wx/dialog.h @@ -273,7 +273,7 @@ public: @since 2.9.2 - @param sizer The sizer to wrap, must be non-@NULL. + @param sizer The sizer to wrap, must be non-null. @return The sizer wrapping the input one or possibly the input sizer itself if no wrapping is necessary. */ diff --git a/interface/wx/dir.h b/interface/wx/dir.h index 977c57bf01..ea4060f64b 100644 --- a/interface/wx/dir.h +++ b/interface/wx/dir.h @@ -302,7 +302,7 @@ public: @see wxFileName::GetHumanReadableSize(), wxGetDiskSpace() */ static wxULongLong GetTotalSize(const wxString& dir, - wxArrayString* filesSkipped = NULL); + wxArrayString* filesSkipped = nullptr); /** Returns @true if the directory contains any files matching the given diff --git a/interface/wx/dirdlg.h b/interface/wx/dirdlg.h index 132c76d000..759b2b7ea4 100644 --- a/interface/wx/dirdlg.h +++ b/interface/wx/dirdlg.h @@ -66,7 +66,7 @@ const char wxDirDialogNameStr[] = "wxDirCtrl"; wxDD_DEFAULT_STYLE unless you explicitly need to use the old dialog version under Windows. E.g. do @code - wxDirDialog dlg(NULL, "Choose input directory", "", + wxDirDialog dlg(nullptr, "Choose input directory", "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); @endcode instead of just using @c wxDD_DIR_MUST_EXIST style alone. @@ -186,7 +186,7 @@ wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, const wxString& default_path = wxEmptyString, long style = 0, const wxPoint& pos = wxDefaultPosition, - wxWindow* parent = NULL); + wxWindow* parent = nullptr); ///@} diff --git a/interface/wx/dnd.h b/interface/wx/dnd.h index a832580aec..98a7c477b8 100644 --- a/interface/wx/dnd.h +++ b/interface/wx/dnd.h @@ -56,7 +56,7 @@ public: /** Constructor. @a data is the data to be associated with the drop target. */ - wxDropTarget(wxDataObject* data = NULL); + wxDropTarget(wxDataObject* data = nullptr); /** Destructor. Deletes the associated data object, if any. @@ -194,7 +194,7 @@ public: @param iconNone The icon or cursor used for feedback when operation can't be done. */ - wxDropSource(wxWindow* win = NULL, + wxDropSource(wxWindow* win = nullptr, const wxCursor& iconCopy = wxNullCursor, const wxCursor& iconMove = wxNullCursor, const wxCursor& iconNone = wxNullCursor); @@ -220,7 +220,7 @@ public: @param iconNone The icon or cursor used for feedback when operation can't be done. */ - wxDropSource(wxDataObject& data, wxWindow* win = NULL, + wxDropSource(wxDataObject& data, wxWindow* win = nullptr, const wxCursor& iconCopy = wxNullCursor, const wxCursor& iconMove = wxNullCursor, const wxCursor& iconNone = wxNullCursor); @@ -242,7 +242,7 @@ public: @param iconNone The icon or cursor used for feedback when operation can't be done. */ - wxDropSource(wxWindow* win = NULL, + wxDropSource(wxWindow* win = nullptr, const wxIcon& iconCopy = wxNullIcon, const wxIcon& iconMove = wxNullIcon, const wxIcon& iconNone = wxNullIcon); @@ -266,7 +266,7 @@ public: @param iconNone The icon or cursor used for feedback when operation can't be done. */ - wxDropSource(wxDataObject& data, wxWindow* win = NULL, + wxDropSource(wxDataObject& data, wxWindow* win = nullptr, const wxIcon& iconCopy = wxNullIcon, const wxIcon& iconMove = wxNullIcon, const wxIcon& iconNone = wxNullIcon); diff --git a/interface/wx/docview.h b/interface/wx/docview.h index b34508629b..7fdfc68cbb 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -433,7 +433,7 @@ public: changes. @param doc - The document to close, must be non-@NULL. + The document to close, must be non-null. @param force If @true, close the document even if wxDocument::Close() returns @false. @@ -1239,12 +1239,12 @@ public: application-specific data. @param parent - Specifying a non-@c NULL parent document here makes this document a + Specifying a non-null parent document here makes this document a special child document, see their description in the class documentation. Notice that this parameter exists but is ignored in wxWidgets versions prior to 2.9.1. */ - wxDocument(wxDocument* parent = NULL); + wxDocument(wxDocument* parent = nullptr); /** Destructor. Removes itself from the document manager. @@ -1660,11 +1660,11 @@ public: void SetTitle(const wxString& title); /** - Updates all views. If @a sender is non-@NULL, does not update this + Updates all views. If @a sender is non-null, does not update this view. @a hint represents optional information to allow a view to optimize its update. */ - virtual void UpdateAllViews(wxView* sender = NULL, wxObject* hint = NULL); + virtual void UpdateAllViews(wxView* sender = nullptr, wxObject* hint = nullptr); protected: /** diff --git a/interface/wx/dragimag.h b/interface/wx/dragimag.h index 49d11fa101..c6752abd95 100644 --- a/interface/wx/dragimag.h +++ b/interface/wx/dragimag.h @@ -109,14 +109,14 @@ public: screen, or over as much of the screen as is specified by rect. Note that the mouse will still be captured in window. @param rect - If non-@NULL, specifies the rectangle (in screen coordinates) that + If non-null, specifies the rectangle (in screen coordinates) that bounds the dragging operation. Specifying this can make the operation more efficient by cutting down on the area under consideration, and it can also make a visual difference since the drag is clipped to this area. */ bool BeginDrag(const wxPoint& hotspot, wxWindow* window, - bool fullScreen = false, wxRect* rect = NULL); + bool fullScreen = false, wxRect* rect = nullptr); /** Start dragging the image, using the first window to capture the mouse and the second to specify the bounding area. This form is equivalent to diff --git a/interface/wx/dynlib.h b/interface/wx/dynlib.h index 0d2a1ac329..8fd95045ee 100644 --- a/interface/wx/dynlib.h +++ b/interface/wx/dynlib.h @@ -232,7 +232,7 @@ public: @since 3.1.0 */ - static void* GetModuleFromAddress(const void* addr, wxString* path = NULL); + static void* GetModuleFromAddress(const void* addr, wxString* path = nullptr); /** Loads DLL with the given @a name into memory. The @a flags argument can diff --git a/interface/wx/event.h b/interface/wx/event.h index cab6b10dc6..fe3f7cf47d 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -184,7 +184,7 @@ public: differences between the timestamps and not their absolute values usually make sense). @warning - wxWidgets returns a non-NULL timestamp only for mouse and key events + wxWidgets returns a valid timestamp only for mouse and key events (see wxMouseEvent and wxKeyEvent). */ long GetTimestamp() const; @@ -458,7 +458,7 @@ public: @param event A heap-allocated event to be queued, QueueEvent() takes ownership - of it. This parameter shouldn't be @c NULL. + of it. This parameter shouldn't be @NULL. */ virtual void QueueEvent(wxEvent *event); @@ -771,8 +771,8 @@ public: */ void Connect(int id, int lastId, wxEventType eventType, wxObjectEventFunction function, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); /** See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) @@ -793,8 +793,8 @@ public: */ void Connect(int id, wxEventType eventType, wxObjectEventFunction function, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); /** See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) @@ -809,8 +809,8 @@ public: */ void Connect(wxEventType eventType, wxObjectEventFunction function, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); /** Disconnects the given function dynamically from the event handler, using the @@ -836,8 +836,8 @@ public: */ bool Disconnect(wxEventType eventType, wxObjectEventFunction function, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); /** See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) @@ -851,9 +851,9 @@ public: */ bool Disconnect(int id = wxID_ANY, wxEventType eventType = wxEVT_NULL, - wxObjectEventFunction function = NULL, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObjectEventFunction function = nullptr, + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); /** See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) @@ -868,9 +868,9 @@ public: */ bool Disconnect(int id, int lastId, wxEventType eventType, - wxObjectEventFunction function = NULL, - wxObject* userData = NULL, - wxEvtHandler* eventSink = NULL); + wxObjectEventFunction function = nullptr, + wxObject* userData = nullptr, + wxEvtHandler* eventSink = nullptr); ///@} @@ -919,7 +919,7 @@ public: Functor functor, int id = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL); + wxObject *userData = nullptr); /** See the Bind<>(const EventTag&, Functor, int, int, wxObject*) overload for @@ -959,7 +959,7 @@ public: EventHandler *handler, int id = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL); + wxObject *userData = nullptr); /** Unbinds the given function, functor or method dynamically from the event handler, using the specified parameters as search criteria and @@ -998,7 +998,7 @@ public: Functor functor, int id = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL); + wxObject *userData = nullptr); /** See the Unbind<>(const EventTag&, Functor, int, int, wxObject*) @@ -1031,7 +1031,7 @@ public: EventHandler *handler, int id = wxID_ANY, int lastId = wxID_ANY, - wxObject *userData = NULL ); + wxObject *userData = nullptr ); ///@} /** @name User-supplied data @@ -2158,7 +2158,7 @@ public: /** Constructor. */ - wxWindowCreateEvent(wxWindow* win = NULL); + wxWindowCreateEvent(wxWindow* win = nullptr); /// Return the window being created. wxWindow *GetWindow() const; @@ -3052,7 +3052,7 @@ public: Constructor. */ wxDropFilesEvent(wxEventType id = 0, int noFiles = 0, - wxString* files = NULL); + wxString* files = nullptr); /** Returns an array of filenames. @@ -3242,7 +3242,7 @@ public: /** Constructor. */ - wxEraseEvent(int id = 0, wxDC* dc = NULL); + wxEraseEvent(int id = 0, wxDC* dc = nullptr); /** Returns the device context associated with the erase event to draw on. @@ -3336,7 +3336,7 @@ public: The direct child which is (or which contains the window which is) receiving the focus. */ - wxChildFocusEvent(wxWindow* win = NULL); + wxChildFocusEvent(wxWindow* win = nullptr); /** Returns the direct child which receives the focus, or a (grand-)parent of the @@ -4322,7 +4322,7 @@ public: /** Constructor. */ - wxWindowDestroyEvent(wxWindow* win = NULL); + wxWindowDestroyEvent(wxWindow* win = nullptr); /// Return the window being destroyed. wxWindow *GetWindow() const; @@ -4449,7 +4449,7 @@ public: Constructor. */ wxMouseCaptureChangedEvent(wxWindowID windowId = 0, - wxWindow* gainedCapture = NULL); + wxWindow* gainedCapture = nullptr); /** Returns the window that gained the capture, or @NULL if it was a @@ -4633,7 +4633,7 @@ public: /** Constructor. */ - wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0, wxMenu* menu = NULL); + wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0, wxMenu* menu = nullptr); /** Returns the menu which is being opened or closed, or the menu containing @@ -5119,9 +5119,9 @@ void wxPostEvent(wxEvtHandler* dest, const wxEvent& event); @header{wx/event.h} @param dest - The object to queue the event on, can't be @c NULL. + The object to queue the event on, can't be @NULL. @param event - The heap-allocated and non-@c NULL event to queue, the function takes + The heap-allocated and non-null event to queue, the function takes ownership of it. */ void wxQueueEvent(wxEvtHandler* dest, wxEvent *event); diff --git a/interface/wx/fdrepdlg.h b/interface/wx/fdrepdlg.h index eca36e5246..7ebd52c77f 100644 --- a/interface/wx/fdrepdlg.h +++ b/interface/wx/fdrepdlg.h @@ -184,7 +184,7 @@ public: /** After using default constructor Create() must be called. - The @a parent and @a data parameters must be non-@NULL. + The @a parent and @a data parameters must be non-null. */ wxFindReplaceDialog(wxWindow* parent, wxFindReplaceData* data, @@ -199,7 +199,7 @@ public: /** Creates the dialog; use wxWindow::Show to show it on screen. - The @a parent and @a data parameters must be non-@NULL. + The @a parent and @a data parameters must be non-null. */ bool Create(wxWindow* parent, wxFindReplaceData* data, const wxString& title, int style = 0); diff --git a/interface/wx/filectrl.h b/interface/wx/filectrl.h index 5e8be8e802..d9ef949ab1 100644 --- a/interface/wx/filectrl.h +++ b/interface/wx/filectrl.h @@ -71,7 +71,7 @@ public: Constructs the window. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param defaultDirectory diff --git a/interface/wx/filedlg.h b/interface/wx/filedlg.h index e2861be011..b6c4391708 100644 --- a/interface/wx/filedlg.h +++ b/interface/wx/filedlg.h @@ -527,7 +527,7 @@ wxString wxFileSelector(const wxString& message, const wxString& default_extension = wxEmptyString, const wxString& wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); @@ -539,10 +539,10 @@ wxString wxFileSelector(const wxString& message, wxString wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr, const wxString& default_path = wxEmptyString, const wxString& default_filename = wxEmptyString, - int *indexDefaultExtension = NULL, + int *indexDefaultExtension = nullptr, const wxString& wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); @@ -556,7 +556,7 @@ wxString wxFileSelectorEx(const wxString& message = wxFileSelectorPromptStr, wxString wxLoadFileSelector(const wxString& what, const wxString& extension, const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); /** Shows a file dialog asking the user for a file name for saving a file. @@ -568,7 +568,7 @@ wxString wxLoadFileSelector(const wxString& what, wxString wxSaveFileSelector(const wxString& what, const wxString& extension, const wxString& default_name = wxEmptyString, - wxWindow *parent = NULL); + wxWindow *parent = nullptr); ///@} diff --git a/interface/wx/filedlgcustomize.h b/interface/wx/filedlgcustomize.h index 818eedc878..7929dcd57b 100644 --- a/interface/wx/filedlgcustomize.h +++ b/interface/wx/filedlgcustomize.h @@ -240,7 +240,7 @@ public: @param n The number of strings, must be positive, as there is no way to add more strings later and creating an empty combobox is not very useful. - @param strings A non-@NULL pointer to an array of @a n strings. + @param strings A non-null pointer to an array of @a n strings. */ wxFileDialogChoice* AddChoice(size_t n, const wxString* strings); @@ -324,7 +324,7 @@ public: void SomeFunc() { - wxFileDialog dialog(NULL, "Save document", wxString(), "file.my", + wxFileDialog dialog(nullptr, "Save document", wxString(), "file.my", "My files (*.my)|*.my", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); diff --git a/interface/wx/filefn.h b/interface/wx/filefn.h index fe71a3c360..1f2ea4a9ba 100644 --- a/interface/wx/filefn.h +++ b/interface/wx/filefn.h @@ -199,7 +199,7 @@ bool wxDirExists(const wxString& dirname); separators under Windows, however it will not consider backslashes as path separators under Unix (where backslash is a valid character in a filename). - On entry, @a fullname should be non-@NULL (it may be empty though). + On entry, @a fullname should be non-null (it may be empty though). On return, @a path contains the file path (without the trailing separator), @a name contains the file name and @c ext contains the file extension @@ -285,7 +285,7 @@ bool wxMatchWild(const wxString& pattern, @header{wx/filefn.h} */ -wxString wxGetWorkingDirectory(char* buf = NULL, int sz = 1000); +wxString wxGetWorkingDirectory(char* buf = nullptr, int sz = 1000); /** Returns the directory part of the filename. @@ -527,7 +527,7 @@ char* wxFileNameFromPath(char* path); @header{wx/filefn.h} */ -char* wxGetTempFileName(const wxString& prefix, char* buf = NULL); +char* wxGetTempFileName(const wxString& prefix, char* buf = nullptr); bool wxGetTempFileName(const wxString& prefix, wxString& buf); ///@} diff --git a/interface/wx/filename.h b/interface/wx/filename.h index 1b8eb63f91..45cfba03fe 100644 --- a/interface/wx/filename.h +++ b/interface/wx/filename.h @@ -525,14 +525,14 @@ public: @return The full temporary filepath, or an empty string on error. */ static wxString CreateTempFileName(const wxString& prefix, - wxFile* fileTemp = NULL); + wxFile* fileTemp = nullptr); /** This is the same as CreateTempFileName(const wxString &prefix, wxFile *fileTemp) but takes a wxFFile parameter instead of wxFile. */ static wxString CreateTempFileName(const wxString& prefix, - wxFFile* fileTemp = NULL); + wxFFile* fileTemp = nullptr); /** @@ -1423,7 +1423,7 @@ public: wxString* path, wxString* name, wxString* ext, - bool* hasExt = NULL, + bool* hasExt = nullptr, wxPathFormat format = wxPATH_NATIVE); static void SplitPath(const wxString& fullpath, wxString* volume, diff --git a/interface/wx/filepicker.h b/interface/wx/filepicker.h index c7e3d01438..2ef54113a9 100644 --- a/interface/wx/filepicker.h +++ b/interface/wx/filepicker.h @@ -102,7 +102,7 @@ public: Creates this widget with the given parameters. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param path @@ -255,7 +255,7 @@ public: Creates the widgets with the given parameters. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param path diff --git a/interface/wx/fontpicker.h b/interface/wx/fontpicker.h index 6968b884bc..72fe86d29a 100644 --- a/interface/wx/fontpicker.h +++ b/interface/wx/fontpicker.h @@ -76,7 +76,7 @@ public: Creates this widget with given parameters. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param font diff --git a/interface/wx/frame.h b/interface/wx/frame.h index 685c65e5b8..2b922022ea 100644 --- a/interface/wx/frame.h +++ b/interface/wx/frame.h @@ -101,7 +101,7 @@ window manager supports _NET_WM_STATE_SKIP_TASKBAR hint. @style{wxFRAME_FLOAT_ON_PARENT} The frame will always be on top of its parent (unlike wxSTAY_ON_TOP). - A frame created with this style must have a non-@NULL parent. + A frame created with this style must have a non-null parent. @style{wxFRAME_SHAPED} Windows with this style are allowed to have their shape changed with the SetShape() method. @@ -173,7 +173,7 @@ public: @param parent The window parent. This may be, and often is, @NULL. If it is - non-@NULL, the frame will be minimized when its parent is minimized + non-null, the frame will be minimized when its parent is minimized and restored when it is restored (although it will still be possible to minimize and restore just this frame itself). @param id @@ -483,7 +483,7 @@ public: Returns a wxTaskBarButton pointer representing the taskbar button of the window under Windows 7 or later. The returned wxTaskBarButton may be - used, if non-@c NULL, to access the functionality including thumbnail + used, if non-null, to access the functionality including thumbnail representations, thumbnail toolbars, notification and status overlays, and progress indicators. diff --git a/interface/wx/gbsizer.h b/interface/wx/gbsizer.h index 88a4354364..031e6baf89 100644 --- a/interface/wx/gbsizer.h +++ b/interface/wx/gbsizer.h @@ -88,10 +88,10 @@ public: */ wxSizerItem* Add(wxWindow* window, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, - int flag = 0, int border = 0, wxObject* userData = NULL); + int flag = 0, int border = 0, wxObject* userData = nullptr); wxSizerItem* Add(wxSizer* sizer, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, - int flag = 0, int border = 0, wxObject* userData = NULL); + int flag = 0, int border = 0, wxObject* userData = nullptr); wxSizerItem* Add(wxGBSizerItem* item); /** @@ -103,7 +103,7 @@ public: */ wxSizerItem* Add(int width, int height, const wxGBPosition& pos, const wxGBSpan& span = wxDefaultSpan, - int flag = 0, int border = 0, wxObject* userData = NULL); + int flag = 0, int border = 0, wxObject* userData = nullptr); ///@} /** @@ -120,9 +120,9 @@ public: for example it may be the item we are checking the position of. */ bool CheckForIntersection(wxGBSizerItem* item, - wxGBSizerItem* excludeItem = NULL); + wxGBSizerItem* excludeItem = nullptr); bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, - wxGBSizerItem* excludeItem = NULL); + wxGBSizerItem* excludeItem = nullptr); ///@} ///@{ @@ -239,19 +239,19 @@ public: */ wxGBSizerItem(int width, int height, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); /** Construct a sizer item for tracking a window. */ wxGBSizerItem(wxWindow* window, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); /** Construct a sizer item for tracking a subsizer. */ wxGBSizerItem(wxSizer* sizer, const wxGBPosition& pos, const wxGBSpan& span=wxDefaultSpan, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); /** Get the row and column of the endpoint of this item. diff --git a/interface/wx/generic/aboutdlgg.h b/interface/wx/generic/aboutdlgg.h index b3b348e3b8..8eece6a52c 100644 --- a/interface/wx/generic/aboutdlgg.h +++ b/interface/wx/generic/aboutdlgg.h @@ -59,12 +59,12 @@ public: /** Creates the dialog and initializes it with the given information. */ - wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = NULL); + wxGenericAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); /** Initializes the dialog created using the default constructor. */ - bool Create(const wxAboutDialogInfo& info, wxWindow* parent = NULL); + bool Create(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); protected: /** @@ -114,4 +114,4 @@ protected: This function does the same thing as wxAboutBox() except that it always uses the generic wxWidgets version of the dialog instead of the native one. */ -void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); +void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = nullptr); diff --git a/interface/wx/generic/helpext.h b/interface/wx/generic/helpext.h index 59d03baaac..64671958a7 100644 --- a/interface/wx/generic/helpext.h +++ b/interface/wx/generic/helpext.h @@ -34,7 +34,7 @@ class wxExtHelpController : public wxHelpControllerBase { public: - wxExtHelpController(wxWindow* parentWindow = NULL); + wxExtHelpController(wxWindow* parentWindow = nullptr); virtual ~wxExtHelpController(); /** @@ -147,8 +147,8 @@ public: /** Obtains the latest settings used by the help frame and the help frame. */ - virtual wxFrame *GetFrameParameters(wxSize *size = NULL, - wxPoint *pos = NULL, - bool *newFrameEachTime = NULL); + virtual wxFrame *GetFrameParameters(wxSize *size = nullptr, + wxPoint *pos = nullptr, + bool *newFrameEachTime = nullptr); }; diff --git a/interface/wx/glcanvas.h b/interface/wx/glcanvas.h index e4fa1204da..711e631ebe 100644 --- a/interface/wx/glcanvas.h +++ b/interface/wx/glcanvas.h @@ -511,8 +511,8 @@ public: driver defaults will be used. */ wxGLContext(wxGLCanvas* win, - const wxGLContext* other = NULL, - const wxGLContextAttrs* ctxAttrs = NULL); + const wxGLContext* other = nullptr, + const wxGLContextAttrs* ctxAttrs = nullptr); /** Checks if the underlying OpenGL rendering context was correctly created @@ -871,7 +871,7 @@ public: under most platforms. */ wxGLCanvas(wxWindow* parent, wxWindowID id = wxID_ANY, - const int* attribList = NULL, + const int* attribList = nullptr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index 1f1ea9e3fa..003c6a8b2d 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -1622,7 +1622,7 @@ public: For Cairo, this is the major,minor,micro version of the Cairo library which is returned. */ - virtual void GetVersion(int* major, int* minor = NULL, int* micro=NULL) const = 0; + virtual void GetVersion(int* major, int* minor = nullptr, int* micro = nullptr) const = 0; /** Returns the default renderer on this platform. On macOS this is the Core @@ -1831,9 +1831,9 @@ public: /** Returns the component values of the matrix via the argument pointers. */ - virtual void Get(wxDouble* a = NULL, wxDouble* b = NULL, - wxDouble* c = NULL, wxDouble* d = NULL, - wxDouble* tx = NULL, wxDouble* ty = NULL) const; + virtual void Get(wxDouble* a = nullptr, wxDouble* b = nullptr, + wxDouble* c = nullptr, wxDouble* d = nullptr, + wxDouble* tx = nullptr, wxDouble* ty = nullptr) const; /** Returns the native representation of the matrix. For CoreGraphics this diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 61a204b556..348e576731 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -668,7 +668,7 @@ public: Show or hide the edit control, use the specified attributes to set colours/fonts for it. */ - virtual void Show(bool show, wxGridCellAttr* attr = NULL); + virtual void Show(bool show, wxGridCellAttr* attr = nullptr); /** If the editor is enabled by clicking on the cell, this method will be @@ -905,7 +905,7 @@ public: array. */ wxGridCellChoiceEditor(size_t count = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, bool allowOthers = false); /** @@ -1246,7 +1246,7 @@ public: /** Default constructor. */ - explicit wxGridCellAttr(wxGridCellAttr* attrDefault = NULL); + explicit wxGridCellAttr(wxGridCellAttr* attrDefault = nullptr); /** Constructor specifying some of the often used attributes. @@ -1277,10 +1277,10 @@ public: this function, use GetNonDefaultAlignment() if this is not desirable. @param hAlign - Horizontal alignment is returned here if this argument is non-@NULL. + Horizontal alignment is returned here if this argument is non-null. It is one of wxALIGN_LEFT, wxALIGN_CENTRE or wxALIGN_RIGHT. @param vAlign - Vertical alignment is returned here if this argument is non-@NULL. + Vertical alignment is returned here if this argument is non-null. It is one of wxALIGN_TOP, wxALIGN_CENTRE or wxALIGN_BOTTOM. */ void GetAlignment(int* hAlign, int* vAlign) const; @@ -1737,7 +1737,7 @@ public: the cell attribute having the highest precedence. Notice that the caller must call DecRef() on the returned pointer if it - is non-@NULL. GetAttrPtr() method can be used to do this automatically. + is non-null. GetAttrPtr() method can be used to do this automatically. @param row The row of the cell. @@ -5363,7 +5363,7 @@ public: */ wxRect BlockToDeviceRect(const wxGridCellCoords& topLeft, const wxGridCellCoords& bottomRight, - const wxGridWindow *gridWindow = NULL) const; + const wxGridWindow *gridWindow = nullptr) const; /** Return the rectangle corresponding to the grid cell's size and position @@ -5468,7 +5468,7 @@ public: @return The column index or @c wxNOT_FOUND. */ - int XToCol(int x, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL) const; + int XToCol(int x, bool clipToMinMax = false, wxGridWindow *gridWindow = nullptr) const; /** Returns the column whose right hand edge is close to the given logical @@ -5487,7 +5487,7 @@ public: logical ones. The parameter @a gridWindow is new since wxWidgets 3.1.3. If it is - specified, i.e. non-@NULL, the coordinates must be in this window + specified, i.e. non-null, the coordinates must be in this window coordinate system and only the cells of this window are considered, i.e. the function returns @c wxNOT_FOUND if the coordinates are out of bounds. @@ -5497,10 +5497,10 @@ public: @see XToCol(), YToRow() */ - wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = NULL) const; + wxGridCellCoords XYToCell(int x, int y, wxGridWindow *gridWindow = nullptr) const; /// @overload - wxGridCellCoords XYToCell(const wxPoint& pos, wxGridWindow *gridWindow = NULL) const; + wxGridCellCoords XYToCell(const wxPoint& pos, wxGridWindow *gridWindow = nullptr) const; // XYToCell(int, int, wxGridCellCoords&) overload is intentionally // undocumented, using it is ugly and non-const reference parameters are @@ -5519,14 +5519,14 @@ public: The parameter @a gridWindow is new since wxWidgets 3.1.3. If it is - specified, i.e. non-@NULL, only the cells of this window are + specified, i.e. non-null, only the cells of this window are considered, i.e. the function returns @c wxNOT_FOUND if @a y is out of bounds. If @a gridWindow is @NULL, the function returns @c wxNOT_FOUND only if there is no row at all at the @a y position. */ - int YToRow(int y, bool clipToMinMax = false, wxGridWindow *gridWindow = NULL) const; + int YToRow(int y, bool clipToMinMax = false, wxGridWindow *gridWindow = nullptr) const; ///@} @@ -5946,11 +5946,11 @@ public: wxArrayInt CalcRowLabelsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; wxArrayInt CalcColLabelsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; wxGridCellCoordsArray CalcCellsExposed( const wxRegion& reg, - wxGridWindow *gridWindow = NULL) const; + wxGridWindow *gridWindow = nullptr) const; ///@} @@ -6240,13 +6240,13 @@ public: /** Creates an object preventing the updates of the specified @a grid. The parameter could be @NULL in which case nothing is done. If @a grid is - non-@NULL then the grid must exist for longer than this + non-null then the grid must exist for longer than this wxGridUpdateLocker object itself. The default constructor could be followed by a call to Create() to set the grid object later. */ - wxGridUpdateLocker(wxGrid* grid = NULL); + wxGridUpdateLocker(wxGrid* grid = nullptr); /** Destructor reenables updates for the grid this object is associated diff --git a/interface/wx/hashmap.h b/interface/wx/hashmap.h index 542a508f6c..f79a920959 100644 --- a/interface/wx/hashmap.h +++ b/interface/wx/hashmap.h @@ -31,7 +31,7 @@ // store and retrieve values h1[1] = new MyClass( 1 ); - h1[10000000] = NULL; + h1[10000000] = nullptr; h1[50000] = new MyClass( 2 ); h2["Bill"] = "ABC"; wxString tmp = h2["Bill"]; diff --git a/interface/wx/help.h b/interface/wx/help.h index 2c37fe076f..257d30ff4b 100644 --- a/interface/wx/help.h +++ b/interface/wx/help.h @@ -51,7 +51,7 @@ public: You can also change the parent window later with SetParentWindow(). */ - wxHelpControllerBase(wxWindow* parentWindow = NULL); + wxHelpControllerBase(wxWindow* parentWindow = nullptr); /** Destroys the help instance, closing down the viewer if it is running. @@ -130,9 +130,9 @@ public: @param newFrameEachTime @true if a new frame is drawn with each invocation. */ - virtual wxFrame* GetFrameParameters(wxSize* size = NULL, - wxPoint* pos = NULL, - bool* newFrameEachTime = NULL); + virtual wxFrame* GetFrameParameters(wxSize* size = nullptr, + wxPoint* pos = nullptr, + bool* newFrameEachTime = nullptr); /** Returns the window to be used as the parent for the help window. @@ -310,7 +310,7 @@ public: You can also change the parent window later with SetParentWindow(). */ - wxHelpController(wxWindow* parentWindow = NULL); + wxHelpController(wxWindow* parentWindow = nullptr); }; diff --git a/interface/wx/html/helpctrl.h b/interface/wx/html/helpctrl.h index bb3e1064a7..4873c5cbe7 100644 --- a/interface/wx/html/helpctrl.h +++ b/interface/wx/html/helpctrl.h @@ -95,7 +95,7 @@ public: This is an optional window to be used as the parent for the help window. */ wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, - wxWindow* parentWindow = NULL); + wxWindow* parentWindow = nullptr); wxHtmlHelpController(wxWindow* parentWindow, int style = wxHF_DEFAULT_STYLE); @@ -259,12 +259,12 @@ public: void SetHelpWindow(wxHtmlHelpWindow* helpWindow); /** - Returns the current help frame. (May be NULL.) + Returns the current help frame. (May be @NULL.) */ wxHtmlHelpFrame* GetFrame(); /** - Returns the current help dialog. (May be NULL.) + Returns the current help dialog. (May be @NULL.) */ wxHtmlHelpDialog* GetDialog(); diff --git a/interface/wx/html/helpdlg.h b/interface/wx/html/helpdlg.h index a42dbd0981..1cd0e65ce9 100644 --- a/interface/wx/html/helpdlg.h +++ b/interface/wx/html/helpdlg.h @@ -18,7 +18,7 @@ class wxHtmlHelpDialog : public wxDialog { public: - wxHtmlHelpDialog(wxHtmlHelpData* data = NULL); + wxHtmlHelpDialog(wxHtmlHelpData* data = nullptr); /** Constructor. @@ -28,7 +28,7 @@ public: wxHtmlHelpDialog(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, int style = wxHF_DEFAULT_STYLE, - wxHtmlHelpData* data = NULL); + wxHtmlHelpData* data = nullptr); /** You may override this virtual method to add more buttons to the help window's diff --git a/interface/wx/html/helpfrm.h b/interface/wx/html/helpfrm.h index 2c358af47e..77b0074335 100644 --- a/interface/wx/html/helpfrm.h +++ b/interface/wx/html/helpfrm.h @@ -36,7 +36,7 @@ class wxHtmlHelpFrame : public wxFrame { public: - wxHtmlHelpFrame(wxHtmlHelpData* data = NULL); + wxHtmlHelpFrame(wxHtmlHelpData* data = nullptr); /** Constructor. @@ -46,8 +46,8 @@ public: wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, int style = wxHF_DEFAULT_STYLE, - wxHtmlHelpData* data = NULL, - wxConfigBase* config = NULL, + wxHtmlHelpData* data = nullptr, + wxConfigBase* config = nullptr, const wxString& rootpath = wxEmptyString); /** @@ -65,7 +65,7 @@ public: */ bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, int style = wxHF_DEFAULT_STYLE, - wxConfigBase* config = NULL, + wxConfigBase* config = nullptr, const wxString& rootpath = wxEmptyString); /** diff --git a/interface/wx/html/helpwnd.h b/interface/wx/html/helpwnd.h index 99f67fc0e5..67f7ce35cc 100644 --- a/interface/wx/html/helpwnd.h +++ b/interface/wx/html/helpwnd.h @@ -69,7 +69,7 @@ enum class wxHtmlHelpWindow : public wxWindow { public: - wxHtmlHelpWindow(wxHtmlHelpData* data = NULL); + wxHtmlHelpWindow(wxHtmlHelpData* data = nullptr); /** Constructor. @@ -82,7 +82,7 @@ public: const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxBORDER_NONE, int helpStyle = wxHF_DEFAULT_STYLE, - wxHtmlHelpData* data = NULL); + wxHtmlHelpData* data = nullptr); /** Creates the help window. See @ref wxHtmlHelpWindow() "the constructor" diff --git a/interface/wx/html/htmlcell.h b/interface/wx/html/htmlcell.h index af3b201db1..1a2a9e3733 100644 --- a/interface/wx/html/htmlcell.h +++ b/interface/wx/html/htmlcell.h @@ -274,7 +274,7 @@ public: /** Find a cell inside this cell positioned at the given coordinates - (relative to this's positions). Returns NULL if no such cell exists. + (relative to this's positions). Returns @NULL if no such cell exists. The flag can be used to specify whether to look for terminal or nonterminal cells or both. In either case, returned cell is deepest cell in cells tree that contains [x,y]. @@ -445,7 +445,7 @@ public: virtual void SetPos(int x, int y); /** - Converts the cell into text representation. If sel != NULL then + Converts the cell into text representation. If sel != nullptr then only part of the cell inside the selection is converted. */ virtual wxString ConvertToText(wxHtmlSelection* sel) const; diff --git a/interface/wx/html/htmltag.h b/interface/wx/html/htmltag.h index 11df3f401e..d3a99efc5c 100644 --- a/interface/wx/html/htmltag.h +++ b/interface/wx/html/htmltag.h @@ -134,7 +134,7 @@ public: The parameter's name. @param value Pointer to the string to be filled with the parameter value, must - be non-@NULL. + be non-null. @since 3.0 */ diff --git a/interface/wx/html/htmlwin.h b/interface/wx/html/htmlwin.h index 8bb41faef8..2783715733 100644 --- a/interface/wx/html/htmlwin.h +++ b/interface/wx/html/htmlwin.h @@ -58,7 +58,7 @@ public: @param url URL the parser wants to open @param redirect If the return value is wxHTML_REDIRECT, then the URL to redirect to will be stored in this variable - (the pointer must never be NULL) + (the pointer must never be @NULL) @return indicator of how to treat the request */ @@ -73,7 +73,7 @@ public: virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, const wxPoint& pos) const = 0; - /// Returns the window used for rendering (may be NULL). + /// Returns the window used for rendering (may be @NULL). virtual wxWindow* GetHTMLWindow() = 0; /// Returns background colour to use by default. @@ -395,7 +395,7 @@ public: @see SetSize() */ void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int* sizes = NULL); + const int* sizes = nullptr); /** Sets default font sizes and/or default font size. diff --git a/interface/wx/html/htmprint.h b/interface/wx/html/htmprint.h index cb6b86822e..6dcd8ba838 100644 --- a/interface/wx/html/htmprint.h +++ b/interface/wx/html/htmprint.h @@ -130,7 +130,7 @@ public: @see SetSize() */ void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int* sizes = NULL); + const int* sizes = nullptr); /** Sets font sizes to be relative to the given size or the system @@ -218,7 +218,7 @@ public: May be @NULL. */ wxHtmlEasyPrinting(const wxString& name = "Printing", - wxWindow* parentWindow = NULL); + wxWindow* parentWindow = nullptr); /** Returns the current name being used for preview frames and setup @@ -300,7 +300,7 @@ public: Sets fonts. See wxHtmlDCRenderer::SetFonts for detailed description. */ void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int* sizes = NULL); + const int* sizes = nullptr); /** Sets the name used for preview frames and setup dialogs. @@ -438,7 +438,7 @@ public: for detailed description. */ void SetFonts(const wxString& normal_face, const wxString& fixed_face, - const int* sizes = NULL); + const int* sizes = nullptr); /** Set page footer. The following macros can be used inside it: diff --git a/interface/wx/html/winpars.h b/interface/wx/html/winpars.h index 5e629c955f..7f7e40cb61 100644 --- a/interface/wx/html/winpars.h +++ b/interface/wx/html/winpars.h @@ -96,7 +96,7 @@ public: (@a wndIface is a pointer to interface object for the associated wxHtmlWindow or other HTML rendering window such as wxHtmlListBox). */ - wxHtmlWinParser(wxHtmlWindowInterface* wndIface = NULL); + wxHtmlWinParser(wxHtmlWindowInterface* wndIface = nullptr); /** Adds module() to the list of wxHtmlWinParser tag handler. @@ -222,7 +222,7 @@ public: /** Returns associated window (wxHtmlWindow). This may be @NULL! - (You should always test if it is non-@NULL. + (You should always test if it is non-null. For example @c TITLE handler sets window title only if some window is associated, otherwise it does nothing. */ diff --git a/interface/wx/htmllbox.h b/interface/wx/htmllbox.h index cba1f1569c..8eb34aeb77 100644 --- a/interface/wx/htmllbox.h +++ b/interface/wx/htmllbox.h @@ -211,7 +211,7 @@ public: Constructor, creating and showing the HTML list box. @param parent - Parent window. Must not be NULL. + Parent window. Must not be @NULL. @param id Window identifier. A value of -1 indicates a default value. @param pos @@ -235,7 +235,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr); @@ -244,7 +244,7 @@ public: Constructor, creating and showing the HTML list box. @param parent - Parent window. Must not be NULL. + Parent window. Must not be @NULL. @param id Window identifier. A value of -1 indicates a default value. @param pos @@ -286,7 +286,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = wxHLB_DEFAULT_STYLE, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSimpleHtmlListBoxNameStr); diff --git a/interface/wx/image.h b/interface/wx/image.h index 4f7e635107..ed248771b8 100644 --- a/interface/wx/image.h +++ b/interface/wx/image.h @@ -887,7 +887,7 @@ public: */ wxImage Rotate(double angle, const wxPoint& rotationCentre, bool interpolating = true, - wxPoint* offsetAfterRotation = NULL) const; + wxPoint* offsetAfterRotation = nullptr) const; /** Returns a copy of the image rotated 90 degrees in the direction @@ -1683,7 +1683,7 @@ public: wxImage takes ownership of the pointer and will free it unless @a static_data parameter is set to @true -- in this case the caller should do it. */ - void SetAlpha(unsigned char* alpha = NULL, + void SetAlpha(unsigned char* alpha = nullptr, bool static_data = false); /** @@ -2113,7 +2113,7 @@ public: // find first colour that is not used in the image and has higher // RGB values than RGB(startR, startG, startB) // - // returns true and puts this colour in r, g, b (each of which may be NULL) + // returns true and puts this colour in r, g, b (each of which may be @NULL) // on success or returns false if there are no more free colours bool FindFirstUnusedColour(unsigned char *r, unsigned char *g, diff --git a/interface/wx/init.h b/interface/wx/init.h index debd3dfb17..76a31f2f74 100644 --- a/interface/wx/init.h +++ b/interface/wx/init.h @@ -24,7 +24,7 @@ public: Initializes the library. Calls wxInitialize(). */ - wxInitializer(int argc = 0, wxChar **argv = NULL); + wxInitializer(int argc = 0, wxChar **argv = nullptr); /** Has the initialization been successful? (explicit test) @@ -73,8 +73,8 @@ bool wxEntryStart(int& argc, wxChar** argv); @header{wx/init.h} */ bool wxEntryStart(HINSTANCE hInstance, - HINSTANCE hPrevInstance = NULL, - char* pCmdLine = NULL, + HINSTANCE hPrevInstance = nullptr, + char* pCmdLine = nullptr, int nCmdShow = SW_SHOWNORMAL); /** @@ -94,7 +94,7 @@ void wxEntryCleanup(); @header{wx/init.h} */ -bool wxInitialize(int argc = 0, wxChar **argv = NULL); +bool wxInitialize(int argc = 0, wxChar **argv = nullptr); /** Clean up; the library can't be used any more after the last call to diff --git a/interface/wx/intl.h b/interface/wx/intl.h index 050e730ce3..53bc3284ab 100644 --- a/interface/wx/intl.h +++ b/interface/wx/intl.h @@ -651,7 +651,7 @@ public: /** - Get the current locale object (note that it may be NULL!) + Get the current locale object (note that it may be @NULL!) */ wxLocale* wxGetLocale(); diff --git a/interface/wx/laywin.h b/interface/wx/laywin.h index dc86f99c20..7ae002255d 100644 --- a/interface/wx/laywin.h +++ b/interface/wx/laywin.h @@ -124,14 +124,14 @@ public: Lays out the children of a normal frame. @a mainWindow is set to occupy the remaining space. This function simply calls LayoutWindow(). */ - bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL); + bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = nullptr); /** - Lays out the children of an MDI parent frame. If @a rect is non-@NULL, the + Lays out the children of an MDI parent frame. If @a rect is non-null, the given rectangle will be used as a starting point instead of the frame's client area. The MDI client window is set to occupy the remaining space. */ - bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL); + bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = nullptr); /** Lays out the children of a normal frame or other window. @@ -141,7 +141,7 @@ public: get the remaining space (that is, a non-query OnCalculateLayout event will not be sent to this window and the window will be set to the remaining size). */ - bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL); + bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = nullptr); }; diff --git a/interface/wx/listbox.h b/interface/wx/listbox.h index 2ea938b8e3..19bf3fe0aa 100644 --- a/interface/wx/listbox.h +++ b/interface/wx/listbox.h @@ -111,7 +111,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); @@ -149,7 +149,7 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, + int n = 0, const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index 17403b91e3..f1a9757291 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -495,7 +495,7 @@ public: This method allows one to programmatically end editing a list control item in place. Usually it will only be called when editing is in progress, - i.e. if GetEditControl() returns non-NULL. In particular, do not call + i.e. if GetEditControl() returns non-null. In particular, do not call it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not yet fully created by then, just veto the event in this handler instead to prevent the editing from even starting. @@ -895,7 +895,7 @@ public: and returns a 2-element list (item, flags). @endWxPerlOnly */ - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = nullptr) const; /** Returns true if the control is currently using ::wxLC_REPORT style. diff --git a/interface/wx/log.h b/interface/wx/log.h index 5d9df732f6..ed9469a6e3 100644 --- a/interface/wx/log.h +++ b/interface/wx/log.h @@ -659,7 +659,7 @@ protected: // don't delete logChain directly as this would leave a dangling // pointer as active log target, use SetActiveTarget() instead - delete wxLog::SetActiveTarget(...something else or NULL...); + delete wxLog::SetActiveTarget(...something else or nullptr...); @endcode @library{wxbase} @@ -804,7 +804,7 @@ public: to the character set given by @a conv, that message will be silently ignored, i.e. it will not be written at all. */ - wxLogStream(std::ostream *ostr = NULL, + wxLogStream(std::ostream *ostr = nullptr, const wxMBConv &conv = wxConvWhateverWorks); }; @@ -846,7 +846,7 @@ public: to the character set given by @a conv, that message will be silently ignored, i.e. it will not be written at all. */ - wxLogStderr(FILE *fp = NULL, + wxLogStderr(FILE *fp = nullptr, const wxMBConv &conv = wxConvWhateverWorks); }; diff --git a/interface/wx/mdi.h b/interface/wx/mdi.h index e4f82ea08e..bbfec62ce2 100644 --- a/interface/wx/mdi.h +++ b/interface/wx/mdi.h @@ -228,7 +228,7 @@ public: /** Returns a pointer to the active MDI child, if there is one. - If there are any children at all this function returns a non-@NULL + If there are any children at all this function returns a non-null pointer. */ virtual wxMDIChildFrame* GetActiveChild() const; diff --git a/interface/wx/menu.h b/interface/wx/menu.h index 8b8d0258ef..e5199311e0 100644 --- a/interface/wx/menu.h +++ b/interface/wx/menu.h @@ -144,7 +144,7 @@ public: context it returns a 2-element list (item, submenu). @endWxPerlOnly */ - virtual wxMenuItem* FindItem(int id, wxMenu** menu = NULL) const; + virtual wxMenuItem* FindItem(int id, wxMenu** menu = nullptr) const; /** Returns the index of the menu with the given @a title or @c wxNOT_FOUND if no @@ -300,7 +300,7 @@ public: /** Redraw the menu bar */ - virtual void Refresh(bool eraseBackground = true, const wxRect* rect = NULL); + virtual void Refresh(bool eraseBackground = true, const wxRect* rect = nullptr); /** Removes the menu from the menu bar and returns the menu object - the caller @@ -746,7 +746,7 @@ public: @return Menu item object or @NULL if not found. */ - wxMenuItem *FindChildItem(int id, size_t *pos = NULL) const; + wxMenuItem *FindChildItem(int id, size_t *pos = nullptr) const; /** Finds the menu id for a menu item string. @@ -771,9 +771,9 @@ public: If the pointer is not @NULL, it will be filled with the item's parent menu (if the item was found) - @return Menu item object or NULL if none is found. + @return Menu item object or nullptr if none is found. */ - wxMenuItem* FindItem(int id, wxMenu** menu = NULL) const; + wxMenuItem* FindItem(int id, wxMenu** menu = nullptr) const; /** Returns the wxMenuItem given a position in the menu. @@ -1068,7 +1068,7 @@ public: not be used, it is deprecated and exists only for backwards compatibility. */ - void UpdateUI(wxEvtHandler* source = NULL); + void UpdateUI(wxEvtHandler* source = nullptr); void SetInvokingWindow(wxWindow *win); diff --git a/interface/wx/menuitem.h b/interface/wx/menuitem.h index b44a3a10ab..228ffd3f0f 100644 --- a/interface/wx/menuitem.h +++ b/interface/wx/menuitem.h @@ -102,13 +102,13 @@ public: May be @c wxITEM_SEPARATOR, @c wxITEM_NORMAL, @c wxITEM_CHECK or @c wxITEM_RADIO. @param subMenu - If non-@NULL, indicates that the menu item is a submenu. + If non-null, indicates that the menu item is a submenu. */ - wxMenuItem(wxMenu* parentMenu = NULL, int id = wxID_SEPARATOR, + wxMenuItem(wxMenu* parentMenu = nullptr, int id = wxID_SEPARATOR, const wxString& text = wxEmptyString, const wxString& helpString = wxEmptyString, wxItemKind kind = wxITEM_NORMAL, - wxMenu* subMenu = NULL); + wxMenu* subMenu = nullptr); /** Destructor. @@ -288,13 +288,13 @@ public: wxColour& GetTextColour() const; /** - Extract the accelerator from the given menu string, return NULL if none + Extract the accelerator from the given menu string, return @NULL if none found. */ static wxAcceleratorEntry *GetAccelFromString(const wxString& label); /** - Get our accelerator or NULL (caller must delete the pointer) + Get our accelerator or @NULL (caller must delete the pointer) */ virtual wxAcceleratorEntry *GetAccel() const; diff --git a/interface/wx/mimetype.h b/interface/wx/mimetype.h index 274b9f7694..e1f7b21f3c 100644 --- a/interface/wx/mimetype.h +++ b/interface/wx/mimetype.h @@ -435,9 +435,7 @@ public: This is a vararg constructor taking an arbitrary number of extensions after the first four required parameters. The list must be terminated - by @c wxNullPtr, notice that @c NULL can't be used here in portable - code (C++0x @c nullptr can be used as well if your compiler supports - it). + by @NULL. */ wxFileTypeInfo(const wxString& mimeType, const wxString& openCmd, diff --git a/interface/wx/minifram.h b/interface/wx/minifram.h index 62ee2f5422..b3fb8d183a 100644 --- a/interface/wx/minifram.h +++ b/interface/wx/minifram.h @@ -59,7 +59,7 @@ public: Constructor, creating the window. @param parent - The window parent. This may be @NULL. If it is non-@NULL, the frame will + The window parent. This may be @NULL. If it is non-null, the frame will always be displayed on top of the parent window on Windows. @param id The window identifier. It may take a value of -1 to indicate a default value. diff --git a/interface/wx/msgdlg.h b/interface/wx/msgdlg.h index e224702d51..477efc67cd 100644 --- a/interface/wx/msgdlg.h +++ b/interface/wx/msgdlg.h @@ -336,7 +336,7 @@ public: int wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, int style = wxOK | wxCENTRE, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord); diff --git a/interface/wx/mstream.h b/interface/wx/mstream.h index c0dfa13fba..69a3d74db9 100644 --- a/interface/wx/mstream.h +++ b/interface/wx/mstream.h @@ -45,7 +45,7 @@ public: If the buffer is created by wxMemoryOutputStream, it will be destroyed at the destruction of the stream. */ - wxMemoryOutputStream(void* data = NULL, size_t length = 0); + wxMemoryOutputStream(void* data = nullptr, size_t length = 0); /** Destructor. diff --git a/interface/wx/msw/ole/activex.h b/interface/wx/msw/ole/activex.h index 7644e75803..47412a6d36 100644 --- a/interface/wx/msw/ole/activex.h +++ b/interface/wx/msw/ole/activex.h @@ -122,7 +122,7 @@ public: class WXDLLIMPEXP_MEDIA wxPDFMediaBackend : public wxMediaBackendCommonBase { public: - wxPDFMediaBackend() : m_pAX(NULL) {} + wxPDFMediaBackend() : m_pAX(nullptr) {} virtual ~wxPDFMediaBackend() { if(m_pAX) @@ -140,7 +140,7 @@ public: const wxString& name) { IDispatch* pDispatch; - if( ::CoCreateInstance(CLSID_Pdf, NULL, + if( ::CoCreateInstance(CLSID_Pdf, nullptr, CLSCTX_INPROC_SERVER, DIID__DPdf, (void**)&pDispatch) != 0 ) return false; diff --git a/interface/wx/msw/ole/automtn.h b/interface/wx/msw/ole/automtn.h index f179be2827..3d963a7406 100644 --- a/interface/wx/msw/ole/automtn.h +++ b/interface/wx/msw/ole/automtn.h @@ -81,7 +81,7 @@ public: the object is deleted. */ - wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL); + wxAutomationObject(WXIDISPATCH* dispatchPtr = nullptr); /** Destructor. If the internal @c IDispatch pointer is non-null, it will be released. @@ -186,7 +186,7 @@ public: */ bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, - wxVariant args[] = NULL) const; + wxVariant args[] = nullptr) const; //@{ /** diff --git a/interface/wx/msw/ole/oleutils.h b/interface/wx/msw/ole/oleutils.h index 85595787f0..d35a9e84d2 100644 --- a/interface/wx/msw/ole/oleutils.h +++ b/interface/wx/msw/ole/oleutils.h @@ -331,7 +331,7 @@ public: /** Constructor initializes the object to @a value. */ - explicit wxVariantDataSafeArray(SAFEARRAY* value = NULL); + explicit wxVariantDataSafeArray(SAFEARRAY* value = nullptr); /** Returns the stored array. diff --git a/interface/wx/msw/ole/safearray.h b/interface/wx/msw/ole/safearray.h index f517d23ad3..a8f47d721d 100644 --- a/interface/wx/msw/ole/safearray.h +++ b/interface/wx/msw/ole/safearray.h @@ -93,7 +93,7 @@ public: /** Returns @true if it has a valid @c SAFEARRAY. */ - bool HasArray() const { return m_array != NULL; } + bool HasArray() const { return m_array != nullptr; } /** Returns the number of dimensions. diff --git a/interface/wx/nativewin.h b/interface/wx/nativewin.h index 2b8b37bda4..5bdaa6d598 100644 --- a/interface/wx/nativewin.h +++ b/interface/wx/nativewin.h @@ -75,7 +75,7 @@ public: Really create the window after using the default ctor to create the C++ object. - @param parent A non-NULL parent window. For the platforms where the + @param parent A non-null parent window. For the platforms where the parent is used for creating the native window (e.g. MSW), this must be the wxWindow corresponding to the parent handle used when creating the native window. diff --git a/interface/wx/notebook.h b/interface/wx/notebook.h index 25b75f25a9..845c46a9d4 100644 --- a/interface/wx/notebook.h +++ b/interface/wx/notebook.h @@ -125,7 +125,7 @@ public: window style. @param parent - The parent window. Must be non-@NULL. + The parent window. Must be non-null. @param id The window identifier. @param pos diff --git a/interface/wx/notifmsg.h b/interface/wx/notifmsg.h index 4a66b251f8..f1ec2caf6b 100644 --- a/interface/wx/notifmsg.h +++ b/interface/wx/notifmsg.h @@ -77,7 +77,7 @@ public: description of the corresponding parameters. */ wxNotificationMessage(const wxString& title, const wxString& message = wxEmptyString, - wxWindow* parent = NULL, int flags = wxICON_INFORMATION); + wxWindow* parent = nullptr, int flags = wxICON_INFORMATION); /** Destructor does not hide the notification. @@ -174,7 +174,7 @@ public: to notifications by using this method. This has no effect if toast notifications are used. - @return the task bar icon which was used previously (may be @c NULL) + @return the task bar icon which was used previously (may be @NULL) @onlyfor{wxmsw} */ diff --git a/interface/wx/numdlg.h b/interface/wx/numdlg.h index 57294ada96..c40c1e9bbf 100644 --- a/interface/wx/numdlg.h +++ b/interface/wx/numdlg.h @@ -111,7 +111,7 @@ long wxGetNumberFromUser(const wxString& message, long value, long min = 0, long max = 100, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, const wxPoint& pos = wxDefaultPosition); ///@} diff --git a/interface/wx/object.h b/interface/wx/object.h index 5532ac95a9..231985cd29 100644 --- a/interface/wx/object.h +++ b/interface/wx/object.h @@ -29,7 +29,7 @@ MyCar() { } MyCar( int price ); - bool IsOk() const { return m_refData != NULL; } + bool IsOk() const { return m_refData != nullptr; } bool operator == ( const MyCar& car ) const; bool operator != (const MyCar& car) const { return !(*this == car); } @@ -349,7 +349,7 @@ public: It takes over memory allocation, allowing wxDebugContext operations. */ - void* operator new(size_t size, const wxString& filename = NULL, int lineNum = 0); + void* operator new(size_t size, const wxString& filename = nullptr, int lineNum = 0); protected: /** @@ -581,9 +581,9 @@ public: Constructor. @a ptr is a pointer to the reference counted object to which this class points. - If @a ptr is not NULL @b T::IncRef() will be called on the object. + If @a ptr is not null @b T::IncRef() will be called on the object. */ - wxObjectDataPtr(T* ptr = NULL); + wxObjectDataPtr(T* ptr = nullptr); ///@{ /** @@ -867,7 +867,7 @@ public: /** This macro is equivalent to wxDynamicCast(this, classname) but the latter provokes spurious compilation warnings from some compilers (because it tests whether - @c this pointer is non-@NULL which is always true), so this macro should be + @c this pointer is non-null which is always true), so this macro should be used to avoid them. @header{wx/object.h} diff --git a/interface/wx/odcombo.h b/interface/wx/odcombo.h index f5dc82bc5c..23e9400fae 100644 --- a/interface/wx/odcombo.h +++ b/interface/wx/odcombo.h @@ -120,7 +120,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox"); diff --git a/interface/wx/popupwin.h b/interface/wx/popupwin.h index ff0e0892fa..238827f312 100644 --- a/interface/wx/popupwin.h +++ b/interface/wx/popupwin.h @@ -99,14 +99,14 @@ public: /** Popup the window (this will show it too). - If @a focus is non-@NULL, it will be kept focused while this window + If @a focus is non-null, it will be kept focused while this window is shown if supported by the current platform, otherwise the popup itself will receive focus. In any case, the popup will disappear automatically if it loses focus because of a user action. @see Dismiss() */ - virtual void Popup(wxWindow *focus = NULL); + virtual void Popup(wxWindow *focus = nullptr); /** Hide the window. diff --git a/interface/wx/print.h b/interface/wx/print.h index b86782c885..416fccc9c6 100644 --- a/interface/wx/print.h +++ b/interface/wx/print.h @@ -311,7 +311,7 @@ public: printing, and the address of an optional block of printer data, which will be copied to the print preview object's print data. - If @a printoutForPrinting is non-@NULL, a @b "Print..." button will be placed on + If @a printoutForPrinting is non-null, a @b "Print..." button will be placed on the preview frame so that the user can print directly from the preview interface. @remarks @@ -322,8 +322,8 @@ public: Use IsOk() to check whether the wxPrintPreview object was created correctly. */ wxPrintPreview(wxPrintout* printout, - wxPrintout* printoutForPrinting = NULL, - wxPrintDialogData* data = NULL); + wxPrintout* printoutForPrinting = nullptr, + wxPrintDialogData* data = nullptr); wxPrintPreview(wxPrintout* printout, wxPrintout* printoutForPrinting, wxPrintData* data); @@ -462,7 +462,7 @@ public: @see wxPrintDialogData, wxPrintData */ - wxPrinter(wxPrintDialogData* data = NULL); + wxPrinter(wxPrintDialogData* data = nullptr); /** Creates the default printing abort window, with a cancel button. diff --git a/interface/wx/printdlg.h b/interface/wx/printdlg.h index 9c9cf83a5a..e659763139 100644 --- a/interface/wx/printdlg.h +++ b/interface/wx/printdlg.h @@ -28,7 +28,7 @@ public: @see wxPrintDialogData */ - wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = nullptr); wxPrintDialog(wxWindow *parent, wxPrintData* data); /** @@ -104,7 +104,7 @@ public: Pass a parent window, and optionally a pointer to a block of page setup data, which will be copied to the print dialog's internal data. */ - wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL); + wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = nullptr); /** Destructor. diff --git a/interface/wx/process.h b/interface/wx/process.h index 3db988284c..4e82265354 100644 --- a/interface/wx/process.h +++ b/interface/wx/process.h @@ -63,7 +63,7 @@ public: @param id id of an event. */ - wxProcess(wxEvtHandler* parent = NULL, int id = -1); + wxProcess(wxEvtHandler* parent = nullptr, int id = -1); /** Creates an object without any associated parent (and hence no id either) diff --git a/interface/wx/progdlg.h b/interface/wx/progdlg.h index 5e94fdb511..2e24f53340 100644 --- a/interface/wx/progdlg.h +++ b/interface/wx/progdlg.h @@ -115,7 +115,7 @@ public: */ wxGenericProgressDialog(const wxString& title, const wxString& message, int maximum = 100, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL); /** @@ -158,7 +158,7 @@ public: @see wxGauge::Pulse(), Update() */ - virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool* skip = NULL); + virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool* skip = nullptr); /** Can be used to continue with the dialog, after the user had clicked the "Abort" button. @@ -242,7 +242,7 @@ public: this is set to @true. */ virtual bool Update(int value, const wxString& newmsg = wxEmptyString, - bool* skip = NULL); + bool* skip = nullptr); }; @@ -259,6 +259,6 @@ class wxProgressDialog : public wxGenericProgressDialog public: wxProgressDialog( const wxString& title, const wxString& message, int maximum = 100, - wxWindow *parent = NULL, + wxWindow *parent = nullptr, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE ); }; diff --git a/interface/wx/propgrid/advprops.h b/interface/wx/propgrid/advprops.h index 7f29efa76a..a9c0be3b56 100644 --- a/interface/wx/propgrid/advprops.h +++ b/interface/wx/propgrid/advprops.h @@ -148,7 +148,7 @@ public: */ virtual wxColour GetColour( int index ) const; - wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const; + wxColourPropertyValue GetVal( const wxVariant* pVariant = nullptr ) const; protected: diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index a52daf8af4..7527ba65f2 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -14,7 +14,7 @@ class wxPGWindowList { public: - wxPGWindowList(wxWindow* primary, wxWindow* secondary = NULL); + wxPGWindowList(wxWindow* primary, wxWindow* secondary = nullptr); void SetSecondary(wxWindow* secondary); diff --git a/interface/wx/propgrid/manager.h b/interface/wx/propgrid/manager.h index 4d9ed996e2..6ef5afcdb8 100644 --- a/interface/wx/propgrid/manager.h +++ b/interface/wx/propgrid/manager.h @@ -259,7 +259,7 @@ public: */ wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString, const wxBitmapBundle& bmp = wxBitmapBundle(), - wxPropertyGridPage* pageObj = NULL ); + wxPropertyGridPage* pageObj = nullptr ); /** Deletes all properties and all pages. @@ -413,7 +413,7 @@ public: */ virtual wxPropertyGridPage* InsertPage( int index, const wxString& label, const wxBitmapBundle& bmp = wxBitmapBundle(), - wxPropertyGridPage* pageObj = NULL ); + wxPropertyGridPage* pageObj = nullptr ); /** Returns @true if any property on any page has been modified by the user. diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 250c02c9f9..63f9ffc52c 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -6,7 +6,7 @@ ///////////////////////////////////////////////////////////////////////////// -#define wxNullProperty ((wxPGProperty*)NULL) +#define wxNullProperty nullptr /** @class wxPGPaintData @@ -1330,7 +1330,7 @@ public: Assumes members in this wxVariant list as pending replacement values. */ - bool AreAllChildrenSpecified( const wxVariant* pendingList = NULL ) const; + bool AreAllChildrenSpecified( const wxVariant* pendingList = nullptr ) const; /** Returns @true if children of this property are component values (for instance, @@ -1616,7 +1616,7 @@ public: wxVariant GetValue() const; /** - Returns bitmap that appears next to value text. Only returns non-@NULL + Returns bitmap that appears next to value text. Only returns non-null bitmap if one was set with SetValueImage(). */ wxBitmap* GetValueImage() const; @@ -2037,7 +2037,7 @@ public: ::wxPG_SETVAL_REFRESH_EDITOR is set by default, to refresh editor and redraw properties. */ - void SetValue( wxVariant value, wxVariant* pList = NULL, + void SetValue( wxVariant value, wxVariant* pList = nullptr, int flags = wxPG_SETVAL_REFRESH_EDITOR ); /** @@ -2611,7 +2611,7 @@ protected: virtual ~wxPGChoicesData(); }; -#define wxPGChoicesEmptyData ((wxPGChoicesData*)NULL) +#define wxPGChoicesEmptyData nullptr @@ -2662,7 +2662,7 @@ public: @since 3.1.2 */ - wxPGChoices(size_t count, const wxString* labels, const long* values = NULL); + wxPGChoices(size_t count, const wxString* labels, const long* values = nullptr); /** Constructor overload taking wxChar strings. @@ -2677,7 +2677,7 @@ public: Values for choices. If @NULL, indexes are used. Otherwise must have at least the same size as @a labels. */ - wxPGChoices( const wxChar** labels, const long* values = NULL ); + wxPGChoices( const wxChar** labels, const long* values = nullptr ); /** Constructor. @@ -2715,7 +2715,7 @@ public: @since 3.1.2 */ - void Add(size_t count, const wxString* labels, const long* values = NULL); + void Add(size_t count, const wxString* labels, const long* values = nullptr); /** Adds to current. @@ -2730,7 +2730,7 @@ public: Values for added choices. If empty, relevant entry indexes are used. Otherwise must have at least the same size as @a labels. */ - void Add( const wxChar** labels, const long* values = NULL ); + void Add( const wxChar** labels, const long* values = nullptr ); /** @overload @@ -2818,7 +2818,7 @@ public: are added to 'unmatched', if not @NULL. */ wxArrayInt GetIndicesForStrings( const wxArrayString& strings, - wxArrayString* unmatched = NULL ) const; + wxArrayString* unmatched = nullptr ) const; /** Returns index of item with given label. @@ -2866,12 +2866,12 @@ public: This is similar to calling Clear() and the corresponding overload of Add(). */ - void Set(size_t count, const wxString* labels, const long* values = NULL); + void Set(size_t count, const wxString* labels, const long* values = nullptr); /** @overload */ - void Set( const wxChar** labels, const long* values = NULL ); + void Set( const wxChar** labels, const long* values = nullptr ); /** @overload diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index b267faa6c2..e30bb5e824 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -763,7 +763,7 @@ public: Which choice of property to use (each choice may have different image). */ - wxSize GetImageSize( wxPGProperty* property = NULL, int item = -1 ) const; + wxSize GetImageSize( wxPGProperty* property = nullptr, int item = -1 ) const; /** Returns last item which could be iterated using given flags. @@ -1508,7 +1508,7 @@ public: const wxString& propLabel, const wxString& propName, const wxString* propValue, - wxPGChoices* pChoices = NULL ); + wxPGChoices* pChoices = nullptr ); /** Pushes property to the back of parent array (ie it becomes bottommost diff --git a/interface/wx/propgrid/propgridiface.h b/interface/wx/propgrid/propgridiface.h index b21b0c5319..6bd5a73586 100644 --- a/interface/wx/propgrid/propgridiface.h +++ b/interface/wx/propgrid/propgridiface.h @@ -338,9 +338,9 @@ public: */ wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL ); + wxPGProperty* firstProp = nullptr ); wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* firstProp = NULL ) const; + wxPGProperty* firstProp = nullptr ) const; //@} //@{ @@ -558,7 +558,7 @@ public: @"@@@@@attr.@" */ wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, - wxPGProperty* baseparent = NULL, long flags = 0 ) const; + wxPGProperty* baseparent = nullptr, long flags = 0 ) const; /** Returns list of currently selected properties. @@ -718,7 +718,7 @@ public: /** If state is shown in its grid, refresh it now. */ - virtual void RefreshGrid( wxPropertyGridPageState* state = NULL ); + virtual void RefreshGrid( wxPropertyGridPageState* state = nullptr ); /** Initializes additional property editors (SpinCtrl etc.). Causes diff --git a/interface/wx/propgrid/propgridpagestate.h b/interface/wx/propgrid/propgridpagestate.h index 37ecb2703c..209e9ce640 100644 --- a/interface/wx/propgrid/propgridpagestate.h +++ b/interface/wx/propgrid/propgridpagestate.h @@ -26,7 +26,7 @@ public: int GetColumn() const; /** - Returns property hit. NULL if empty space below + Returns property hit. @NULL if empty space below properties was hit instead. */ wxPGProperty* GetProperty() const; @@ -228,7 +228,7 @@ public: wxPropertyGridIterator(); wxPropertyGridIterator( wxPropertyGridPageState* state, int flags = wxPG_ITERATE_DEFAULT, - wxPGProperty* property = NULL, int dir = 1 ); + wxPGProperty* property = nullptr, int dir = 1 ); wxPropertyGridIterator( wxPropertyGridPageState* state, int flags, int startPos, int dir = 0 ); wxPropertyGridIterator( const wxPropertyGridIterator& it ); @@ -253,7 +253,7 @@ public: wxPropertyGridConstIterator(); wxPropertyGridConstIterator( const wxPropertyGridPageState* state, int flags = wxPG_ITERATE_DEFAULT, - const wxPGProperty* property = NULL, int dir = 1 ); + const wxPGProperty* property = nullptr, int dir = 1 ); wxPropertyGridConstIterator( wxPropertyGridPageState* state, int flags, int startPos, int dir = 0 ); wxPropertyGridConstIterator( const wxPropertyGridConstIterator& it ); diff --git a/interface/wx/propgrid/props.h b/interface/wx/propgrid/props.h index 68323e8448..ca8daf735e 100644 --- a/interface/wx/propgrid/props.h +++ b/interface/wx/propgrid/props.h @@ -349,7 +349,7 @@ public: // If set, then selection of choices is static and should not be -// changed (i.e. returns NULL in GetPropertyChoices). +// changed (i.e. returns @NULL in GetPropertyChoices). #define wxPG_PROP_STATIC_CHOICES wxPG_PROP_CLASS_SPECIFIC_1 /** @class wxEnumProperty @@ -368,8 +368,8 @@ class wxEnumProperty : public wxPGProperty public: wxEnumProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, - const wxChar* const* labels = NULL, - const long* values = NULL, + const wxChar* const* labels = nullptr, + const long* values = nullptr, int value = 0 ); wxEnumProperty( const wxString& label, @@ -496,7 +496,7 @@ public: wxFlagsProperty( const wxString& label, const wxString& name, const wxChar* const* labels, - const long* values = NULL, + const long* values = nullptr, long value = 0 ); wxFlagsProperty( const wxString& label, diff --git a/interface/wx/protocol/protocol.h b/interface/wx/protocol/protocol.h index 7ab332db9a..204717ea2c 100644 --- a/interface/wx/protocol/protocol.h +++ b/interface/wx/protocol/protocol.h @@ -134,7 +134,7 @@ public: Detach the existing logger without deleting it. The caller is responsible for deleting the returned pointer if it's - non-@c NULL. + non-null. */ wxProtocolLog *DetachLog(); diff --git a/interface/wx/radiobox.h b/interface/wx/radiobox.h index 37d2de7a77..1c1d397159 100644 --- a/interface/wx/radiobox.h +++ b/interface/wx/radiobox.h @@ -85,7 +85,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, @@ -151,7 +151,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, - const wxString choices[] = NULL, + const wxString choices[] = nullptr, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, diff --git a/interface/wx/rearrangectrl.h b/interface/wx/rearrangectrl.h index 2b200372bd..42303718b5 100644 --- a/interface/wx/rearrangectrl.h +++ b/interface/wx/rearrangectrl.h @@ -88,7 +88,7 @@ public: conventions used by the @a order argument. @param parent - The parent window, must be non-@NULL. + The parent window, must be non-null. @param id The window identifier. @param pos @@ -254,7 +254,7 @@ public: order.push_back(1); order.push_back(2); - wxRearrangeDialog dlg(NULL, + wxRearrangeDialog dlg(nullptr, "You can also uncheck the items you don't like " "at all.", "Sort the items in order of preference", diff --git a/interface/wx/renderer.h b/interface/wx/renderer.h index 3604754630..8b5bdfeebf 100644 --- a/interface/wx/renderer.h +++ b/interface/wx/renderer.h @@ -204,12 +204,12 @@ public: virtual int DrawHeaderButton(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); + wxHeaderButtonParams* params = nullptr); virtual int DrawHeaderButtonContents(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); + wxHeaderButtonParams* params = nullptr); virtual int GetHeaderButtonHeight(wxWindow *win); @@ -389,7 +389,7 @@ public: */ virtual int DrawHeaderButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0; + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = nullptr) = 0; /** Draw the contents of a header control button (label, sort arrows, @@ -404,7 +404,7 @@ public: */ virtual int DrawHeaderButtonContents(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0, - wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0; + wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = nullptr) = 0; /** Draw a selection rectangle underneath the text as used e.g. in a diff --git a/interface/wx/ribbon/art.h b/interface/wx/ribbon/art.h index 663b998528..d9c48e7be6 100644 --- a/interface/wx/ribbon/art.h +++ b/interface/wx/ribbon/art.h @@ -318,11 +318,11 @@ public: as described above. @param[out] primary - Pointer to a location to store the primary colour, or NULL. + Pointer to a location to store the primary colour, or @NULL. @param[out] secondary - Pointer to a location to store the secondary colour, or NULL. + Pointer to a location to store the secondary colour, or @NULL. @param[out] tertiary - Pointer to a location to store the tertiary colour, or NULL. + Pointer to a location to store the tertiary colour, or @NULL. */ virtual void GetColourScheme(wxColour* primary, wxColour* secondary, @@ -798,7 +798,7 @@ public: The client size. @param[out] client_offset The offset where the client rectangle begins within the panel (may - be NULL). + be @NULL). @sa GetPanelClientSize() */ @@ -821,7 +821,7 @@ public: The overall size to calculate client size for. @param[out] client_offset The offset where the returned client size begins within the given - @a size (may be NULL). + @a size (may be @NULL). @sa GetPanelSize() */ @@ -985,7 +985,7 @@ public: The size-class to calculate the size for. Buttons on a button bar can have three distinct sizes: wxRIBBON_BUTTONBAR_BUTTON_SMALL, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, and wxRIBBON_BUTTONBAR_BUTTON_LARGE. - If the requested size-class is not applicable, then NULL should + If the requested size-class is not applicable, then @NULL should be returned. @return Width of the given label text in pixel. diff --git a/interface/wx/ribbon/bar.h b/interface/wx/ribbon/bar.h index 615d07e30b..a8cc8387f6 100644 --- a/interface/wx/ribbon/bar.h +++ b/interface/wx/ribbon/bar.h @@ -71,7 +71,7 @@ public: */ wxRibbonBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonPage* page = NULL); + wxRibbonPage* page = nullptr); /** Returns the page being changed to, or being clicked on. @@ -289,7 +289,7 @@ public: /** Get a page by index. - NULL will be returned if the given index is out of range. + @NULL will be returned if the given index is out of range. */ wxRibbonPage* GetPage(int n); diff --git a/interface/wx/ribbon/buttonbar.h b/interface/wx/ribbon/buttonbar.h index 0ef2602cac..33e6099918 100644 --- a/interface/wx/ribbon/buttonbar.h +++ b/interface/wx/ribbon/buttonbar.h @@ -416,7 +416,7 @@ public: virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const; /** - Returns the first button having a given id or NULL if none matches. + Returns the first button having a given id or @NULL if none matches. @since 2.9.5 */ @@ -624,7 +624,7 @@ public: wxRibbonButtonBarButtonState max_size_class); /** - Returns the active item of the button bar or NULL if there is none. + Returns the active item of the button bar or @NULL if there is none. The active button is the one being clicked. @since 2.9.5 @@ -632,7 +632,7 @@ public: virtual wxRibbonButtonBarButtonBase *GetActiveItem() const; /** - Returns the hovered item of the button bar or NULL if there is none. + Returns the hovered item of the button bar or @NULL if there is none. The hovered button is the one the mouse is over. @since 2.9.5 @@ -682,8 +682,8 @@ public: */ wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonButtonBar* bar = NULL, - wxRibbonButtonBarButtonBase* button = NULL); + wxRibbonButtonBar* bar = nullptr, + wxRibbonButtonBarButtonBase* button = nullptr); /** Returns the bar which contains the button which the event relates to. diff --git a/interface/wx/ribbon/control.h b/interface/wx/ribbon/control.h index 7d49661622..eef977e71c 100644 --- a/interface/wx/ribbon/control.h +++ b/interface/wx/ribbon/control.h @@ -36,7 +36,7 @@ public: /** Constructor. - If @a parent is a wxRibbonControl with a non-NULL art provider, then + If @a parent is a wxRibbonControl with a non-null art provider, then the art provider of new control is set to that of @a parent. */ wxRibbonControl(wxWindow *parent, wxWindowID id, @@ -57,7 +57,7 @@ public: /** Get the art provider to be used. Note that until an art provider has - been set in some way, this function may return NULL. + been set in some way, this function may return @NULL. */ wxRibbonArtProvider* GetArtProvider() const; @@ -148,7 +148,7 @@ public: bool Realise(); /** - Get the first ancestor which is a wxRibbonBar (or derived) or NULL + Get the first ancestor which is a wxRibbonBar (or derived) or @NULL if not having such parent. @since 2.9.4 diff --git a/interface/wx/ribbon/gallery.h b/interface/wx/ribbon/gallery.h index 6fd8145746..f9f6b17c21 100644 --- a/interface/wx/ribbon/gallery.h +++ b/interface/wx/ribbon/gallery.h @@ -36,7 +36,7 @@ enum wxRibbonGalleryButtonState This event is available since wxWidgets 2.9.2. @event{EVT_RIBBONGALLERY_HOVER_CHANGED(id, func)} Triggered when the item being hovered over by the user changes. The - item in the event will be the new item being hovered, or NULL if there + item in the event will be the new item being hovered, or @NULL if there is no longer an item being hovered. Note that the ID is that of the gallery, not of the item. @endEventTable @@ -175,14 +175,14 @@ public: /** Set the selection to the given item, or removes the selection if - @a item == NULL. + @a item == nullptr. Note that this not cause any events to be emitted. */ void SetSelection(wxRibbonGalleryItem* item); /** - Get the currently selected item, or NULL if there is none. + Get the currently selected item, or @NULL if there is none. The selected item is set by SetSelection(), or by the user clicking on an item. @@ -190,14 +190,14 @@ public: wxRibbonGalleryItem* GetSelection() const; /** - Get the currently hovered item, or NULL if there is none. + Get the currently hovered item, or @NULL if there is none. The hovered item is the item underneath the mouse cursor. */ wxRibbonGalleryItem* GetHoveredItem() const; /** - Get the currently active item, or NULL if there is none. + Get the currently active item, or @NULL if there is none. The active item is the item being pressed by the user, and will thus become the selected item if the user releases the mouse button. @@ -273,8 +273,8 @@ public: */ wxRibbonGalleryEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonGallery* gallery = NULL, - wxRibbonGalleryItem* item = NULL); + wxRibbonGallery* gallery = nullptr, + wxRibbonGalleryItem* item = nullptr); /** Returns the gallery which the event relates to. @@ -282,7 +282,7 @@ public: wxRibbonGallery* GetGallery(); /** - Returns the gallery item which the event relates to, or NULL if it does + Returns the gallery item which the event relates to, or @NULL if it does not relate to an item. */ wxRibbonGalleryItem* GetGalleryItem(); diff --git a/interface/wx/ribbon/panel.h b/interface/wx/ribbon/panel.h index ca83991a55..e552e092a5 100644 --- a/interface/wx/ribbon/panel.h +++ b/interface/wx/ribbon/panel.h @@ -39,7 +39,7 @@ public: */ wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonPanel* panel = NULL); + wxRibbonPanel* panel = nullptr); /** Returns the panel relating to this event. @@ -268,7 +268,7 @@ public: Get the dummy panel of an expanded panel. Note that this should be called on an expanded panel to get the dummy - associated with it - it will return NULL when called on the dummy + associated with it - it will return @NULL when called on the dummy itself. @see ShowExpanded() @@ -280,7 +280,7 @@ public: Get the expanded panel of a dummy panel. Note that this should be called on a dummy panel to get the expanded - panel associated with it - it will return NULL when called on the + panel associated with it - it will return @NULL when called on the expanded panel itself. @see ShowExpanded() diff --git a/interface/wx/ribbon/toolbar.h b/interface/wx/ribbon/toolbar.h index accf86873e..276003a291 100644 --- a/interface/wx/ribbon/toolbar.h +++ b/interface/wx/ribbon/toolbar.h @@ -144,7 +144,7 @@ public: const wxBitmap& bitmap_disabled = wxNullBitmap, const wxString& help_string = wxEmptyString, wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, - wxObject* clientData = NULL); + wxObject* clientData = nullptr); /** Add a separator to the tool bar. @@ -249,7 +249,7 @@ public: const wxBitmap& bitmap_disabled = wxNullBitmap, const wxString& help_string = wxEmptyString, wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL, - wxObject* clientData = NULL); + wxObject* clientData = nullptr); /** Insert a separator to the tool bar at the specified position. @@ -301,7 +301,7 @@ public: /** Return the opaque pointer corresponding to the given tool. - @return an opaque pointer, NULL if is a separator or not found. + @return an opaque pointer, @NULL if is a separator or not found. @since 2.9.4 */ @@ -311,7 +311,7 @@ public: Returns the opaque pointer for the tool at the given coordinates, which are relative to the toolbar's parent. - @return an opaque pointer, NULL if is not found. + @return an opaque pointer, @NULL if is not found. @since 3.1.5 */ @@ -335,7 +335,7 @@ public: virtual int GetToolId(const wxRibbonToolBarToolBase* tool)const; /** - Returns the active item of the tool bar or NULL if there is none. + Returns the active item of the tool bar or @NULL if there is none. The active tool is the one being clicked. @@ -532,7 +532,7 @@ class wxRibbonToolBarEvent : public wxCommandEvent public: wxRibbonToolBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonToolBar* bar = NULL); + wxRibbonToolBar* bar = nullptr); wxRibbonToolBar* GetBar(); void SetBar(wxRibbonToolBar* bar); diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index 0d43e184c7..da9ec77cc4 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -263,7 +263,7 @@ public: /** Apply the dimension, but not those identical to @a compareWith if present. */ - bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = NULL); + bool Apply(const wxTextAttrDimension& dim, const wxTextAttrDimension* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of which attributes are absent in some objects and which clash in some objects. @@ -396,7 +396,7 @@ public: Apply to 'this', but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = NULL); + bool Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -488,7 +488,7 @@ public: /** Apply to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = NULL); + bool Apply(const wxTextAttrSize& dims, const wxTextAttrSize* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -732,7 +732,7 @@ public: Applies the border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = NULL); + bool Apply(const wxTextAttrBorder& border, const wxTextAttrBorder* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -915,7 +915,7 @@ public: /** Applies border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = NULL); + bool Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -1001,7 +1001,7 @@ public: Applies the border to this object, but not if the same as @a compareWith. */ - bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = NULL); + bool Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith = nullptr); /** Removes the specified attributes from this object. @@ -1192,11 +1192,11 @@ public: bool EqPartial(const wxTextBoxAttr& attr, bool weakTest = true) const; /** - Merges the given attributes. If @a compareWith is non-NULL, then it will be used + Merges the given attributes. If @a compareWith is non-null, then it will be used to mask out those attributes that are the same in style and @a compareWith, for situations where we don't want to explicitly set inherited attributes. */ - bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = NULL); + bool Apply(const wxTextBoxAttr& style, const wxTextBoxAttr* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -1637,10 +1637,10 @@ public: /** Merges the given attributes. If @a compareWith - is non-NULL, then it will be used to mask out those attributes that are the same in style + is non-null, then it will be used to mask out those attributes that are the same in style and @a compareWith, for situations where we don't want to explicitly set inherited attributes. */ - bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL); + bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = nullptr); /** Collects the attributes that are common to a range of content, building up a note of @@ -1877,7 +1877,7 @@ public: /** Returns @true if the font table is valid. */ - bool IsOk() const { return m_refData != NULL; } + bool IsOk() const { return m_refData != nullptr; } /** Finds a font for the given attribute object. @@ -2091,7 +2091,7 @@ public: /** Resets the selection. */ - void Reset() { m_ranges.Clear(); m_container = NULL; } + void Reset() { m_ranges.Clear(); m_container = nullptr; } /** Sets the selection. @@ -2355,7 +2355,7 @@ public: /** Constructor, taking an optional parent pointer. */ - wxRichTextObject(wxRichTextObject* parent = NULL); + wxRichTextObject(wxRichTextObject* parent = nullptr); virtual ~wxRichTextObject(); @@ -2416,7 +2416,7 @@ public: wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, - wxArrayInt* partialExtents = NULL) const = 0; + wxArrayInt* partialExtents = nullptr) const = 0; /** Do a split from @a pos, returning an object containing the second part, and setting @@ -2690,7 +2690,8 @@ public: /** Returns the top-level container of this object. - Returns a different container than itself, unless there's no parent, in which case it will return NULL. + Returns a different container than itself, unless there's no parent, in + which case it will return @NULL. */ virtual wxRichTextParagraphLayoutBox* GetParentContainer() const; @@ -2872,7 +2873,7 @@ public: Draws the borders and background for the given rectangle and attributes. @a boxRect is taken to be the outer margin box, not the box around the content. */ - static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = NULL); + static bool DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, const wxRichTextAttr& attr, const wxRect& boxRect, int flags = 0, wxRichTextObject* obj = nullptr); /** Draws a border. @@ -2946,7 +2947,7 @@ class wxRichTextCompositeObject: public wxRichTextObject public: // Constructors - wxRichTextCompositeObject(wxRichTextObject* parent = NULL); + wxRichTextCompositeObject(wxRichTextObject* parent = nullptr); virtual ~wxRichTextCompositeObject(); // Overridables @@ -2968,7 +2969,7 @@ public: wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, - wxArrayInt* partialExtents = NULL) const; + wxArrayInt* partialExtents = nullptr) const; virtual void Dump(wxTextOutputStream& stream); @@ -3072,7 +3073,7 @@ class wxRichTextParagraphLayoutBox: public wxRichTextCompositeObject public: // Constructors - wxRichTextParagraphLayoutBox(wxRichTextObject* parent = NULL); + wxRichTextParagraphLayoutBox(wxRichTextObject* parent = nullptr); wxRichTextParagraphLayoutBox(const wxRichTextParagraphLayoutBox& obj): wxRichTextCompositeObject() { Init(); Copy(obj); } ~wxRichTextParagraphLayoutBox(); @@ -3084,7 +3085,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -3212,17 +3213,17 @@ public: /** Convenience function to add a paragraph of text. */ - virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = nullptr); /** Convenience function to add an image. */ - virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddImage(const wxImage& image, wxRichTextAttr* paraStyle = nullptr); /** Adds multiple paragraphs, based on newlines. */ - virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = NULL); + virtual wxRichTextRange AddParagraphs(const wxString& text, wxRichTextAttr* paraStyle = nullptr); /** Returns the line at the given position. If @a caretPosition is true, the position is @@ -3439,11 +3440,11 @@ public: - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used. - @a def can be NULL to indicate that the existing list style should be used. + @a def can be @NULL to indicate that the existing list style should be used. @see SetListStyle(), PromoteList(), ClearListStyle() */ - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); //@} @@ -3464,13 +3465,13 @@ public: @see SetListStyle(), SetListStyle(), ClearListStyle() */ - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); //@} /** Helper for NumberList and PromoteList, that does renumbering and promotion simultaneously - @a def can be NULL/empty to indicate that the existing list style should be used. + @a def can be @NULL/empty to indicate that the existing list style should be used. */ virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); @@ -3504,7 +3505,7 @@ public: /** Sets with undo the properties for the given object. */ - virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = NULL); + virtual bool SetObjectPropertiesWithUndo(wxRichTextObject& obj, const wxRichTextProperties& properties, wxRichTextObject* objToSet = nullptr); /** Test if this whole range has character attributes of the specified kind. If any @@ -3614,11 +3615,11 @@ public: virtual void InvalidateHierarchy(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); /** - Gather information about floating objects. If untilObj is non-NULL, + Gather information about floating objects. If untilObj is non-null, will stop getting information if the current object is this, since we will collect the rest later. */ - virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = NULL); + virtual bool UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj = nullptr); /** Get invalid range, rounding to entire paragraphs if argument is true. @@ -3679,7 +3680,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextBox(wxRichTextObject* parent = NULL); + wxRichTextBox(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -3760,7 +3761,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = NULL); + wxRichTextField(const wxString& fieldType = wxEmptyString, wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -3774,7 +3775,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; virtual wxString GetXMLNodeName() const { return wxT("field"); } @@ -3869,7 +3870,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const = 0; /** Returns @true if we can edit the object's properties via a GUI. @@ -4034,7 +4035,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; /** Get the size of the field, given the label, font size, and so on. @@ -4190,7 +4191,7 @@ public: // Constructors wxRichTextLine(wxRichTextParagraph* parent); - wxRichTextLine(const wxRichTextLine& obj) { Init( NULL); Copy(obj); } + wxRichTextLine(const wxRichTextLine& obj); virtual ~wxRichTextLine() {} // Overridables @@ -4326,11 +4327,11 @@ public: /** Constructor taking a parent and style. */ - wxRichTextParagraph(wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + wxRichTextParagraph(wxRichTextObject* parent = nullptr, wxRichTextAttr* style = nullptr); /** Constructor taking a text string, a parent and paragraph and character attributes. */ - wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxRichTextAttr* paraStyle = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = nullptr, wxRichTextAttr* paraStyle = nullptr, wxRichTextAttr* charStyle = nullptr); virtual ~wxRichTextParagraph(); wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextCompositeObject() { Copy(obj); } @@ -4342,7 +4343,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); @@ -4387,9 +4388,9 @@ public: /** Splits an object at this position if necessary, and returns - the previous object, or NULL if inserting at the beginning. + the previous object, or @NULL if inserting at the beginning. */ - virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = NULL); + virtual wxRichTextObject* SplitAt(long pos, wxRichTextObject** previousObject = nullptr); /** Moves content to a list from this point. @@ -4512,7 +4513,7 @@ public: /** Constructor. */ - wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxRichTextAttr* style = NULL); + wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = nullptr, wxRichTextAttr* style = nullptr); /** Copy constructor. @@ -4525,7 +4526,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; virtual wxString GetTextForRange(const wxRichTextRange& range) const; @@ -4720,9 +4721,9 @@ public: void SetImageType(wxBitmapType imageType) { m_imageType = imageType; } /** - Returns @true if the data is non-NULL. + Returns @true if the data is non-null. */ - bool IsOk() const { return GetData() != NULL; } + bool IsOk() const { return GetData() != nullptr; } bool Ok() const { return IsOk(); } /** @@ -4779,17 +4780,17 @@ public: /** Default constructor. */ - wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { } + wxRichTextImage(wxRichTextObject* parent = nullptr): wxRichTextObject(parent) { } /** Creates a wxRichTextImage from a wxImage. */ - wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextImage(const wxImage& image, wxRichTextObject* parent = nullptr, wxRichTextAttr* charStyle = nullptr); /** Creates a wxRichTextImage from an image block. */ - wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxRichTextAttr* charStyle = NULL); + wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = nullptr, wxRichTextAttr* charStyle = nullptr); /** Copy constructor. @@ -4802,7 +4803,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; /** Returns the 'natural' size for this object - the image size. @@ -5055,7 +5056,7 @@ public: /** Convenience function to add a paragraph of text. */ - virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } + virtual wxRichTextRange AddParagraph(const wxString& text, wxRichTextAttr* paraStyle = nullptr) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } /** Begin collapsing undo/redo commands. Note that this may not work properly @@ -5507,7 +5508,7 @@ public: it will be filled with the file type corresponding to each filter. This can be used to determine the type to pass to LoadFile given a selected filter. */ - static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = NULL); + static wxString GetExtWildcard(bool combine = false, bool save = false, wxArrayInt* types = nullptr); /** Clean up file handlers. @@ -5719,7 +5720,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextCell(wxRichTextObject* parent = NULL); + wxRichTextCell(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -5817,7 +5818,7 @@ public: Default constructor; optionally pass the parent object. */ - wxRichTextTable(wxRichTextObject* parent = NULL); + wxRichTextTable(wxRichTextObject* parent = nullptr); /** Copy constructor. @@ -5835,7 +5836,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = nullptr) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -6214,7 +6215,7 @@ public: */ void UpdateAppearance(long caretPosition, bool sendUpdateEvent = false, const wxRect& oldFloatRect = wxRect(), - wxArrayInt* optimizationLineCharPositions = NULL, wxArrayInt* optimizationLineYPositions = NULL, + wxArrayInt* optimizationLineCharPositions = nullptr, wxArrayInt* optimizationLineYPositions = nullptr, bool isDoCmd = true); /** @@ -6680,7 +6681,7 @@ public: The constructor doesn't copy the pointer, so it shouldn't go away while this object is alive. */ - wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = NULL); + wxRichTextBufferDataObject(wxRichTextBuffer* richTextBuffer = nullptr); virtual ~wxRichTextBufferDataObject(); /** @@ -6810,7 +6811,7 @@ bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); bool wxTextAttrEq(const wxRichTextAttr& attr1, const wxRichTextAttr& attr2); /// Apply one style to another -bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL); +bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = nullptr); // Remove attributes bool wxRichTextRemoveStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style); diff --git a/interface/wx/richtext/richtextctrl.h b/interface/wx/richtext/richtextctrl.h index 387391b67c..566aad2663 100644 --- a/interface/wx/richtext/richtextctrl.h +++ b/interface/wx/richtext/richtextctrl.h @@ -784,7 +784,7 @@ public: @see SetListStyle(), PromoteList(), ClearListStyle(). */ - virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); + virtual bool NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool NumberList(const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); //@} @@ -805,7 +805,7 @@ public: @see SetListStyle(), @see SetListStyle(), ClearListStyle(). */ - virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = NULL, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); + virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, wxRichTextListStyleDefinition* def = nullptr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1); //@} @@ -1385,7 +1385,7 @@ public: Please note that this does not update the current editing style from the new position; to do that, call wxRichTextCtrl::SetInsertionPoint instead. */ - virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = NULL); + virtual bool MoveCaret(long pos, bool showAtLineStart = false, wxRichTextParagraphLayoutBox* container = nullptr); /** Moves right. @@ -1601,7 +1601,7 @@ public: /** Applies the style sheet to the buffer, for example if the styles have changed. */ - bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL); + bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = nullptr); /** Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy. @@ -1921,7 +1921,7 @@ public: Internal function to position the visible caret according to the current caret position. */ - virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = NULL); + virtual void PositionCaret(wxRichTextParagraphLayoutBox* container = nullptr); /** Helper function for extending the selection, returning @true if the selection @@ -1996,7 +1996,7 @@ public: 2-element list (ok, rect). @endWxPerlOnly */ - bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = NULL); + bool GetCaretPositionForIndex(long position, wxRect& rect, wxRichTextParagraphLayoutBox* container = nullptr); /** Internal helper function returning the line for the visible caret position. @@ -2021,7 +2021,7 @@ public: list (ok, newPos). @endWxPerlOnly */ - virtual bool DeleteSelectedContent(long* newPos= NULL); + virtual bool DeleteSelectedContent(long* newPos= nullptr); /** Transforms logical (unscrolled) position to physical window position. diff --git a/interface/wx/richtext/richtextprint.h b/interface/wx/richtext/richtextprint.h index 44ecaaa920..cf997a1460 100644 --- a/interface/wx/richtext/richtextprint.h +++ b/interface/wx/richtext/richtextprint.h @@ -272,7 +272,7 @@ public: dialog, and also a parent window for these windows. */ wxRichTextPrinting(const wxString& name = "Printing", - wxWindow* parentWindow = NULL); + wxWindow* parentWindow = nullptr); /** A convenience function to get the footer text. diff --git a/interface/wx/richtext/richtextstyledlg.h b/interface/wx/richtext/richtextstyledlg.h index bcf1604500..4225e104e1 100644 --- a/interface/wx/richtext/richtextstyledlg.h +++ b/interface/wx/richtext/richtextstyledlg.h @@ -103,7 +103,7 @@ public: Applies the selected style to selection in the given control or the control passed to the constructor. */ - bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); + bool ApplyStyle(wxRichTextCtrl* ctrl = nullptr); /** Creates the dialog. See the ctor. diff --git a/interface/wx/richtext/richtextstyles.h b/interface/wx/richtext/richtextstyles.h index 085a293f60..c1a3f74e73 100644 --- a/interface/wx/richtext/richtextstyles.h +++ b/interface/wx/richtext/richtextstyles.h @@ -506,7 +506,7 @@ public: */ wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, - wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextStyleSheet* styleSheet = nullptr); /** This function finds the level (from 0 to 9) whose indentation attribute mostly @@ -522,7 +522,7 @@ public: included in the result. */ wxRichTextAttr GetCombinedStyle(int indent, - wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextStyleSheet* styleSheet = nullptr); /** This function combines the list style's base attributes and the style for the @@ -533,7 +533,7 @@ public: */ wxRichTextAttr GetCombinedStyleForLevel(int level, - wxRichTextStyleSheet* styleSheet = NULL); + wxRichTextStyleSheet* styleSheet = nullptr); /** Returns the style for the given level. @a level is a number between 0 and 9. diff --git a/interface/wx/richtooltip.h b/interface/wx/richtooltip.h index 346383e118..9a07f3f477 100644 --- a/interface/wx/richtooltip.h +++ b/interface/wx/richtooltip.h @@ -178,7 +178,7 @@ public: show the tooltip. By default the tooltip tip points to the (middle of the) specified - window which must be non-@NULL or, if @a rect is non-@NULL, the middle + window which must be non-null or, if @a rect is non-@NULL, the middle of the specified wxRect. The coordinates of the @a rect parameter are relative to the given window. @@ -189,7 +189,7 @@ public: Parameter @a rect is new since wxWidgets 2.9.5. */ - void ShowFor(wxWindow* win, const wxRect* rect = NULL); + void ShowFor(wxWindow* win, const wxRect* rect = nullptr); /** Destructor. diff --git a/interface/wx/scopedarray.h b/interface/wx/scopedarray.h index 59e8baf9cb..08df8dd9c0 100644 --- a/interface/wx/scopedarray.h +++ b/interface/wx/scopedarray.h @@ -73,7 +73,7 @@ public: Creates the smart pointer with the given pointer or none if @NULL. On compilers that support it, this uses the explicit keyword. */ - wxScopedArray(type* T = NULL); + wxScopedArray(type* T = nullptr); /** This operator gets the pointer stored in the smart pointer or returns @NULL if @@ -92,7 +92,7 @@ public: arguments are specified. This function does check to make sure that the pointer you are assigning is not the same pointer that is already stored. */ - reset(T* p = NULL); + reset(T* p = nullptr); /** Swap the pointer inside the smart pointer with @a ot. The pointer being swapped @@ -127,7 +127,7 @@ public: @param array An array allocated using @c new[] or @NULL. */ - explicit wxScopedArray(T * array = NULL); + explicit wxScopedArray(T * array = nullptr); /** Constructor allocating a new array of the specified size. @@ -159,7 +159,7 @@ public: @param array An array allocated using @c new[] or @NULL. */ - void reset(T *array = NULL); + void reset(T *array = nullptr); /** Return the n-th element of the array. @@ -172,7 +172,7 @@ public: Return the array pointer. The returned pointer may be @NULL. It must not be deleted by the - caller, call @c reset(NULL) instead. + caller, call @c reset(nullptr) instead. */ T *get() const; diff --git a/interface/wx/scopedptr.h b/interface/wx/scopedptr.h index 4895ee96e6..fd7e8e87f0 100644 --- a/interface/wx/scopedptr.h +++ b/interface/wx/scopedptr.h @@ -96,7 +96,7 @@ public: On compilers that support it, this uses the explicit keyword. */ - explicit wxScopedPtr(type* T = NULL); + explicit wxScopedPtr(type* T = nullptr); /** Destructor frees the pointer help by this object if it is not @NULL. @@ -142,7 +142,7 @@ public: This function does check to make sure that the pointer you are assigning is not the same pointer that is already stored. */ - reset(T* p = NULL); + reset(T* p = nullptr); /** Swap the pointer inside the smart pointer with @a other. The pointer being @@ -209,7 +209,7 @@ public: @param ptr Pointer allocated with @c new or @NULL. */ - wxScopedPtr(T* ptr = NULL); + wxScopedPtr(T* ptr = nullptr); /** Destructor deletes the pointer. @@ -257,7 +257,7 @@ public: Reset pointer to the value of @a ptr. The previous pointer will be deleted. */ - void reset(T* ptr = NULL); + void reset(T* ptr = nullptr); /** Swaps pointers. diff --git a/interface/wx/scopeguard.h b/interface/wx/scopeguard.h index 0550a1611d..c854055e83 100644 --- a/interface/wx/scopeguard.h +++ b/interface/wx/scopeguard.h @@ -140,10 +140,10 @@ wxScopeGuard wxMakeGuard(F func, P1 p1, ..., PN pN); #define wxON_BLOCK_EXIT_SET(var, value) /** - This macro sets the pointer passed to it as argument to NULL on scope exit. + This macro sets the pointer passed to it as argument to @NULL on scope exit. - It must be used instead of wxON_BLOCK_EXIT_SET() when the value being set - is @c NULL. + It may be used instead of wxON_BLOCK_EXIT_SET() when the value being set + is @NULL. @header{wx/scopeguard.h} */ diff --git a/interface/wx/scrolbar.h b/interface/wx/scrolbar.h index db9a64c57e..25248c5a7b 100644 --- a/interface/wx/scrolbar.h +++ b/interface/wx/scrolbar.h @@ -120,7 +120,7 @@ public: Constructor, creating and showing a scrollbar. @param parent - Parent window. Must be non-@NULL. + Parent window. Must be non-null. @param id Window identifier. The value wxID_ANY indicates a default value. @param pos diff --git a/interface/wx/secretstore.h b/interface/wx/secretstore.h index f094e702de..1d17cfc9a3 100644 --- a/interface/wx/secretstore.h +++ b/interface/wx/secretstore.h @@ -254,7 +254,7 @@ public: user-readable error message explaining why the secret store can't be used (this argument is new since wxWidgets 3.1.4) */ - bool IsOk(wxString* errmsg = NULL) const; + bool IsOk(wxString* errmsg = nullptr) const; /** Store a username/password combination. diff --git a/interface/wx/settings.h b/interface/wx/settings.h index d5b52d7eb3..8ea316b666 100644 --- a/interface/wx/settings.h +++ b/interface/wx/settings.h @@ -368,7 +368,7 @@ public: one should still be given, as for example it might determine which displays cursor width is requested with wxSYS_CURSOR_X. */ - static int GetMetric(wxSystemMetric index, wxWindow* win = NULL); + static int GetMetric(wxSystemMetric index, wxWindow* win = nullptr); /** Returns the screen type. diff --git a/interface/wx/sharedptr.h b/interface/wx/sharedptr.h index 52900275a4..567bb9e3e3 100644 --- a/interface/wx/sharedptr.h +++ b/interface/wx/sharedptr.h @@ -26,7 +26,7 @@ public: Creates shared pointer from the raw pointer @a ptr and takes ownership of it. */ - explicit wxSharedPtr(T* ptr = NULL); + explicit wxSharedPtr(T* ptr = nullptr); /** Constructor. @@ -102,7 +102,7 @@ public: If the reference count of the previously owned pointer was 1 it will be deleted. */ - void reset(T* ptr = NULL); + void reset(T* ptr = nullptr); /** Reset pointer to @a ptr. diff --git a/interface/wx/sizer.h b/interface/wx/sizer.h index 2e85ee5703..57ce6c64cb 100644 --- a/interface/wx/sizer.h +++ b/interface/wx/sizer.h @@ -187,7 +187,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Appends a child to the sizer. @@ -245,7 +245,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Appends a spacer child to the sizer. @@ -293,7 +293,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Appends a spacer child to the sizer. @@ -578,7 +578,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Insert a child into the sizer before any existing item at @a index. @@ -597,7 +597,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Insert a child into the sizer before any existing item at @a index. @@ -608,7 +608,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Insert a child into the sizer before any existing item at @a index. @@ -681,7 +681,7 @@ public: wxSizerItem* Prepend(wxWindow* window, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Same as Add(), but prepends the items to the beginning of the @@ -697,7 +697,7 @@ public: wxSizerItem* Prepend(wxSizer* sizer, int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Same as Add(), but prepends the items to the beginning of the @@ -707,7 +707,7 @@ public: int proportion = 0, int flag = 0, int border = 0, - wxObject* userData = NULL); + wxObject* userData = nullptr); /** Same as Add(), but prepends the items to the beginning of the @@ -1091,7 +1091,7 @@ public: Construct a sizer item for tracking a spacer. */ wxSizerItem(int width, int height, int proportion=0, int flag=0, - int border=0, wxObject* userData=NULL); + int border=0, wxObject* userData=nullptr); ///@{ /** @@ -1100,7 +1100,7 @@ public: wxSizerItem(wxWindow* window, const wxSizerFlags& flags); wxSizerItem(wxWindow* window, int proportion=0, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); ///@} ///@{ @@ -1110,7 +1110,7 @@ public: wxSizerItem(wxSizer* sizer, const wxSizerFlags& flags); wxSizerItem(wxSizer* sizer, int proportion=0, int flag=0, int border=0, - wxObject* userData=NULL); + wxObject* userData=nullptr); ///@} /** diff --git a/interface/wx/snglinst.h b/interface/wx/snglinst.h index 999b6bcb1d..037ac16e71 100644 --- a/interface/wx/snglinst.h +++ b/interface/wx/snglinst.h @@ -28,7 +28,7 @@ wxLogError(_("Another program instance is already running, aborting.")); delete m_checker; // OnExit() won't be called if we return false - m_checker = NULL; + m_checker = nullptr; return false; } diff --git a/interface/wx/splash.h b/interface/wx/splash.h index 61cbe25a7c..dcf04a5b8d 100644 --- a/interface/wx/splash.h +++ b/interface/wx/splash.h @@ -29,7 +29,7 @@ { wxSplashScreen* splash = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, - 6000, NULL, -1, wxDefaultPosition, wxDefaultSize, + 6000, nullptr, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxSTAY_ON_TOP); } wxYield(); diff --git a/interface/wx/splitter.h b/interface/wx/splitter.h index 661fac4acb..3c4bfac29e 100644 --- a/interface/wx/splitter.h +++ b/interface/wx/splitter.h @@ -288,7 +288,7 @@ public: (if any). It is valid to call this function whether the splitter has two windows or only one. - Both parameters should be non-@NULL and @a winOld must specify one of the + Both parameters should be non-null and @a winOld must specify one of the windows managed by the splitter. If the parameters are incorrect or the window couldn't be replaced, @false is returned. Otherwise the function will return @true, but please notice that it will not delete the replaced window and you @@ -460,7 +460,7 @@ public: @see SplitHorizontally(), SplitVertically(), IsSplit(), OnUnsplit() */ - bool Unsplit(wxWindow* toRemove = NULL); + bool Unsplit(wxWindow* toRemove = nullptr); /** Causes any pending sizing of the sash and child panes to take place @@ -519,7 +519,7 @@ public: Constructor. Used internally by wxWidgets only. */ wxSplitterEvent(wxEventType eventType = wxEVT_NULL, - wxSplitterWindow* splitter = NULL); + wxSplitterWindow* splitter = nullptr); /** Returns the new sash position. diff --git a/interface/wx/sstream.h b/interface/wx/sstream.h index e9522db36e..b2c7d3fb41 100644 --- a/interface/wx/sstream.h +++ b/interface/wx/sstream.h @@ -47,7 +47,7 @@ public: /** Construct a new stream object writing the data to a string. - If the provided pointer is non-@NULL, data will be written to it. + If the provided pointer is non-null, data will be written to it. Otherwise, an internal string is used for the data written to this stream, use GetString() to get access to it. @@ -62,7 +62,7 @@ public: with default value of this argument the data written to the stream must be valid UTF-8, pass @c wxConvISO8859_1 to deal with arbitrary 8 bit data. */ - explicit wxStringOutputStream(wxString* pString = NULL, wxMBConv& conv = wxConvUTF8); + explicit wxStringOutputStream(wxString* pString = nullptr, wxMBConv& conv = wxConvUTF8); /** Returns the string containing all the data written to the stream so far. diff --git a/interface/wx/stackwalk.h b/interface/wx/stackwalk.h index 416df031a5..9a7448cb86 100644 --- a/interface/wx/stackwalk.h +++ b/interface/wx/stackwalk.h @@ -56,7 +56,7 @@ public: /** Constructor does nothing, use Walk() to walk the stack. */ - wxStackWalker(const char* argv0 = NULL); + wxStackWalker(const char* argv0 = nullptr); /** Destructor does nothing either but should be virtual as this class is used as diff --git a/interface/wx/statusbr.h b/interface/wx/statusbr.h index acd8489c49..2d25722607 100644 --- a/interface/wx/statusbr.h +++ b/interface/wx/statusbr.h @@ -246,7 +246,7 @@ public: Use SetStatusWidths to set the field widths. @endWxPerlOnly */ - virtual void SetFieldsCount(int number = 1, const int* widths = NULL); + virtual void SetFieldsCount(int number = 1, const int* widths = nullptr); /** Sets the minimal possible height for the status bar. diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index dac632b9b3..34531e894e 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -3038,7 +3038,7 @@ public: than maxPos. */ int FindText(int minPos, int maxPos, const wxString& text, int flags=0, - int* findEnd=NULL); + int* findEnd=nullptr); /** Sets the position that starts the target which is used for updating the @@ -3368,7 +3368,7 @@ public: linePos can optionally be passed in to receive the index of the caret on the line. */ - wxString GetCurLine(int* linePos=NULL); + wxString GetCurLine(int* linePos=nullptr); /** Retrieve the column number of a position, taking tab width into account. @@ -7372,7 +7372,7 @@ public: Retrieve the text of the line containing the caret. Returns the index of the caret on the line. */ - wxCharBuffer GetCurLineRaw(int* linePos=NULL); + wxCharBuffer GetCurLineRaw(int* linePos=nullptr); /** Retrieve the contents of a line. diff --git a/interface/wx/strconv.h b/interface/wx/strconv.h index e21046f623..a8e631dfc0 100644 --- a/interface/wx/strconv.h +++ b/interface/wx/strconv.h @@ -128,7 +128,7 @@ public: Example of use of this function: @code - size_t dstLen = conv.ToWChar(NULL, 0, src); + size_t dstLen = conv.ToWChar(nullptr, 0, src); if ( dstLen == wxCONV_FAILED ) ... handle error ... wchar_t *dst = new wchar_t[dstLen]; @@ -145,7 +145,7 @@ public: Pointer to output buffer of the size of at least @a dstLen or @NULL. @param dstLen Maximal number of characters to be written to the output buffer if - @a dst is non-@NULL, unused otherwise. + @a dst is non-null, unused otherwise. @param src Point to the source string, must not be @NULL. @param srcLen @@ -155,7 +155,7 @@ public: @return The number of characters written (or which would have been written - if it were non-@NULL) to @a dst or @c wxCONV_FAILED on error. + if it were non-null) to @a dst or @c wxCONV_FAILED on error. */ virtual size_t ToWChar(wchar_t* dst, size_t dstLen, const char* src, size_t srcLen = wxNO_LEN) const; @@ -172,7 +172,7 @@ public: Pointer to output buffer of the size of at least @a dstLen or @NULL. @param dstLen Maximal number of characters to be written to the output buffer if - @a dst is non-@NULL, unused otherwise. + @a dst is non-null, unused otherwise. @param src Point to the source string, must not be @NULL. @param srcLen @@ -181,10 +181,10 @@ public: including the terminating @c NUL character. @return - If @a dst is non-@NULL, the number of characters actually written to + If @a dst is non-null, the number of characters actually written to it. If @a dst is @NULL, the returned value is at least equal to the number of characters that would have been written out if it were - non-@NULL, but can be larger than it under the platforms using + non-null, but can be larger than it under the platforms using UTF-16 as @c wchar_t encoding (this allows a useful optimization in the implementation of this function for UTF-32). In any case, @c wxCONV_FAILED is returned on conversion error. @@ -200,7 +200,7 @@ public: of allocating the buffer of the necessary size itself. Its parameters have the same meaning as for ToWChar(), in particular @a inLen can be specified explicitly in which case exactly that many characters are - converted and @a outLen receives (if non-@NULL) exactly the + converted and @a outLen receives (if non-null) exactly the corresponding number of wide characters, whether the last one of them is @c NUL or not. However if @c inLen is @c wxNO_LEN, then @c outLen doesn't count the trailing @c NUL even if it is always present in this @@ -320,13 +320,13 @@ public: If @a out is @NULL, only the length of the string which would result from the conversion is calculated and returned. Note that this is the length and not size, i.e. the returned value does not include the - trailing @c NUL. But when the function is called with a non-@NULL @a + trailing @c NUL. But when the function is called with a non-null @a out buffer, the @a outLen parameter should be one more to allow to properly @c NUL-terminate the string. So to properly use this function you need to write: @code - size_t lenConv = conv.MB2WC(NULL, in, 0); + size_t lenConv = conv.MB2WC(nullptr, in, 0); if ( lenConv == wxCONV_FAILED ) ... handle error ... // allocate 1 more character for the trailing NUL and also pass @@ -357,7 +357,7 @@ public: Converts from Unicode to multibyte encoding. The semantics of this function (including the return value meaning) is the same as for wxMBConv::MB2WC. Notice that when the function is - called with a non-@NULL buffer, the @a n parameter should be the size + called with a non-null buffer, the @a n parameter should be the size of the buffer and so it should take into account the trailing @c NUL, which might take two or four bytes for some encodings (UTF-16 and UTF-32) and not one, i.e. GetMBNulLen(). diff --git a/interface/wx/stream.h b/interface/wx/stream.h index cac4aa42ed..d80777577c 100644 --- a/interface/wx/stream.h +++ b/interface/wx/stream.h @@ -783,12 +783,12 @@ public: @param stream The associated low-level stream. @param buffer - The buffer to use if non-@NULL. Notice that the ownership of this + The buffer to use if non-null. Notice that the ownership of this buffer is taken by the stream, i.e. it will delete it. If this parameter is @NULL a default 1KB buffer is used. */ wxBufferedInputStream(wxInputStream& stream, - wxStreamBuffer *buffer = NULL); + wxStreamBuffer *buffer = nullptr); /** Constructor allowing to specify the size of the buffer. @@ -1058,12 +1058,12 @@ public: @param stream The associated low-level stream. @param buffer - The buffer to use if non-@NULL. Notice that the ownership of this + The buffer to use if non-null. Notice that the ownership of this buffer is taken by the stream, i.e. it will delete it. If this parameter is @NULL a default 1KB buffer is used. */ wxBufferedOutputStream(wxOutputStream& stream, - wxStreamBuffer *buffer = NULL); + wxStreamBuffer *buffer = nullptr); /** Constructor allowing to specify the size of the buffer. diff --git a/interface/wx/string.h b/interface/wx/string.h index 3d3a0255ee..4d7932f76a 100644 --- a/interface/wx/string.h +++ b/interface/wx/string.h @@ -643,7 +643,7 @@ public: current locale (and so can fail). @param len - If non-@NULL, filled with the length of the returned buffer. + If non-null, filled with the length of the returned buffer. @return buffer containing the string contents in the specified type, @@ -652,7 +652,7 @@ public: @c char). */ template - wxCharTypeBuffer tchar_str(size_t *len = NULL) const; + wxCharTypeBuffer tchar_str(size_t *len = nullptr) const; /** Returns a string representation suitable for passing to OS' functions @@ -966,7 +966,7 @@ public: (i.e. after the prefix) into @a rest string if it is not @NULL. Otherwise, the function returns @false and doesn't modify the @a rest. */ - bool StartsWith(const wxString& prefix, wxString *rest = NULL) const; + bool StartsWith(const wxString& prefix, wxString *rest = nullptr) const; /** This function can be used to test if the string ends with the specified @@ -975,7 +975,7 @@ public: @NULL. Otherwise, the function returns @false and doesn't modify the @e rest. */ - bool EndsWith(const wxString& suffix, wxString *rest = NULL) const; + bool EndsWith(const wxString& suffix, wxString *rest = nullptr) const; ///@} @@ -1046,7 +1046,7 @@ public: available in wxWidgets version 2.9.2 and later only. @return Part of the string before the first occurrence of @a ch. */ - wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const; + wxString BeforeFirst(wxUniChar ch, wxString *rest = nullptr) const; /** Gets all characters before the last occurrence of @e ch. @@ -1061,7 +1061,7 @@ public: parameter is available in wxWidgets version 2.9.2 and later only. @return Part of the string before the last occurrence of @a ch. */ - wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const; + wxString BeforeLast(wxUniChar ch, wxString *rest = nullptr) const; ///@} @@ -1456,7 +1456,7 @@ public: for ( size_t n = 0; n < len; n++ ) { - if ( strchr("aeuio", tolower(original[n])) == NULL ) + if ( strchr("aeuio", tolower(original[n])) == nullptr ) result += original[n]; } diff --git a/interface/wx/tarstrm.h b/interface/wx/tarstrm.h index de04c11852..78dbdffd73 100644 --- a/interface/wx/tarstrm.h +++ b/interface/wx/tarstrm.h @@ -395,7 +395,7 @@ public: */ static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, - bool* pIsDir = NULL); + bool* pIsDir = nullptr); /** Assignment operator. diff --git a/interface/wx/taskbar.h b/interface/wx/taskbar.h index 2cc7aae5a3..205620ddc6 100644 --- a/interface/wx/taskbar.h +++ b/interface/wx/taskbar.h @@ -191,7 +191,7 @@ protected: clicked. If GetPopupMenu() returns @NULL (this happens by default), - CreatePopupMenu() is called next and its menu is used (if non-@NULL). + CreatePopupMenu() is called next and its menu is used (if non-null). Otherwise the menu returned by GetPopupMenu() is shown and, contrary to CreatePopupMenu(), not destroyed when the user dismisses it, allowing to reuse the same menu pointer multiple times. diff --git a/interface/wx/taskbarbutton.h b/interface/wx/taskbarbutton.h index 2aa01a8881..099d1f84a2 100644 --- a/interface/wx/taskbarbutton.h +++ b/interface/wx/taskbarbutton.h @@ -366,7 +366,7 @@ public: Constructs a jump list item. @param parentCategory - Category that the jump list item belongs to. Can be NULL if the item + Category that the jump list item belongs to. Can be @NULL if the item is going to be added to the category later. @param type The type for this item. @@ -388,7 +388,7 @@ public: @param iconIndex The index of the icon, which is specified by iconPath. */ - wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL, + wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = nullptr, wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR, const wxString& title = wxEmptyString, const wxString& filePath = wxEmptyString, @@ -468,7 +468,7 @@ public: void SetIconIndex(int iconIndex); /** - Returns the category this jump list item is in, or NULL if this jump + Returns the category this jump list item is in, or @NULL if this jump list item is not attached. */ wxTaskBarJumpListCategory* GetCategory() const; @@ -509,12 +509,12 @@ public: Constructs the jump list category. @param parent - Jump list that the jump list category belongs to. Can be NULL if + Jump list that the jump list category belongs to. Can be @NULL if the category is going to be added to the jump list later. @param title The title of the category. */ - wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL, + wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = nullptr, const wxString& title = wxEmptyString); virtual ~wxTaskBarJumpListCategory(); diff --git a/interface/wx/textctrl.h b/interface/wx/textctrl.h index 9eb18eb4f2..825006dc75 100644 --- a/interface/wx/textctrl.h +++ b/interface/wx/textctrl.h @@ -294,7 +294,7 @@ public: attributes from @a style that are the same as those in @a compareWith (if passed). */ bool Apply(const wxTextAttr& style, - const wxTextAttr* compareWith = NULL); + const wxTextAttr* compareWith = nullptr); /** Copies all defined/valid properties from overlay to current object. @@ -1884,7 +1884,7 @@ public: the default parameter value to the text control @a text. @param text - The text control to append output too, must be non-@NULL + The text control to append output too, must be non-null @param ostr The C++ stream to redirect, cout is used if it is @NULL */ diff --git a/interface/wx/textdlg.h b/interface/wx/textdlg.h index c857f86f15..13702e7f6f 100644 --- a/interface/wx/textdlg.h +++ b/interface/wx/textdlg.h @@ -226,7 +226,7 @@ public: wxString wxGetTextFromUser(const wxString& message, const wxString& caption = wxGetTextFromUserPromptStr, const wxString& default_value = wxEmptyString, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true); @@ -241,7 +241,7 @@ wxString wxGetTextFromUser(const wxString& message, wxString wxGetPasswordFromUser(const wxString& message, const wxString& caption = wxGetPasswordFromUserPromptStr, const wxString& default_value = wxEmptyString, - wxWindow* parent = NULL, + wxWindow* parent = nullptr, int x = wxDefaultCoord, int y = wxDefaultCoord, bool centre = true); diff --git a/interface/wx/textentry.h b/interface/wx/textentry.h index a27788ce0c..8771875774 100644 --- a/interface/wx/textentry.h +++ b/interface/wx/textentry.h @@ -81,7 +81,7 @@ public: @since 2.9.2 @param completer - The object to be used for generating completions if non-@NULL. If + The object to be used for generating completions if non-null. If it is @NULL, auto-completion is disabled. The wxTextEntry object takes ownership of this pointer and will delete it in any case (i.e. even if this method returns @false). diff --git a/interface/wx/textwrapper.h b/interface/wx/textwrapper.h index 495cb90ed1..2d018732de 100644 --- a/interface/wx/textwrapper.h +++ b/interface/wx/textwrapper.h @@ -73,7 +73,7 @@ public: less than @a widthMax). @param win - A non-@NULL window used for measuring the text extents. + A non-null window used for measuring the text extents. @param text The text to wrap. @param widthMax diff --git a/interface/wx/thread.h b/interface/wx/thread.h index 75d931d9c3..0faf4a800a 100644 --- a/interface/wx/thread.h +++ b/interface/wx/thread.h @@ -813,13 +813,13 @@ enum wxThreadError { wxLogError("Can't create the thread!"); delete m_pThread; - m_pThread = NULL; + m_pThread = nullptr; } // after the call to wxThread::Run(), the m_pThread pointer is "unsafe": // at any moment the thread may cease to exist (because it completes its work). // To avoid dangling pointers OnThreadExit() will set m_pThread - // to NULL when the thread dies. + // to nullptr when the thread dies. } wxThread::ExitCode MyThread::Entry() @@ -844,7 +844,7 @@ enum wxThreadError wxCriticalSectionLocker enter(m_pHandler->m_pThreadCS); // the thread is being destroyed; make sure not to leave dangling pointers around - m_pHandler->m_pThread = NULL; + m_pHandler->m_pThread = nullptr; } void MyFrame::OnThreadCompletion(wxThreadEvent&) @@ -1066,7 +1066,7 @@ public: @param rc For joinable threads, filled with the thread exit code on - successful return, if non-@NULL. For detached threads this + successful return, if non-null. For detached threads this parameter is not used. @param waitMode @@ -1083,7 +1083,7 @@ public: See @ref thread_deletion for a broader explanation of this routine. */ - wxThreadError Delete(ExitCode *rc = NULL, + wxThreadError Delete(ExitCode *rc = nullptr, wxThreadWait waitMode = wxTHREAD_WAIT_DEFAULT); /** diff --git a/interface/wx/timectrl.h b/interface/wx/timectrl.h index daaba32ac6..633548ee14 100644 --- a/interface/wx/timectrl.h +++ b/interface/wx/timectrl.h @@ -76,7 +76,7 @@ public: constructor. @param parent - Parent window, must not be non-@NULL. + Parent window, must not be non-null. @param id The identifier for the control. @param dt @@ -110,7 +110,7 @@ public: /** Returns the currently entered time as hours, minutes and seconds. - All the arguments must be non-@NULL, @false is returned otherwise and + All the arguments must be non-null, @false is returned otherwise and none of them is modified. @see SetTime() diff --git a/interface/wx/timer.h b/interface/wx/timer.h index d23f1b726e..84bf360650 100644 --- a/interface/wx/timer.h +++ b/interface/wx/timer.h @@ -79,7 +79,7 @@ public: /** Returns the current @e owner of the timer. - If non-@NULL this is the event handler which will receive the + If non-null this is the event handler which will receive the timer events (see wxTimerEvent) when the timer is running. */ wxEvtHandler* GetOwner() const; diff --git a/interface/wx/tipwin.h b/interface/wx/tipwin.h index 3254864101..2781d26411 100644 --- a/interface/wx/tipwin.h +++ b/interface/wx/tipwin.h @@ -28,7 +28,7 @@ public: Constructor. The tip is shown immediately after the window is constructed. @param parent - The parent window, must be non-@NULL + The parent window, must be non-null @param text The text to show, may contain the new line characters @param maxLength @@ -38,13 +38,13 @@ public: Simply passed to SetTipWindowPtr() below, please see its documentation for the description of this parameter @param rectBounds - If non-@NULL, passed to SetBoundingRect() below, please see its + If non-null, passed to SetBoundingRect() below, please see its documentation for the description of this parameter */ wxTipWindow(wxWindow* parent, const wxString& text, wxCoord maxLength = 100, - wxTipWindow** windowPtr = NULL, - wxRect* rectBounds = NULL); + wxTipWindow** windowPtr = nullptr, + wxRect* rectBounds = nullptr); /** By default, the tip window disappears when the user clicks the mouse or presses diff --git a/interface/wx/toolbar.h b/interface/wx/toolbar.h index eda0697bd8..5630aca98f 100644 --- a/interface/wx/toolbar.h +++ b/interface/wx/toolbar.h @@ -80,13 +80,13 @@ enum class wxToolBarToolBase : public wxObject { public: - wxToolBarToolBase(wxToolBarBase *tbar = NULL, + wxToolBarToolBase(wxToolBarBase *tbar = nullptr, int toolid = wxID_SEPARATOR, const wxString& label = wxEmptyString, const wxBitmapBundle& bmpNormal = wxNullBitmap, const wxBitmapBundle& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelpString = wxEmptyString, const wxString& longHelpString = wxEmptyString); @@ -342,7 +342,7 @@ public: const wxBitmapBundle& bmpDisabled = wxNullBitmap, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject* clientData = NULL); + wxObject* clientData = nullptr); /** Adds any control to the toolbar, typically e.g.\ a wxComboBox. @@ -378,7 +378,7 @@ public: const wxBitmapBundle& bmpDisabled = wxNullBitmap, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject* clientData = NULL); + wxObject* clientData = nullptr); /** Adds a separator for spacing groups of tools. @@ -503,7 +503,7 @@ public: wxItemKind kind = wxITEM_NORMAL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject* clientData = NULL); + wxObject* clientData = nullptr); ///@} /** @@ -753,7 +753,7 @@ public: wxItemKind kind = wxITEM_NORMAL, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString, - wxObject *clientData = NULL); + wxObject *clientData = nullptr); wxToolBarToolBase* InsertTool(size_t pos, wxToolBarToolBase* tool); @@ -1020,7 +1020,7 @@ public: const wxBitmapBundle& bmpNormal, const wxBitmapBundle& bmpDisabled = wxNullBitmap, wxItemKind kind = wxITEM_NORMAL, - wxObject *clientData = NULL, + wxObject *clientData = nullptr, const wxString& shortHelp = wxEmptyString, const wxString& longHelp = wxEmptyString); /** diff --git a/interface/wx/toplevel.h b/interface/wx/toplevel.h index f696a1c14b..57c16b8b30 100644 --- a/interface/wx/toplevel.h +++ b/interface/wx/toplevel.h @@ -326,7 +326,7 @@ public: MSW-specific function for accessing the system menu. Returns a wxMenu pointer representing the system menu of the window - under MSW. The returned wxMenu may be used, if non-@c NULL, to add + under MSW. The returned wxMenu may be used, if non-null, to add extra items to the system menu. The usual @c wxEVT_MENU events (that can be processed using @c EVT_MENU event table macro) will then be generated for them. All the other wxMenu methods may be used as @@ -421,7 +421,7 @@ public: other values. @param name uniquely identifies the field - @param value non-@NULL pointer to the value to be filled by this + @param value non-null pointer to the value to be filled by this function @return @true if the value was retrieved or @false if it wasn't diff --git a/interface/wx/translation.h b/interface/wx/translation.h index a8c30c8492..2d6beddb0d 100644 --- a/interface/wx/translation.h +++ b/interface/wx/translation.h @@ -38,7 +38,7 @@ public: wxTranslations(); /** - Returns current translations object, may return NULL. + Returns current translations object, may return @NULL. You must either call this early in app initialization code, or let wxLocale do it for you. @@ -313,7 +313,7 @@ public: additional modifiers (e.g. "fr", "en_GB" or "ca@valencia"). - @return Loaded catalog or NULL on failure. + @return Loaded catalog or @NULL on failure. */ virtual wxMsgCatalog *LoadCatalog(const wxString& domain, const wxString& lang) = 0; @@ -420,7 +420,7 @@ public: @param domain Catalog's domain. This typically matches the @a filename. - @return Successfully loaded catalog or NULL on failure. + @return Successfully loaded catalog or @NULL on failure. */ static wxMsgCatalog *CreateFromFile(const wxString& filename, const wxString& domain); @@ -432,7 +432,7 @@ public: @param domain Catalog's domain. This typically matches the @a filename. - @return Successfully loaded catalog or NULL on failure. + @return Successfully loaded catalog or @NULL on failure. */ static wxMsgCatalog *CreateFromData(const wxScopedCharBuffer& data, const wxString& domain); diff --git a/interface/wx/treebook.h b/interface/wx/treebook.h index bcc74785c2..e7f3daae25 100644 --- a/interface/wx/treebook.h +++ b/interface/wx/treebook.h @@ -60,7 +60,7 @@ public: Creates an empty wxTreebook. @param parent - The parent window. Must be non-@NULL. + The parent window. Must be non-null. @param id The window identifier. @param pos diff --git a/interface/wx/treectrl.h b/interface/wx/treectrl.h index 90269948f7..01b970e088 100644 --- a/interface/wx/treectrl.h +++ b/interface/wx/treectrl.h @@ -244,7 +244,7 @@ public: */ virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData* data = NULL); + wxTreeItemData* data = nullptr); /** Appends an item to the end of the branch identified by @a parent, return @@ -259,7 +259,7 @@ public: const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData* data = NULL); + wxTreeItemData* data = nullptr); /** Sets the buttons image list. The button images assigned with this method @@ -730,7 +730,7 @@ public: const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData* data = NULL); + wxTreeItemData* data = nullptr); /** Inserts an item before one identified @@ -747,7 +747,7 @@ public: const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData* data = NULL); + wxTreeItemData* data = nullptr); /** Returns @true if the given item is in bold state. @@ -812,7 +812,7 @@ public: const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData* data = NULL); + wxTreeItemData* data = nullptr); /** Scrolls the specified item into view. diff --git a/interface/wx/treelist.h b/interface/wx/treelist.h index bb0b12a5d7..388781c864 100644 --- a/interface/wx/treelist.h +++ b/interface/wx/treelist.h @@ -293,7 +293,7 @@ public: constructor and exactly once. @param parent - The parent window, must be non-NULL. + The parent window, must be non-null. @param id The window identifier, may be ::wxID_ANY. @param pos @@ -449,7 +449,7 @@ public: const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL); + wxClientData* data = nullptr); /** Insert a new item into the tree. @@ -478,14 +478,14 @@ public: const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL); + wxClientData* data = nullptr); /// Same as InsertItem() with wxTLI_FIRST. wxTreeListItem PrependItem(wxTreeListItem parent, const wxString& text, int imageClosed = NO_IMAGE, int imageOpened = NO_IMAGE, - wxClientData* data = NULL); + wxClientData* data = nullptr); /// Delete the specified item. void DeleteItem(wxTreeListItem item); @@ -841,14 +841,14 @@ public: @false and doesn't modify any of its output parameters. @param col - Receives the index of the column used for sorting if non-@NULL. + Receives the index of the column used for sorting if non-null. @param ascendingOrder Receives @true or @false depending on whether the items are sorted in ascending or descending order. @return @true if the control is sorted or @false if it isn't sorted at all. */ - bool GetSortColumn(unsigned* col, bool* ascendingOrder = NULL); + bool GetSortColumn(unsigned* col, bool* ascendingOrder = nullptr); /** Set the object to use for comparing the items. @@ -880,7 +880,7 @@ public: /** Return the view part of this control as a wxWindow. - This method always returns non-@NULL pointer once the window was + This method always returns non-null pointer once the window was created. */ wxWindow* GetView() const; diff --git a/interface/wx/unichar.h b/interface/wx/unichar.h index 9460b1c04c..2b45f3e7a6 100644 --- a/interface/wx/unichar.h +++ b/interface/wx/unichar.h @@ -72,7 +72,7 @@ public: @param c An output pointer to the value of this Unicode character as a @c - char. Must be non-@NULL. + char. Must be non-null. @return @true if the object is an 8 bit char and @a c was filled with its value as char or @false otherwise (@a c won't be modified then). diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 48f974b56d..c19e5bb592 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -102,7 +102,7 @@ public: leave enabled, if it is non-null. This parameter is only available since wxWidgets 3.1.7. */ - explicit wxWindowDisabler(wxWindow* winToSkip, wxWindow* winToSkip2 = NULL); + explicit wxWindowDisabler(wxWindow* winToSkip, wxWindow* winToSkip2 = nullptr); /** Reenables the windows disabled by the constructor. @@ -323,7 +323,7 @@ bool wxUnsetEnv(const wxString& var); values as values. @param map - The environment map to fill, must be non-@NULL. + The environment map to fill, must be non-null. @return @true if environment was successfully retrieved or @false otherwise. @@ -343,7 +343,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map); Fills the memory block with zeros in a way that is guaranteed not to be optimized away by the compiler. - @param p Pointer to the memory block to be zeroed, must be non-@NULL. + @param p Pointer to the memory block to be zeroed, must be non-null. @param n The number of bytes to zero. NOTE: If security is vitally important in your use case, please @@ -403,8 +403,8 @@ wxString wxGetDisplayName(); @header{wx/utils.h} */ bool wxGetDiskSpace(const wxString& path, - wxLongLong total = NULL, - wxLongLong free = NULL); + wxLongLong total = nullptr, + wxLongLong free = nullptr); /** For normal keys, returns @true if the specified key is currently down. @@ -464,28 +464,28 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt); Find a window by its label. Depending on the type of window, the label may be a window title or panel item label. If @a parent is @NULL, the search - will start from all top-level frames and dialog boxes; if non-@NULL, the + will start from all top-level frames and dialog boxes; if non-null, the search will be limited to the given window hierarchy. The search is recursive in both cases. @header{wx/utils.h} */ wxWindow* wxFindWindowByLabel(const wxString& label, - wxWindow* parent = NULL); + wxWindow* parent = nullptr); /** @deprecated Replaced by wxWindow::FindWindowByName(). Find a window by its name (as given in a window constructor or @e Create function call). If @a parent is @NULL, the search will start from all - top-level frames and dialog boxes; if non-@NULL, the search will be limited + top-level frames and dialog boxes; if non-null, the search will be limited to the given window hierarchy. The search is recursive in both cases. If no such named window is found, wxFindWindowByLabel() is called. @header{wx/utils.h} */ -wxWindow* wxFindWindowByName(const wxString& name, wxWindow* parent = NULL); +wxWindow* wxFindWindowByName(const wxString& name, wxWindow* parent = nullptr); /** Find a menu item identifier associated with the given frame's menu bar. @@ -579,7 +579,7 @@ bool wxLaunchDefaultBrowser(const wxString& url, int flags = 0); @endcode and then use it in the following way: @code - const void* data = NULL; + const void* data = nullptr; size_t size = 0; if ( !wxLoadUserResource(&data, &size, "mydata", "MYDATA") ) { ... handle error ... @@ -634,7 +634,7 @@ wxLoadUserResource(const void **outData, standard Windows @c MAKEINTRESOURCE() macro, including any constants for the standard resources types like @c RT_RCDATA. @param pLen Filled with the length of the returned buffer if it is - non-@NULL. This parameter should be used if NUL characters can occur in + non-null. This parameter should be used if NUL characters can occur in the resource data. It is new since wxWidgets 2.9.1 @param module The @c HINSTANCE of the module to load the resources from. The current module is used by default. This parameter is new since @@ -650,7 +650,7 @@ wxLoadUserResource(const void **outData, */ char* wxLoadUserResource(const wxString& resourceName, const wxChar* resourceType = "TEXT", - int* pLen = NULL, + int* pLen = nullptr, WXHINSTANCE module = 0); /** @@ -1056,7 +1056,7 @@ wxString wxGetOsDescription(); @header{wx/utils.h} */ -wxOperatingSystemId wxGetOsVersion(int* major = NULL, int* minor = NULL, int* micro = NULL); +wxOperatingSystemId wxGetOsVersion(int* major = nullptr, int* minor = nullptr, int* micro = nullptr); /** Returns @true if the version of the operating system on which the program @@ -1346,8 +1346,8 @@ enum @endWxPerlOnly */ long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, - wxProcess* callback = NULL, - const wxExecuteEnv* env = NULL); + wxProcess* callback = nullptr, + const wxExecuteEnv* env = nullptr); ///@} /** @addtogroup group_funcmacro_procctrl */ @@ -1382,11 +1382,11 @@ long wxExecute(const wxString& command, int flags = wxEXEC_ASYNC, @endWxPerlOnly */ long wxExecute(const char* const* argv, int flags = wxEXEC_ASYNC, - wxProcess* callback = NULL, - const wxExecuteEnv *env = NULL); + wxProcess* callback = nullptr, + const wxExecuteEnv *env = nullptr); long wxExecute(const wchar_t* const* argv, int flags = wxEXEC_ASYNC, - wxProcess* callback = NULL, - const wxExecuteEnv *env = NULL); + wxProcess* callback = nullptr, + const wxExecuteEnv *env = nullptr); ///@} /** @addtogroup group_funcmacro_procctrl */ @@ -1424,7 +1424,7 @@ long wxExecute(const wchar_t* const* argv, int flags = wxEXEC_ASYNC, @endWxPerlOnly */ long wxExecute(const wxString& command, wxArrayString& output, int flags = 0, - const wxExecuteEnv *env = NULL); + const wxExecuteEnv *env = nullptr); /** This is an overloaded version of wxExecute(const wxString&,int,wxProcess*), @@ -1461,7 +1461,7 @@ long wxExecute(const wxString& command, wxArrayString& output, int flags = 0, */ long wxExecute(const wxString& command, wxArrayString& output, wxArrayString& errors, int flags = 0, - const wxExecuteEnv *env = NULL); + const wxExecuteEnv *env = nullptr); /** Returns the number uniquely identifying the current process in the system. @@ -1533,7 +1533,7 @@ unsigned long wxGetProcessId(); @header{wx/utils.h} */ int wxKill(long pid, wxSignal sig = wxSIGTERM, - wxKillError* rc = NULL, int flags = wxKILL_NOCHILDREN); + wxKillError* rc = nullptr, int flags = wxKILL_NOCHILDREN); /** Executes a command in an interactive shell window. If no command is diff --git a/interface/wx/valnum.h b/interface/wx/valnum.h index b6dad5e3d9..cc9c7e913e 100644 --- a/interface/wx/valnum.h +++ b/interface/wx/valnum.h @@ -287,7 +287,7 @@ public: A combination of wxNumValidatorStyle enum values with the exception of wxNUM_VAL_NO_TRAILING_ZEROES which can't be used here. */ - wxIntegerValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT); + wxIntegerValidator(ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT); /** Validator constructor with specified range. @@ -405,7 +405,7 @@ public: @param style A combination of wxNumValidatorStyle enum values. */ - wxFloatingPointValidator(ValueType *value = NULL, + wxFloatingPointValidator(ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT); /** @@ -423,7 +423,7 @@ public: and accept. */ wxFloatingPointValidator(int precision, - ValueType *value = NULL, + ValueType *value = nullptr, int style = wxNUM_VAL_DEFAULT); diff --git a/interface/wx/valtext.h b/interface/wx/valtext.h index 5416db7044..6599c22f67 100644 --- a/interface/wx/valtext.h +++ b/interface/wx/valtext.h @@ -120,7 +120,7 @@ public: validator lifetime (which is usually determined by the lifetime of the window). */ - wxTextValidator(long style = wxFILTER_NONE, wxString* valPtr = NULL); + wxTextValidator(long style = wxFILTER_NONE, wxString* valPtr = nullptr); /** Clones the text validator using the copy constructor. diff --git a/interface/wx/weakref.h b/interface/wx/weakref.h index e954c26a3a..27243debcd 100644 --- a/interface/wx/weakref.h +++ b/interface/wx/weakref.h @@ -66,7 +66,7 @@ public: wnd->Destroy(); // Now the weak ref has been reset, so we don't risk accessing // a dangling pointer: - wxASSERT( wr==NULL ); + wxASSERT( wr==nullptr ); @endcode wxWeakRef works for any objects that are derived from wxTrackable. @@ -107,7 +107,7 @@ public: /** Constructor. The weak reference is initialized to @e pobj. */ - wxWeakRef(T* pobj = NULL); + wxWeakRef(T* pobj = nullptr); /** Copy constructor. diff --git a/interface/wx/webrequest.h b/interface/wx/webrequest.h index ff8f100f42..9a6ca22b4f 100644 --- a/interface/wx/webrequest.h +++ b/interface/wx/webrequest.h @@ -666,7 +666,7 @@ public: and destroyed. @param handler - The handler object to notify, must be non-@NULL. + The handler object to notify, must be non-null. @param url The URL of the HTTP resource for this request @param id diff --git a/interface/wx/webview.h b/interface/wx/webview.h index d2475c5462..3794d554a2 100644 --- a/interface/wx/webview.h +++ b/interface/wx/webview.h @@ -771,7 +771,7 @@ public: @param style Window style. For generic window styles, please see wxWindow. @param name Window name. - @return The created wxWebView, or @c NULL if the requested backend + @return The created wxWebView, or @NULL if the requested backend is not available @since 2.9.5 */ @@ -848,7 +848,7 @@ public: WebKitWebSettings* settings = webkit_web_view_get_settings(wv); g_object_set(G_OBJECT(settings), "enable-frame-flattening", TRUE, - NULL); + nullptr); #endif @endcode @@ -1081,7 +1081,7 @@ public: @see RunScriptAsync() */ - virtual bool RunScript(const wxString& javascript, wxString* output = NULL) const = 0; + virtual bool RunScript(const wxString& javascript, wxString* output = nullptr) const = 0; /** Runs the given JavaScript code asynchronously and returns the result @@ -1101,7 +1101,7 @@ public: @since 3.1.6 @see RunScript() */ - virtual void RunScriptAsync(const wxString& javascript, void* clientData = NULL) const; + virtual void RunScriptAsync(const wxString& javascript, void* clientData = nullptr) const; /** diff --git a/interface/wx/window.h b/interface/wx/window.h index 8426068129..46af378389 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -835,7 +835,7 @@ public: function directly. */ virtual void ScrollWindow(int dx, int dy, - const wxRect* rect = NULL); + const wxRect* rect = nullptr); /** Same as #ScrollLines (-1). @@ -1118,7 +1118,7 @@ public: Using these methods is discouraged as passing @NULL will prevent your application from correctly supporting monitors with different resolutions even in the future wxWidgets versions which will add - support for them, and passing non-@NULL window is just a less + support for them, and passing non-null window is just a less convenient way of calling the non-static FromDIP() method. @since 3.1.0 @@ -1185,7 +1185,7 @@ public: Using these methods is discouraged as passing @NULL will prevent your application from correctly supporting monitors with different resolutions even in the future wxWidgets versions which will add - support for them, and passing non-@NULL window is just a less + support for them, and passing non-null window is just a less convenient way of calling the non-static ToDIP() method. @since 3.1.0 @@ -1893,9 +1893,9 @@ public: for the child windows or relative to the display origin for the top level windows. @param x - Receives the x position of the window if non-@NULL. + Receives the x position of the window if non-null. @param y - Receives the y position of the window if non-@NULL. + Receives the y position of the window if non-null. @beginWxPerlOnly In wxPerl this method is implemented as GetPositionXY() returning @@ -1926,9 +1926,9 @@ public: child window or a top level one. @param x - Receives the x position of the window on the screen if non-@NULL. + Receives the x position of the window on the screen if non-null. @param y - Receives the y position of the window on the screen if non-@NULL. + Receives the y position of the window on the screen if non-null. @see GetPosition() */ @@ -2264,9 +2264,9 @@ public: */ void GetTextExtent(const wxString& string, int* w, int* h, - int* descent = NULL, - int* externalLeading = NULL, - const wxFont* font = NULL) const; + int* descent = nullptr, + int* externalLeading = nullptr, + const wxFont* font = nullptr) const; /** Gets the dimensions of the string as it would be drawn on the @@ -2307,12 +2307,12 @@ public: If @true, the background will be erased too. Note that in non-MSW ports background is always erased. @param rect - If non-@NULL, only the given rectangle will be treated as damaged. + If non-null, only the given rectangle will be treated as damaged. @see RefreshRect() */ virtual void Refresh(bool eraseBackground = true, - const wxRect* rect = NULL); + const wxRect* rect = nullptr); /** Redraws the contents of the given rectangle: only the area inside it will be @@ -2446,7 +2446,7 @@ public: @since 2.9.4 */ - virtual bool IsTransparentBackgroundSupported(wxString *reason = NULL) const; + virtual bool IsTransparentBackgroundSupported(wxString *reason = nullptr) const; /** Sets the font for this window. This function should not be called for the @@ -2726,7 +2726,7 @@ public: See wxEvtHandler::Unlink() for more info. @param handler - The event handler to remove, must be non-@NULL and + The event handler to remove, must be non-null and must be present in this windows event handlers stack. @return Returns @true if it was found and @false otherwise (this also @@ -3572,7 +3572,7 @@ public: window, it will be deleted if the @a deleteOld parameter is @true. Note that this function will also call SetAutoLayout() implicitly with @true - parameter if the @a sizer is non-@NULL and @false otherwise so that the + parameter if the @a sizer is non-null and @false otherwise so that the sizer will be effectively used to layout the window children whenever it is resized. @@ -4081,7 +4081,7 @@ public: Find the first window with the given @e id. If @a parent is @NULL, the search will start from all top-level frames - and dialog boxes; if non-@NULL, the search will be limited to the given + and dialog boxes; if non-null, the search will be limited to the given window hierarchy. The search is recursive in both cases. @@ -4096,7 +4096,7 @@ public: Depending on the type of window, the label may be a window title or panel item label. If @a parent is @NULL, the search will start from all - top-level frames and dialog boxes; if non-@NULL, the search will be + top-level frames and dialog boxes; if non-null, the search will be limited to the given window hierarchy. The search is recursive in both cases and, unlike with FindWindow(), @@ -4114,7 +4114,7 @@ public: function call). If @a parent is @NULL, the search will start from all top-level frames - and dialog boxes; if non-@NULL, the search will be limited to the given + and dialog boxes; if non-null, the search will be limited to the given window hierarchy. The search is recursive in both cases and, unlike FindWindow(), diff --git a/interface/wx/windowptr.h b/interface/wx/windowptr.h index 11e7b6f3d5..f4b0a15cd3 100644 --- a/interface/wx/windowptr.h +++ b/interface/wx/windowptr.h @@ -77,6 +77,6 @@ public: If the reference count of the previously owned pointer was 1 it will be deleted. */ - void reset(T* ptr = NULL); + void reset(T* ptr = nullptr); }; diff --git a/interface/wx/withimages.h b/interface/wx/withimages.h index 3dbb6ac621..b387bf3397 100644 --- a/interface/wx/withimages.h +++ b/interface/wx/withimages.h @@ -109,7 +109,7 @@ public: virtual void SetImageList(wxImageList* imageList); /** - Returns the associated image list, may be NULL. + Returns the associated image list, may be @NULL. Note that the new code should use GetUpdatedImageListFor() instead. diff --git a/interface/wx/wizard.h b/interface/wx/wizard.h index 4784a6a6ab..a8d339dce5 100644 --- a/interface/wx/wizard.h +++ b/interface/wx/wizard.h @@ -212,17 +212,17 @@ public: They may be modified later by SetPrev() or SetNext(). */ wxWizardPageSimple(wxWizard* parent, - wxWizardPage* prev = NULL, - wxWizardPage* next = NULL, + wxWizardPage* prev = nullptr, + wxWizardPage* next = nullptr, const wxBitmapBundle& bitmap = wxBitmapBundle()); /** Creates the wizard page. Must be called if the default constructor had been used to create the object. */ - bool Create(wxWizard *parent = NULL, - wxWizardPage *prev = NULL, - wxWizardPage *next = NULL, + bool Create(wxWizard *parent = nullptr, + wxWizardPage *prev = nullptr, + wxWizardPage *next = nullptr, const wxBitmapBundle& bitmap = wxBitmapBundle()); /** @@ -242,7 +242,7 @@ public: in fully static wizards, i.e. in those where the order doesn't depend on the choices made by the user in the wizard pages during run-time. - @param next A non-@NULL pointer to the next page. + @param next A non-null pointer to the next page. @return Reference to @a next on which Chain() can be called again. @since 2.9.5 diff --git a/interface/wx/wupdlock.h b/interface/wx/wupdlock.h index 9caf70acc8..093108be00 100644 --- a/interface/wx/wupdlock.h +++ b/interface/wx/wupdlock.h @@ -48,7 +48,7 @@ public: /** Creates an object preventing the updates of the specified @e win. - The parameter must be non-@NULL and the window must exist for longer than + The parameter must be non-null and the window must exist for longer than wxWindowUpdateLocker object itself. */ explicit wxWindowUpdateLocker(wxWindow* win); diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h index 9dda59358f..a8e82e4572 100644 --- a/interface/wx/xml/xml.h +++ b/interface/wx/xml/xml.h @@ -101,8 +101,8 @@ public: wxXmlNode(wxXmlNode* parent, wxXmlNodeType type, const wxString& name, const wxString& content = wxEmptyString, - wxXmlAttribute* attrs = NULL, - wxXmlNode* next = NULL, int lineNo = -1); + wxXmlAttribute* attrs = nullptr, + wxXmlNode* next = nullptr, int lineNo = -1); /** A simplified version of the first constructor form, assuming a @NULL parent. @@ -206,7 +206,7 @@ public: @a grandparent or the @NULL node (which is the parent of non-linked nodes or the parent of a wxXmlDocument's root element node). */ - int GetDepth(wxXmlNode* grandparent = NULL) const; + int GetDepth(wxXmlNode* grandparent = nullptr) const; /** Returns a flag indicating whether encoding conversion is necessary when saving. The default is @false. @@ -417,7 +417,7 @@ public: If @a next is not @NULL, then sets it as sibling of this attribute. */ wxXmlAttribute(const wxString& name, const wxString& value, - wxXmlAttribute* next = NULL); + wxXmlAttribute* next = nullptr); /** The virtual destructor. @@ -664,7 +664,7 @@ enum wxXmlDocumentLoadFlag // Create a document and add the root node. wxXmlDocument xmlDoc; - wxXmlNode* root = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, "Root"); + wxXmlNode* root = new wxXmlNode(nullptr, wxXML_ELEMENT_NODE, "Root"); xmlDoc.SetRoot(root); // Add some XML. diff --git a/interface/wx/xrc/xmlres.h b/interface/wx/xrc/xmlres.h index 18741f29ad..7cc4da094b 100644 --- a/interface/wx/xrc/xmlres.h +++ b/interface/wx/xrc/xmlres.h @@ -107,7 +107,7 @@ public: */ bool AttachUnknownControl(const wxString& name, wxWindow* control, - wxWindow* parent = NULL); + wxWindow* parent = nullptr); /** Removes all handlers and deletes them (this means that any handlers @@ -527,7 +527,7 @@ public: (usually window, dialog or panel) that is often necessary to create the resource. - If @b instance is non-@NULL it should not create a new instance via + If @b instance is non-null it should not create a new instance via 'new' but should rather use this one, and call its Create method. */ wxObject* CreateResource(wxXmlNode* node, wxObject* parent, @@ -578,13 +578,13 @@ protected: Helper function. */ void CreateChildrenPrivately(wxObject* parent, - wxXmlNode* rootnode = NULL); + wxXmlNode* rootnode = nullptr); /** Creates a resource from a node. */ wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent, - wxObject* instance = NULL); + wxObject* instance = nullptr); /** Creates an animation (see wxAnimation) from the filename specified in @a param. @@ -596,7 +596,7 @@ protected: implementation is created. */ wxAnimation* GetAnimation(const wxString& param = "animation", - wxAnimationCtrlBase* ctrl = NULL); + wxAnimationCtrlBase* ctrl = nullptr); /** Gets a bitmap. diff --git a/interface/wx/zipstrm.h b/interface/wx/zipstrm.h index 547fcd9eb5..bfb2f76a0f 100644 --- a/interface/wx/zipstrm.h +++ b/interface/wx/zipstrm.h @@ -311,7 +311,7 @@ public: */ static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, - bool* pIsDir = NULL); + bool* pIsDir = nullptr); /** Returns the entry's filename in the internal format used within the archive. The name can include directory components, i.e. it can be a full path. diff --git a/misc/languages/genlang.py b/misc/languages/genlang.py index f02469eda8..b375e628d2 100755 --- a/misc/languages/genlang.py +++ b/misc/languages/genlang.py @@ -150,7 +150,7 @@ static const struct langData_t tabLangData[] = { %s - { 0, NULL, NULL, NULL, 0, 0, wxLayout_Default, NULL, NULL } + { 0, nullptr, nullptr, nullptr, 0, 0, wxLayout_Default, nullptr, nullptr } }; // Data table for known language scripts @@ -162,7 +162,7 @@ static const struct scriptData_t tabScriptData[] = { %s - { NULL, NULL } + { nullptr, nullptr } }; void wxUILocale::InitLanguagesDB() diff --git a/samples/access/accesstest.cpp b/samples/access/accesstest.cpp index fb1900fd6d..1e26751e83 100644 --- a/samples/access/accesstest.cpp +++ b/samples/access/accesstest.cpp @@ -249,12 +249,12 @@ public: virtual wxAccStatus GetChildCount(int* childCount) override; // Gets the specified child (starting from 1). - // If *child is NULL and return value is wxACC_OK, + // If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. virtual wxAccStatus GetChild(int childId, wxAccessible** child) override; - // Gets the parent, or NULL. + // Gets the parent, or nullptr. virtual wxAccStatus GetParent(wxAccessible** parent) override; // Performs the default action. childId is 0 (the action for this object) @@ -295,7 +295,7 @@ public: virtual wxAccStatus Select(int childId, wxAccSelectionFlags selectFlags) override; // Gets the window with the keyboard focus. - // If childId is 0 and child is NULL, no object in + // If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. virtual wxAccStatus GetFocus(int* childId, wxAccessible** child) override; @@ -318,9 +318,9 @@ public: // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, wxID_ANY, title, pos, size, style) + : wxFrame(nullptr, wxID_ANY, title, pos, size, style) { - m_textCtrl = NULL; + m_textCtrl = nullptr; SetAccessible(new FrameAccessible(this)); @@ -400,7 +400,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event)) { m_textCtrl->Clear(); - IAccessible* accessibleFrame = NULL; + IAccessible* accessibleFrame = nullptr; if (S_OK != AccessibleObjectFromWindow((HWND) GetHWND(), (DWORD)OBJID_CLIENT, IID_IAccessible, (void**) & accessibleFrame)) { @@ -442,7 +442,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event)) { for (i = 0; i < childCount; i++) { - IAccessible* childAccessible = NULL; + IAccessible* childAccessible = nullptr; if (var[i].pdispVal) { if (var[i].pdispVal->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK) @@ -525,8 +525,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj) VariantInit(& var); var.vt = VT_I4; var.lVal = i; - IDispatch* pDisp = NULL; - IAccessible* childObject = NULL; + IDispatch* pDisp = nullptr; + IAccessible* childObject = nullptr; if (S_OK == obj->get_accChild(var, & pDisp) && pDisp) { @@ -689,7 +689,7 @@ wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId, if (fromId == 1) { *toId = 2; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } else if (fromId == 2) @@ -726,7 +726,7 @@ wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId, if (fromId == 3) { *toId = 2; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } else if (fromId == 2) @@ -748,7 +748,7 @@ wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId, if (fromId == 1) { *toId = 2; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } else if (fromId == 2) @@ -769,7 +769,7 @@ wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId, if (fromId == 3) { *toId = 2; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } else if (fromId == 2) @@ -792,7 +792,7 @@ wxAccStatus SplitterWindowAccessible::Navigate(wxNavDir navDir, int fromId, if (fromId == 1) { *toId = 2; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } else if (fromId == 2) @@ -873,7 +873,7 @@ wxAccStatus SplitterWindowAccessible::GetChildCount(int* childCount) } // Gets the specified child (starting from 1). -// If *child is NULL and return value is wxACC_OK, +// If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. wxAccStatus SplitterWindowAccessible::GetChild(int childId, wxAccessible** child) @@ -896,7 +896,7 @@ wxAccStatus SplitterWindowAccessible::GetChild(int childId, wxAccessible** child } else if (childId == 2) { - *child = NULL; // Sash + *child = nullptr; // Sash } else if (childId == 3) { @@ -936,7 +936,7 @@ wxAccStatus SplitterWindowAccessible::GetChild(int childId, wxAccessible** child return wxACC_NOT_IMPLEMENTED; } -// Gets the parent, or NULL. +// Gets the parent, or nullptr. wxAccStatus SplitterWindowAccessible::GetParent(wxAccessible** WXUNUSED(parent)) { return wxACC_NOT_IMPLEMENTED; @@ -1086,7 +1086,7 @@ wxAccStatus SplitterWindowAccessible::Select(int childId, wxAccSelectionFlags WX } // Gets the window with the keyboard focus. -// If childId is 0 and child is NULL, no object in +// If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. wxAccStatus SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) diff --git a/samples/animate/anitest.cpp b/samples/animate/anitest.cpp index 07e784ab6a..36da022990 100644 --- a/samples/animate/anitest.cpp +++ b/samples/animate/anitest.cpp @@ -100,7 +100,7 @@ bool MyApp::OnInit() // Create the main frame window - MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, "Animation Demo", + MyFrame* frame = new MyFrame(nullptr, wxID_ANY, "Animation Demo", wxDefaultPosition, wxSize(500, 400), wxDEFAULT_FRAME_STYLE); frame->Show(true); diff --git a/samples/archive/archive.cpp b/samples/archive/archive.cpp index 2469569e0e..312f942a1c 100644 --- a/samples/archive/archive.cpp +++ b/samples/archive/archive.cpp @@ -29,8 +29,8 @@ public: ArchiveApp() { m_forceZip64 = false; - m_archiveClassFactory = NULL; - m_filterClassFactory = NULL; + m_archiveClassFactory = nullptr; + m_filterClassFactory = nullptr; } virtual void OnInitCmdLine(wxCmdLineParser& parser) override; @@ -62,7 +62,7 @@ private: wxVector m_fileNames; bool m_forceZip64; - // At most one of these pointers is non-NULL. + // At most one of these pointers is non-null. const wxArchiveClassFactory* m_archiveClassFactory; const wxFilterClassFactory* m_filterClassFactory; diff --git a/samples/artprov/arttest.cpp b/samples/artprov/arttest.cpp index fb6e6f3728..e0f37003f0 100644 --- a/samples/artprov/arttest.cpp +++ b/samples/artprov/arttest.cpp @@ -144,7 +144,7 @@ wxBitmap MyArtProvider::CreateBitmap(const wxArtID& id, // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, wxID_ANY, title, pos, size, style) + : wxFrame(nullptr, wxID_ANY, title, pos, size, style) { SetIcon(wxICON(sample)); diff --git a/samples/aui/auidemo.cpp b/samples/aui/auidemo.cpp index 5b22b852c9..950bf1c7da 100644 --- a/samples/aui/auidemo.cpp +++ b/samples/aui/auidemo.cpp @@ -120,9 +120,9 @@ private: wxTextCtrl* CreateTextCtrl(const wxString& text = wxEmptyString); wxGrid* CreateGrid(); wxTreeCtrl* CreateTreeCtrl(); - wxSizeReportCtrl* CreateSizeReportCtrl(const wxSize &size = wxWindow::FromDIP(wxSize(80, 80), NULL)); + wxSizeReportCtrl* CreateSizeReportCtrl(const wxSize &size = wxWindow::FromDIP(wxSize(80, 80), nullptr)); wxPoint GetStartPosition(); - wxHtmlWindow* CreateHTMLCtrl(wxWindow* parent = NULL); + wxHtmlWindow* CreateHTMLCtrl(wxWindow* parent = nullptr); wxAuiNotebook* CreateNotebook(); wxString GetIntroText(); @@ -183,7 +183,7 @@ public: wxSizeReportCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - wxAuiManager* mgr = NULL) + wxAuiManager* mgr = nullptr) : wxControl(parent, id, pos, size, wxNO_BORDER) { m_mgr = mgr; @@ -561,11 +561,11 @@ bool MyApp::OnInit() if ( !wxApp::OnInit() ) return false; - wxFrame* frame = new MyFrame(NULL, + wxFrame* frame = new MyFrame(nullptr, wxID_ANY, "wxAUI Sample Application", wxDefaultPosition, - wxWindow::FromDIP(wxSize(800, 600), NULL)); + wxWindow::FromDIP(wxSize(800, 600), nullptr)); frame->Show(); return true; diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 0f952c2fa0..951aee7c60 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -414,7 +414,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { // set the frame icon SetIcon(wxICON(sample)); @@ -953,11 +953,11 @@ wxEND_EVENT_TABLE() MyDateDialog::MyDateDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle) : wxDialog(parent, wxID_ANY, wxString("Calendar: Choose a date")) { - wxWindow* datePickerWindow = NULL; + wxWindow* datePickerWindow = nullptr; #if wxUSE_DATEPICKCTRL_GENERIC - m_datePickerGeneric = NULL; - m_datePicker = NULL; + m_datePickerGeneric = nullptr; + m_datePicker = nullptr; wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent); if ( frame && frame->GetMenuBar()->IsChecked(Calendar_DatePicker_Generic) ) @@ -1027,11 +1027,11 @@ wxEND_EVENT_TABLE() MyTimeDialog::MyTimeDialog(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString("Calendar: Choose time")) { - wxWindow* timePickerWindow = NULL; + wxWindow* timePickerWindow = nullptr; #if wxUSE_TIMEPICKCTRL_GENERIC - m_timePickerGeneric = NULL; - m_timePicker = NULL; + m_timePickerGeneric = nullptr; + m_timePicker = nullptr; wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent); if ( frame && frame->GetMenuBar()->IsChecked(Calendar_TimePicker_Generic) ) diff --git a/samples/caret/caret.cpp b/samples/caret/caret.cpp index 98a3b03db0..c865f5b356 100644 --- a/samples/caret/caret.cpp +++ b/samples/caret/caret.cpp @@ -200,7 +200,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { // set the frame icon SetIcon(wxICON(sample)); @@ -304,7 +304,7 @@ MyCanvas::MyCanvas( wxWindow *parent ) wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ) { - m_text = (wxChar *)NULL; + m_text = nullptr; SetBackgroundColour(*wxWHITE); diff --git a/samples/clipboard/clipboard.cpp b/samples/clipboard/clipboard.cpp index 656dcc2fb0..ed865d1a0a 100644 --- a/samples/clipboard/clipboard.cpp +++ b/samples/clipboard/clipboard.cpp @@ -98,7 +98,7 @@ bool MyApp::OnInit() } MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/collpane/collpane.cpp b/samples/collpane/collpane.cpp index 155d3931bd..f435ef4f06 100644 --- a/samples/collpane/collpane.cpp +++ b/samples/collpane/collpane.cpp @@ -168,7 +168,7 @@ wxEND_EVENT_TABLE() // My frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxCollapsiblePane sample", + : wxFrame(nullptr, wxID_ANY, "wxCollapsiblePane sample", wxDefaultPosition, wxSize(420, 300)) { SetIcon(wxICON(sample)); diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp index b07c7b0f29..d97c2f275c 100644 --- a/samples/combo/combo.cpp +++ b/samples/combo/combo.cpp @@ -578,7 +578,7 @@ private: // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { wxBoxSizer* topSizer; wxBoxSizer* topRowSizer; @@ -1154,7 +1154,7 @@ void MyFrame::OnIdle(wxIdleEvent& event) // This code is useful for debugging focus problems // (which are plentiful when dealing with popup windows). #if 0 - static wxWindow* lastFocus = (wxWindow*) NULL; + static wxWindow* lastFocus = nullptr; wxWindow* curFocus = ::wxWindow::FindFocus(); diff --git a/samples/config/conftest.cpp b/samples/config/conftest.cpp index 6fa11af1e0..76bea765a1 100644 --- a/samples/config/conftest.cpp +++ b/samples/config/conftest.cpp @@ -133,7 +133,7 @@ int MyApp::OnExit() // clean up: Set() returns the active config object as Get() does, but unlike // Get() it doesn't try to create one if there is none (definitely not what // we want here!) - delete wxConfigBase::Set((wxConfigBase *) NULL); + delete wxConfigBase::Set(nullptr); return 0; } @@ -144,7 +144,7 @@ int MyApp::OnExit() // main frame ctor MyFrame::MyFrame() - : wxFrame((wxFrame *) NULL, wxID_ANY, "wxConfig Demo") + : wxFrame(nullptr, wxID_ANY, "wxConfig Demo") { SetIcon(wxICON(sample)); @@ -229,7 +229,7 @@ void MyFrame::OnAbout(wxCommandEvent&) void MyFrame::OnDelete(wxCommandEvent&) { wxConfigBase *pConfig = wxConfigBase::Get(); - if ( pConfig == NULL ) + if ( pConfig == nullptr ) { wxLogError("No config to delete!"); return; @@ -239,7 +239,7 @@ void MyFrame::OnDelete(wxCommandEvent&) { wxLogMessage("Config file/registry key successfully deleted."); - delete wxConfigBase::Set(NULL); + delete wxConfigBase::Set(nullptr); wxConfigBase::DontCreateOnDemand(); } else @@ -251,7 +251,7 @@ void MyFrame::OnDelete(wxCommandEvent&) MyFrame::~MyFrame() { wxConfigBase *pConfig = wxConfigBase::Get(); - if ( pConfig == NULL ) + if ( pConfig == nullptr ) return; // save the control's values to the config diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index 491a0262c0..1560ab8bd1 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -384,7 +384,7 @@ bool MyApp::OnInit() return false; MyFrame *frame = - new MyFrame(NULL, "wxDataViewCtrl sample", 40, 40, 1000, 540); + new MyFrame(nullptr, "wxDataViewCtrl sample", 40, 40, 1000, 540); frame->Show(true); return true; @@ -561,11 +561,11 @@ wxEND_EVENT_TABLE() MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h): wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)) { - m_log = NULL; - m_col = NULL; + m_log = nullptr; + m_col = nullptr; for ( int page = 0; page < Page_Max; ++page ) - m_ctrl[page] = NULL; + m_ctrl[page] = nullptr; m_eventFromProgram = false; @@ -1152,7 +1152,7 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event)) wxDataViewCtrl* const dvc = m_ctrl[m_notebook->GetSelection()]; wxDataViewItem item; - wxDataViewColumn* column = NULL; + wxDataViewColumn* column = nullptr; dvc->HitTest(dvc->ScreenToClient(wxGetMousePosition()), item, column); if ( item.IsOk() ) @@ -1366,14 +1366,14 @@ void MyFrame::OnStyleChange( wxCommandEvent& WXUNUSED(event) ) sz->Detach(m_ctrl[nPanel]); wxDELETE(m_ctrl[nPanel]); - m_ctrl[nPanel] = NULL; + m_ctrl[nPanel] = nullptr; if (nPanel == 0) - m_music_model.reset(NULL); + m_music_model.reset(nullptr); else if (nPanel == 1) - m_list_model.reset(NULL); + m_list_model.reset(nullptr); else if (nPanel == 4) - m_long_music_model.reset(NULL); + m_long_music_model.reset(nullptr); int flags = 0; if ( GetMenuBar()->FindItem(ID_ALIGN_CENTRE_H)->IsChecked() ) @@ -1938,7 +1938,7 @@ void MyFrame::FillIndexList(Lang lang) void MyFrame::OnIndexListResetModel(wxCommandEvent&) { - m_ctrl[Page_IndexList]->AssociateModel(NULL); + m_ctrl[Page_IndexList]->AssociateModel(nullptr); m_ctrl[Page_IndexList]->AssociateModel(m_index_list_model.get()); } diff --git a/samples/dataview/mymodels.cpp b/samples/dataview/mymodels.cpp index 9854aa0e33..30d8f71328 100644 --- a/samples/dataview/mymodels.cpp +++ b/samples/dataview/mymodels.cpp @@ -27,7 +27,7 @@ MyMusicTreeModel::MyMusicTreeModel() { - m_root = new MyMusicTreeModelNode( NULL, "My Music" ); + m_root = new MyMusicTreeModelNode( nullptr, "My Music" ); // setup pop music m_pop = new MyMusicTreeModelNode( m_root, "Pop music" ); @@ -128,11 +128,11 @@ void MyMusicTreeModel::Delete( const wxDataViewItem &item ) // is the node one of those we keep stored in special pointers? if (node == m_pop) - m_pop = NULL; + m_pop = nullptr; else if (node == m_classical) - m_classical = NULL; + m_classical = nullptr; else if (node == m_ninth) - m_ninth = NULL; + m_ninth = nullptr; // first remove the node from the parent's array of children; // NOTE: MyMusicTreeModelNodePtrArray is only an array of _pointers_ @@ -147,9 +147,9 @@ void MyMusicTreeModel::Delete( const wxDataViewItem &item ) } void MyMusicTreeModel::Clear() { - m_pop = NULL; - m_classical = NULL; - m_ninth = NULL; + m_pop = nullptr; + m_classical = nullptr; + m_ninth = nullptr; while (!m_root->GetChildren().IsEmpty()) { diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp index b41e4596da..2b18c1dfbb 100644 --- a/samples/debugrpt/debugrpt.cpp +++ b/samples/debugrpt/debugrpt.cpp @@ -248,7 +248,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets Debug Report Sample", + : wxFrame(nullptr, wxID_ANY, "wxWidgets Debug Report Sample", wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE) { m_numLines = 10; diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index ad18c88b96..8a69f341e6 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -370,7 +370,7 @@ bool MyApp::OnInit() "Progress in progress", "Please wait, starting...", PROGRESS_COUNT, - NULL, + nullptr, m_startupProgressStyle ); for ( int i = 0; i <= PROGRESS_COUNT; i++ ) @@ -693,17 +693,17 @@ bool MyApp::OnInit() // My frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title), m_confirmExit(false) + : wxFrame(nullptr, wxID_ANY, title), m_confirmExit(false) { SetIcon(wxICON(sample)); #if USE_MODAL_PRESENTATION - m_dialog = (MyModelessDialog *)NULL; + m_dialog = nullptr; #endif // USE_MODAL_PRESENTATION #if wxUSE_FINDREPLDLG m_dlgFind = - m_dlgReplace = NULL; + m_dlgReplace = nullptr; #endif #if wxUSE_COLOURDLG @@ -766,7 +766,7 @@ MyFrame::MyFrame(const wxString& title) #endif // wxUSE_INFOBAR #if wxUSE_TIPWINDOW - m_tipWindow = NULL; + m_tipWindow = nullptr; #endif // wxUSE_TIPWINDOW #ifdef __WXMSW__ @@ -2294,12 +2294,12 @@ void MyFrame::ModelessDlg(wxCommandEvent& event) } else // hide { - // If m_dialog is NULL, then possibly the system + // If m_dialog is null, then possibly the system // didn't report the checked menu item status correctly. // It should be true just after the menu item was selected, // if there was no modeless dialog yet. - wxASSERT( m_dialog != NULL ); + wxASSERT( m_dialog != nullptr ); if (m_dialog) m_dialog->Hide(); } @@ -2359,7 +2359,7 @@ void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event)) if ( s_index == (size_t)-1 ) { - srand(time(NULL)); + srand(time(nullptr)); // this is completely bogus, we don't know how many lines are there // in the file, but who cares, it's a demo only... @@ -2520,7 +2520,7 @@ public: sizerSettings->Add(m_handleEvents); #if defined(__WXMSW__) && wxUSE_TASKBARICON - m_taskbarIcon = NULL; + m_taskbarIcon = nullptr; m_useTaskbar = new wxCheckBox(this, wxID_ANY, "Use persistent &taskbar icon"); m_useTaskbar->SetValue(false); sizerSettings->Add(m_useTaskbar); @@ -2635,9 +2635,9 @@ private: else if ( m_taskbarIcon ) { - wxNotificationMessage::UseTaskBarIcon(NULL); + wxNotificationMessage::UseTaskBarIcon(nullptr); delete m_taskbarIcon; - m_taskbarIcon = NULL; + m_taskbarIcon = nullptr; } #endif } @@ -2830,7 +2830,7 @@ void MyFrame::OnShowTip(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUpdateShowTipUI(wxUpdateUIEvent& event) { - event.Check(m_tipWindow != NULL); + event.Check(m_tipWindow != nullptr); } #endif // wxUSE_TIPWINDOW @@ -3566,7 +3566,7 @@ void MyFrame::ShowReplaceDialog( wxCommandEvent& WXUNUSED(event) ) { m_dlgReplace->Destroy(); - m_dlgReplace = NULL; + m_dlgReplace = nullptr; } else { @@ -3588,7 +3588,7 @@ void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) ) { m_dlgFind->Destroy(); - m_dlgFind = NULL; + m_dlgFind = nullptr; } else { @@ -3646,13 +3646,13 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) { txt = "Find"; idMenu = DIALOGS_FIND; - m_dlgFind = NULL; + m_dlgFind = nullptr; } else if ( dlg == m_dlgReplace ) { txt = "Replace"; idMenu = DIALOGS_REPLACE; - m_dlgReplace = NULL; + m_dlgReplace = nullptr; } else { @@ -3794,7 +3794,7 @@ void MyModalDialog::OnButton(wxCommandEvent& event) StdButtonSizerDialog::StdButtonSizerDialog(wxWindow *parent) : wxDialog(parent, wxID_ANY, wxString("StdButtonSizer dialog"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), - m_buttonsSizer(NULL) + m_buttonsSizer(nullptr) { wxBoxSizer *const sizerTop = new wxBoxSizer(wxVERTICAL); @@ -3996,7 +3996,7 @@ SettingsDialog::SettingsDialog(wxWindow* win, SettingsData& settingsData, int di Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize)); } else - m_imageList = NULL; + m_imageList = nullptr; Create(win, wxID_ANY, "Preferences", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | resizeBorder); @@ -4557,7 +4557,7 @@ private: const wxString& title, int style) override { - wxMessageDialog dlg(NULL, message, title, + wxMessageDialog dlg(nullptr, message, title, wxOK | wxCANCEL | wxCANCEL_DEFAULT | style); dlg.SetOKCancelLabels(wxID_COPY, wxID_OK); dlg.SetExtendedMessage("Note that this is a custom log dialog."); diff --git a/samples/dialup/nettest.cpp b/samples/dialup/nettest.cpp index f8bd276256..0f19730585 100644 --- a/samples/dialup/nettest.cpp +++ b/samples/dialup/nettest.cpp @@ -217,7 +217,7 @@ void MyApp::OnConnected(wxDialUpEvent& event) // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 54fcd50d69..cd54c683df 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -202,7 +202,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, wxID_ANY, title, pos, size, style) + : wxFrame(nullptr, wxID_ANY, title, pos, size, style) { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/dll/my_dll.cpp b/samples/dll/my_dll.cpp index 2079682ba0..7386ba3517 100644 --- a/samples/dll/my_dll.cpp +++ b/samples/dll/my_dll.cpp @@ -150,7 +150,7 @@ MyDllApp::MyDllApp() void MyDllApp::OnShowWindow(wxThreadEvent& event) { - wxFrame *f = new MyDllFrame(NULL, event.GetString()); + wxFrame *f = new MyDllFrame(nullptr, event.GetString()); f->Show(true); } @@ -173,8 +173,8 @@ namespace // Critical section that guards everything related to wxWidgets "main" thread // startup or shutdown. wxCriticalSection gs_wxStartupCS; -// Handle of wx "main" thread if running, NULL otherwise -HANDLE gs_wxMainThread = NULL; +// Handle of wx "main" thread if running, nullptr otherwise +HANDLE gs_wxMainThread = nullptr; // wx application startup code -- runs from its own thread @@ -245,10 +245,10 @@ void run_wx_gui_from_dll(const char *title) { HANDLE hEvent = CreateEvent ( - NULL, // default security attributes + nullptr, // default security attributes FALSE, // auto-reset FALSE, // initially non-signaled - NULL // anonymous + nullptr // anonymous ); if ( !hEvent ) return; // error @@ -256,12 +256,12 @@ void run_wx_gui_from_dll(const char *title) // NB: If your compiler doesn't have _beginthreadex(), use CreateThread() gs_wxMainThread = (HANDLE)_beginthreadex ( - NULL, // default security + nullptr, // default security 0, // default stack size &MyAppLauncher, &hEvent, // arguments 0, // create running - NULL + nullptr ); if ( !gs_wxMainThread ) @@ -300,7 +300,7 @@ void wx_dll_cleanup() // We must then wait for the thread to actually terminate. WaitForSingleObject(gs_wxMainThread, INFINITE); CloseHandle(gs_wxMainThread); - gs_wxMainThread = NULL; + gs_wxMainThread = nullptr; } } // extern "C" diff --git a/samples/dll/sdk_exe.cpp b/samples/dll/sdk_exe.cpp index 7e5c127029..ef848b6aa8 100644 --- a/samples/dll/sdk_exe.cpp +++ b/samples/dll/sdk_exe.cpp @@ -95,8 +95,8 @@ bool RegisterMainClass() wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = MainWndProc; wc.hInstance = g_hInstance; - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszClassName = MAIN_WIN_CLASS_NAME; @@ -112,7 +112,7 @@ bool CreateMainWindow() WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, - NULL, NULL, g_hInstance, NULL + nullptr, nullptr, g_hInstance, nullptr ); if ( !g_hwndMain ) return false; @@ -123,7 +123,7 @@ bool CreateMainWindow() _TEXT("Main Win32 application"), WS_CHILD | WS_VISIBLE, 10, 10, 200, 30, - g_hwndMain, (HMENU)-1, g_hInstance, NULL + g_hwndMain, (HMENU)-1, g_hInstance, nullptr ); CreateWindow @@ -132,7 +132,7 @@ bool CreateMainWindow() _TEXT("Run GUI from DLL"), WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 200, 200, 150, 35, - g_hwndMain, (HMENU)IDB_RUN_GUI_FROM_DLL, g_hInstance, NULL + g_hwndMain, (HMENU)IDB_RUN_GUI_FROM_DLL, g_hInstance, nullptr ); return true; @@ -157,7 +157,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow) ShowWindow(g_hwndMain, nCmdShow); MSG msg; - while ( GetMessage(&msg, NULL, 0, 0) ) + while ( GetMessage(&msg, nullptr, 0, 0) ) { TranslateMessage(&msg); DispatchMessage(&msg); diff --git a/samples/dll/wx_exe.cpp b/samples/dll/wx_exe.cpp index f4843bd1f6..335d07076c 100644 --- a/samples/dll/wx_exe.cpp +++ b/samples/dll/wx_exe.cpp @@ -73,7 +73,7 @@ wxBEGIN_EVENT_TABLE(MainFrame, wxFrame) wxEND_EVENT_TABLE() MainFrame::MainFrame() - : wxFrame(NULL, wxID_ANY, "Main wx app", + : wxFrame(nullptr, wxID_ANY, "Main wx app", wxDefaultPosition, wxSize(400, 300)) { wxPanel *p = new wxPanel(this, wxID_ANY); diff --git a/samples/dnd/d_and_d.txt b/samples/dnd/d_and_d.txt index e1a7c7fdfb..f7dd7a5f47 100644 --- a/samples/dnd/d_and_d.txt +++ b/samples/dnd/d_and_d.txt @@ -58,7 +58,7 @@ called in the process of the d&d operation are OnEnter and OnLeave. The object created passed to SetDropTarget becomes the propriety of wxWindow and will be deleted with the window (or when you call SetDropTarget next -time). You can always break the association by calling SetDropTarget(NULL). +time). You can always break the association by calling SetDropTarget(nullptr). When some data is dragged over a window, the program must decide if it's going to accept this data or not. The virtual function IsAcceptedData() is diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 5a2428092e..d67ebcb06c 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -53,7 +53,7 @@ private: class DnDFile : public wxFileDropTarget { public: - DnDFile(wxListBox *pOwner = NULL) { m_pOwner = pOwner; } + DnDFile(wxListBox *pOwner = nullptr) { m_pOwner = pOwner; } virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) override; @@ -474,7 +474,7 @@ class DnDShapeDataObject : public wxDataObject public: // ctor doesn't copy the pointer, so it shouldn't go away while this object // is alive - DnDShapeDataObject(DnDShape *shape = (DnDShape *)NULL) + DnDShapeDataObject(DnDShape *shape = nullptr) { if ( shape ) { @@ -490,7 +490,7 @@ public: else { // nothing to copy - m_shape = NULL; + m_shape = nullptr; } // this string should uniquely identify our format, but is otherwise @@ -517,7 +517,7 @@ public: { DnDShape *shape = m_shape; - m_shape = (DnDShape *)NULL; + m_shape = nullptr; m_hasBitmap = false; #if wxUSE_METAFILE m_hasMetaFile = false; @@ -932,7 +932,7 @@ bool DnDApp::OnInit() #if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD DnDFrame::DnDFrame() - : wxFrame(NULL, wxID_ANY, "Drag-and-Drop/Clipboard wxWidgets Sample", + : wxFrame(nullptr, wxID_ANY, "Drag-and-Drop/Clipboard wxWidgets Sample", wxPoint(10, 100)), m_strText("wxWidgets drag & drop works :-)") @@ -1252,7 +1252,7 @@ void DnDFrame::OnRightDown(wxMouseEvent &event ) DnDFrame::~DnDFrame() { #if wxUSE_LOG - if ( m_pLog != NULL ) { + if ( m_pLog != nullptr ) { if ( wxLog::SetActiveTarget(m_pLogPrev) == m_pLog ) delete m_pLog; } @@ -1576,7 +1576,7 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) wxString str; str.Printf( "%d files dropped", (int)nFiles); - if (m_pOwner != NULL) + if (m_pOwner != nullptr) { m_pOwner->Append(str); for ( size_t n = 0; n < nFiles; n++ ) @@ -1662,7 +1662,7 @@ DnDShape *DnDShapeDialog::GetShape() const switch ( m_shapeKind ) { default: - case DnDShape::None: return NULL; + case DnDShape::None: return nullptr; case DnDShape::Triangle: return new DnDTriangularShape(m_pos, m_size, m_col); case DnDShape::Rectangle: return new DnDRectangularShape(m_pos, m_size, m_col); case DnDShape::Ellipse: return new DnDEllipticShape(m_pos, m_size, m_col); @@ -1735,7 +1735,7 @@ void DnDShapeDialog::OnColour(wxCommandEvent& WXUNUSED(event)) // DnDShapeFrame // ---------------------------------------------------------------------------- -DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = NULL; +DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = nullptr; DnDShapeFrame::DnDShapeFrame(wxFrame *parent) : wxFrame(parent, wxID_ANY, "Shape Frame") @@ -1766,7 +1766,7 @@ DnDShapeFrame::DnDShapeFrame(wxFrame *parent) SetDropTarget(new DnDShapeDropTarget(this)); - m_shape = NULL; + m_shape = nullptr; SetBackgroundColour(*wxWHITE); } @@ -1822,7 +1822,7 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event) if ( ms_lastDropTarget != this ) { // don't delete the shape if we dropped it on ourselves! - SetShape(NULL); + SetShape(nullptr); } break; @@ -1885,7 +1885,7 @@ void DnDShapeFrame::OnNewShape(wxCommandEvent& WXUNUSED(event)) void DnDShapeFrame::OnClearShape(wxCommandEvent& WXUNUSED(event)) { - SetShape(NULL); + SetShape(nullptr); } void DnDShapeFrame::OnCopyShape(wxCommandEvent& WXUNUSED(event)) @@ -1914,7 +1914,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event)) return; } - DnDShapeDataObject shapeDataObject(NULL); + DnDShapeDataObject shapeDataObject(nullptr); if ( wxTheClipboard->GetData(shapeDataObject) ) { SetShape(shapeDataObject.GetShape()); @@ -1927,7 +1927,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event)) void DnDShapeFrame::OnUpdateUICopy(wxUpdateUIEvent& event) { - event.Enable( m_shape != NULL ); + event.Enable( m_shape != nullptr ); } void DnDShapeFrame::OnUpdateUIPaste(wxUpdateUIEvent& event) @@ -1975,7 +1975,7 @@ DnDShape *DnDShape::New(const void *buf) default: wxFAIL_MSG("invalid shape!"); - return NULL; + return nullptr; } } @@ -2032,7 +2032,7 @@ void DnDShapeDataObject::CreateBitmap() const static void ShowBitmap(const wxBitmap& bitmap) { - wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Bitmap view"); + wxFrame *frame = new wxFrame(nullptr, wxID_ANY, "Bitmap view"); #if wxUSE_STATUSBAR frame->CreateStatusBar(); #endif // wxUSE_STATUSBAR @@ -2053,7 +2053,7 @@ static void ShowBitmap(const wxBitmap& bitmap) static void ShowMetaFile(const wxMetaFile& metafile) { - wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Metafile view"); + wxFrame *frame = new wxFrame(nullptr, wxID_ANY, "Metafile view"); frame->CreateStatusBar(); DnDCanvasMetafile *canvas = new DnDCanvasMetafile(frame); canvas->SetMetafile(metafile); diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index fcd3db18f6..3dc259055a 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -246,7 +246,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument); wxTextCtrl* TextEditDocument::GetTextCtrl() const { wxView* view = GetFirstView(); - return view ? wxStaticCast(view, TextEditView)->GetText() : NULL; + return view ? wxStaticCast(view, TextEditView)->GetText() : nullptr; } // ---------------------------------------------------------------------------- diff --git a/samples/docview/doc.h b/samples/docview/doc.h index 18b15b5f36..d94f2d667f 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.h @@ -87,7 +87,7 @@ public: void AddDoodleSegment(const DoodleSegment& segment); // remove the last segment, if any, and copy it in the provided pointer if - // not NULL and return true or return false and do nothing if there are no + // not null and return true or return false and do nothing if there are no // segments bool PopLastSegment(DoodleSegment *segment); diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp index b2aa4eafb0..b4fb71ae3b 100644 --- a/samples/docview/docview.cpp +++ b/samples/docview/docview.cpp @@ -86,8 +86,8 @@ MyApp::MyApp() m_mode = Mode_SDI; #endif - m_canvas = NULL; - m_menuEdit = NULL; + m_canvas = nullptr; + m_menuEdit = nullptr; } // constants for the command line options names @@ -219,12 +219,12 @@ bool MyApp::OnInit() } // create the main frame window - wxFrame *frame = NULL; + wxFrame *frame = nullptr; switch ( m_mode ) { #if wxUSE_MDI_ARCHITECTURE case Mode_MDI: - frame = new wxDocMDIParentFrame(docManager, NULL, wxID_ANY, + frame = new wxDocMDIParentFrame(docManager, nullptr, wxID_ANY, GetAppDisplayName(), wxDefaultPosition, wxSize(500, 400)); @@ -235,7 +235,7 @@ bool MyApp::OnInit() case Mode_AUI: frame = new wxDocParentFrameAny ( - docManager, NULL, wxID_ANY, + docManager, nullptr, wxID_ANY, GetAppDisplayName(), wxDefaultPosition, wxSize(500, 400) @@ -245,7 +245,7 @@ bool MyApp::OnInit() case Mode_SDI: case Mode_Single: - frame = new wxDocParentFrame(docManager, NULL, wxID_ANY, + frame = new wxDocParentFrame(docManager, nullptr, wxID_ANY, GetAppDisplayName(), wxDefaultPosition, wxSize(500, 400)); @@ -273,7 +273,7 @@ bool MyApp::OnInit() if ( m_mode == Mode_Single ) { - m_canvas = new MyCanvas(NULL, frame); + m_canvas = new MyCanvas(nullptr, frame); m_menuEdit = CreateDrawingEditMenu(); } @@ -357,7 +357,7 @@ void MyApp::CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit) wxFrame *MyApp::CreateChildFrame(wxView *view, bool isCanvas) { // create a child frame of appropriate class for the current mode - wxFrame *subframe = NULL; + wxFrame *subframe = nullptr; wxDocument *doc = view->GetDocument(); switch ( GetMode() ) #if wxUSE_MDI_ARCHITECTURE diff --git a/samples/docview/docview.h b/samples/docview/docview.h index bea75423e9..49a531896f 100644 --- a/samples/docview/docview.h +++ b/samples/docview/docview.h @@ -52,7 +52,7 @@ public: wxFrame *CreateChildFrame(wxView *view, bool isCanvas); // these accessors should only be called in single document mode, otherwise - // the pointers are NULL and an assert is triggered + // the pointers are null and an assert is triggered MyCanvas *GetMainWindowCanvas() const { wxASSERT(m_canvas); return m_canvas; } wxMenu *GetMainWindowEditMenu() const @@ -66,7 +66,7 @@ private: wxMenu *CreateDrawingEditMenu(); // create and associate with the given frame the menu bar containing the - // given file and edit (possibly NULL) menus as well as the standard help + // given file and edit (possibly null) menus as well as the standard help // one void CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit); diff --git a/samples/docview/view.cpp b/samples/docview/view.cpp index 9963c114fa..d1c7283b4e 100644 --- a/samples/docview/view.cpp +++ b/samples/docview/view.cpp @@ -114,7 +114,7 @@ bool DrawingView::OnClose(bool deleteWindow) { m_canvas->ClearBackground(); m_canvas->ResetView(); - m_canvas = NULL; + m_canvas = nullptr; if (GetFrame()) wxStaticCast(GetFrame(), wxFrame)->SetTitle(wxTheApp->GetAppDisplayName()); @@ -124,7 +124,7 @@ bool DrawingView::OnClose(bool deleteWindow) if ( deleteWindow ) { GetFrame()->Destroy(); - SetFrame(NULL); + SetFrame(nullptr); } } return true; @@ -185,7 +185,7 @@ bool TextEditView::OnClose(bool deleteWindow) if ( deleteWindow ) { GetFrame()->Destroy(); - SetFrame(NULL); + SetFrame(nullptr); } } return true; @@ -204,7 +204,7 @@ MyCanvas::MyCanvas(wxView *view, wxWindow *parent) : wxScrolledWindow(parent ? parent : view->GetFrame()) { m_view = view; - m_currentSegment = NULL; + m_currentSegment = nullptr; m_lastMousePos = wxDefaultPosition; SetCursor(wxCursor(wxCURSOR_PENCIL)); @@ -352,7 +352,7 @@ bool ImageView::OnClose(bool deleteWindow) if ( deleteWindow ) { GetFrame()->Destroy(); - SetFrame(NULL); + SetFrame(nullptr); } } return true; @@ -426,7 +426,7 @@ bool ImageDetailsView::OnClose(bool deleteWindow) if ( wxGetApp().GetMode() != MyApp::Mode_Single && deleteWindow ) { delete m_frame; - m_frame = NULL; + m_frame = nullptr; } return true; diff --git a/samples/docview/view.h b/samples/docview/view.h index 6e905b5c5a..af587492d2 100644 --- a/samples/docview/view.h +++ b/samples/docview/view.h @@ -22,9 +22,9 @@ class MyCanvas : public wxScrolledWindow { public: - // view may be NULL if we're not associated with one yet, but parent must + // view may be null if we're not associated with one yet, but parent must // be a valid pointer - MyCanvas(wxView *view, wxWindow *parent = NULL); + MyCanvas(wxView *view, wxWindow *parent = nullptr); virtual ~MyCanvas(); virtual void OnDraw(wxDC& dc) override; @@ -45,7 +45,7 @@ public: { wxASSERT_MSG( m_view, "should be associated with a view" ); - m_view = NULL; + m_view = nullptr; } private: @@ -53,7 +53,7 @@ private: wxView *m_view; - // the segment being currently drawn or NULL if none + // the segment being currently drawn or nullptr if none DoodleSegment *m_currentSegment; // the last mouse press position @@ -66,11 +66,11 @@ private: class DrawingView : public wxView { public: - DrawingView() : wxView(), m_canvas(NULL) {} + DrawingView() : wxView(), m_canvas(nullptr) {} virtual bool OnCreate(wxDocument *doc, long flags) override; virtual void OnDraw(wxDC *dc) override; - virtual void OnUpdate(wxView *sender, wxObject *hint = NULL) override; + virtual void OnUpdate(wxView *sender, wxObject *hint = nullptr) override; virtual bool OnClose(bool deleteWindow = true) override; DrawingDocument* GetDocument(); @@ -92,7 +92,7 @@ private: class TextEditView : public wxView { public: - TextEditView() : wxView(), m_text(NULL) {} + TextEditView() : wxView(), m_text(nullptr) {} virtual bool OnCreate(wxDocument *doc, long flags) override; virtual void OnDraw(wxDC *dc) override; @@ -137,7 +137,7 @@ public: virtual bool OnCreate(wxDocument*, long flags) override; virtual void OnDraw(wxDC*) override; virtual bool OnClose(bool deleteWindow = true) override; - virtual void OnUpdate(wxView *sender, wxObject *hint = NULL) override; + virtual void OnUpdate(wxView *sender, wxObject *hint = nullptr) override; ImageDocument* GetDocument(); diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index cefe6a7197..21cb9d37da 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -60,9 +60,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, SetCursor(wxCursor(wxCURSOR_ARROW)); m_dragMode = TEST_DRAG_NONE; - m_draggedShape = (DragShape*) NULL; - m_dragImage = (wxDragImage*) NULL; - m_currentlyHighlighted = (DragShape*) NULL; + m_draggedShape = nullptr; + m_dragImage = nullptr; + m_currentlyHighlighted = nullptr; } MyCanvas::~MyCanvas() @@ -135,9 +135,9 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) m_draggedShape->SetShow(true); - m_currentlyHighlighted = (DragShape*) NULL; + m_currentlyHighlighted = nullptr; - m_draggedShape = (DragShape*) NULL; + m_draggedShape = nullptr; Refresh(true); } @@ -217,7 +217,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) if (m_currentlyHighlighted) { - if ((onShape == (DragShape*) NULL) || (m_currentlyHighlighted != onShape)) + if ((onShape == nullptr) || (m_currentlyHighlighted != onShape)) mustUnhighlightOld = true; } @@ -229,7 +229,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event) // Now with the drag image switched off, we can change the window contents. if (mustUnhighlightOld) - m_currentlyHighlighted = (DragShape*) NULL; + m_currentlyHighlighted = nullptr; if (mustHighlightNew) m_currentlyHighlighted = onShape; @@ -298,7 +298,7 @@ DragShape* MyCanvas::FindShape(const wxPoint& pt) const return shape; node = node->GetNext(); } - return (DragShape*) NULL; + return nullptr; } // MyFrame @@ -310,7 +310,7 @@ wxBEGIN_EVENT_TABLE(MyFrame,wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() -: wxFrame( (wxFrame *)NULL, wxID_ANY, "wxDragImage sample", +: wxFrame(nullptr, wxID_ANY, "wxDragImage sample", wxPoint(20,20), wxSize(470,360) ) { wxMenu *file_menu = new wxMenu(); diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index c74de342de..64df725202 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -63,13 +63,13 @@ // global variables // ---------------------------------------------------------------------------- -static wxBitmap *gs_bmpNoMask = NULL, - *gs_bmpWithColMask = NULL, - *gs_bmpMask = NULL, - *gs_bmpWithMask = NULL, - *gs_bmp4 = NULL, - *gs_bmp4_mono = NULL, - *gs_bmp36 = NULL; +static wxBitmap *gs_bmpNoMask = nullptr, + *gs_bmpWithColMask = nullptr, + *gs_bmpMask = nullptr, + *gs_bmpWithMask = nullptr, + *gs_bmp4 = nullptr, + *gs_bmp4_mono = nullptr, + *gs_bmp36 = nullptr; // ---------------------------------------------------------------------------- // private classes @@ -114,7 +114,7 @@ public: // set or remove the clipping region void Clip(bool clip) { m_clip = clip; Refresh(); } #if wxUSE_GRAPHICS_CONTEXT - bool HasRenderer() const { return m_renderer != NULL; } + bool HasRenderer() const { return m_renderer != nullptr; } void UseGraphicRenderer(wxGraphicsRenderer* renderer); bool IsDefaultRenderer() const { if ( !m_renderer ) return false; @@ -198,7 +198,7 @@ public: #if wxUSE_GRAPHICS_CONTEXT void OnGraphicContextNone(wxCommandEvent& WXUNUSED(event)) { - m_canvas->UseGraphicRenderer(NULL); + m_canvas->UseGraphicRenderer(nullptr); } void OnGraphicContextDefault(wxCommandEvent& WXUNUSED(event)) @@ -233,7 +233,7 @@ public: void OnAntiAliasingUpdateUI(wxUpdateUIEvent& event) { - event.Enable(m_canvas->GetRenderer() != NULL); + event.Enable(m_canvas->GetRenderer() != nullptr); } #endif // wxUSE_GRAPHICS_CONTEXT @@ -518,7 +518,7 @@ MyCanvas::MyCanvas(MyFrame *parent) m_clip = false; m_rubberBand = false; #if wxUSE_GRAPHICS_CONTEXT - m_renderer = NULL; + m_renderer = nullptr; m_useAntiAliasing = true; #endif m_useBuffer = false; @@ -1155,7 +1155,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc) break; } wxDouble w, h; - gc->GetTextExtent(label, &w, &h, NULL, NULL); + gc->GetTextExtent(label, &w, &h, nullptr, nullptr); gc->DrawText(label, -w/2, -BASE2 - h - gc->FromDIP(4)); switch( i ) { @@ -1225,7 +1225,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc) gc->DrawText(labelText, 0, 0); // Center a bitmap horizontally wxDouble textWidth; - gc->GetTextExtent(labelText, &textWidth, NULL); + gc->GetTextExtent(labelText, &textWidth, nullptr); const wxDouble rectSize = gc->FromDIP(100); wxDouble x0 = (textWidth - rectSize) / 2; gc->DrawRectangle(x0, BASE2, rectSize, rectSize); @@ -2260,7 +2260,7 @@ wxEND_EVENT_TABLE() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { // set the frame icon SetIcon(wxICON(sample)); @@ -2513,7 +2513,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) return; } wxGraphicsRenderer* tempRenderer = m_canvas->GetRenderer(); - m_canvas->UseGraphicRenderer(NULL); + m_canvas->UseGraphicRenderer(nullptr); #endif wxSVGFileDC svgdc(dlg.GetPath(), canvasSize.GetWidth(), @@ -2539,7 +2539,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) return; } wxGraphicsRenderer* curRenderer = m_canvas->GetRenderer(); - m_canvas->UseGraphicRenderer(NULL); + m_canvas->UseGraphicRenderer(nullptr); #endif // wxUSE_GRAPHICS_CONTEXT wxPrintData printData; printData.SetPrintMode(wxPRINT_MODE_FILE); diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index e65da926d5..8c3e3d0809 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -246,7 +246,7 @@ wxEND_EVENT_TABLE() // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "Erase sample", + : wxFrame(nullptr, wxID_ANY, "Erase sample", wxPoint(50, 50), wxSize(450, 340)) { SetIcon(wxICON(sample)); diff --git a/samples/event/event.cpp b/samples/event/event.cpp index 36979d4c01..954f0e3689 100644 --- a/samples/event/event.cpp +++ b/samples/event/event.cpp @@ -48,7 +48,7 @@ wxDEFINE_EVENT(wxEVT_MY_CUSTOM_COMMAND, wxCommandEvent); DECLARE_EVENT_TABLE_ENTRY( \ wxEVT_MY_CUSTOM_COMMAND, id, wxID_ANY, \ wxCommandEventHandler(fn), \ - (wxObject *) NULL \ + nullptr \ ), // ---------------------------------------------------------------------------- @@ -359,13 +359,13 @@ void MyApp::OnClickStaticHandlerApp(wxCommandEvent& event) // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame(NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); // init members m_nPush = 0; - m_btnDynamic = NULL; + m_btnDynamic = nullptr; // create a menu bar wxMenu *menuFile = new wxMenu; diff --git a/samples/event/gestures.cpp b/samples/event/gestures.cpp index 8a030bff3f..a630352b20 100644 --- a/samples/event/gestures.cpp +++ b/samples/event/gestures.cpp @@ -5,7 +5,7 @@ #include "../image/horse.xpm" MyGestureFrame::MyGestureFrame() - : wxFrame(NULL, wxID_ANY, "Multi-touch Gestures", wxDefaultPosition, wxSize(800, 600)) + : wxFrame(nullptr, wxID_ANY, "Multi-touch Gestures", wxDefaultPosition, wxSize(800, 600)) { // Create controls MyGesturePanel *myPanel = new MyGesturePanel(this); @@ -101,7 +101,7 @@ void MyGesturePanel::OnPan(wxPanGestureEvent& event) // Transform the distance using the transpose of the matrix, // in order to translate the image to match the screen coordinates wxMatrix2D m; - m_affineMatrix.Get(&m, NULL); + m_affineMatrix.Get(&m, nullptr); wxPoint2DDouble deltaD(m.m_11 * delta.x + m.m_12 * delta.y, m.m_21 * delta.x + m.m_22 * delta.y); diff --git a/samples/except/except.cpp b/samples/except/except.cpp index 866c15459c..19a9462f75 100644 --- a/samples/except/except.cpp +++ b/samples/except/except.cpp @@ -400,7 +400,7 @@ void MyApp::OnAssertFailure(const wxChar *file, // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "Except wxWidgets App", + : wxFrame(nullptr, wxID_ANY, "Except wxWidgets App", wxPoint(50, 50), wxSize(450, 340)) { // set the frame icon diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index ca8e3f691b..b2e9b9071e 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -442,7 +442,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size), + : wxFrame(nullptr, wxID_ANY, title, pos, size), m_timerIdleWakeUp(this, Exec_TimerIdle), m_timerBg(this, Exec_TimerBg) { @@ -738,7 +738,7 @@ wxBEGIN_EVENT_TABLE(ExecQueryDialog, wxDialog) wxEND_EVENT_TABLE() ExecQueryDialog::ExecQueryDialog(const wxString& cmd) - : wxDialog(NULL, wxID_ANY, GetDialogTitle(), + : wxDialog(nullptr, wxID_ANY, GetDialogTitle(), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { @@ -876,7 +876,7 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event)) wxLogStatus( "'%s' is running please wait...", cmd ); - int code = wxExecute(cmd, wxEXEC_SYNC | GetExecFlags(), NULL, &env); + int code = wxExecute(cmd, wxEXEC_SYNC | GetExecFlags(), nullptr, &env); wxLogStatus("Process '%s' terminated with exit code %d.", cmd, code); @@ -1434,7 +1434,7 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent, wxProcess *process) : wxFrame(parent, wxID_ANY, cmd), m_process(process), - // in a real program we'd check that the streams are !NULL here + // in a real program we'd check that the streams are non-null here m_out(*process->GetOutputStream()), m_in(*process->GetInputStream()), m_err(*process->GetErrorStream()) @@ -1557,8 +1557,8 @@ void MyPipeFrame::OnClose(wxCloseEvent& event) // we're not interested in getting the process termination notification // if we are closing it ourselves wxProcess *process = m_process; - m_process = NULL; - process->SetNextHandler(NULL); + m_process = nullptr; + process->SetNextHandler(nullptr); process->CloseOutput(); } diff --git a/samples/font/font.cpp b/samples/font/font.cpp index c3dacbaf7a..6c0093e6f2 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -408,7 +408,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets font sample") + : wxFrame(nullptr, wxID_ANY, "wxWidgets font sample") { SetIcon(wxICON(sample)); diff --git a/samples/fswatcher/fswatcher.cpp b/samples/fswatcher/fswatcher.cpp index 5b941f736b..85aaeeeed4 100644 --- a/samples/fswatcher/fswatcher.cpp +++ b/samples/fswatcher/fswatcher.cpp @@ -135,8 +135,8 @@ wxIMPLEMENT_APP(MyApp); // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title), - m_watcher(NULL), m_followLinks(false) + : wxFrame(nullptr, wxID_ANY, title), + m_watcher(nullptr), m_followLinks(false) { SetIcon(wxICON(sample)); diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 1943089938..6a26a58b8d 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -382,7 +382,7 @@ wxEND_EVENT_TABLE() GridFrame::GridFrame() - : wxFrame( (wxFrame *)NULL, wxID_ANY, "wxWidgets grid class demo", + : wxFrame( nullptr, wxID_ANY, "wxWidgets grid class demo", wxDefaultPosition, wxDefaultSize ) { @@ -775,11 +775,11 @@ GridFrame::GridFrame() grid->SetRowAttr(10, attr); grid->SetCellValue(10, 0, "You can't resize this row interactively -- try it"); - // this does exactly nothing except testing that SetAttr() handles NULL + // this does exactly nothing except testing that SetAttr() handles null // attributes and does reference counting correctly - grid->SetAttr(11, 11, NULL); + grid->SetAttr(11, 11, nullptr); grid->SetAttr(11, 11, new wxGridCellAttr); - grid->SetAttr(11, 11, NULL); + grid->SetAttr(11, 11, nullptr); grid->Bind(wxEVT_CONTEXT_MENU, &GridFrame::OnGridContextMenu, this, grid->GetId()); @@ -1045,7 +1045,7 @@ void GridFrame::ResizeCell( wxCommandEvent& ev ) void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) ) { - wxColourDialog dlg( NULL ); + wxColourDialog dlg( nullptr ); if ( dlg.ShowModal() == wxID_OK ) { wxColourData retData; @@ -1059,7 +1059,7 @@ void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::SetLabelTextColour( wxCommandEvent& WXUNUSED(ev) ) { - wxColourDialog dlg( NULL ); + wxColourDialog dlg( nullptr ); if ( dlg.ShowModal() == wxID_OK ) { wxColourData retData; @@ -1243,7 +1243,7 @@ void GridFrame::ToggleCornerLabelOrientation( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::SetGridLineColour( wxCommandEvent& WXUNUSED(ev) ) { - wxColourDialog dlg( NULL ); + wxColourDialog dlg( nullptr ); if ( dlg.ShowModal() == wxID_OK ) { wxColourData retData; @@ -1968,7 +1968,7 @@ void MyGridCellRenderer::Draw(wxGrid& grid, // ============================================================================ BigGridFrame::BigGridFrame(long sizeGrid) - : wxFrame(NULL, wxID_ANY, "Plugin Virtual Table") + : wxFrame(nullptr, wxID_ANY, "Plugin Virtual Table") { m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_table = new BigGridTable(sizeGrid); @@ -2258,7 +2258,7 @@ wxString BugsGridTable::GetColLabelValue( int col ) // ---------------------------------------------------------------------------- BugsGridFrame::BugsGridFrame() - : wxFrame(NULL, wxID_ANY, "Bugs table") + : wxFrame(nullptr, wxID_ANY, "Bugs table") { wxGrid *grid = new wxGrid(this, wxID_ANY); wxGridTableBase *table = new BugsGridTable(); @@ -2303,7 +2303,7 @@ public: ROW_MAX = 3 }; - TabularGridTable() { m_sortOrder = NULL; } + TabularGridTable() { m_sortOrder = nullptr; } virtual int GetNumberRows() override { return ROW_MAX; } virtual int GetNumberCols() override { return COL_MAX; } @@ -2365,7 +2365,7 @@ public: { { 1, 0, 2 }, { 2, 0, 1 } }, }; - m_sortOrder = col == wxNOT_FOUND ? NULL : sortOrders[col][ascending]; + m_sortOrder = col == wxNOT_FOUND ? nullptr : sortOrders[col][ascending]; } private: @@ -2657,7 +2657,7 @@ wxBEGIN_EVENT_TABLE(TabularGridFrame, wxFrame) wxEND_EVENT_TABLE() TabularGridFrame::TabularGridFrame() - : wxFrame(NULL, wxID_ANY, "Tabular table") + : wxFrame(nullptr, wxID_ANY, "Tabular table") { m_shouldUpdateColOrder = false; diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index 84fd591986..ba2899ee44 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -373,7 +373,7 @@ bool MyApp::OnInit() int MyApp::OnExit() { // clean up - delete wxHelpProvider::Set(NULL); + delete wxHelpProvider::Set(nullptr); return 0; } @@ -384,7 +384,7 @@ int MyApp::OnExit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, 300, title, pos, size) + : wxFrame(nullptr, 300, title, pos, size) #if USE_HTML_HELP , m_embeddedHtmlHelp(wxHF_EMBEDDED|wxHF_DEFAULT_STYLE) #endif diff --git a/samples/htlbox/htlbox.cpp b/samples/htlbox/htlbox.cpp index bb37cbf6ad..6f1af4aedb 100644 --- a/samples/htlbox/htlbox.cpp +++ b/samples/htlbox/htlbox.cpp @@ -233,7 +233,7 @@ wxIMPLEMENT_APP(MyApp); // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "HtmlLbox wxWidgets Sample", + : wxFrame(nullptr, wxID_ANY, "HtmlLbox wxWidgets Sample", wxDefaultPosition, wxSize(500, 500)) { // set the frame icon @@ -314,7 +314,7 @@ MyFrame::MyFrame() MyFrame::~MyFrame() { - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); } void MyFrame::CreateBox() @@ -328,7 +328,7 @@ void MyFrame::CreateBox() else // simple listbox { m_hlbox = new wxSimpleHtmlListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - 0, NULL, multi ? wxLB_MULTIPLE : 0); + 0, nullptr, multi ? wxLB_MULTIPLE : 0); // unlike wxHtmlListBox which is abstract, wxSimpleHtmlListBox is a // concrete control and doesn't support virtual mode, this we need diff --git a/samples/html/about/about.cpp b/samples/html/about/about.cpp index 4ec4266988..b12e11229a 100644 --- a/samples/html/about/about.cpp +++ b/samples/html/about/about.cpp @@ -114,7 +114,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame((wxFrame *)NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { SetIcon(wxICON(sample)); diff --git a/samples/html/help/help.cpp b/samples/html/help/help.cpp index 53c52f0a3b..11ce55ef79 100644 --- a/samples/html/help/help.cpp +++ b/samples/html/help/help.cpp @@ -139,7 +139,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size), + : wxFrame(nullptr, wxID_ANY, title, pos, size), help(wxHF_DEFAULT_STYLE | wxHF_OPEN_FILES) { SetIcon(wxICON(sample)); @@ -192,11 +192,11 @@ void MyFrame::OnClose(wxCloseEvent& event) { // Close the help frame; this will cause the config data to // get written. - if ( help.GetFrame() ) // returns NULL if no help frame active + if ( help.GetFrame() ) // returns nullptr if no help frame active help.GetFrame()->Close(true); // now we can safely delete the config pointer event.Skip(); - delete wxConfig::Set(NULL); + delete wxConfig::Set(nullptr); } diff --git a/samples/html/helpview/helpview.cpp b/samples/html/helpview/helpview.cpp index 744df85b0d..8cc55c87dd 100644 --- a/samples/html/helpview/helpview.cpp +++ b/samples/html/helpview/helpview.cpp @@ -84,7 +84,7 @@ bool MyApp::OnInit() int MyApp::OnExit() { delete help; - delete wxConfig::Set(NULL); + delete wxConfig::Set(nullptr); return 0; } diff --git a/samples/html/printing/printing.cpp b/samples/html/printing/printing.cpp index 75e9646470..42561af0ce 100644 --- a/samples/html/printing/printing.cpp +++ b/samples/html/printing/printing.cpp @@ -164,7 +164,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); diff --git a/samples/html/test/test.cpp b/samples/html/test/test.cpp index af3eff8cb1..c5402495e9 100644 --- a/samples/html/test/test.cpp +++ b/samples/html/test/test.cpp @@ -199,7 +199,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size, + : wxFrame(nullptr, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE, "html_test_app") { // create a menu bar @@ -272,7 +272,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { m_Html->WriteCustomization(wxConfig::Get()); - delete wxConfig::Set(NULL); + delete wxConfig::Set(nullptr); // true is to force the frame to close Close(true); diff --git a/samples/html/virtual/virtual.cpp b/samples/html/virtual/virtual.cpp index 438622c4a2..c7c53b449e 100644 --- a/samples/html/virtual/virtual.cpp +++ b/samples/html/virtual/virtual.cpp @@ -184,7 +184,7 @@ wxHtmlWindow *html; // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); diff --git a/samples/html/widget/widget.cpp b/samples/html/widget/widget.cpp index 03cd428011..931da74403 100644 --- a/samples/html/widget/widget.cpp +++ b/samples/html/widget/widget.cpp @@ -175,7 +175,7 @@ wxHtmlWindow *html; // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); diff --git a/samples/html/zip/zip.cpp b/samples/html/zip/zip.cpp index 0b8c6aa90d..d22bcf69ca 100644 --- a/samples/html/zip/zip.cpp +++ b/samples/html/zip/zip.cpp @@ -137,7 +137,7 @@ wxHtmlWindow *html; // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { SetIcon(wxICON(sample)); diff --git a/samples/image/canvas.cpp b/samples/image/canvas.cpp index 932f4724e6..25139741f2 100644 --- a/samples/image/canvas.cpp +++ b/samples/image/canvas.cpp @@ -50,7 +50,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, , m_bmpSmileXpm(smile_xpm) , m_iconSmileXpm(smile_xpm) { - my_horse_ani = NULL; + my_horse_ani = nullptr; m_ani_images = 0 ; SetBackgroundColour(* wxWHITE); diff --git a/samples/image/image.cpp b/samples/image/image.cpp index fed8268100..d65e48ce10 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -311,7 +311,7 @@ private: return; wxString extension; - wxFileName::SplitPath(savefilename, NULL, NULL, &extension); + wxFileName::SplitPath(savefilename, nullptr, nullptr, &extension); bool saved = false; if ( extension == "bmp" ) @@ -563,7 +563,7 @@ private: // This is a copy of protected wxImageHandler::GetResolutionFromOptions() static wxImageResolution GetResolutionFromOptions(const wxImage& image, int* x, int* y) { - wxCHECK_MSG(x && y, wxIMAGE_RESOLUTION_NONE, wxT("NULL pointer")); + wxCHECK_MSG(x && y, wxIMAGE_RESOLUTION_NONE, wxT("null pointer")); if ( image.HasOption(wxIMAGE_OPTION_RESOLUTIONX) && image.HasOption(wxIMAGE_OPTION_RESOLUTIONY) ) @@ -1100,7 +1100,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame( (wxFrame *)NULL, wxID_ANY, "wxImage sample", + : wxFrame( nullptr, wxID_ANY, "wxImage sample", wxPoint(20, 20), wxSize(950, 700) ) { SetIcon(wxICON(sample)); diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 363774b1ec..db6dbf1035 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -284,7 +284,7 @@ bool MyApp::OnInit() // main frame constructor MyFrame::MyFrame() - : wxFrame(NULL, + : wxFrame(nullptr, wxID_ANY, _("International wxWidgets App")) { @@ -359,7 +359,7 @@ MyFrame::MyFrame() ( _("Current UI locale: %s; C locale: %s"), wxUILocale::GetCurrent().GetName(), - setlocale(LC_ALL, NULL) + setlocale(LC_ALL, nullptr) ) ), wxSizerFlags().Center().Border()); diff --git a/samples/ipc/baseclient.cpp b/samples/ipc/baseclient.cpp index c5fb2670aa..a32f0d1bc5 100644 --- a/samples/ipc/baseclient.cpp +++ b/samples/ipc/baseclient.cpp @@ -59,7 +59,7 @@ class MyConnection : public MyConnectionBase { public: virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) override; - virtual const void *Request(const wxString& item, size_t *size = NULL, wxIPCFormat format = wxIPC_TEXT) override; + virtual const void *Request(const wxString& item, size_t *size = nullptr, wxIPCFormat format = wxIPC_TEXT) override; virtual bool DoPoke(const wxString& item, const void* data, size_t size, wxIPCFormat format) override; virtual bool OnAdvise(const wxString& topic, const wxString& item, const void *data, size_t size, wxIPCFormat format) override; virtual bool OnDisconnect() override; @@ -75,7 +75,7 @@ public: bool Connect(const wxString& sHost, const wxString& sService, const wxString& sTopic); void Disconnect(); wxConnectionBase *OnMakeConnection() override; - bool IsConnected() { return m_connection != NULL; } + bool IsConnected() { return m_connection != nullptr; } virtual void Notify() override; @@ -149,7 +149,7 @@ void MyApp::OnIdle(wxIdleEvent& event) MyClient::MyClient() : wxClient() { - m_connection = NULL; + m_connection = nullptr; m_step = 0; } @@ -199,7 +199,7 @@ void MyClient::Notify() // while waiting for IO and so starting another IPC call would result in // fatal reentrancies -- instead, just set a flag and perform the test // indicated by it later from our idle event handler - MyClientTestFunc testfunc = NULL; + MyClientTestFunc testfunc = nullptr; switch ( m_step++ ) { case 0: diff --git a/samples/ipc/baseserver.cpp b/samples/ipc/baseserver.cpp index d4069cf897..1576ccf735 100644 --- a/samples/ipc/baseserver.cpp +++ b/samples/ipc/baseserver.cpp @@ -110,7 +110,7 @@ public: MyServer(); virtual ~MyServer(); void Disconnect(); - bool IsConnected() { return m_connection != NULL; } + bool IsConnected() { return m_connection != nullptr; } virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) override; @@ -172,7 +172,7 @@ bool MyApp::OnInit() MyServer::MyServer() { - m_connection = NULL; + m_connection = nullptr; } MyServer::~MyServer() @@ -195,7 +195,7 @@ wxConnectionBase *MyServer::OnAcceptConnection(const wxString& topic) else // unknown topic { wxLogMessage("Unknown topic"); - return NULL; + return nullptr; } wxLogMessage("Connection accepted"); @@ -267,7 +267,7 @@ MyConnection::OnRequest(const wxString& topic, } else { - data = NULL; + data = nullptr; *size = 0; } Log("OnRequest", topic, item, data, *size, format); diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index 6c2fc39952..5bb75f6c82 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -76,7 +76,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - m_frame = new MyFrame(NULL, "Client"); + m_frame = new MyFrame(nullptr, "Client"); m_frame->Show(true); return true; @@ -200,7 +200,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) item0->SetSizeHints( this ); // status - m_client = NULL; + m_client = nullptr; GetServername()->SetSelection(0); GetHostname()->SetSelection(0); GetTopic()->SetSelection(0); @@ -212,18 +212,18 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) void MyFrame::EnableControls() { - GetStart()->Enable(m_client == NULL); - GetServername()->Enable(m_client == NULL); - GetHostname()->Enable(m_client == NULL); - GetTopic()->Enable(m_client == NULL); + GetStart()->Enable(m_client == nullptr); + GetServername()->Enable(m_client == nullptr); + GetHostname()->Enable(m_client == nullptr); + GetTopic()->Enable(m_client == nullptr); - const bool isConnected = (m_client != NULL && m_client->IsConnected()); - GetDisconnect()->Enable(m_client != NULL && isConnected); - GetStartAdvise()->Enable(m_client != NULL && isConnected); - GetStopAdvise()->Enable(m_client != NULL && isConnected); - GetExecute()->Enable(m_client != NULL && isConnected); - GetPoke()->Enable(m_client != NULL && isConnected); - GetRequest()->Enable(m_client != NULL && isConnected); + const bool isConnected = (m_client != nullptr && m_client->IsConnected()); + GetDisconnect()->Enable(m_client != nullptr && isConnected); + GetStartAdvise()->Enable(m_client != nullptr && isConnected); + GetStopAdvise()->Enable(m_client != nullptr && isConnected); + GetExecute()->Enable(m_client != nullptr && isConnected); + GetPoke()->Enable(m_client != nullptr && isConnected); + GetRequest()->Enable(m_client != nullptr && isConnected); } void MyFrame::OnClose(wxCloseEvent& event) @@ -368,7 +368,7 @@ void MyFrame::OnRequest(wxCommandEvent& WXUNUSED(event)) // ---------------------------------------------------------------------------- MyClient::MyClient() : wxClient() { - m_connection = NULL; + m_connection = nullptr; } bool MyClient::Connect(const wxString& sHost, const wxString& sService, const wxString& sTopic) @@ -377,7 +377,7 @@ bool MyClient::Connect(const wxString& sHost, const wxString& sService, const wx wxLogNull nolog; m_connection = (MyConnection *)MakeConnection(sHost, sService, sTopic); - return m_connection != NULL; + return m_connection != nullptr; } wxConnectionBase *MyClient::OnMakeConnection() diff --git a/samples/ipc/client.h b/samples/ipc/client.h index 923d2cc68c..e4005f8424 100644 --- a/samples/ipc/client.h +++ b/samples/ipc/client.h @@ -82,7 +82,7 @@ class MyConnection : public MyConnectionBase { public: virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) override; - virtual const void *Request(const wxString& item, size_t *size = NULL, wxIPCFormat format = wxIPC_TEXT) override; + virtual const void *Request(const wxString& item, size_t *size = nullptr, wxIPCFormat format = wxIPC_TEXT) override; virtual bool DoPoke(const wxString& item, const void* data, size_t size, wxIPCFormat format) override; virtual bool OnAdvise(const wxString& topic, const wxString& item, const void *data, size_t size, wxIPCFormat format) override; virtual bool OnDisconnect() override; @@ -96,7 +96,7 @@ public: bool Connect(const wxString& sHost, const wxString& sService, const wxString& sTopic); void Disconnect(); wxConnectionBase *OnMakeConnection() override; - bool IsConnected() { return m_connection != NULL; } + bool IsConnected() { return m_connection != nullptr; } MyConnection *GetConnection() { return m_connection; } protected: diff --git a/samples/ipc/server.cpp b/samples/ipc/server.cpp index 48a03ca157..3316488628 100644 --- a/samples/ipc/server.cpp +++ b/samples/ipc/server.cpp @@ -66,7 +66,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - m_frame = new MyFrame(NULL, "Server"); + m_frame = new MyFrame(nullptr, "Server"); m_frame->Show(true); return true; @@ -86,7 +86,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) SetIcon(wxICON(sample)); - m_server = NULL; + m_server = nullptr; wxPanel * const panel = new wxPanel(this); @@ -148,8 +148,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title) void MyFrame::UpdateUI() { - GetStart()->Enable(m_server == NULL); - GetServername()->Enable(m_server == NULL); + GetStart()->Enable(m_server == nullptr); + GetServername()->Enable(m_server == nullptr); GetAdvise()->Enable(m_server && m_server->CanAdvise()); GetDisconnect()->Enable(m_server && m_server->IsConnected()); } @@ -224,7 +224,7 @@ void MyFrame::OnAdvise(wxCommandEvent& WXUNUSED(event)) MyServer::MyServer() : wxServer() { - m_connection = NULL; + m_connection = nullptr; } MyServer::~MyServer() @@ -246,7 +246,7 @@ wxConnectionBase *MyServer::OnAcceptConnection(const wxString& topic) //else: unknown topic wxLogMessage("Unknown topic, connection refused"); - return NULL; + return nullptr; } void MyServer::Disconnect() @@ -341,7 +341,7 @@ MyConnection::OnRequest(const wxString& topic, if ( !*size ) { wxLogMessage("Unknown request for \"%s\"", item); - return NULL; + return nullptr; } // store the data pointer to which we return in a member variable to ensure diff --git a/samples/ipc/server.h b/samples/ipc/server.h index 7baefdc509..007cde67d9 100644 --- a/samples/ipc/server.h +++ b/samples/ipc/server.h @@ -89,7 +89,7 @@ public: virtual ~MyServer(); void Disconnect(); - bool IsConnected() { return m_connection != NULL; } + bool IsConnected() { return m_connection != nullptr; } MyConnection *GetConnection() { return m_connection; } void Advise(); diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 6180214b1f..e072d715a0 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -31,7 +31,7 @@ #include "../sample.xpm" #endif -MyFrame *frame = NULL; +MyFrame *frame = nullptr; wxIMPLEMENT_APP(MyApp); @@ -66,7 +66,7 @@ bool MyApp::OnInit() // Create the main frame window - frame = new MyFrame(NULL, "Joystick Demo", wxDefaultPosition, + frame = new MyFrame(nullptr, "Joystick Demo", wxDefaultPosition, wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); frame->SetIcon(wxICON(sample)); diff --git a/samples/keyboard/keyboard.cpp b/samples/keyboard/keyboard.cpp index 0728a796a8..e12e9dafe0 100644 --- a/samples/keyboard/keyboard.cpp +++ b/samples/keyboard/keyboard.cpp @@ -169,8 +169,8 @@ wxIMPLEMENT_APP(MyApp); // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title), - m_inputWin(NULL), + : wxFrame(nullptr, wxID_ANY, title), + m_inputWin(nullptr), m_skipHook(true), m_skipDown(true) { @@ -515,7 +515,7 @@ const char* GetVirtualKeyCodeName(int keycode) #undef WXK_ default: - return NULL; + return nullptr; } } diff --git a/samples/layout/expt.cpp b/samples/layout/expt.cpp index 6b77454b2d..6a072806a2 100644 --- a/samples/layout/expt.cpp +++ b/samples/layout/expt.cpp @@ -37,7 +37,7 @@ class wxConstraintOp: public wxObject { opType = typ; edge = wxLeft; - win = NULL; + win = nullptr; value = 0; margin = 0; relationship = wxSameAs; @@ -54,11 +54,11 @@ class wxConstraintOp: public wxObject if (op.lhs) lhs = new wxConstraintOp(*op.lhs); else - lhs = NULL; + lhs = nullptr; if (op.rhs) rhs = new wxConstraintOp(*op.rhs); else - rhs = NULL; + rhs = nullptr; } ~wxConstraintOp(void) { diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 7f62233250..fd7630d442 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -74,7 +74,7 @@ wxEND_EVENT_TABLE() // Define my frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets Layout Demo") + : wxFrame(nullptr, wxID_ANY, "wxWidgets Layout Demo") { SetIcon(wxICON(sample)); diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 4b2aae9e57..86376f59fe 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -169,10 +169,10 @@ wxEND_EVENT_TABLE() // My frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) + : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) { - m_listCtrl = NULL; - m_logWindow = NULL; + m_listCtrl = nullptr; + m_logWindow = nullptr; m_smallVirtual = false; m_numListItems = 10; @@ -1565,7 +1565,7 @@ void MyListCtrl::InsertItemInReportView(int i) #if USE_CONTEXT_MENU void MyListCtrl::OnContextMenu(wxContextMenuEvent& event) { - if (GetEditControl() == NULL) + if (GetEditControl() == nullptr) { wxPoint point = event.GetPosition(); // If from keyboard diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index f8aa6d7f28..14453fff87 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -148,7 +148,7 @@ bool MyApp::OnInit() // Define my frame constructor MyFrame::MyFrame() - : wxMDIParentFrame(NULL, wxID_ANY, "wxWidgets MDI Sample", + : wxMDIParentFrame(nullptr, wxID_ANY, "wxWidgets MDI Sample", wxDefaultPosition, wxSize(500, 400)), MenuEventLogger("parent", this) { @@ -227,7 +227,7 @@ MyFrame::~MyFrame() Unbind(wxEVT_SIZE, &MyFrame::OnSize, this); // also prevent its use as log target - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); } #if wxUSE_MENUS diff --git a/samples/mediaplayer/mediaplayer.cpp b/samples/mediaplayer/mediaplayer.cpp index 858813710d..1d7b8e26aa 100644 --- a/samples/mediaplayer/mediaplayer.cpp +++ b/samples/mediaplayer/mediaplayer.cpp @@ -500,7 +500,7 @@ void wxMediaPlayerApp::MacOpenFiles(const wxArrayString & fileNames ) // ---------------------------------------------------------------------------- wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(1366,768)) + : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(1366,768)) { SetIcon(wxICON(sample)); diff --git a/samples/memcheck/memcheck.cpp b/samples/memcheck/memcheck.cpp index 1e818dee18..c8663ed3a9 100644 --- a/samples/memcheck/memcheck.cpp +++ b/samples/memcheck/memcheck.cpp @@ -56,7 +56,7 @@ bool MyApp::OnInit(void) return false; // Create the main frame window - MyFrame *frame = new MyFrame((wxFrame *) NULL); + MyFrame *frame = new MyFrame(nullptr); // Give it an icon frame->SetIcon(wxICON(sample)); diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index fc0febe471..3b5e1e6412 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -175,7 +175,7 @@ private: wxMenuItem *GetLastMenuItem() const; - // the menu previously detached from the menubar (may be NULL) + // the menu previously detached from the menubar (may be null) wxMenu *m_menu; // the count of dummy menus already created @@ -466,16 +466,16 @@ bool MyApp::OnInit() // Define my frame constructor MyFrame::MyFrame() - : wxFrame((wxFrame *)NULL, wxID_ANY, "wxWidgets menu sample") + : wxFrame(nullptr, wxID_ANY, "wxWidgets menu sample") { SetIcon(wxICON(sample)); #if USE_LOG_WINDOW - m_textctrl = NULL; + m_textctrl = nullptr; #endif - m_menu = NULL; + m_menu = nullptr; m_countDummy = 0; - m_logOld = NULL; + m_logOld = nullptr; #if wxUSE_STATUSBAR CreateStatusBar(); @@ -771,14 +771,14 @@ wxMenuItem *MyFrame::GetLastMenuItem() const { wxMenuBar *menubar = GetMenuBar(); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); - wxCHECK_MSG( menu, NULL, "no 'Test' menu?" ); + wxCHECK_MSG( menu, nullptr, "no 'Test' menu?" ); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast(); if ( !node ) { wxLogWarning("No last item in the 'Test' menu!"); - return NULL; + return nullptr; } else { @@ -887,7 +887,7 @@ void MyFrame::OnToggleMenu(wxCommandEvent& WXUNUSED(event)) { // restore it mbar->Insert(0, m_menu, "&File"); - m_menu = NULL; + m_menu = nullptr; } } @@ -986,7 +986,7 @@ void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event)) wxCHECK_RET( menu, "no 'Test' menu?" ); menu->Append(Menu_Dummy_Last, "&Dummy sub menu", - CreateDummyMenu(NULL), "Dummy sub menu help"); + CreateDummyMenu(nullptr), "Dummy sub menu help"); } void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event)) @@ -1241,7 +1241,7 @@ void MyFrame::ShowContextMenu(const wxPoint& pos) else // normal case, shift not pressed { menu.Append(Menu_Help_About, "&About"); - menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(NULL)); + menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(nullptr)); menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted"); menu.AppendCheckItem(Menu_Popup_ToBeChecked, "To be &checked"); menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed", diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index ff526e93b3..f9163a03ff 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -174,8 +174,8 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, char *, int) CMainWindow::CMainWindow() { LoadAccelTable( "MainAccelTable" ); - Create( NULL, "Hello Foundation Application", - WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" ); + Create( nullptr, "Hello Foundation Application", + WS_OVERLAPPEDWINDOW, rectDefault, nullptr, "MainMenu" ); // Create a container representing the MFC window in wxWidgets window // hierarchy. @@ -251,7 +251,7 @@ bool MyApp::OnInit() wxFrame *MyApp::CreateFrame() { - MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300), + MyChild *subframe = new MyChild(nullptr, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE); subframe->SetTitle("wxWidgets canvas frame"); @@ -343,7 +343,7 @@ wxEND_EVENT_TABLE() MyChild::MyChild(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, const long style) : wxFrame(frame, -1, title, pos, size, style) { - canvas = NULL; + canvas = nullptr; } MyChild::~MyChild() diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 088a5a7d2b..4da42f9217 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -39,7 +39,7 @@ bool MyApp::OnInit(void) return false; // Create the main frame window - MyFrame* frame = new MyFrame(NULL, wxID_ANY, "wxWidgets Native Dialog Sample", wxDefaultPosition, wxDefaultSize); + MyFrame* frame = new MyFrame(nullptr, wxID_ANY, "wxWidgets Native Dialog Sample", wxDefaultPosition, wxDefaultSize); #if wxUSE_STATUSBAR // Give it a status line @@ -77,7 +77,7 @@ MyFrame::MyFrame(wxWindow* parent, const wxWindowID id, const wxString& title, c { SetIcon(wxICON(sample)); - panel = NULL; + panel = nullptr; } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 57b58a9268..8fa3b86a56 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -205,7 +205,7 @@ wxWindow *CreatePage(wxBookCtrlBase *parent, const wxString&pageName) wxFAIL_MSG( "unknown page name" ); - return NULL; + return nullptr; } @@ -274,7 +274,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, wxString("wxWidgets book controls sample")) + : wxFrame(nullptr, wxID_ANY, wxString("wxWidgets book controls sample")) { #if wxUSE_HELP SetExtraStyle(wxFRAME_EX_CONTEXTHELP); @@ -389,8 +389,8 @@ MyFrame::MyFrame() SetMenuBar(menuBar); // books creation - m_panel = NULL; - m_bookCtrl = NULL; + m_panel = nullptr; + m_bookCtrl = nullptr; // use some random images for the book control pages const wxSize imageSize(32, 32); @@ -533,7 +533,7 @@ void MyFrame::RecreateBook() wxBookCtrlBase *oldBook = m_bookCtrl; - m_bookCtrl = NULL; + m_bookCtrl = nullptr; DISPATCH_ON_TYPE(m_bookCtrl = new, wxNotebook, @@ -562,7 +562,7 @@ void MyFrame::RecreateBook() // we only need the old treebook if we're recreating another treebook wxTreebook *tbkOld = m_type == Type_Treebook ? wxDynamicCast(oldBook, wxTreebook) - : NULL; + : nullptr; #endif // wxUSE_TREEBOOK const int count = oldBook->GetPageCount(); @@ -925,7 +925,7 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) { static int s_nPages = wxNOT_FOUND; static int s_nSel = wxNOT_FOUND; - static wxBookCtrlBase *s_currBook = NULL; + static wxBookCtrlBase *s_currBook = nullptr; wxBookCtrlBase *currBook = GetCurrentBook(); diff --git a/samples/oleauto/oleauto.cpp b/samples/oleauto/oleauto.cpp index 24674c244f..5d55a4adf6 100644 --- a/samples/oleauto/oleauto.cpp +++ b/samples/oleauto/oleauto.cpp @@ -143,7 +143,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp index 4d1597ae1b..77cc734837 100644 --- a/samples/opengl/cube/cube.cpp +++ b/samples/opengl/cube/cube.cpp @@ -456,11 +456,11 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame( bool stereoWindow ) - : wxFrame(NULL, wxID_ANY, "wxWidgets OpenGL Cube Sample") + : wxFrame(nullptr, wxID_ANY, "wxWidgets OpenGL Cube Sample") { int stereoAttribList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO, 0 }; - new TestGLCanvas(this, stereoWindow ? stereoAttribList : NULL); + new TestGLCanvas(this, stereoWindow ? stereoAttribList : nullptr); SetIcon(wxICON(sample)); diff --git a/samples/opengl/cube/cube.h b/samples/opengl/cube/cube.h index c38ce330bc..4f9bd0d280 100644 --- a/samples/opengl/cube/cube.h +++ b/samples/opengl/cube/cube.h @@ -31,7 +31,7 @@ private: class MyApp : public wxApp { public: - MyApp() { m_glContext = NULL; m_glStereoContext = NULL; } + MyApp() { m_glContext = nullptr; m_glStereoContext = nullptr; } // Returns the shared context used by all frames and sets it as current for // the given canvas. @@ -65,7 +65,7 @@ private: class TestGLCanvas : public wxGLCanvas { public: - TestGLCanvas(wxWindow *parent, int *attribList = NULL); + TestGLCanvas(wxWindow *parent, int *attribList = nullptr); private: void OnPaint(wxPaintEvent& event); diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index 1150553abf..251e53d59c 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -53,7 +53,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - new MyFrame(NULL, "wxWidgets OpenGL Isosurf Sample"); + new MyFrame(nullptr, "wxWidgets OpenGL Isosurf Sample"); return true; } @@ -91,7 +91,7 @@ wxEND_EVENT_TABLE() MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(frame, wxID_ANY, title, pos, size, style), - m_canvas(NULL) + m_canvas(nullptr) { SetIcon(wxICON(sample)); @@ -109,7 +109,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, // JACS #ifdef __WXMSW__ - int *gl_attrib = NULL; + int *gl_attrib = nullptr; #else int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1, diff --git a/samples/opengl/isosurf/isosurf.h b/samples/opengl/isosurf/isosurf.h index 8c90eb57f0..4a7305d0c6 100644 --- a/samples/opengl/isosurf/isosurf.h +++ b/samples/opengl/isosurf/isosurf.h @@ -46,7 +46,7 @@ class TestGLCanvas : public wxGLCanvas public: TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, - int *gl_attrib = NULL); + int *gl_attrib = nullptr); virtual ~TestGLCanvas(); diff --git a/samples/opengl/penguin/penguin.cpp b/samples/opengl/penguin/penguin.cpp index 8c728b7cc1..a2b5da28e4 100644 --- a/samples/opengl/penguin/penguin.cpp +++ b/samples/opengl/penguin/penguin.cpp @@ -40,7 +40,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - MyFrame *frame = new MyFrame(NULL, "wxWidgets Penguin Sample", + MyFrame *frame = new MyFrame(nullptr, "wxWidgets Penguin Sample", wxDefaultPosition, wxDefaultSize); #if wxUSE_ZLIB @@ -143,7 +143,7 @@ TestGLCanvas::TestGLCanvas(wxWindow *parent, const wxSize& size, long style, const wxString& name) - : wxGLCanvas(parent, id, NULL, pos, size, + : wxGLCanvas(parent, id, nullptr, pos, size, style | wxFULL_REPAINT_ON_RESIZE, name) { // Explicitly create a new rendering context instance for this canvas. diff --git a/samples/opengl/pyramid/oglpfuncs.cpp b/samples/opengl/pyramid/oglpfuncs.cpp index d1b6c4bece..d33c54cbe2 100644 --- a/samples/opengl/pyramid/oglpfuncs.cpp +++ b/samples/opengl/pyramid/oglpfuncs.cpp @@ -58,39 +58,39 @@ void* MyGetGLFuncAddress(const char* fname) } // Declare and initialize pointers -PFNGLACTIVETEXTUREPROC my_glActiveTexture = NULL; -PFNGLATTACHSHADERPROC my_glAttachShader = NULL; -PFNGLBINDATTRIBLOCATIONPROC my_glBindAttribLocation = NULL; -PFNGLBINDBUFFERPROC my_glBindBuffer = NULL; -PFNGLBINDVERTEXARRAYPROC my_glBindVertexArray = NULL; -PFNGLBUFFERDATAPROC my_glBufferData = NULL; -PFNGLBUFFERSUBDATAPROC my_glBufferSubData = NULL; -PFNGLCOMPILESHADERPROC my_glCompileShader = NULL; -PFNGLCREATEPROGRAMPROC my_glCreateProgram = NULL; -PFNGLCREATESHADERPROC my_glCreateShader = NULL; -PFNGLDELETEBUFFERSPROC my_glDeleteBuffers = NULL; -PFNGLDELETEPROGRAMPROC my_glDeleteProgram = NULL; -PFNGLDELETESHADERPROC my_glDeleteShader = NULL; -PFNGLDELETEVERTEXARRAYSPROC my_glDeleteVertexArrays = NULL; -PFNGLDETACHSHADERPROC my_glDetachShader = NULL; -PFNGLDISABLEVERTEXATTRIBARRAYPROC my_glDisableVertexAttribArray = NULL; -PFNGLENABLEVERTEXATTRIBARRAYPROC my_glEnableVertexAttribArray = NULL; -PFNGLGENBUFFERSPROC my_glGenBuffers = NULL; -PFNGLGENVERTEXARRAYSPROC my_glGenVertexArrays = NULL; -PFNGLGETPROGRAMINFOLOGPROC my_glGetProgramInfoLog = NULL; -PFNGLGETPROGRAMIVPROC my_glGetProgramiv = NULL; -PFNGLGETSHADERINFOLOGPROC my_glGetShaderInfoLog = NULL; -PFNGLGETSHADERIVPROC my_glGetShaderiv = NULL; -PFNGLGETUNIFORMLOCATIONPROC my_glGetUniformLocation = NULL; -PFNGLLINKPROGRAMPROC my_glLinkProgram = NULL; -PFNGLPROVOKINGVERTEXPROC my_glProvokingVertex = NULL; -PFNGLSHADERSOURCEPROC my_glShaderSource = NULL; -PFNGLUNIFORM1IPROC my_glUniform1i = NULL; -PFNGLUNIFORM3FVPROC my_glUniform3fv = NULL; -PFNGLUNIFORM4FVPROC my_glUniform4fv = NULL; -PFNGLUNIFORMMATRIX4FVPROC my_glUniformMatrix4fv = NULL; -PFNGLUSEPROGRAMPROC my_glUseProgram = NULL; -PFNGLVERTEXATTRIBPOINTERPROC my_glVertexAttribPointer = NULL; +PFNGLACTIVETEXTUREPROC my_glActiveTexture = nullptr; +PFNGLATTACHSHADERPROC my_glAttachShader = nullptr; +PFNGLBINDATTRIBLOCATIONPROC my_glBindAttribLocation = nullptr; +PFNGLBINDBUFFERPROC my_glBindBuffer = nullptr; +PFNGLBINDVERTEXARRAYPROC my_glBindVertexArray = nullptr; +PFNGLBUFFERDATAPROC my_glBufferData = nullptr; +PFNGLBUFFERSUBDATAPROC my_glBufferSubData = nullptr; +PFNGLCOMPILESHADERPROC my_glCompileShader = nullptr; +PFNGLCREATEPROGRAMPROC my_glCreateProgram = nullptr; +PFNGLCREATESHADERPROC my_glCreateShader = nullptr; +PFNGLDELETEBUFFERSPROC my_glDeleteBuffers = nullptr; +PFNGLDELETEPROGRAMPROC my_glDeleteProgram = nullptr; +PFNGLDELETESHADERPROC my_glDeleteShader = nullptr; +PFNGLDELETEVERTEXARRAYSPROC my_glDeleteVertexArrays = nullptr; +PFNGLDETACHSHADERPROC my_glDetachShader = nullptr; +PFNGLDISABLEVERTEXATTRIBARRAYPROC my_glDisableVertexAttribArray = nullptr; +PFNGLENABLEVERTEXATTRIBARRAYPROC my_glEnableVertexAttribArray = nullptr; +PFNGLGENBUFFERSPROC my_glGenBuffers = nullptr; +PFNGLGENVERTEXARRAYSPROC my_glGenVertexArrays = nullptr; +PFNGLGETPROGRAMINFOLOGPROC my_glGetProgramInfoLog = nullptr; +PFNGLGETPROGRAMIVPROC my_glGetProgramiv = nullptr; +PFNGLGETSHADERINFOLOGPROC my_glGetShaderInfoLog = nullptr; +PFNGLGETSHADERIVPROC my_glGetShaderiv = nullptr; +PFNGLGETUNIFORMLOCATIONPROC my_glGetUniformLocation = nullptr; +PFNGLLINKPROGRAMPROC my_glLinkProgram = nullptr; +PFNGLPROVOKINGVERTEXPROC my_glProvokingVertex = nullptr; +PFNGLSHADERSOURCEPROC my_glShaderSource = nullptr; +PFNGLUNIFORM1IPROC my_glUniform1i = nullptr; +PFNGLUNIFORM3FVPROC my_glUniform3fv = nullptr; +PFNGLUNIFORM4FVPROC my_glUniform4fv = nullptr; +PFNGLUNIFORMMATRIX4FVPROC my_glUniformMatrix4fv = nullptr; +PFNGLUSEPROGRAMPROC my_glUseProgram = nullptr; +PFNGLVERTEXATTRIBPOINTERPROC my_glVertexAttribPointer = nullptr; #endif // __APPLE__ diff --git a/samples/opengl/pyramid/oglstuff.cpp b/samples/opengl/pyramid/oglstuff.cpp index 367f681ff1..7deb30da28 100644 --- a/samples/opengl/pyramid/oglstuff.cpp +++ b/samples/opengl/pyramid/oglstuff.cpp @@ -12,10 +12,10 @@ #include "oglstuff.h" // External function for GL errors -myOGLErrHandler* externalMyOGLErrHandler = NULL; +myOGLErrHandler* externalMyOGLErrHandler = nullptr; // Allow GL errors to be handled in other part of the app. -bool MyOnGLError(int err, const GLchar* glMsg = NULL) +bool MyOnGLError(int err, const GLchar* glMsg = nullptr) { GLenum GLErrorVal = glGetError(); @@ -27,7 +27,7 @@ bool MyOnGLError(int err, const GLchar* glMsg = NULL) return true; } - if ( (GLErrorVal == GL_NO_ERROR) && (glMsg == NULL) ) + if ( (GLErrorVal == GL_NO_ERROR) && (glMsg == nullptr) ) return true; if ( externalMyOGLErrHandler ) @@ -385,7 +385,7 @@ void myOGLShaders::Init() for (shaShas_v::iterator it = m_shaCode.begin(); it != m_shaCode.end(); ++it) { it->shaId = glCreateShader(it->typeSha); - glShaderSource(it->shaId, 1, &(it->scode), NULL); + glShaderSource(it->shaId, 1, &(it->scode), nullptr); MyOnGLError(myoglERR_SHADERCREATE); resC = Compile(it->shaId); @@ -527,7 +527,7 @@ void myLight::Set(const myVec3& position, GLfloat intensity, myOGLTriangles::myOGLTriangles() { m_triangVAO = m_bufVertId = m_bufColNorId = m_bufIndexId = 0; - m_triangShaders = NULL; + m_triangShaders = nullptr; } myOGLTriangles::~myOGLTriangles() @@ -557,7 +557,7 @@ void myOGLTriangles::Clear() glFlush(); //Tell GL to execute those commands now, but we don't wait for them - m_triangShaders = NULL; + m_triangShaders = nullptr; m_triangVAO = m_bufIndexId = m_bufColNorId = m_bufVertId = 0; } @@ -568,7 +568,7 @@ void myOGLTriangles::SetBuffers(myOGLShaders* theShader, { MyOnGLError(myoglERR_CLEAR); //clear error stack - // NOTE: have you realized that I fully trust on parameters being != 0 and != NULL? + // NOTE: have you realized that I fully trust on parameters being != 0 and != nullptr? // Part 1: Buffers - - - - - - - - - - - - - - - - - - - @@ -592,7 +592,7 @@ void myOGLTriangles::SetBuffers(myOGLShaders* theShader, glBindBuffer(GL_ARRAY_BUFFER, m_bufColNorId); // Allocate space for both arrays nBytes = (nuPoints * 4 + nuTriangs * 3) * sizeof(GLfloat); - glBufferData(GL_ARRAY_BUFFER, nBytes, NULL, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, nBytes, nullptr, GL_STATIC_DRAW); if ( ! MyOnGLError(myoglERR_BUFFER) ) { // Likely the GPU got out of memory @@ -707,7 +707,7 @@ void myOGLTriangles::Draw(const GLfloat* unifMvp, const GLfloat* unifToVw, myOGLString::myOGLString() { m_bufPosId = m_textureId = m_stringVAO = m_textureUnit = 0; - m_stringShaders = NULL; + m_stringShaders = nullptr; } myOGLString::~myOGLString() @@ -740,7 +740,7 @@ void myOGLString::Clear() glFlush(); //Tell GL to execute those commands now, but we don't wait for them m_bufPosId = m_textureId = m_stringVAO = m_textureUnit = 0; - m_stringShaders = NULL; + m_stringShaders = nullptr; } void myOGLString::SetStringWithVerts(myOGLShaders* theShader, @@ -759,7 +759,7 @@ void myOGLString::SetStringWithVerts(myOGLShaders* theShader, glBindBuffer(GL_ARRAY_BUFFER, m_bufPosId); // (4+4) (vertices + normals) x 3 components + 4 text-vertices x 2 components GLsizeiptr nBytes = (8 * 3 + 4 * 2) * sizeof(GLfloat); - glBufferData(GL_ARRAY_BUFFER, nBytes, NULL, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, nBytes, nullptr, GL_STATIC_DRAW); if ( ! MyOnGLError(myoglERR_BUFFER) ) { @@ -925,7 +925,7 @@ void myOGLImmutString::SetImmutString(myOGLShaders* theShader, SetAsGLFloat4x4(imaVerts, fimaVerts, 12); // Call the base class without normals, it will handle this case - SetStringWithVerts(theShader, tImage, tWidth, tHeigh, fimaVerts, NULL); + SetStringWithVerts(theShader, tImage, tWidth, tHeigh, fimaVerts, nullptr); } void myOGLImmutString::SetOrtho(int winWidth, int winHeight) @@ -1245,7 +1245,7 @@ void myOGLManager::Render() m_StringOnPyr.Draw(m_Camera.GetFloatMVP(), m_Camera.GetFloatToVw(), &m_Light); // This string is at the very front, whatever z-coords are given glDisable(GL_DEPTH_TEST); - m_ImmString.Draw(m_ImmString.GetFloatMVP(), NULL, NULL); + m_ImmString.Draw(m_ImmString.GetFloatMVP(), nullptr, nullptr); } void myOGLManager::OnMouseButDown(int posX, int posY) diff --git a/samples/opengl/pyramid/oglstuff.h b/samples/opengl/pyramid/oglstuff.h index 65b4c7f657..33f037d3ab 100644 --- a/samples/opengl/pyramid/oglstuff.h +++ b/samples/opengl/pyramid/oglstuff.h @@ -89,7 +89,7 @@ struct shaShas { GLuint shaId; GLenum typeSha; //The type of shader - const GLchar* scode; //The NULL terminated GLSL code + const GLchar* scode; //The nullptr terminated GLSL code }; typedef std::vector shaShas_v; @@ -293,7 +293,7 @@ private: class myOGLManager { public: - myOGLManager(myOGLErrHandler* extErrHnd = NULL); + myOGLManager(myOGLErrHandler* extErrHnd = nullptr); ~myOGLManager(); // Constants, prototypes and pointers to OGL functions diff --git a/samples/opengl/pyramid/pyramid.cpp b/samples/opengl/pyramid/pyramid.cpp index b8f988f5f2..ae953eb474 100644 --- a/samples/opengl/pyramid/pyramid.cpp +++ b/samples/opengl/pyramid/pyramid.cpp @@ -82,7 +82,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(500, 400)) + : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(500, 400)) { // set the frame icon SetIcon(wxICON(sample)); @@ -118,12 +118,12 @@ MyFrame::MyFrame(const wxString& title) #if wxUSE_LOGWINDOW //Open a log window, don't show it though - m_LogWin = new wxLogWindow(NULL, "Pyramid log window", false, false); + m_LogWin = new wxLogWindow(nullptr, "Pyramid log window", false, false); wxLog::SetActiveTarget(m_LogWin); #endif // wxUSE_LOGWINDOW // The canvas - m_mycanvas = NULL; + m_mycanvas = nullptr; wxGLAttributes vAttrs; // Defaults should be accepted vAttrs.PlatformDefaults().Defaults().EndList(); @@ -260,7 +260,7 @@ void fOGLErrHandler(int err, int glerr, const GLchar* glMsg) else if ( err != myoglERR_JUSTLOG ) msg += _(" GL reports: "); - if ( glMsg != NULL ) + if ( glMsg != nullptr ) msg += wxString::FromUTF8( reinterpret_cast(glMsg) ); wxLogMessage(msg); @@ -284,7 +284,7 @@ unsigned char* MyImgToArray(const wxImage& img, const wxColour& cTrans, unsigned unsigned char *resArr = new unsigned char [siz * 4]; unsigned char *res = resArr; unsigned char *sdata = img.GetData(); - unsigned char *alpha = NULL; + unsigned char *alpha = nullptr; if ( img.HasAlpha() ) alpha = img.GetAlpha(); // Pixel by pixel @@ -293,7 +293,7 @@ unsigned char* MyImgToArray(const wxImage& img, const wxColour& cTrans, unsigned res[0] = sdata[0] ; res[1] = sdata[1] ; res[2] = sdata[2] ; - if ( alpha != NULL ) + if ( alpha != nullptr ) { //copy alpha res[3] = alpha[i] ; } @@ -323,7 +323,7 @@ unsigned char* MyTextToPixels(const wxString& sText, // The string int* width, int* height) // Image sizes { if ( sText.IsEmpty() ) - return NULL; + return nullptr; // The dc where we temporally draw wxMemoryDC mdc; @@ -388,7 +388,7 @@ MyGLCanvas::MyGLCanvas(MyFrame* parent, const wxGLAttributes& canvasAttrs) { m_parent = parent; - m_oglManager = NULL; + m_oglManager = nullptr; m_winHeight = 0; // We have not been sized yet // Explicitly create a new rendering context instance for this canvas. @@ -396,7 +396,7 @@ MyGLCanvas::MyGLCanvas(MyFrame* parent, const wxGLAttributes& canvasAttrs) #ifndef __WXMAC__ // An impossible context, just to test IsOk() ctxAttrs.PlatformDefaults().OGLVersion(99, 2).EndList(); - m_oglContext = new wxGLContext(this, NULL, &ctxAttrs); + m_oglContext = new wxGLContext(this, nullptr, &ctxAttrs); if ( !m_oglContext->IsOK() ) { @@ -407,7 +407,7 @@ MyGLCanvas::MyGLCanvas(MyFrame* parent, const wxGLAttributes& canvasAttrs) ctxAttrs.Reset(); #endif //__WXMAC__ ctxAttrs.PlatformDefaults().CoreProfile().OGLVersion(3, 2).EndList(); - m_oglContext = new wxGLContext(this, NULL, &ctxAttrs); + m_oglContext = new wxGLContext(this, nullptr, &ctxAttrs); #ifndef __WXMAC__ } #endif //__WXMAC__ @@ -417,7 +417,7 @@ MyGLCanvas::MyGLCanvas(MyFrame* parent, const wxGLAttributes& canvasAttrs) wxMessageBox("This sample needs an OpenGL 3.2 capable driver.\nThe app will end now.", "OpenGL version error", wxOK | wxICON_INFORMATION, this); delete m_oglContext; - m_oglContext = NULL; + m_oglContext = nullptr; } else { @@ -436,13 +436,13 @@ MyGLCanvas::~MyGLCanvas() if ( m_oglManager ) { delete m_oglManager; - m_oglManager = NULL; + m_oglManager = nullptr; } if ( m_oglContext ) { delete m_oglContext; - m_oglContext = NULL; + m_oglContext = nullptr; } } diff --git a/samples/opengl/pyramid/pyramid.h b/samples/opengl/pyramid/pyramid.h index 5319cc0200..64a8d5938d 100644 --- a/samples/opengl/pyramid/pyramid.h +++ b/samples/opengl/pyramid/pyramid.h @@ -56,7 +56,7 @@ public: //Used just to know if we must end now because OGL 3.2 isn't available bool OglCtxAvailable() - {return m_oglContext != NULL;} + {return m_oglContext != nullptr;} //Init the OpenGL stuff bool oglInit(); diff --git a/samples/ownerdrw/ownerdrw.cpp b/samples/ownerdrw/ownerdrw.cpp index d1d07e1c0b..00ca423ed3 100644 --- a/samples/ownerdrw/ownerdrw.cpp +++ b/samples/ownerdrw/ownerdrw.cpp @@ -89,7 +89,7 @@ bool OwnerDrawnApp::OnInit(void) if ( !wxApp::OnInit() ) return false; - new OwnerDrawnFrame(NULL, "wxWidgets Ownerdraw Sample", 50, 50, 450, 340); + new OwnerDrawnFrame(nullptr, "wxWidgets Ownerdraw Sample", 50, 50, 450, 340); return true; } diff --git a/samples/popup/popup.cpp b/samples/popup/popup.cpp index b46696cc24..27099f3506 100644 --- a/samples/popup/popup.cpp +++ b/samples/popup/popup.cpp @@ -66,7 +66,7 @@ public: virtual ~SimpleTransientPopup(); // wxPopupTransientWindow virtual methods are all overridden to log them - virtual void Popup(wxWindow *focus = NULL) override; + virtual void Popup(wxWindow *focus = nullptr) override; virtual void OnDismiss() override; virtual bool ProcessLeftDown(wxMouseEvent& event) override; virtual bool Show( bool show = true ) override; @@ -338,9 +338,9 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame(const wxString& title) -: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(500,300)) +: wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(500,300)) { - m_simplePopup = m_scrolledPopup = NULL; + m_simplePopup = m_scrolledPopup = nullptr; SetIcon(wxICON(sample)); @@ -459,9 +459,9 @@ wxBEGIN_EVENT_TABLE(MyDialog, wxDialog) wxEND_EVENT_TABLE() MyDialog::MyDialog(const wxString& title) - :wxDialog(NULL, wxID_ANY, title, wxPoint(50,50), wxSize(400,300)) + :wxDialog(nullptr, wxID_ANY, title, wxPoint(50,50), wxSize(400,300)) { - m_simplePopup = m_scrolledPopup = NULL; + m_simplePopup = m_scrolledPopup = nullptr; wxPanel *panel = new wxPanel(this, -1); wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, "Show simple popup", wxPoint(20,20) ); diff --git a/samples/power/power.cpp b/samples/power/power.cpp index e976c7796f..e0dab54472 100644 --- a/samples/power/power.cpp +++ b/samples/power/power.cpp @@ -43,10 +43,10 @@ class MyFrame : public wxFrame { public: MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets Power Management Sample", + : wxFrame(nullptr, wxID_ANY, "wxWidgets Power Management Sample", wxDefaultPosition, wxSize(500, 200)) { - m_powerResourceBlocker = NULL; + m_powerResourceBlocker = nullptr; wxMenu *fileMenu = new wxMenu; fileMenu->Append(wxID_NEW, "Start long running task\tCtrl-S"); diff --git a/samples/preferences/preferences.cpp b/samples/preferences/preferences.cpp index 72e5545e39..86367aabde 100644 --- a/samples/preferences/preferences.cpp +++ b/samples/preferences/preferences.cpp @@ -67,7 +67,7 @@ wxIMPLEMENT_APP(MyApp); class MyFrame : public wxFrame { public: - MyFrame() : wxFrame(NULL, wxID_ANY, "Preferences sample") + MyFrame() : wxFrame(nullptr, wxID_ANY, "Preferences sample") { wxMenu *fileMenu = new wxMenu; fileMenu->Append(wxID_PREFERENCES); diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index a9d847b7b5..ce107995b1 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -49,10 +49,10 @@ #endif // Global print data, to remember settings during the session -wxPrintData *g_printData = NULL; +wxPrintData *g_printData = nullptr; // Global page setup data -wxPageSetupDialogData* g_pageSetupData = NULL; +wxPageSetupDialogData* g_pageSetupData = nullptr; @@ -275,9 +275,9 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { - m_canvas = NULL; + m_canvas = nullptr; m_previewModality = wxPreviewFrame_AppModal; #if wxUSE_STATUSBAR diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 5793752e76..5e96d1da66 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -1951,11 +1951,11 @@ void FormMain::ReplaceGrid(int style, int extraStyle) // ----------------------------------------------------------------------- FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame *)NULL, -1, title, pos, size, + : wxFrame(nullptr, -1, title, pos, size, (wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION| wxTAB_TRAVERSAL|wxCLOSE_BOX) ) - , m_pPropGridManager(NULL) - , m_propGrid(NULL) + , m_pPropGridManager(nullptr) + , m_propGrid(nullptr) , m_hasHeader(false) , m_labelEditingEnabled(false) { @@ -3181,7 +3181,7 @@ void FormMain::OnIdle( wxIdleEvent& event ) { /* // This code is useful for debugging focus problems - static wxWindow* last_focus = (wxWindow*) NULL; + static wxWindow* last_focus = nullptr; wxWindow* cur_focus = ::wxWindow::FindFocus(); @@ -3206,7 +3206,7 @@ void FormMain::OnIdle( wxIdleEvent& event ) wxPGProperty* GetRealRoot(wxPropertyGrid *grid) { wxPGProperty *property = grid->GetRoot(); - return property ? grid->GetFirstChild(property) : NULL; + return property ? grid->GetFirstChild(property) : nullptr; } void GetColumnWidths(wxPropertyGrid *grid, wxPGProperty *root, int width[3]) @@ -3351,11 +3351,11 @@ wxEND_EVENT_TABLE() void FormMain::OnShowPopup(wxCommandEvent& WXUNUSED(event)) { - static PropertyGridPopup *popup = NULL; + static PropertyGridPopup *popup = nullptr; if ( popup ) { delete popup; - popup = NULL; + popup = nullptr; return; } popup = new PropertyGridPopup(this); diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp index ee9bbafe97..0438930607 100644 --- a/samples/propgrid/propgrid_minimal.cpp +++ b/samples/propgrid/propgrid_minimal.cpp @@ -69,7 +69,7 @@ void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) } else { - wxLogVerbose("OnPropertyGridChange(NULL)"); + wxLogVerbose("OnPropertyGridChange(nullptr)"); } } diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index fdce011c43..354cffcdb7 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -649,7 +649,7 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const WX_PG_DOGETVALIDATOR_EXIT(validator) #else - return NULL; + return nullptr; #endif } diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index 21231c4d41..ed7ed747e9 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -326,12 +326,12 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pgman->ClearSelection(); - srand((unsigned int)(time(NULL) % UINT_MAX)); + srand((unsigned int)(time(nullptr) % UINT_MAX)); int failures = 0; bool _failed_ = false; wxVector errorMessages; - wxDialog* dlg = NULL; + wxDialog* dlg = nullptr; dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests", wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); @@ -587,7 +587,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) // in wxPropertyGridInterface functions is intentional. // Purpose is to test wxPGPropArgCls ctors. - //pg = (wxPropertyGrid*) NULL; + //pg = nullptr; wxArrayString test_arrstr_1; test_arrstr_1.Add("Apple"); @@ -695,7 +695,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pg->SetPropertyValue("DateProperty",dt2); #endif - //pg = (wxPropertyGrid*) NULL; + //pg = nullptr; pgman->SelectPage(0); @@ -1130,11 +1130,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_START_TEST(GetPropertyValues) page1 = pgman->GetPage(0); - pg1_values = page1->GetPropertyValues("Page1",NULL,wxPG_KEEP_STRUCTURE); + pg1_values = page1->GetPropertyValues("Page1",nullptr,wxPG_KEEP_STRUCTURE); page2 = pgman->GetPage(1); - pg2_values = page2->GetPropertyValues("Page2",NULL,wxPG_KEEP_STRUCTURE); + pg2_values = page2->GetPropertyValues("Page2",nullptr,wxPG_KEEP_STRUCTURE); page3 = pgman->GetPage(2); - pg3_values = page3->GetPropertyValues("Page3",NULL,wxPG_KEEP_STRUCTURE); + pg3_values = page3->GetPropertyValues("Page3",nullptr,wxPG_KEEP_STRUCTURE); } { diff --git a/samples/regtest/regtest.cpp b/samples/regtest/regtest.cpp index 4ecc8104c4..32965b02f3 100644 --- a/samples/regtest/regtest.cpp +++ b/samples/regtest/regtest.cpp @@ -108,18 +108,18 @@ private: { WX_DEFINE_ARRAY_PTR(TreeNode *, TreeChildren); public: - RegTreeCtrl *m_pTree; // must be !NULL - TreeNode *m_pParent; // NULL only for the root node + RegTreeCtrl *m_pTree; // must be non-null + TreeNode *m_pParent; // nullptr only for the root node wxTreeItemId m_id; // the id of the tree control item wxString m_strName; // name of the key/value TreeChildren m_aChildren; // array of subkeys/values bool m_bKey; // key or value? - wxRegKey *m_pKey; // only may be !NULL if m_bKey == true + wxRegKey *m_pKey; // only may be non-null if m_bKey == true wxRegKey::WOW64ViewMode m_viewMode; // How to view the registry. // trivial accessors wxTreeItemId Id() const { return m_id; } - bool IsRoot() const { return m_pParent == NULL; } + bool IsRoot() const { return m_pParent == nullptr; } bool IsKey() const { return m_bKey; } TreeNode *Parent() const { return m_pParent; } @@ -134,7 +134,7 @@ private: const wxString FullName() const; void SetRegistryView(wxRegKey::WOW64ViewMode viewMode); - // get the associated key: make sure the pointer is !NULL + // get the associated key: make sure the pointer is not null wxRegKey& Key() { if ( !m_pKey ) OnExpand(); return *m_pKey; } // dtor deletes all children @@ -163,7 +163,7 @@ public: TreeNode *InsertNewTreeNode(TreeNode *pParent, const wxString& strName, int idImage = RegImageList::ClosedKey, - const wxString *pstrValue = NULL, + const wxString *pstrValue = nullptr, wxRegKey::WOW64ViewMode viewMode = wxRegKey::WOW64ViewMode_Default); // add standard registry keys @@ -348,7 +348,7 @@ bool RegApp::OnInit() return false; // create the main frame window and show it - RegFrame *frame = new RegFrame(NULL, "wxRegTest", 50, 50, 600, 350); + RegFrame *frame = new RegFrame(nullptr, "wxRegTest", 50, 50, 600, 350); frame->Show(true); return true; @@ -579,8 +579,8 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode( pNewNode->m_pTree = this; pNewNode->m_pParent = pParent; pNewNode->m_strName = strName; - pNewNode->m_bKey = pstrValue == NULL; - pNewNode->m_pKey = NULL; + pNewNode->m_bKey = pstrValue == nullptr; + pNewNode->m_pKey = nullptr; pNewNode->m_viewMode = viewMode; if (pParent) { @@ -599,7 +599,7 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode( SetItemData(pNewNode->m_id, pNewNode); // add it to the list of parent's children - if ( pParent != NULL ) + if ( pParent != nullptr ) { pParent->m_aChildren.Add(pNewNode); } @@ -625,7 +625,7 @@ RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id) wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS | wxSUNKEN_BORDER) { // initialize members - m_draggedItem = NULL; + m_draggedItem = nullptr; m_restoreStatus = false; m_viewMode = wxRegKey::WOW64ViewMode_Default; @@ -638,10 +638,10 @@ RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id) // ---------------- m_pRoot = InsertNewTreeNode( - NULL, + nullptr, "Registry Root", RegImageList::Root, - NULL, + nullptr, m_viewMode); // create popup menu @@ -664,7 +664,7 @@ void RegTreeCtrl::AddStdKeys() m_pRoot, wxRegKey::GetStdKeyName(ui), RegImageList::ClosedKey, - NULL, + nullptr, m_viewMode); } } @@ -710,7 +710,7 @@ void RegTreeCtrl::OnMenuTest() wxTreeItemId lId = GetSelection(); TreeNode *pNode = (TreeNode *)GetItemData(lId); - wxCHECK_RET( pNode != NULL, "tree item without data?" ); + wxCHECK_RET( pNode != nullptr, "tree item without data?" ); if ( pNode->IsRoot() ) { @@ -879,7 +879,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event) // clear the pointer anyhow TreeNode *src = m_draggedItem; - m_draggedItem = NULL; + m_draggedItem = nullptr; // where are we going to drop it? TreeNode *dst = GetNode(event); @@ -1025,7 +1025,7 @@ bool RegTreeCtrl::TreeNode::OnExpand() this, str, RegImageList::ClosedKey, - NULL, + nullptr, m_viewMode); bCont = m_pKey->GetNextKey(str, l); @@ -1302,7 +1302,7 @@ void RegTreeCtrl::CreateNewKey(const wxString& strName) wxTreeItemId lCurrent = GetSelection(); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); - wxCHECK_RET( pCurrent != NULL, "node without data?" ); + wxCHECK_RET( pCurrent != nullptr, "node without data?" ); wxASSERT( pCurrent->IsKey() ); // check must have been done before @@ -1322,7 +1322,7 @@ void RegTreeCtrl::CreateNewTextValue(const wxString& strName) wxTreeItemId lCurrent = GetSelection(); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); - wxCHECK_RET( pCurrent != NULL, "node without data?" ); + wxCHECK_RET( pCurrent != nullptr, "node without data?" ); wxASSERT( pCurrent->IsKey() ); // check must have been done before @@ -1341,7 +1341,7 @@ void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName) wxTreeItemId lCurrent = GetSelection(); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); - wxCHECK_RET( pCurrent != NULL, "node without data?" ); + wxCHECK_RET( pCurrent != nullptr, "node without data?" ); wxASSERT( pCurrent->IsKey() ); // check must have been done before @@ -1378,7 +1378,7 @@ void RegTreeCtrl::ShowProperties() { const wxRegKey& key = pCurrent->Key(); size_t nSubKeys, nValues; - if ( !key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) ) + if ( !key.GetKeyInfo(&nSubKeys, nullptr, &nValues, nullptr) ) { wxLogError("Couldn't get key info"); } @@ -1410,7 +1410,7 @@ bool RegTreeCtrl::IsKeySelected() const wxTreeItemId lCurrent = GetSelection(); TreeNode *pCurrent = (TreeNode *) GetItemData(lCurrent); - wxCHECK( pCurrent != NULL, false ); + wxCHECK( pCurrent != nullptr, false ); return pCurrent->IsKey(); } @@ -1423,7 +1423,7 @@ void RegTreeCtrl::DoRefresh() TreeNode *pNode = (TreeNode *) GetItemData(lId); - wxCHECK_RET( pNode != NULL, "tree item without data?" ); + wxCHECK_RET( pNode != nullptr, "tree item without data?" ); pNode->Refresh(); } diff --git a/samples/render/renddll.cpp b/samples/render/renddll.cpp index 1449315d9c..75b928b92b 100644 --- a/samples/render/renddll.cpp +++ b/samples/render/renddll.cpp @@ -28,7 +28,7 @@ public: const wxRect& rect, int WXUNUSED(flags) = 0, wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* WXUNUSED(params) = NULL) override + wxHeaderButtonParams* WXUNUSED(params) = nullptr) override { dc.SetBrush(*wxCYAN_BRUSH); dc.SetTextForeground(*wxRED); diff --git a/samples/render/render.cpp b/samples/render/render.cpp index 3fc111ff6d..d24240e39a 100644 --- a/samples/render/render.cpp +++ b/samples/render/render.cpp @@ -64,7 +64,7 @@ public: int WXUNUSED(flags) = 0, wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override + wxHeaderButtonParams* params = nullptr) override { wxDCBrushChanger setBrush(dc, *wxBLUE_BRUSH); wxDCTextColourChanger setFgCol(dc, *wxWHITE); @@ -184,7 +184,7 @@ public: m_useBitmap = m_useGeneric = false; #if wxUSE_GRAPHICS_CONTEXT - m_renderer = NULL; + m_renderer = nullptr; #endif } @@ -567,7 +567,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame() - : wxFrame(NULL, + : wxFrame(nullptr, wxID_ANY, "Render wxWidgets Sample") { @@ -663,7 +663,7 @@ MyFrame::MyFrame() MyFrame::~MyFrame() { - delete wxRendererNative::Set(NULL); + delete wxRendererNative::Set(nullptr); } @@ -744,7 +744,7 @@ void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUnload(wxCommandEvent& WXUNUSED(event)) { - wxRendererNative *renderer = wxRendererNative::Set(NULL); + wxRendererNative *renderer = wxRendererNative::Set(nullptr); if ( renderer ) { delete renderer; @@ -788,7 +788,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) #if wxUSE_GRAPHICS_CONTEXT void MyFrame::OnGraphicContextNone(wxCommandEvent& WXUNUSED(evt)) { - m_panel->UseGraphicRenderer(NULL); + m_panel->UseGraphicRenderer(nullptr); } void MyFrame::OnGraphicContextDefault(wxCommandEvent& WXUNUSED(evt)) diff --git a/samples/ribbon/ribbondemo.cpp b/samples/ribbon/ribbondemo.cpp index c0a5fc1833..fdf793baf0 100644 --- a/samples/ribbon/ribbondemo.cpp +++ b/samples/ribbon/ribbondemo.cpp @@ -156,7 +156,7 @@ protected: int gallery_id); void AddText(wxString msg); wxRibbonGalleryItem* AddColourToGallery(wxRibbonGallery *gallery, - wxString name, wxMemoryDC& dc, wxColour* value = NULL); + wxString name, wxMemoryDC& dc, wxColour* value = nullptr); wxColour GetGalleryColour(wxRibbonGallery *gallery, wxRibbonGalleryItem* item, wxString* name); void ResetGalleryArtProviders(); @@ -284,7 +284,7 @@ wxEND_EVENT_TABLE() #include "triangle.xpm" MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxRibbon Sample Application", wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE) + : wxFrame(nullptr, wxID_ANY, "wxRibbon Sample Application", wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE) { m_ribbon = new wxRibbonBar(this,-1,wxDefaultPosition, wxDefaultSize, wxRIBBON_BAR_FLOW_HORIZONTAL | wxRIBBON_BAR_SHOW_PAGE_LABELS @@ -610,7 +610,7 @@ wxColour MyFrame::GetGalleryColour(wxRibbonGallery *gallery, wxRibbonGalleryItem* item, wxString* name) { ColourClientData *data = (ColourClientData*)gallery->GetItemClientObject(item); - if(name != NULL) + if(name != nullptr) *name = data->GetName(); return data->GetColour(); } @@ -623,7 +623,7 @@ void MyFrame::OnHoveredColourChange(wxRibbonGalleryEvent& evt) wxRibbonGallery *gallery = evt.GetGallery(); wxRibbonArtProvider *provider = gallery->GetArtProvider(); - if(evt.GetGalleryItem() != NULL) + if(evt.GetGalleryItem() != nullptr) { if(provider == m_ribbon->GetArtProvider()) { @@ -631,7 +631,7 @@ void MyFrame::OnHoveredColourChange(wxRibbonGalleryEvent& evt) gallery->SetArtProvider(provider); } provider->SetColour(wxRIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR, - GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), NULL)); + GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), nullptr)); } else { @@ -649,7 +649,7 @@ void MyFrame::OnPrimaryColourSelect(wxRibbonGalleryEvent& evt) wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); AddText("Colour \"" + name + "\" selected as primary."); wxColour secondary, tertiary; - m_ribbon->GetArtProvider()->GetColourScheme(NULL, &secondary, &tertiary); + m_ribbon->GetArtProvider()->GetColourScheme(nullptr, &secondary, &tertiary); m_ribbon->GetArtProvider()->SetColourScheme(colour, secondary, tertiary); ResetGalleryArtProviders(); m_ribbon->Refresh(); @@ -661,7 +661,7 @@ void MyFrame::OnSecondaryColourSelect(wxRibbonGalleryEvent& evt) wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); AddText("Colour \"" + name + "\" selected as secondary."); wxColour primary, tertiary; - m_ribbon->GetArtProvider()->GetColourScheme(&primary, NULL, &tertiary); + m_ribbon->GetArtProvider()->GetColourScheme(&primary, nullptr, &tertiary); m_ribbon->GetArtProvider()->SetColourScheme(primary, colour, tertiary); ResetGalleryArtProviders(); m_ribbon->Refresh(); @@ -959,7 +959,7 @@ wxRibbonGalleryItem* MyFrame::AddColourToGallery(wxRibbonGallery *gallery, wxString colour, wxMemoryDC& dc, wxColour* value) { - wxRibbonGalleryItem* item = NULL; + wxRibbonGalleryItem* item = nullptr; wxColour c; if (colour != "Default") c = wxColour(colour); @@ -1002,12 +1002,12 @@ wxRibbonGalleryItem* MyFrame::AddColourToGallery(wxRibbonGallery *gallery, void MyFrame::OnColourGalleryButton(wxCommandEvent& evt) { wxRibbonGallery *gallery = wxDynamicCast(evt.GetEventObject(), wxRibbonGallery); - if(gallery == NULL) + if(gallery == nullptr) return; m_ribbon->DismissExpandedPanel(); if(gallery->GetSelection()) - m_colour_data.SetColour(GetGalleryColour(gallery, gallery->GetSelection(), NULL)); + m_colour_data.SetColour(GetGalleryColour(gallery, gallery->GetSelection(), nullptr)); wxColourDialog dlg(this, &m_colour_data); if(dlg.ShowModal() == wxID_OK) { @@ -1015,18 +1015,18 @@ void MyFrame::OnColourGalleryButton(wxCommandEvent& evt) wxColour clr = m_colour_data.GetColour(); // Try to find colour in gallery - wxRibbonGalleryItem *item = NULL; + wxRibbonGalleryItem *item = nullptr; for(unsigned int i = 0; i < gallery->GetCount(); ++i) { item = gallery->GetItem(i); - if(GetGalleryColour(gallery, item, NULL) == clr) + if(GetGalleryColour(gallery, item, nullptr) == clr) break; else - item = NULL; + item = nullptr; } // Colour not in gallery - add it - if(item == NULL) + if(item == nullptr) { item = AddColourToGallery(gallery, clr.GetAsString(wxC2S_HTML_SYNTAX), m_bitmap_creation_dc, diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index 30fcfdf1e8..5b53ee47c6 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -755,9 +755,9 @@ void MyApp::CreateStyles() // frame constructor MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) - : wxFrame(NULL, id, title, pos, size, style) + : wxFrame(nullptr, id, title, pos, size, style) { - m_richTextCtrl = NULL; + m_richTextCtrl = nullptr; #ifdef __WXMAC__ SetWindowVariant(wxWINDOW_VARIANT_SMALL); @@ -1204,7 +1204,7 @@ void MyFrame::WriteInitialText() r.WriteText("This is a text box. Just testing! Once more unto the breach, dear friends, once more..."); - r.SetFocusObject(NULL); // Set the focus back to the main buffer + r.SetFocusObject(nullptr); // Set the focus back to the main buffer r.SetInsertionPointEnd(); } #endif @@ -1263,7 +1263,7 @@ void MyFrame::WriteInitialText() cell->Clear(); r.WriteText("This cell spans 2 columns and 3 rows"); - r.SetFocusObject(NULL); // Set the focus back to the main buffer + r.SetFocusObject(nullptr); // Set the focus back to the main buffer r.SetInsertionPointEnd(); } #endif @@ -1345,7 +1345,7 @@ bool MyFrame::ProcessEvent(wxEvent& event) focusWin = m_richTextCtrl; if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) { - //s_command = NULL; + //s_command = nullptr; s_eventType = 0; s_id = 0; return true; @@ -1815,7 +1815,7 @@ void MyFrame::OnViewHTML(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSwitchStyleSheets(wxCommandEvent& WXUNUSED(event)) { - static wxRichTextStyleSheet* gs_AlternateStyleSheet = NULL; + static wxRichTextStyleSheet* gs_AlternateStyleSheet = nullptr; wxRichTextStyleListCtrl *styleList = (wxRichTextStyleListCtrl*) FindWindow(ID_RICHTEXT_STYLE_LIST); wxRichTextStyleComboCtrl* styleCombo = (wxRichTextStyleComboCtrl*) FindWindow(ID_RICHTEXT_STYLE_COMBO); @@ -1870,7 +1870,7 @@ void MyFrame::OnManageStyles(wxCommandEvent& WXUNUSED(event)) int flags = wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES; - wxRichTextStyleOrganiserDialog dlg(flags, sheet, NULL, this, wxID_ANY, _("Style Manager")); + wxRichTextStyleOrganiserDialog dlg(flags, sheet, nullptr, this, wxID_ANY, _("Style Manager")); dlg.ShowModal(); } @@ -1946,7 +1946,7 @@ void MyFrame::OnRenumberList(wxCommandEvent& WXUNUSED(event)) if (m_richTextCtrl->HasSelection()) { wxRichTextRange range = m_richTextCtrl->GetSelectionRange(); - m_richTextCtrl->NumberList(range, NULL, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER); + m_richTextCtrl->NumberList(range, nullptr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER); } } @@ -1955,7 +1955,7 @@ void MyFrame::OnPromoteList(wxCommandEvent& WXUNUSED(event)) if (m_richTextCtrl->HasSelection()) { wxRichTextRange range = m_richTextCtrl->GetSelectionRange(); - m_richTextCtrl->PromoteList(1, range, NULL); + m_richTextCtrl->PromoteList(1, range, nullptr); } } @@ -1964,7 +1964,7 @@ void MyFrame::OnDemoteList(wxCommandEvent& WXUNUSED(event)) if (m_richTextCtrl->HasSelection()) { wxRichTextRange range = m_richTextCtrl->GetSelectionRange(); - m_richTextCtrl->PromoteList(-1, range, NULL); + m_richTextCtrl->PromoteList(-1, range, nullptr); } } @@ -2029,7 +2029,7 @@ void MyFrame::OnTableDeleteRow(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTableFocusedUpdateUI(wxUpdateUIEvent& event) { - event.Enable(m_richTextCtrl->FindTable() != NULL); + event.Enable(m_richTextCtrl->FindTable() != nullptr); } void MyFrame::OnTableHasCellsUpdateUI(wxUpdateUIEvent& event) @@ -2323,5 +2323,5 @@ wxRichTextTable* MyRichTextCtrl::FindTable() const } } - return NULL; + return nullptr; } diff --git a/samples/sashtest/sashtest.cpp b/samples/sashtest/sashtest.cpp index 27fc8d0572..dc4d4edf9c 100644 --- a/samples/sashtest/sashtest.cpp +++ b/samples/sashtest/sashtest.cpp @@ -22,7 +22,7 @@ #include "sashtest.h" -MyFrame *frame = NULL; +MyFrame *frame = nullptr; wxList my_children; wxIMPLEMENT_APP(MyApp); @@ -41,7 +41,7 @@ bool MyApp::OnInit(void) // Create the main frame window - frame = new MyFrame(NULL, wxID_ANY, "Sash Demo", wxPoint(0, 0), wxSize(500, 400), + frame = new MyFrame(nullptr, wxID_ANY, "Sash Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); @@ -346,7 +346,7 @@ wxEND_EVENT_TABLE() MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size): wxMDIChildFrame(parent, wxID_ANY, title, pos, size) { - canvas = NULL; + canvas = nullptr; my_children.Append(this); } diff --git a/samples/scroll/scroll.cpp b/samples/scroll/scroll.cpp index 64382015d3..263b8b1156 100644 --- a/samples/scroll/scroll.cpp +++ b/samples/scroll/scroll.cpp @@ -451,15 +451,15 @@ public: wxBORDER_SUNKEN) { m_nLines = 50; - m_winSync = NULL; + m_winSync = nullptr; m_inDoSync = false; wxClientDC dc(this); - dc.GetTextExtent("Line 17", NULL, &m_hLine); + dc.GetTextExtent("Line 17", nullptr, &m_hLine); } // this scrolled window can be synchronized with another one: if this - // function is called with a non-NULL pointer, the given window will be + // function is called with a non-null pointer, the given window will be // scrolled to the same position as this one void SyncWith(MyScrolledWindowBase *win) { @@ -468,7 +468,7 @@ public: DoSyncIfNecessary(); } - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL) override + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = nullptr) override { wxScrolled::ScrollWindow(dx, dy, rect); @@ -497,7 +497,7 @@ private: } } - // the window to synchronize with this one or NULL + // the window to synchronize with this one or nullptr MyScrolledWindowBase *m_winSync; // the flag preventing infinite recursion which would otherwise happen if @@ -851,7 +851,7 @@ wxBEGIN_EVENT_TABLE(MyFrame,wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample") + : wxFrame(nullptr, wxID_ANY, "wxWidgets scroll sample") { SetIcon(wxICON(sample)); @@ -940,8 +940,8 @@ void MyFrame::OnToggleSync(wxCommandEvent& event) } else { - m_win1->SyncWith(NULL); - m_win2->SyncWith(NULL); + m_win1->SyncWith(nullptr); + m_win2->SyncWith(nullptr); } } @@ -1000,7 +1000,7 @@ void MyScrolledWindowDumb::OnDraw(wxDC& dc) for ( size_t line = 0; line < m_nLines; line++ ) { int yPhys; - CalcScrolledPosition(0, y, NULL, &yPhys); + CalcScrolledPosition(0, y, nullptr, &yPhys); dc.DrawText(wxString::Format("Line %u (logical %d, physical %d)", unsigned(line), y, yPhys), 0, y); @@ -1029,7 +1029,7 @@ void MyScrolledWindowSmart::OnDraw(wxDC& dc) for ( size_t line = lineFrom; line <= lineTo; line++ ) { int yPhys; - CalcScrolledPosition(0, y, NULL, &yPhys); + CalcScrolledPosition(0, y, nullptr, &yPhys); dc.DrawText(wxString::Format("Line %u (logical %d, physical %d)", unsigned(line), y, yPhys), 0, y); diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp index f6c789b881..5e0809f450 100644 --- a/samples/shaped/shaped.cpp +++ b/samples/shaped/shaped.cpp @@ -250,7 +250,7 @@ wxBEGIN_EVENT_TABLE(MainFrame, wxFrame) wxEND_EVENT_TABLE() MainFrame::MainFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample", + : wxFrame(nullptr, wxID_ANY, "wxWidgets Shaped Sample", wxDefaultPosition, wxSize(200, 100)) { SetIcon(wxICON(sample)); diff --git a/samples/sockets/baseclient.cpp b/samples/sockets/baseclient.cpp index 44bdda835f..7143c10db5 100644 --- a/samples/sockets/baseclient.cpp +++ b/samples/sockets/baseclient.cpp @@ -27,7 +27,7 @@ #include "wx/thread.h" const wxEventType wxEVT_WORKER = wxNewEventType(); -#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) NULL ), +#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) nullptr ), const int timeout_val = 1000; @@ -722,7 +722,7 @@ wxThread::ExitCode ThreadWorker::Entry() } m_clientSocket->Close(); m_clientSocket->Destroy(); - m_clientSocket = NULL; + m_clientSocket = nullptr; delete [] m_outbuf; delete [] m_inbuf; if (!failed) diff --git a/samples/sockets/baseserver.cpp b/samples/sockets/baseserver.cpp index 05d535e68a..760387afc3 100644 --- a/samples/sockets/baseserver.cpp +++ b/samples/sockets/baseserver.cpp @@ -64,7 +64,7 @@ const char *GetSocketErrorMsg(int pSockError) //event sent by workers to server class //after client is served const wxEventType wxEVT_WORKER = wxNewEventType(); -#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) NULL ), +#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) nullptr ), class WorkerEvent : public wxEvent { @@ -579,9 +579,9 @@ wxThread::ExitCode ThreadWorker::Entry() EventWorker::EventWorker(wxSocketBase* pSock) : m_socket(pSock), - m_inbuf(NULL), + m_inbuf(nullptr), m_infill(0), - m_outbuf(NULL), + m_outbuf(nullptr), m_outfill(0) { m_socket->SetNotify(wxSOCKET_LOST_FLAG|wxSOCKET_INPUT_FLAG|wxSOCKET_OUTPUT_FLAG); @@ -601,7 +601,7 @@ EventWorker::~EventWorker() void EventWorker::DoRead() { - if (m_inbuf == NULL) + if (m_inbuf == nullptr) { //read message header do @@ -650,7 +650,7 @@ EventWorker::DoRead() while(!m_socket->Error() && (2 - m_infill != 0)); } - if (m_inbuf == NULL) + if (m_inbuf == nullptr) return; //read message data do diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 30bbcbf5d5..f3786fb3b9 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -198,7 +198,7 @@ bool MyApp::OnInit() // -------------------------------------------------------------------------- // frame constructor -MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY, +MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, _("wxSocket demo: Client"), wxDefaultPosition, wxSize(300, 200)) { @@ -645,7 +645,7 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event)) { DoDownload(m_url); - return NULL; + return nullptr; } private: diff --git a/samples/sockets/server.cpp b/samples/sockets/server.cpp index 90f060e2fc..1fb8d9b93e 100644 --- a/samples/sockets/server.cpp +++ b/samples/sockets/server.cpp @@ -170,7 +170,7 @@ bool MyApp::OnInit() // frame constructor -MyFrame::MyFrame() : wxFrame((wxFrame *)NULL, wxID_ANY, +MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, _("wxSocket demo: Server"), wxDefaultPosition, wxSize(300, 200)) { diff --git a/samples/sound/sound.cpp b/samples/sound/sound.cpp index 12040cbdf4..1c111ca55a 100644 --- a/samples/sound/sound.cpp +++ b/samples/sound/sound.cpp @@ -181,9 +181,9 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { - m_sound = NULL; + m_sound = nullptr; m_soundFile = WAV_FILE; m_useMemory = false; @@ -979,7 +979,7 @@ wxSound* MyFrame::TryCreateSound() const if ( !CreateSound(*sound) ) { delete sound; - return NULL; + return nullptr; } return sound; diff --git a/samples/splash/splash.cpp b/samples/splash/splash.cpp index 45dfd229ba..420b0f4189 100644 --- a/samples/splash/splash.cpp +++ b/samples/splash/splash.cpp @@ -206,7 +206,7 @@ void MyApp::DecorateSplashScreen(wxBitmap& bmp) // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { m_isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp index d97c211b74..c06496525d 100644 --- a/samples/splitter/splitter.cpp +++ b/samples/splitter/splitter.cpp @@ -226,7 +226,7 @@ wxEND_EVENT_TABLE() // My frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxSplitterWindow sample", + : wxFrame(nullptr, wxID_ANY, "wxSplitterWindow sample", wxDefaultPosition, wxSize(420, 300)) { m_lockSash = false; @@ -342,7 +342,7 @@ MyFrame::MyFrame() SetStatusText("Min pane size = 0", 1); #endif // wxUSE_STATUSBAR - m_replacewindow = NULL; + m_replacewindow = nullptr; } MyFrame::~MyFrame() @@ -367,7 +367,7 @@ void MyFrame::OnSplitHorizontal(wxCommandEvent& WXUNUSED(event) ) m_left->Show(true); m_right->Show(true); m_splitter->SplitHorizontally( m_left, m_right ); - m_replacewindow = NULL; + m_replacewindow = nullptr; #if wxUSE_STATUSBAR SetStatusText("Splitter split horizontally", 1); @@ -381,7 +381,7 @@ void MyFrame::OnSplitVertical(wxCommandEvent& WXUNUSED(event) ) m_left->Show(true); m_right->Show(true); m_splitter->SplitVertically( m_left, m_right ); - m_replacewindow = NULL; + m_replacewindow = nullptr; #if wxUSE_STATUSBAR SetStatusText("Splitter split vertically", 1); @@ -445,7 +445,7 @@ void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) ) if ( str.empty() ) return; - int minsize = wxStrtol( str, (wxChar**)NULL, 10 ); + int minsize = wxStrtol( str, (wxChar**)nullptr, 10 ); m_splitter->SetMinimumPaneSize(minsize); #if wxUSE_STATUSBAR str.Printf( "Min pane size = %d", minsize); @@ -474,7 +474,7 @@ void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) ) if ( str.empty() ) return; - double gravity = wxStrtod( str, (wxChar**)NULL); + double gravity = wxStrtod( str, (wxChar**)nullptr); m_splitter->SetSashGravity(gravity); #if wxUSE_STATUSBAR str.Printf( "Gravity = %g", gravity); @@ -499,7 +499,7 @@ void MyFrame::OnReplace(wxCommandEvent& WXUNUSED(event) ) wxASSERT(empty != m_replacewindow); m_splitter->ReplaceWindow(empty, m_replacewindow); m_replacewindow->Show(); - m_replacewindow = NULL; + m_replacewindow = nullptr; empty->Destroy(); } } diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 01dcbb50cb..6da2419db4 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -323,9 +323,9 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) #ifdef USE_MDI_PARENT_FRAME - : wxMDIParentFrame(NULL, wxID_ANY, title, pos, size) + : wxMDIParentFrame(nullptr, wxID_ANY, title, pos, size) #else - : wxFrame(NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) #endif { SetIcon(wxICON(sample)); @@ -437,11 +437,11 @@ void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style) wxStatusBar *statbarOld = GetStatusBar(); if ( statbarOld ) { - SetStatusBar(NULL); + SetStatusBar(nullptr); delete statbarOld; } - wxStatusBar *statbarNew = NULL; + wxStatusBar *statbarNew = nullptr; switch ( kind ) { case StatBar_Default: @@ -497,7 +497,7 @@ void MyFrame::OnSetStatusField(wxCommandEvent& WXUNUSED(event)) m_field, 0, sb->GetFieldsCount() - 1, - NULL + nullptr ); if ( rc == -1 ) @@ -606,11 +606,11 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event)) static const int *widthsAll[] = { - NULL, // 1 field: default + nullptr, // 1 field: default widthsFor2Fields, // 2 fields: 1 fixed, 1 var widthsFor3Fields, // 3 fields: 3 var widthsFor4Fields, // 4 fields: 3 fixed, 2 vars - NULL // 5 fields: default (all have same width) + nullptr // 5 fields: default (all have same width) }; const int * const widths = widthsAll[nFields - 1]; @@ -650,7 +650,7 @@ void MyFrame::OnResetFieldsWidth(wxCommandEvent& WXUNUSED(event)) return; const int n = pStat->GetFieldsCount(); - pStat->SetStatusWidths(n, NULL); + pStat->SetStatusWidths(n, nullptr); for ( int i = 0; i < n; i++ ) pStat->SetStatusText("same size", i); } @@ -691,7 +691,7 @@ void MyFrame::OnShowFieldsRect(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event) { - event.Check(GetStatusBar() != NULL); + event.Check(GetStatusBar() != nullptr); } void MyFrame::OnStatusBarToggle(wxCommandEvent& WXUNUSED(event)) @@ -699,7 +699,7 @@ void MyFrame::OnStatusBarToggle(wxCommandEvent& WXUNUSED(event)) wxStatusBar *statbarOld = GetStatusBar(); if ( statbarOld ) { - SetStatusBar(NULL); + SetStatusBar(nullptr); delete statbarOld; } else @@ -914,7 +914,7 @@ MyStatusBar::MyStatusBar(wxWindow *parent, long style) , m_timer(this) #endif #if wxUSE_CHECKBOX - , m_checkbox(NULL) + , m_checkbox(nullptr) #endif { // compute the size needed for num lock indicator pane diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp index f364c908fd..58818a5b99 100644 --- a/samples/stc/edit.cpp +++ b/samples/stc/edit.cpp @@ -152,7 +152,7 @@ Edit::Edit (wxWindow *parent, wxWindowID id, m_FoldingID = 2; // initialize language - m_language = NULL; + m_language = nullptr; // default font for all styles SetViewEOL (g_CommonPrefs.displayEOLEnable); @@ -606,7 +606,7 @@ bool Edit::InitializePrefs (const wxString &name) { // initialize styles StyleClearAll(); - LanguageInfo const* curInfo = NULL; + LanguageInfo const* curInfo = nullptr; // determine language bool found = false; diff --git a/samples/stc/prefs.cpp b/samples/stc/prefs.cpp index cf5a2182aa..2735c5088b 100644 --- a/samples/stc/prefs.cpp +++ b/samples/stc/prefs.cpp @@ -100,112 +100,112 @@ const LanguageInfo g_LanguagePrefs [] = { {"C++", "*.c;*.cc;*.cpp;*.cxx;*.cs;*.h;*.hh;*.hpp;*.hxx;*.sma", wxSTC_LEX_CPP, - {{mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_COMMENT, NULL}, - {mySTC_TYPE_COMMENT_LINE, NULL}, - {mySTC_TYPE_COMMENT_DOC, NULL}, - {mySTC_TYPE_NUMBER, NULL}, + {{mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_COMMENT, nullptr}, + {mySTC_TYPE_COMMENT_LINE, nullptr}, + {mySTC_TYPE_COMMENT_DOC, nullptr}, + {mySTC_TYPE_NUMBER, nullptr}, {mySTC_TYPE_WORD1, CppWordlist1}, // KEYWORDS - {mySTC_TYPE_STRING, NULL}, - {mySTC_TYPE_CHARACTER, NULL}, - {mySTC_TYPE_UUID, NULL}, - {mySTC_TYPE_PREPROCESSOR, NULL}, - {mySTC_TYPE_OPERATOR, NULL}, - {mySTC_TYPE_IDENTIFIER, NULL}, - {mySTC_TYPE_STRING_EOL, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, // VERBATIM - {mySTC_TYPE_REGEX, NULL}, - {mySTC_TYPE_COMMENT_SPECIAL, NULL}, // DOXY + {mySTC_TYPE_STRING, nullptr}, + {mySTC_TYPE_CHARACTER, nullptr}, + {mySTC_TYPE_UUID, nullptr}, + {mySTC_TYPE_PREPROCESSOR, nullptr}, + {mySTC_TYPE_OPERATOR, nullptr}, + {mySTC_TYPE_IDENTIFIER, nullptr}, + {mySTC_TYPE_STRING_EOL, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, // VERBATIM + {mySTC_TYPE_REGEX, nullptr}, + {mySTC_TYPE_COMMENT_SPECIAL, nullptr}, // DOXY {mySTC_TYPE_WORD2, CppWordlist2}, // EXTRA WORDS {mySTC_TYPE_WORD3, CppWordlist3}, // DOXY KEYWORDS - {mySTC_TYPE_ERROR, NULL}, // KEYWORDS ERROR - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}}, + {mySTC_TYPE_ERROR, nullptr}, // KEYWORDS ERROR + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}}, mySTC_FOLD_COMMENT | mySTC_FOLD_COMPACT | mySTC_FOLD_PREPROC}, // Python {"Python", "*.py;*.pyw", wxSTC_LEX_PYTHON, - {{mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_COMMENT_LINE, NULL}, - {mySTC_TYPE_NUMBER, NULL}, - {mySTC_TYPE_STRING, NULL}, - {mySTC_TYPE_CHARACTER, NULL}, + {{mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_COMMENT_LINE, nullptr}, + {mySTC_TYPE_NUMBER, nullptr}, + {mySTC_TYPE_STRING, nullptr}, + {mySTC_TYPE_CHARACTER, nullptr}, {mySTC_TYPE_WORD1, PythonWordlist1}, // KEYWORDS - {mySTC_TYPE_DEFAULT, NULL}, // TRIPLE - {mySTC_TYPE_DEFAULT, NULL}, // TRIPLEDOUBLE - {mySTC_TYPE_DEFAULT, NULL}, // CLASSNAME + {mySTC_TYPE_DEFAULT, nullptr}, // TRIPLE + {mySTC_TYPE_DEFAULT, nullptr}, // TRIPLEDOUBLE + {mySTC_TYPE_DEFAULT, nullptr}, // CLASSNAME {mySTC_TYPE_DEFAULT, PythonWordlist2}, // DEFNAME - {mySTC_TYPE_OPERATOR, NULL}, - {mySTC_TYPE_IDENTIFIER, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, // COMMENT_BLOCK - {mySTC_TYPE_STRING_EOL, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}}, + {mySTC_TYPE_OPERATOR, nullptr}, + {mySTC_TYPE_IDENTIFIER, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, // COMMENT_BLOCK + {mySTC_TYPE_STRING_EOL, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}}, mySTC_FOLD_COMMENTPY | mySTC_FOLD_QUOTESPY}, // * (any) {wxTRANSLATE(DEFAULT_LANGUAGE), "*.*", wxSTC_LEX_PROPERTIES, - {{mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, - {mySTC_TYPE_DEFAULT, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}, - {-1, NULL}}, + {{mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, + {mySTC_TYPE_DEFAULT, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}, + {-1, nullptr}}, 0}, }; diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index bd8a273474..3bd781051e 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -66,13 +66,13 @@ class AppBook; //---------------------------------------------------------------------------- //! global application name -wxString *g_appname = NULL; +wxString *g_appname = nullptr; #if wxUSE_PRINTING_ARCHITECTURE //! global print data, to remember settings during the session -wxPrintData *g_printData = (wxPrintData*) NULL; -wxPageSetupDialogData *g_pageSetupData = (wxPageSetupDialogData*) NULL; +wxPrintData *g_printData = nullptr; +wxPageSetupDialogData *g_pageSetupData = nullptr; #endif // wxUSE_PRINTING_ARCHITECTURE @@ -278,12 +278,12 @@ wxBEGIN_EVENT_TABLE (AppFrame, wxFrame) wxEND_EVENT_TABLE () AppFrame::AppFrame (const wxString &title) - : wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550)) + : wxFrame (nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(750,550)) { SetIcon(wxICON(sample)); // initialize important variables - m_edit = NULL; + m_edit = nullptr; // set icon and background SetTitle (*g_appname); @@ -665,7 +665,7 @@ AppAbout::AppAbout (wxWindow *parent, style | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { // set timer if any - m_timer = NULL; + m_timer = nullptr; if (milliseconds > 0) { m_timer = new wxTimer (this, myID_ABOUTTIMER); m_timer->Start (milliseconds, wxTIMER_ONE_SHOT); @@ -840,7 +840,7 @@ void MinimalEditor::OnText(wxStyledTextEvent& event) class MinimalEditorFrame : public wxFrame { public: - MinimalEditorFrame() : wxFrame(NULL, wxID_ANY, _("Minimal Editor")) + MinimalEditorFrame() : wxFrame(nullptr, wxID_ANY, _("Minimal Editor")) { MinimalEditor* editor = new MinimalEditor(this); editor->SetFont(wxFontInfo().Family(wxFONTFAMILY_TELETYPE)); diff --git a/samples/svg/svgtest.cpp b/samples/svg/svgtest.cpp index 35048413c4..574246253a 100644 --- a/samples/svg/svgtest.cpp +++ b/samples/svg/svgtest.cpp @@ -136,7 +136,7 @@ bool MyApp::OnInit() { // Create the main frame window - MyFrame* frame = new MyFrame(NULL, -1, "SVG Demo", + MyFrame* frame = new MyFrame(nullptr, -1, "SVG Demo", wxDefaultPosition, wxSize(500, 400)); frame->Show(true); diff --git a/samples/taborder/taborder.cpp b/samples/taborder/taborder.cpp index ad8cecb4c0..8b553cd515 100644 --- a/samples/taborder/taborder.cpp +++ b/samples/taborder/taborder.cpp @@ -191,7 +191,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "TabOrder wxWidgets Sample", + : wxFrame(nullptr, wxID_ANY, "TabOrder wxWidgets Sample", wxDefaultPosition, wxSize(700, 450)) { SetIcon(wxICON(sample)); @@ -242,7 +242,7 @@ void MyFrame::OnTabBackward(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) { // track the window which has the focus in the status bar - static wxWindow *s_windowFocus = NULL; + static wxWindow *s_windowFocus = nullptr; wxWindow *focus = wxWindow::FindFocus(); if ( focus != s_windowFocus ) { diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp index b91ebb6134..1a717705ee 100644 --- a/samples/taskbar/tbtest.cpp +++ b/samples/taskbar/tbtest.cpp @@ -36,7 +36,7 @@ // global variables // ---------------------------------------------------------------------------- -static MyDialog *gs_dialog = NULL; +static MyDialog *gs_dialog = nullptr; // ============================================================================ // implementation @@ -85,7 +85,7 @@ wxEND_EVENT_TABLE() MyDialog::MyDialog(const wxString& title) - : wxDialog(NULL, wxID_ANY, title) + : wxDialog(nullptr, wxID_ANY, title) { wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); diff --git a/samples/taskbarbutton/taskbarbutton.cpp b/samples/taskbarbutton/taskbarbutton.cpp index 2bd58186ae..9e930e425b 100644 --- a/samples/taskbarbutton/taskbarbutton.cpp +++ b/samples/taskbarbutton/taskbarbutton.cpp @@ -135,7 +135,7 @@ bool MyApp::OnInit() wxTaskBarJumpList jumpList; wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem( - NULL, + nullptr, wxTASKBAR_JUMP_LIST_TASK, "Task 1", wxStandardPaths::Get().GetExecutablePath(), @@ -144,7 +144,7 @@ bool MyApp::OnInit() wxStandardPaths::Get().GetExecutablePath(), 0); wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem( - NULL, + nullptr, wxTASKBAR_JUMP_LIST_TASK, "Task 2", wxStandardPaths::Get().GetExecutablePath(), @@ -154,7 +154,7 @@ bool MyApp::OnInit() 0); jumpList.GetTasks().Append(item1); jumpList.GetTasks().Append( - new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_SEPARATOR)); + new wxTaskBarJumpListItem(nullptr, wxTASKBAR_JUMP_LIST_SEPARATOR)); jumpList.GetTasks().Append(item2); jumpList.ShowRecentCategory(); jumpList.ShowFrequentCategory(); @@ -202,7 +202,7 @@ bool MyApp::OnInit() } MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { wxPanel *panel = new wxPanel(this); wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 3a319c86cc..88d2329f07 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -155,7 +155,7 @@ public: private: // get the currently focused text control or return the default one // (m_multitext) is no text ctrl has focus -- in any case, returns - // something non NULL + // something non null wxTextCtrl *GetFocusedText() const; }; @@ -1311,7 +1311,7 @@ wxTextCtrl *MyPanel::GetFocusedText() const { wxWindow *win = FindFocus(); - wxTextCtrl *text = win ? wxDynamicCast(win, wxTextCtrl) : NULL; + wxTextCtrl *text = win ? wxDynamicCast(win, wxTextCtrl) : nullptr; return text ? text : m_multitext; } @@ -1533,7 +1533,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame(const wxString& title, int x, int y) - : wxFrame(NULL, wxID_ANY, title, wxPoint(x, y)) + : wxFrame(nullptr, wxID_ANY, title, wxPoint(x, y)) { SetIcon(wxICON(sample)); @@ -1672,7 +1672,7 @@ void MyFrame::OnRichTextTest(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIdle( wxIdleEvent& event ) { // track the window which has the focus in the status bar - static wxWindow *s_windowFocus = (wxWindow *)NULL; + static wxWindow *s_windowFocus = nullptr; wxWindow *focus = wxWindow::FindFocus(); if ( focus && (focus != s_windowFocus) ) { diff --git a/samples/thread/thread.cpp b/samples/thread/thread.cpp index 2988c6ace9..381738f624 100644 --- a/samples/thread/thread.cpp +++ b/samples/thread/thread.cpp @@ -343,7 +343,7 @@ wxEND_EVENT_TABLE() // My frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { m_oldLogger = wxLog::GetActiveTarget(); @@ -381,7 +381,7 @@ MyFrame::MyFrame(const wxString& title) m_nRunning = m_nCount = 0; - m_dlgProgress = NULL; + m_dlgProgress = nullptr; #if wxUSE_STATUSBAR CreateStatusBar(2); @@ -592,7 +592,7 @@ void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) ) { - wxThread* toDelete = NULL; + wxThread* toDelete = nullptr; { wxCriticalSectionLocker enter(wxGetApp().m_critsect); @@ -740,7 +740,7 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUpdateWorker(wxUpdateUIEvent& event) { - event.Enable( m_dlgProgress == NULL ); + event.Enable( m_dlgProgress == nullptr ); } void MyFrame::OnStartWorker(wxCommandEvent& WXUNUSED(event)) @@ -778,7 +778,7 @@ void MyFrame::OnWorkerEvent(wxThreadEvent& event) if ( n == -1 ) { m_dlgProgress->Destroy(); - m_dlgProgress = (wxProgressDialog *)NULL; + m_dlgProgress = nullptr; // the dialog is aborted because the event came from another thread, so // we may need to wake up the main event loop for the dialog to be @@ -932,7 +932,7 @@ wxThread::ExitCode MyThread::Entry() { wxCriticalSectionLocker locker(wxGetApp().m_critsect); if ( wxGetApp().m_shuttingDown ) - return NULL; + return nullptr; } // check if just this thread was asked to exit @@ -947,7 +947,7 @@ wxThread::ExitCode MyThread::Entry() wxLogMessage("Thread finished."); - return NULL; + return nullptr; } @@ -980,7 +980,7 @@ wxThread::ExitCode MyWorkerThread::Entry() #if TEST_YIELD_RACE_CONDITION if ( TestDestroy() ) - return NULL; + return nullptr; wxThreadEvent event( wxEVT_THREAD, WORKER_EVENT ); @@ -1011,7 +1011,7 @@ wxThread::ExitCode MyWorkerThread::Entry() wxQueueEvent( m_frame, event.Clone() ); #endif - return NULL; + return nullptr; } @@ -1072,7 +1072,7 @@ wxThread::ExitCode MyGUIThread::Entry() } // now remove the thread-specific thread target - wxLog::SetThreadActiveTarget(NULL); + wxLog::SetThreadActiveTarget(nullptr); // so that this goes to the main window again wxLogMessage("GUI thread finished."); diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index c1df35ff22..efc892c967 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -152,9 +152,9 @@ public: void OnUpdateCopyAndCut(wxUpdateUIEvent& event); void OnUpdateToggleHorzText(wxUpdateUIEvent& event); void OnUpdateNeedsToolbar(wxUpdateUIEvent& event) - { event.Enable( GetToolBar() != NULL ); } + { event.Enable( GetToolBar() != nullptr ); } void OnUpdateToggleRadioBtn(wxUpdateUIEvent& event) - { event.Enable( m_tbar != NULL ); } + { event.Enable( m_tbar != nullptr ); } private: void DoEnablePrint(); @@ -187,7 +187,7 @@ private: // the path to the custom bitmap for the test toolbar tool wxString m_pathBmp; - // the search tool, initially NULL + // the search tool, initially nullptr wxToolBarToolBase *m_searchTool; wxDECLARE_EVENT_TABLE(); @@ -348,16 +348,16 @@ void MyFrame::RecreateToolbar() wxToolBarBase *toolBar = GetToolBar(); long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE; - if (toolBar && m_searchTool && m_searchTool->GetToolBar() == NULL) + if (toolBar && m_searchTool && m_searchTool->GetToolBar() == nullptr) { // see ~MyFrame() toolBar->AddTool(m_searchTool); } - m_searchTool = NULL; + m_searchTool = nullptr; delete toolBar; - SetToolBar(NULL); + SetToolBar(nullptr); style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT); switch( m_toolbarPosition ) @@ -594,15 +594,15 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar) // Define my frame constructor MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxToolBar Sample") + : wxFrame(nullptr, wxID_ANY, "wxToolBar Sample") { - m_tbar = NULL; + m_tbar = nullptr; m_smallToolbar = true; m_horzText = false; m_useCustomDisabled = false; m_showTooltips = true; - m_searchTool = NULL; + m_searchTool = nullptr; m_rows = 1; m_nPrint = 0; // set to 1 in PopulateToolbar() @@ -782,7 +782,7 @@ void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event)) } else { - // notice that there is no need to call SetToolBar(NULL) here (although + // notice that there is no need to call SetToolBar(nullptr) here (although // this it is harmless to do and it must be called if you do not delete // the toolbar but keep it for later reuse), just delete the toolbar // directly and it will reset the associated frame toolbar pointer diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 00a8b0b7c3..d75bc7dd2f 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -205,10 +205,10 @@ bool MyApp::OnInit() // My frame constructor MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) - : wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)), - m_treeCtrl(NULL) + : wxFrame(nullptr, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)), + m_treeCtrl(nullptr) #if wxUSE_LOG - , m_textCtrl(NULL) + , m_textCtrl(nullptr) #endif // wxUSE_LOG { // This reduces flicker effects - even better would be to define @@ -361,7 +361,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) MyFrame::~MyFrame() { #if wxUSE_LOG - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); #endif // wxUSE_LOG } @@ -960,7 +960,7 @@ void MyTreeCtrl::CreateImages(int size) { if ( size == -1 ) { - SetImageList(NULL); + SetImageList(nullptr); return; } if ( size == 0 ) @@ -1040,7 +1040,7 @@ void MyTreeCtrl::CreateStateImageList(bool del) { if ( del ) { - SetStateImageList(NULL); + SetStateImageList(nullptr); return; } @@ -1089,7 +1089,7 @@ void MyTreeCtrl::CreateButtonsImageList(int size) #ifdef HAS_GENERIC_TREECTRL if ( size == -1 ) { - SetButtonsImageList(NULL); + SetButtonsImageList(nullptr); return; } @@ -1289,7 +1289,7 @@ void MyTreeCtrl::DoToggleState(const wxTreeItemId& item) int state = GetItemState(item); int nState; - srand (time(NULL)); + srand (time(nullptr)); do { nState = rand() % GetStateImageList()->GetImageCount(); } while (nState == state); @@ -1620,7 +1620,7 @@ void MyTreeCtrl::OnItemActivated(wxTreeEvent& event) wxTreeItemId itemId = event.GetItem(); MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId); - if ( item != NULL ) + if ( item != nullptr ) { item->ShowInfo(this); } diff --git a/samples/treelist/treelist.cpp b/samples/treelist/treelist.cpp index 0c488c1775..dfc765e256 100644 --- a/samples/treelist/treelist.cpp +++ b/samples/treelist/treelist.cpp @@ -284,7 +284,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets tree/list control sample", + : wxFrame(nullptr, wxID_ANY, "wxWidgets tree/list control sample", wxDefaultPosition, wxSize(600, 450)) { m_isFlat = false; diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 16aff8124b..a738e18486 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -67,7 +67,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - MyFrame *frame = new MyFrame((wxFrame *) NULL, "wxWidgets Types Demo", + MyFrame *frame = new MyFrame(nullptr, "wxWidgets Types Demo", wxPoint(50, 50), wxSize(450, 340)); // Give it an icon diff --git a/samples/typetest/typetest.h b/samples/typetest/typetest.h index 005ffeaadd..a36b42373b 100644 --- a/samples/typetest/typetest.h +++ b/samples/typetest/typetest.h @@ -15,7 +15,7 @@ class MyApp: public wxApp { public: - MyApp() { m_textCtrl = NULL; m_mimeDatabase = NULL; } + MyApp() { m_textCtrl = nullptr; m_mimeDatabase = nullptr; } bool OnInit() override; int OnExit() override { delete m_mimeDatabase; return wxApp::OnExit(); } diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index bd525cc365..7c506062ae 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -133,7 +133,7 @@ bool MyApp::OnInit() // frame constructor MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { SetIcon(wxICON(sample)); diff --git a/samples/validate/validate.cpp b/samples/validate/validate.cpp index 669c0909d0..d49ffb740a 100644 --- a/samples/validate/validate.cpp +++ b/samples/validate/validate.cpp @@ -134,7 +134,7 @@ bool MyApp::OnInit() return false; // Create and display the main frame window. - MyFrame *frame = new MyFrame((wxFrame *) NULL, "Validator Test", + MyFrame *frame = new MyFrame(nullptr, "Validator Test", 50, 50, 300, 250); frame->Show(true); diff --git a/samples/vscroll/vstest.cpp b/samples/vscroll/vstest.cpp index 72f4e1bfd7..00c14e5023 100644 --- a/samples/vscroll/vstest.cpp +++ b/samples/vscroll/vstest.cpp @@ -490,12 +490,12 @@ bool VarScrollApp::OnInit() // frame constructor VarScrollFrame::VarScrollFrame() - : wxFrame(NULL, + : wxFrame(nullptr, wxID_ANY, "VScroll wxWidgets Sample", wxDefaultPosition, wxSize(400, 350)), - m_scrollWindow(NULL) + m_scrollWindow(nullptr) { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/webrequest/webrequest.cpp b/samples/webrequest/webrequest.cpp index 31abbfe3ca..96027fcf1a 100644 --- a/samples/webrequest/webrequest.cpp +++ b/samples/webrequest/webrequest.cpp @@ -41,7 +41,7 @@ public: }; WebRequestFrame(const wxString& title): - wxFrame(NULL, wxID_ANY, title) + wxFrame(nullptr, wxID_ANY, title) { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/webview/webview.cpp b/samples/webview/webview.cpp index c891aadcf3..6b8a6acc48 100644 --- a/samples/webview/webview.cpp +++ b/samples/webview/webview.cpp @@ -331,7 +331,7 @@ bool WebApp::OnInit() } WebFrame::WebFrame(const wxString& url) : - wxFrame(NULL, wxID_ANY, "wxWebView Sample") + wxFrame(nullptr, wxID_ANY, "wxWebView Sample") { // set the frame icon SetIcon(wxICON(sample)); diff --git a/samples/widgets/activityindicator.cpp b/samples/widgets/activityindicator.cpp index af467ff4ea..c43129c3f6 100644 --- a/samples/widgets/activityindicator.cpp +++ b/samples/widgets/activityindicator.cpp @@ -57,8 +57,8 @@ public: ActivityIndicatorWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) : WidgetsPage(book, imaglist, activityindicator_xpm) { - m_indicator = NULL; - m_sizerIndicator = NULL; + m_indicator = nullptr; + m_sizerIndicator = nullptr; } virtual wxWindow *GetWidget() const override { return m_indicator; } diff --git a/samples/widgets/bmpcombobox.cpp b/samples/widgets/bmpcombobox.cpp index f33fb21f44..5d7cbad31a 100644 --- a/samples/widgets/bmpcombobox.cpp +++ b/samples/widgets/bmpcombobox.cpp @@ -252,15 +252,15 @@ BitmapComboBoxWidgetsPage::BitmapComboBoxWidgetsPage(WidgetsBookCtrl *book, // init everything m_chkSort = m_chkProcessEnter = - m_chkReadonly = NULL; + m_chkReadonly = nullptr; - m_combobox = NULL; - m_sizerCombo = NULL; + m_combobox = nullptr; + m_sizerCombo = nullptr; m_textInsert = m_textChangeHeight = m_textChange = - m_textDelete = NULL; + m_textDelete = nullptr; } // create a sizer containing a label and a small text ctrl @@ -387,7 +387,7 @@ void BitmapComboBoxWidgetsPage::CreateContent() m_combobox = new wxBitmapComboBox(); m_combobox->Create(this, BitmapComboBoxPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, // Flags correspond to the checkboxes state in Reset(). wxTE_PROCESS_ENTER); @@ -470,7 +470,7 @@ void BitmapComboBoxWidgetsPage::CreateCombo() m_combobox = new wxBitmapComboBox(); m_combobox->Create(this, BitmapComboBoxPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, flags); #if defined(wxGENERIC_BITMAPCOMBOBOX) @@ -585,7 +585,7 @@ void BitmapComboBoxWidgetsPage::OnButtonLoadFromFile(wxCommandEvent& WXUNUSED(ev void BitmapComboBoxWidgetsPage::OnButtonSetFromFile(wxCommandEvent& WXUNUSED(event)) { - wxBitmap bmp = QueryBitmap(NULL); + wxBitmap bmp = QueryBitmap(nullptr); if (bmp.IsOk()) m_combobox->SetItemBitmap(m_combobox->GetSelection(), bmp); } diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 8837938299..b8b34b29e3 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -149,7 +149,7 @@ protected: wxButton *m_button; #if wxUSE_COMMANDLINKBUTTON - // same as m_button or NULL if not showing a command link button currently + // same as m_button or nullptr if not showing a command link button currently wxCommandLinkButton *m_cmdLnkButton; #endif // wxUSE_COMMANDLINKBUTTON @@ -226,19 +226,19 @@ ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, m_chkUsePressed = m_chkUseFocused = m_chkUseCurrent = - m_chkUseDisabled = (wxCheckBox *)NULL; + m_chkUseDisabled = nullptr; m_radioImagePos = m_radioHAlign = - m_radioVAlign = (wxRadioBox *)NULL; + m_radioVAlign = nullptr; - m_textLabel = (wxTextCtrl *)NULL; + m_textLabel = nullptr; - m_textImageMarginH = NULL; - m_textImageMarginV = NULL; + m_textImageMarginH = nullptr; + m_textImageMarginV = nullptr; - m_button = (wxButton *)NULL; - m_sizerButton = (wxSizer *)NULL; + m_button = nullptr; + m_sizerButton = nullptr; m_imageMarginH = 0; m_imageMarginV = 0; @@ -526,13 +526,13 @@ void ButtonWidgetsPage::CreateButton() bbtn->SetBitmapDisabled(CreateBitmap("disabled", wxART_MISSING_IMAGE)); m_button = bbtn; #if wxUSE_COMMANDLINKBUTTON - m_cmdLnkButton = NULL; + m_cmdLnkButton = nullptr; #endif } else // normal button { #if wxUSE_COMMANDLINKBUTTON - m_cmdLnkButton = NULL; + m_cmdLnkButton = nullptr; if ( m_chkCommandLink->GetValue() ) { diff --git a/samples/widgets/choice.cpp b/samples/widgets/choice.cpp index 305aedbc17..fccd5b2fe9 100644 --- a/samples/widgets/choice.cpp +++ b/samples/widgets/choice.cpp @@ -185,10 +185,10 @@ ChoiceWidgetsPage::ChoiceWidgetsPage(WidgetsBookCtrl *book, { // init everything - m_chkSort = (wxCheckBox *)NULL; + m_chkSort = nullptr; - m_choice = NULL; - m_sizerChoice = (wxSizer *)NULL; + m_choice = nullptr; + m_sizerChoice = nullptr; } @@ -302,7 +302,7 @@ void ChoiceWidgetsPage::CreateChoice() m_choice = new wxChoice(this, ChoicePage_Choice, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, flags); m_choice->Set(items); diff --git a/samples/widgets/clrpicker.cpp b/samples/widgets/clrpicker.cpp index 0b10e8ed3b..36707c537f 100644 --- a/samples/widgets/clrpicker.cpp +++ b/samples/widgets/clrpicker.cpp @@ -153,7 +153,7 @@ void ColourPickerWidgetsPage::CreateContent() Reset(); // set checkboxes state // create pickers - m_clrPicker = NULL; + m_clrPicker = nullptr; CreatePicker(); // right pane diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 29515c5f7d..c881c402fe 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -242,10 +242,10 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book, // init everything m_chkSort = m_chkReadonly = - m_chkProcessEnter = (wxCheckBox *)NULL; + m_chkProcessEnter = nullptr; - m_combobox = (wxComboBox *)NULL; - m_sizerCombo = (wxSizer *)NULL; + m_combobox = nullptr; + m_sizerCombo = nullptr; } void ComboboxWidgetsPage::CreateContent() @@ -377,7 +377,7 @@ void ComboboxWidgetsPage::CreateContent() wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL); m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, 0); sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5); m_combobox1 = new wxComboBox( this, ComboPage_Dynamic ); diff --git a/samples/widgets/dirctrl.cpp b/samples/widgets/dirctrl.cpp index 7ea3c0cee9..58a48302f9 100644 --- a/samples/widgets/dirctrl.cpp +++ b/samples/widgets/dirctrl.cpp @@ -169,7 +169,7 @@ DirCtrlWidgetsPage::DirCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) :WidgetsPage(book, imaglist, dirctrl_xpm) { - m_dirCtrl = NULL; + m_dirCtrl = nullptr; } void DirCtrlWidgetsPage::CreateContent() diff --git a/samples/widgets/dirpicker.cpp b/samples/widgets/dirpicker.cpp index ac99c899fb..d0ce8e2cfd 100644 --- a/samples/widgets/dirpicker.cpp +++ b/samples/widgets/dirpicker.cpp @@ -167,7 +167,7 @@ void DirPickerWidgetsPage::CreateContent() Reset(); // set checkboxes state // create pickers - m_dirPicker = NULL; + m_dirPicker = nullptr; CreatePicker(); // right pane diff --git a/samples/widgets/filepicker.cpp b/samples/widgets/filepicker.cpp index 2c81229075..25aa702b3f 100644 --- a/samples/widgets/filepicker.cpp +++ b/samples/widgets/filepicker.cpp @@ -194,7 +194,7 @@ void FilePickerWidgetsPage::CreateContent() // create the picker and the static text displaying its current value m_labelPath = new wxStaticText(this, PickerPage_CurrentPath, ""); - m_filePicker = NULL; + m_filePicker = nullptr; CreatePicker(); // right pane diff --git a/samples/widgets/fontpicker.cpp b/samples/widgets/fontpicker.cpp index a48f7d5231..6ad222b29f 100644 --- a/samples/widgets/fontpicker.cpp +++ b/samples/widgets/fontpicker.cpp @@ -148,7 +148,7 @@ void FontPickerWidgetsPage::CreateContent() Reset(); // set checkboxes state // create pickers - m_fontPicker = NULL; + m_fontPicker = nullptr; CreatePicker(); // right pane diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index 5812d538cc..1b25e749d2 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -181,14 +181,14 @@ GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book, // init everything m_range = 100; - m_timer = (wxTimer *)NULL; + m_timer = nullptr; m_chkVert = m_chkSmooth = - m_chkProgress = (wxCheckBox *)NULL; + m_chkProgress = nullptr; - m_gauge = (wxGauge *)NULL; - m_sizerGauge = (wxSizer *)NULL; + m_gauge = nullptr; + m_sizerGauge = nullptr; } void GaugeWidgetsPage::CreateContent() diff --git a/samples/widgets/headerctrl.cpp b/samples/widgets/headerctrl.cpp index e0146a546e..26f0b9baa9 100644 --- a/samples/widgets/headerctrl.cpp +++ b/samples/widgets/headerctrl.cpp @@ -53,8 +53,8 @@ public: HeaderCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) : WidgetsPage(book, imaglist, header_xpm) { - m_header = NULL; - m_sizerHeader = NULL; + m_header = nullptr; + m_sizerHeader = nullptr; } virtual wxWindow *GetWidget() const override { return m_header; } diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index 5beebd72e2..4b1eb010cf 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -128,7 +128,7 @@ protected: // read the value of a listbox item index from the given control, return // false if it's invalid - bool GetValidIndexFromText(const wxTextCtrl *text, int *n = NULL) const; + bool GetValidIndexFromText(const wxTextCtrl *text, int *n = nullptr) const; // listbox parameters @@ -250,16 +250,16 @@ ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book, : ItemContainerWidgetsPage(book, imaglist, listbox_xpm) { // init everything - m_radioSelMode = (wxRadioBox *)NULL; - m_radioListType = (wxRadioBox*)NULL; + m_radioSelMode = nullptr; + m_radioListType = nullptr; m_chkVScroll = m_chkHScroll = m_chkSort = - m_chkOwnerDraw = (wxCheckBox *)NULL; + m_chkOwnerDraw = nullptr; - m_lbox = NULL; - m_sizerLbox = (wxSizer *)NULL; + m_lbox = nullptr; + m_sizerLbox = nullptr; } @@ -391,7 +391,7 @@ void ListboxWidgetsPage::CreateContent() wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL); m_lbox = new wxListBox(this, ListboxPage_Listbox, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, wxLB_HSCROLL); sizerRight->Add(m_lbox, 1, wxGROW | wxALL, 5); sizerRight->SetMinSize(150, 0); diff --git a/samples/widgets/native.cpp b/samples/widgets/native.cpp index 37b54c908d..19e1c27b70 100644 --- a/samples/widgets/native.cpp +++ b/samples/widgets/native.cpp @@ -95,7 +95,7 @@ public: TEXT("Press me to do it"), WS_CHILD | WS_VISIBLE | BS_SPLITBUTTON, 0, 0, size.x, size.y, - (HWND)parent->GetHWND(), 0, NULL, NULL + (HWND)parent->GetHWND(), 0, nullptr, nullptr ); if ( !hwnd ) { @@ -276,7 +276,7 @@ IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, "Native", NATIVE_CTRLS); NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) : WidgetsPage(book, imaglist, native_xpm) { - m_nativeWindow = NULL; + m_nativeWindow = nullptr; } void NativeWidgetsPage::CreateContent() diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index 2e98e9a080..9118ef0939 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -188,12 +188,12 @@ BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, c :WidgetsPage(book, imaglist, icon) { // init everything - m_chkImages = NULL; - m_imageList = NULL; + m_chkImages = nullptr; + m_imageList = nullptr; - m_book = NULL; - m_radioOrient = NULL; - m_sizerBook = (wxSizer *)NULL; + m_book = nullptr; + m_radioOrient = nullptr; + m_sizerBook = nullptr; } void BookWidgetsPage::CreateContent() @@ -323,7 +323,7 @@ void BookWidgetsPage::CreateImageList() wxDELETE(m_imageList); } - // because of the bug in wxMSW we can't use SetImageList(NULL) - although + // because of the bug in wxMSW we can't use SetImageList(nullptr) - although // it would be logical if this removed the image list from book, under // MSW it crashes instead - FIXME } diff --git a/samples/widgets/odcombobox.cpp b/samples/widgets/odcombobox.cpp index 3acaed1295..8dbfc020e4 100644 --- a/samples/widgets/odcombobox.cpp +++ b/samples/widgets/odcombobox.cpp @@ -89,7 +89,7 @@ public: virtual wxWindow *GetWidget() const override { return m_combobox; } virtual wxTextEntryBase *GetTextEntry() const override - { return m_combobox ? m_combobox->GetTextCtrl() : NULL; } + { return m_combobox ? m_combobox->GetTextCtrl() : nullptr; } virtual wxItemContainer* GetContainer() const override { return m_combobox; } virtual void RecreateWidget() override { CreateCombo(); } @@ -307,10 +307,10 @@ ODComboboxWidgetsPage::ODComboboxWidgetsPage(WidgetsBookCtrl *book, // init everything m_chkSort = m_chkReadonly = - m_chkDclickcycles = (wxCheckBox *)NULL; + m_chkDclickcycles = nullptr; - m_combobox = (wxOwnerDrawnComboBox *)NULL; - m_sizerCombo = (wxSizer *)NULL; + m_combobox = nullptr; + m_sizerCombo = nullptr; } void ODComboboxWidgetsPage::CreateContent() @@ -458,7 +458,7 @@ void ODComboboxWidgetsPage::CreateContent() m_combobox = new DemoODComboBox(); m_combobox->Create(this, ODComboPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, 0); sizerRight->Add(m_combobox, 0, wxGROW | wxALL, 5); sizerRight->SetMinSize(150, 0); @@ -517,7 +517,7 @@ void ODComboboxWidgetsPage::CreateCombo() m_combobox = new DemoODComboBox(); m_combobox->Create(this, ODComboPage_Combo, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, flags); unsigned int count = items.GetCount(); diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 42e3d88d10..af851aff96 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -178,16 +178,16 @@ RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book, : WidgetsPage(book, imaglist, radio_xpm) { // init everything - m_chkSpecifyRows = (wxCheckBox *)NULL; - m_chkEnableItem = (wxCheckBox *)NULL; - m_chkShowItem = (wxCheckBox *)NULL; + m_chkSpecifyRows = nullptr; + m_chkEnableItem = nullptr; + m_chkShowItem = nullptr; m_textNumBtns = m_textLabelBtns = - m_textLabel = (wxTextCtrl *)NULL; + m_textLabel = nullptr; - m_radio = (wxRadioBox *)NULL; - m_sizerRadio = (wxSizer *)NULL; + m_radio = nullptr; + m_sizerRadio = nullptr; } void RadioWidgetsPage::CreateContent() diff --git a/samples/widgets/searchctrl.cpp b/samples/widgets/searchctrl.cpp index 52d7bba51d..f0f4f44054 100644 --- a/samples/widgets/searchctrl.cpp +++ b/samples/widgets/searchctrl.cpp @@ -144,7 +144,7 @@ SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book, void SearchCtrlWidgetsPage::CreateContent() { - m_srchCtrl = NULL; + m_srchCtrl = nullptr; CreateControl(); @@ -225,7 +225,7 @@ void SearchCtrlWidgetsPage::OnToggleSearchMenu(wxCommandEvent&) if ( m_menuBtnCheck->GetValue() ) m_srchCtrl->SetMenu( CreateTestMenu() ); else - m_srchCtrl->SetMenu(NULL); + m_srchCtrl->SetMenu(nullptr); } void SearchCtrlWidgetsPage::OnText(wxCommandEvent& event) diff --git a/samples/widgets/slider.cpp b/samples/widgets/slider.cpp index bd8572c45e..6e863b6912 100644 --- a/samples/widgets/slider.cpp +++ b/samples/widgets/slider.cpp @@ -265,12 +265,12 @@ SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book, m_chkMinMaxLabels = m_chkValueLabel = m_chkBothSides = - m_chkSelectRange =(wxCheckBox *)NULL; + m_chkSelectRange = nullptr; - m_radioSides = (wxRadioBox *)NULL; + m_radioSides = nullptr; - m_slider = (wxSlider *)NULL; - m_sizerSlider = (wxSizer *)NULL; + m_slider = nullptr; + m_sizerSlider = nullptr; } void SliderWidgetsPage::CreateContent() diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index e75415fa26..ad14612325 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -223,19 +223,19 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) : WidgetsPage(book, imaglist, spinbtn_xpm) { - m_chkVert = NULL; - m_chkArrowKeys = NULL; - m_chkWrap = NULL; - m_chkProcessEnter = NULL; - m_radioAlign = NULL; - m_spinbtn = NULL; - m_spinctrl = NULL; - m_spinctrldbl = NULL; + m_chkVert = nullptr; + m_chkArrowKeys = nullptr; + m_chkWrap = nullptr; + m_chkProcessEnter = nullptr; + m_radioAlign = nullptr; + m_spinbtn = nullptr; + m_spinctrl = nullptr; + m_spinctrldbl = nullptr; m_textValue = m_textMin = m_textMax = m_textBase = - m_textIncrement = NULL; + m_textIncrement = nullptr; m_min = 0; m_max = 10; @@ -243,7 +243,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book, m_base = 10; m_increment = 1; - m_sizerSpin = NULL; + m_sizerSpin = nullptr; } void SpinBtnWidgetsPage::CreateContent() diff --git a/samples/widgets/statbmp.cpp b/samples/widgets/statbmp.cpp index efd6802435..3069a5c3ed 100644 --- a/samples/widgets/statbmp.cpp +++ b/samples/widgets/statbmp.cpp @@ -116,7 +116,7 @@ void StatBmpWidgetsPage::CreateContent() Bind(wxEVT_FILEPICKER_CHANGED, &StatBmpWidgetsPage::OnFileChange, this); Bind(wxEVT_RADIOBOX, &StatBmpWidgetsPage::OnRadioChange, this); - m_statbmp = NULL; + m_statbmp = nullptr; RecreateWidget(); } diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index 34d7d0d978..02fc775ddf 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -194,28 +194,28 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, #if wxUSE_MARKUP m_chkGreen = #endif // wxUSE_MARKUP - NULL; + nullptr; m_radioHAlign = - m_radioVAlign = (wxRadioBox *)NULL; + m_radioVAlign = nullptr; - m_statText = NULL; + m_statText = nullptr; #if wxUSE_STATLINE - m_statLine = (wxStaticLine *)NULL; + m_statLine = nullptr; #endif // wxUSE_STATLINE #if wxUSE_MARKUP - m_statMarkup = NULL; + m_statMarkup = nullptr; #endif // wxUSE_MARKUP - m_sizerStatBox = (wxStaticBoxSizer *)NULL; - m_sizerStatic = (wxSizer *)NULL; + m_sizerStatBox = nullptr; + m_sizerStatic = nullptr; m_textBox = m_textLabel = #if wxUSE_MARKUP m_textLabelWithMarkup = #endif // wxUSE_MARKUP - NULL; + nullptr; } void StaticWidgetsPage::CreateContent() diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index a660a10e77..179a7e0003 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -164,7 +164,7 @@ protected: wxSizer *CreateTextWithLabelSizer(const wxString& label, wxTextCtrl *text, const wxString& label2 = wxEmptyString, - wxTextCtrl *text2 = NULL); + wxTextCtrl *text2 = nullptr); // event handlers void OnButtonReset(wxCommandEvent& event); @@ -380,14 +380,14 @@ TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) #endif // __WXMSW__ m_radioWrap = m_radioAlign = - m_radioTextLines = (wxRadioBox *)NULL; + m_radioTextLines = nullptr; m_chkPassword = m_chkReadonly = m_chkProcessEnter = m_chkProcessTab = m_chkFilename = - m_chkNoVertScrollbar = (wxCheckBox *)NULL; + m_chkNoVertScrollbar = nullptr; m_text = m_textPosCur = @@ -397,9 +397,9 @@ TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) m_textLineLast = m_textSelFrom = m_textSelTo = - m_textRange = (wxTextCtrl *)NULL; + m_textRange = nullptr; - m_sizerText = (wxSizer *)NULL; + m_sizerText = nullptr; m_posCur = m_posLast = @@ -628,7 +628,7 @@ wxTextCtrl *TextWidgetsPage::CreateInfoText() if ( !s_maxWidth ) { // calc it once only - GetTextExtent("9999999", &s_maxWidth, NULL); + GetTextExtent("9999999", &s_maxWidth, nullptr); } wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, diff --git a/samples/widgets/toggle.cpp b/samples/widgets/toggle.cpp index b2a7816ed4..e93edac14e 100644 --- a/samples/widgets/toggle.cpp +++ b/samples/widgets/toggle.cpp @@ -188,10 +188,10 @@ ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book, :WidgetsPage(book, imaglist, toggle_xpm) { m_chkFit = - m_chkDisable = (wxCheckBox *)NULL; + m_chkDisable = nullptr; #if wxUSE_MARKUP - m_chkUseMarkup = (wxCheckBox *)NULL; + m_chkUseMarkup = nullptr; #endif // wxUSE_MARKUP #ifdef wxHAS_BITMAPTOGGLEBUTTON @@ -202,17 +202,17 @@ ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book, m_chkUsePressed = m_chkUseFocused = m_chkUseCurrent = - m_chkUseDisabled = (wxCheckBox *)NULL; + m_chkUseDisabled = nullptr; m_radioImagePos = m_radioHAlign = - m_radioVAlign = (wxRadioBox *)NULL; + m_radioVAlign = nullptr; #endif // wxHAS_BITMAPTOGGLEBUTTON - m_textLabel = (wxTextCtrl *)NULL; + m_textLabel = nullptr; - m_toggle = (wxToggleButton *)NULL; - m_sizerToggle = (wxSizer *)NULL; + m_toggle = nullptr; + m_sizerToggle = nullptr; } void ToggleWidgetsPage::CreateContent() diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index f376273728..0b848a40bd 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -139,7 +139,7 @@ public: WidgetsApp() { #if USE_LOG - m_logTarget = NULL; + m_logTarget = nullptr; #endif // USE_LOG } @@ -215,14 +215,14 @@ protected: void OnUpdateTextUI(wxUpdateUIEvent& event) { - event.Enable( CurrentPage()->GetTextEntry() != NULL ); + event.Enable( CurrentPage()->GetTextEntry() != nullptr ); } #endif // wxUSE_MENUS // initialize the book: add all pages to it void InitBook(); - // return the currently selected page (never NULL) + // return the currently selected page (never null) WidgetsPage *CurrentPage(); private: @@ -411,17 +411,17 @@ bool WidgetsApp::IsUsingLogWindow() const // ---------------------------------------------------------------------------- WidgetsFrame::WidgetsFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title) + : wxFrame(nullptr, wxID_ANY, title) { // set the frame icon SetIcon(wxICON(sample)); // init everything #if USE_LOG - m_lboxLog = NULL; - m_logTarget = NULL; + m_lboxLog = nullptr; + m_logTarget = nullptr; #endif // USE_LOG - m_book = NULL; + m_book = nullptr; #if wxUSE_MENUS // create the menubar @@ -638,7 +638,7 @@ void WidgetsFrame::InitBook() for ( cat = 0; cat < MAX_PAGES; cat++ ) { #if USE_TREEBOOK - m_book->AddPage(NULL,WidgetsCategories[cat],false,0); + m_book->AddPage(nullptr,WidgetsCategories[cat],false,0); #else m_book->AddPage(books[cat],WidgetsCategories[cat],false,0); books[cat]->SetImageList(imageList); @@ -694,7 +694,7 @@ WidgetsPage *WidgetsFrame::CurrentPage() #if !USE_TREEBOOK WidgetsBookCtrl *subBook = wxStaticCast(page, WidgetsBookCtrl); - wxCHECK_MSG( subBook, NULL, "no WidgetsBookCtrl?" ); + wxCHECK_MSG( subBook, nullptr, "no WidgetsBookCtrl?" ); page = subBook->GetCurrentPage(); #endif // !USE_TREEBOOK @@ -711,7 +711,7 @@ void WidgetsFrame::ConnectToWidgetEvents() ++it ) { wxWindow* const w = *it; - wxCHECK_RET(w, "NULL widget"); + wxCHECK_RET(w, "null widget"); w->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this); w->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this); @@ -1268,7 +1268,7 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxString& label, int ca { m_ctor = ctor; - m_next = NULL; + m_next = nullptr; // dummy sorting: add and immediately sort in the list according to label if ( WidgetsPage::ms_widgetPages ) @@ -1294,7 +1294,7 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxString& label, int ca node_prev->SetNext(this); m_next = node_next; // force to break loop - node_next = NULL; + node_next = nullptr; } } else @@ -1319,7 +1319,7 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxString& label, int ca // WidgetsPage // ---------------------------------------------------------------------------- -WidgetsPageInfo *WidgetsPage::ms_widgetPages = NULL; +WidgetsPageInfo *WidgetsPage::ms_widgetPages = nullptr; WidgetsPage::WidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, @@ -1348,7 +1348,7 @@ void WidgetsPage::SetUpWidget() it != widgets.end(); ++it ) { - wxCHECK_RET(*it, "NULL widget"); + wxCHECK_RET(*it, "null widget"); #if wxUSE_TOOLTIPS (*it)->SetToolTip(GetAttrs().m_tooltip); diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index b93b409e3f..7e6a5f4304 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -130,7 +130,7 @@ public: virtual wxWindow *GetWidget() const = 0; // return the control shown by this page, if it supports text entry interface - virtual wxTextEntryBase *GetTextEntry() const { return NULL; } + virtual wxTextEntryBase *GetTextEntry() const { return nullptr; } // lazy creation of the content virtual void CreateContent() = 0; @@ -163,22 +163,22 @@ protected: // several helper functions for page creation // create a horz sizer containing the given control and the text ctrl - // (pointer to which will be saved in the provided variable if not NULL) + // (pointer to which will be saved in the provided variable if not null) // with the specified id wxSizer *CreateSizerWithText(wxControl *control, wxWindowID id = wxID_ANY, - wxTextCtrl **ppText = NULL); + wxTextCtrl **ppText = nullptr); // create a sizer containing a label and a text ctrl wxSizer *CreateSizerWithTextAndLabel(const wxString& label, wxWindowID id = wxID_ANY, - wxTextCtrl **ppText = NULL); + wxTextCtrl **ppText = nullptr); // create a sizer containing a button and a text ctrl wxSizer *CreateSizerWithTextAndButton(wxWindowID idBtn, const wxString& labelBtn, wxWindowID id = wxID_ANY, - wxTextCtrl **ppText = NULL); + wxTextCtrl **ppText = nullptr); // create a checkbox and add it to the sizer wxCheckBox *CreateCheckBoxAndAddToSizer(wxSizer *sizer, @@ -221,7 +221,7 @@ private: // the function to create this page Constructor m_ctor; - // next node in the linked list or NULL + // next node in the linked list or nullptr WidgetsPageInfo *m_next; }; diff --git a/samples/wizard/wizard.cpp b/samples/wizard/wizard.cpp index 8cb6174405..7b97f278cc 100644 --- a/samples/wizard/wizard.cpp +++ b/samples/wizard/wizard.cpp @@ -431,7 +431,7 @@ MyWizard::MyWizard(wxFrame *frame, bool useSizer) // ---------------------------------------------------------------------------- MyFrame::MyFrame(const wxString& title) - :wxFrame((wxFrame *)NULL, wxID_ANY, title, + :wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150)) // small frame { wxMenu *menuFile = new wxMenu; diff --git a/samples/wrapsizer/wrapsizer.cpp b/samples/wrapsizer/wrapsizer.cpp index c2b483472b..2941b0be99 100644 --- a/samples/wrapsizer/wrapsizer.cpp +++ b/samples/wrapsizer/wrapsizer.cpp @@ -85,7 +85,7 @@ wxIMPLEMENT_APP(WrapSizerApp); // ---------------------------------------------------------------------------- WrapSizerFrame::WrapSizerFrame() - : wxFrame(NULL, wxID_ANY, "wxWrapSizer Sample") + : wxFrame(nullptr, wxID_ANY, "wxWrapSizer Sample") { SetIcon(wxICON(sample)); diff --git a/samples/xrc/custclas.h b/samples/xrc/custclas.h index 85f1913d21..f8bf0d0af2 100644 --- a/samples/xrc/custclas.h +++ b/samples/xrc/custclas.h @@ -50,7 +50,7 @@ public: \param exclusion_column_caption The label of header of listctrl's exclusion column. */ - MyResizableListCtrl( wxWindow *parent = NULL, + MyResizableListCtrl( wxWindow *parent = nullptr, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, diff --git a/samples/xrc/myframe.cpp b/samples/xrc/myframe.cpp index 6ec36104aa..b7660c1eb4 100644 --- a/samples/xrc/myframe.cpp +++ b/samples/xrc/myframe.cpp @@ -104,10 +104,10 @@ wxEND_EVENT_TABLE() MyFrame::MyFrame(wxWindow* parent) { // Load up this frame from XRC. [Note, instead of making a class's - // constructor take a wxWindow* parent with a default value of NULL, + // constructor take a wxWindow* parent with a default value of nullptr, // we could have just had designed MyFrame class with an empty // constructor and then written here: - // wxXmlResource::Get()->LoadFrame(this, (wxWindow* )NULL, "main_frame"); + // wxXmlResource::Get()->LoadFrame(this, nullptr, "main_frame"); // since this frame will always be the top window, and thus parentless. // However, the current approach has source code that can be recycled // for other frames that aren't the top level window.] @@ -320,7 +320,7 @@ void MyFrame::OnAuiDemoToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnObjRefToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) { // The dialog redirects log messages, so save the old log target first - wxLog* oldlogtarget = wxLog::SetActiveTarget(NULL); + wxLog* oldlogtarget = wxLog::SetActiveTarget(nullptr); // Make an instance of the dialog ObjrefDialog* objrefDialog = new ObjrefDialog(this); @@ -392,7 +392,7 @@ void MyFrame::OnRecursiveLoad(wxCommandEvent& WXUNUSED(event)) // this is a slightly contrived example, please keep in mind that it's done // only to demonstrate LoadObjectRecursively() in action and is not the // recommended to do this - wxDialog dlg(NULL, wxID_ANY, "Recursive Load Example", + wxDialog dlg(nullptr, wxID_ANY, "Recursive Load Example", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxSizer * const sizer = new wxBoxSizer(wxVERTICAL); diff --git a/samples/xrc/myframe.h b/samples/xrc/myframe.h index 17ab0f43c1..a130bd588c 100644 --- a/samples/xrc/myframe.h +++ b/samples/xrc/myframe.h @@ -30,7 +30,7 @@ class MyFrame : public wxFrame public: // Constructor. - MyFrame( wxWindow* parent=(wxWindow *)NULL); + MyFrame( wxWindow* parent=nullptr); private: diff --git a/samples/xrc/xrcdemo.cpp b/samples/xrc/xrcdemo.cpp index 4e82fb17be..1c86fa130e 100644 --- a/samples/xrc/xrcdemo.cpp +++ b/samples/xrc/xrcdemo.cpp @@ -111,8 +111,8 @@ bool MyApp::OnInit() wxHelpProvider::Set( new wxSimpleHelpProvider ); #endif // wxUSE_HELP - // Make an instance of your derived frame. Passing NULL (the default value - // of MyFrame's constructor is NULL) as the frame doesn't have a parent + // Make an instance of your derived frame. Passing nullptr (the default value + // of MyFrame's constructor is null) as the frame doesn't have a parent // since it is the main application window. MyFrame *frame = new MyFrame(); diff --git a/samples/xti/classlist.cpp b/samples/xti/classlist.cpp index 937aad92b4..18e658bbeb 100644 --- a/samples/xti/classlist.cpp +++ b/samples/xti/classlist.cpp @@ -80,11 +80,11 @@ ClassListDialog::~ClassListDialog() void ClassListDialog::Init() { - m_pClassCountText = NULL; - m_pRawListBox = NULL; - m_pParentTreeCtrl = NULL; - m_pSizeListBox = NULL; - m_pTextCtrl = NULL; + m_pClassCountText = nullptr; + m_pRawListBox = nullptr; + m_pParentTreeCtrl = nullptr; + m_pSizeListBox = nullptr; + m_pTextCtrl = nullptr; } void ClassListDialog::CreateControls() @@ -267,7 +267,7 @@ bool ClassListDialog::IsToDiscard(const wxString &classname) const wxClassInfo *info = wxClassInfo::FindClass(classname); if (!info) return false; - if (info->GetFirstProperty() != NULL || info->GetFirstHandler() != NULL) + if (info->GetFirstProperty() != nullptr || info->GetFirstHandler() != nullptr) return false; // has XTI info return true; // no XTI info } @@ -465,7 +465,7 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive) const wxClassInfo **parent = info->GetParents(); wxString str; - for (int i=0; parent[i] != NULL; i++) + for (int i=0; parent[i] != nullptr; i++) { int ppcount = DumpProperties(parent[i], str, recursive); if (ppcount) @@ -500,7 +500,7 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive) const wxClassInfo **parent = info->GetParents(); wxString str; - for (int i=0; parent[i] != NULL; i++) + for (int i=0; parent[i] != nullptr; i++) { int hhcount = DumpHandlers(parent[i], str, recursive); if (hhcount) diff --git a/samples/xti/xti.cpp b/samples/xti/xti.cpp index 239813a5a9..b979523727 100644 --- a/samples/xti/xti.cpp +++ b/samples/xti/xti.cpp @@ -154,7 +154,7 @@ bool MyApp::OnInit() // ---------------------------------------------------------------------------- MyFrame::MyFrame(const wxString& title) - : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200)) + : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(300, 200)) { // set the frame icon SetIcon(wxICON(sample)); @@ -212,7 +212,7 @@ MyFrame::MyFrame(const wxString& title) // MyXTIFrame() // { // Init(); -// m_button = NULL; +// m_button = nullptr; // } // // bool Create(wxWindow *parent, @@ -313,16 +313,16 @@ void RegisterFrameRTTI() // is not defined anywhere in this program wxDynamicClassInfo *dyninfo = wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame")); - if ( dyninfo == NULL ) + if ( dyninfo == nullptr ) { dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"), wxT("MyXTIFrame"), CLASSINFO(wxFrame) ); // this class has a property named "Button" and the relative handler: - dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) NULL)); + dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) nullptr)); dyninfo->AddHandler(wxT("ButtonClickHandler"), - NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) ); + nullptr /* no instance of the handler method */, CLASSINFO( wxEvent ) ); } } @@ -338,7 +338,7 @@ wxDynamicObject* CreateFrameRTTI() wxASSERT( info ); wxDynamicObject* frameWrapper = wx_dynamic_cast(wxDynamicObject*, info->CreateObject() ); - Params[0] = wxAny((wxWindow*)(NULL)); + Params[0] = wxAny((wxWindow*)(nullptr)); Params[1] = wxAny(wxWindowID(baseID++)); Params[2] = wxAny(wxString("This is a frame created from XTI")); Params[3] = wxAny(wxPoint(-1,-1)); @@ -550,11 +550,11 @@ wxDynamicObject* LoadFrameRTTI(const wxString &fileName) // load the XML document wxXmlDocument xml; if (!xml.Load(fileName)) - return NULL; + return nullptr; wxXmlNode *root = xml.GetRoot(); if (root->GetName() != "TestXTI") - return NULL; + return nullptr; // now depersist the wxFrame we saved into it using wxObjectRuntimeReaderCallback wxObjectRuntimeReaderCallback Callbacks; diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 74a297d565..b2e2f8a1e7 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -137,10 +137,10 @@ wxAuiGenericToolBarArt::wxAuiGenericToolBarArt() m_flags = 0; m_textOrientation = wxAUI_TBTOOL_TEXT_BOTTOM; - m_separatorSize = wxWindow::FromDIP( 7, NULL); - m_gripperSize = wxWindow::FromDIP( 7, NULL); - m_overflowSize = wxWindow::FromDIP(16, NULL); - m_dropdownSize = wxWindow::FromDIP(10, NULL); + m_separatorSize = wxWindow::FromDIP( 7, nullptr); + m_gripperSize = wxWindow::FromDIP( 7, nullptr); + m_overflowSize = wxWindow::FromDIP(16, nullptr); + m_dropdownSize = wxWindow::FromDIP(10, nullptr); m_font = *wxNORMAL_FONT; @@ -162,7 +162,7 @@ void wxAuiGenericToolBarArt::UpdateColoursFromSystem() wxColor darker3Colour = m_baseColour.ChangeLightness(60); wxColor darker5Colour = m_baseColour.ChangeLightness(40); - int pen_width = wxWindow::FromDIP(1, NULL); + int pen_width = wxWindow::FromDIP(1, nullptr); m_gripperPen1 = wxPen(darker5Colour, pen_width); m_gripperPen2 = wxPen(darker3Colour, pen_width); m_gripperPen3 = wxPen(*wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE), pen_width); @@ -851,12 +851,12 @@ void wxAuiToolBar::Init() m_buttonHeight = -1; m_sizerElementCount = 0; m_actionPos = wxDefaultPosition; - m_actionItem = NULL; - m_tipItem = NULL; + m_actionItem = nullptr; + m_tipItem = nullptr; m_art = new wxAuiDefaultToolBarArt; m_toolTextOrientation = wxAUI_TBTOOL_TEXT_BOTTOM; - m_gripperSizerItem = NULL; - m_overflowSizerItem = NULL; + m_gripperSizerItem = nullptr; + m_overflowSizerItem = nullptr; m_dragging = false; m_gripperVisible = false; m_overflowVisible = false; @@ -974,7 +974,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, kind, shortHelp_string, wxEmptyString, - NULL); + nullptr); } @@ -988,7 +988,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, wxObject* WXUNUSED(client_data)) { wxAuiToolBarItem item; - item.m_window = NULL; + item.m_window = nullptr; item.m_label = label; item.m_bitmap = bitmap; item.m_disabledBitmap = disabledBitmap; @@ -1001,7 +1001,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddTool(int tool_id, item.m_state = 0; item.m_proportion = 0; item.m_kind = kind; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = wxDefaultSize; item.m_userData = 0; item.m_sticky = false; @@ -1028,7 +1028,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddControl(wxControl* control, item.m_state = 0; item.m_proportion = 0; item.m_kind = wxITEM_CONTROL; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = control->GetEffectiveMinSize(); item.m_userData = 0; item.m_sticky = false; @@ -1046,7 +1046,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddLabel(int tool_id, min_size.x = width; wxAuiToolBarItem item; - item.m_window = NULL; + item.m_window = nullptr; item.m_label = label; item.m_bitmap = wxBitmapBundle(); item.m_disabledBitmap = wxBitmapBundle(); @@ -1057,7 +1057,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddLabel(int tool_id, item.m_state = 0; item.m_proportion = 0; item.m_kind = wxITEM_LABEL; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = min_size; item.m_userData = 0; item.m_sticky = false; @@ -1072,7 +1072,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddLabel(int tool_id, wxAuiToolBarItem* wxAuiToolBar::AddSeparator() { wxAuiToolBarItem item; - item.m_window = NULL; + item.m_window = nullptr; item.m_label = wxEmptyString; item.m_bitmap = wxBitmapBundle(); item.m_disabledBitmap = wxBitmapBundle(); @@ -1082,7 +1082,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddSeparator() item.m_state = 0; item.m_proportion = 0; item.m_kind = wxITEM_SEPARATOR; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = wxDefaultSize; item.m_userData = 0; item.m_sticky = false; @@ -1094,7 +1094,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddSeparator() wxAuiToolBarItem* wxAuiToolBar::AddSpacer(int pixels) { wxAuiToolBarItem item; - item.m_window = NULL; + item.m_window = nullptr; item.m_label = wxEmptyString; item.m_bitmap = wxBitmapBundle(); item.m_disabledBitmap = wxBitmapBundle(); @@ -1105,7 +1105,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddSpacer(int pixels) item.m_state = 0; item.m_proportion = 0; item.m_kind = wxITEM_SPACER; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = wxDefaultSize; item.m_userData = 0; item.m_sticky = false; @@ -1117,7 +1117,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddSpacer(int pixels) wxAuiToolBarItem* wxAuiToolBar::AddStretchSpacer(int proportion) { wxAuiToolBarItem item; - item.m_window = NULL; + item.m_window = nullptr; item.m_label = wxEmptyString; item.m_bitmap = wxBitmapBundle(); item.m_disabledBitmap = wxBitmapBundle(); @@ -1128,7 +1128,7 @@ wxAuiToolBarItem* wxAuiToolBar::AddStretchSpacer(int proportion) item.m_state = 0; item.m_proportion = proportion; item.m_kind = wxITEM_SPACER; - item.m_sizerItem = NULL; + item.m_sizerItem = nullptr; item.m_minSize = wxDefaultSize; item.m_userData = 0; item.m_sticky = false; @@ -1193,7 +1193,7 @@ wxAuiToolBarItem* wxAuiToolBar::FindTool(int tool_id) const return &item; } - return NULL; + return nullptr; } wxAuiToolBarItem* wxAuiToolBar::FindToolByPosition(wxCoord x, wxCoord y) const @@ -1209,15 +1209,15 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByPosition(wxCoord x, wxCoord y) const wxRect rect = item.m_sizerItem->GetRect(); if (rect.Contains(x,y)) { - // if the item doesn't fit on the toolbar, return NULL + // if the item doesn't fit on the toolbar, return nullptr if (!GetToolFitsByIndex(i)) - return NULL; + return nullptr; return &item; } } - return NULL; + return nullptr; } wxAuiToolBarItem* wxAuiToolBar::FindToolByPositionWithPacking(wxCoord x, wxCoord y) const @@ -1238,24 +1238,24 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByPositionWithPacking(wxCoord x, wxCoord if (rect.Contains(x,y)) { - // if the item doesn't fit on the toolbar, return NULL + // if the item doesn't fit on the toolbar, return nullptr if (!GetToolFitsByIndex(i)) - return NULL; + return nullptr; return &item; } } - return NULL; + return nullptr; } wxAuiToolBarItem* wxAuiToolBar::FindToolByIndex(int idx) const { if (idx < 0) - return NULL; + return nullptr; if (idx >= (int)m_items.size()) - return NULL; + return nullptr; return &(m_items[idx]); } @@ -1461,9 +1461,9 @@ bool wxAuiToolBar::SetFont(const wxFont& font) void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem) { if (pitem && (pitem->m_state & wxAUI_BUTTON_STATE_DISABLED)) - pitem = NULL; + pitem = nullptr; - wxAuiToolBarItem* former_hover = NULL; + wxAuiToolBarItem* former_hover = nullptr; size_t i, count; for (i = 0, count = m_items.GetCount(); i < count; ++i) @@ -1488,7 +1488,7 @@ void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem) void wxAuiToolBar::SetPressedItem(wxAuiToolBarItem* pitem) { - wxAuiToolBarItem* former_item = NULL; + wxAuiToolBarItem* former_item = nullptr; size_t i, count; for (i = 0, count = m_items.GetCount(); i < count; ++i) @@ -1896,7 +1896,7 @@ 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; + m_sizer = nullptr; // create the new sizer to add toolbar elements to wxBoxSizer* sizer = new wxBoxSizer(horizontal ? wxHORIZONTAL : wxVERTICAL); @@ -1913,7 +1913,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) } else { - m_gripperSizerItem = NULL; + m_gripperSizerItem = nullptr; } // add "left" padding @@ -1929,7 +1929,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) for (i = 0, count = m_items.GetCount(); i < count; ++i) { wxAuiToolBarItem& item = m_items.Item(i); - wxSizerItem* sizerItem = NULL; + wxSizerItem* sizerItem = nullptr; switch (item.m_kind) { @@ -2045,7 +2045,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) } // add drop down area - m_overflowSizerItem = NULL; + m_overflowSizerItem = nullptr; if (m_windowStyle & wxAUI_TB_OVERFLOW) { @@ -2060,7 +2060,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) } else { - m_overflowSizerItem = NULL; + m_overflowSizerItem = nullptr; } } @@ -2600,7 +2600,7 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) if (m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; return; } @@ -2624,12 +2624,12 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) // we only set the 'pressed button' state if we hit the actual button // and not just the drop-down - SetPressedItem(dropDownHit ? 0 : m_actionItem); + SetPressedItem(dropDownHit ? nullptr : m_actionItem); if(dropDownHit) { m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; } if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped()) @@ -2649,7 +2649,7 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt) if (!HasCapture()) return; - SetPressedItem(NULL); + SetPressedItem(nullptr); wxAuiToolBarItem* hitItem; hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); @@ -2739,7 +2739,7 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) if (m_actionItem && m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; return; } @@ -2776,7 +2776,7 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) // reset member variables m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; } void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) @@ -2813,7 +2813,7 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) if (m_actionItem->m_state & wxAUI_BUTTON_STATE_DISABLED) { m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; return; } } @@ -2844,7 +2844,7 @@ void wxAuiToolBar::OnMiddleUp(wxMouseEvent& evt) // reset member variables m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; } void wxAuiToolBar::OnMotion(wxMouseEvent& evt) @@ -2878,7 +2878,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) SetPressedItem(m_actionItem); else { - SetPressedItem(NULL); + SetPressedItem(nullptr); SetHoverItem(m_actionItem); } } @@ -2906,7 +2906,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) else { UnsetToolTip(); - m_tipItem = NULL; + m_tipItem = nullptr; } } @@ -2918,16 +2918,16 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt) void wxAuiToolBar::DoResetMouseState() { RefreshOverflowState(); - SetHoverItem(NULL); - SetPressedItem(NULL); + SetHoverItem(nullptr); + SetPressedItem(nullptr); - m_tipItem = NULL; + m_tipItem = nullptr; // we have to reset those here, because the mouse-up handlers which do // it usually won't be called if we let go of a mouse button while we // are outside of the window m_actionPos = wxPoint(-1,-1); - m_actionItem = NULL; + m_actionItem = nullptr; } void wxAuiToolBar::OnLeaveWindow(wxMouseEvent& evt) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index e1394d73a1..25051b8e79 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -320,7 +320,7 @@ int wxAuiTabContainer::GetActivePage() const wxWindow* wxAuiTabContainer::GetWindowFromIdx(size_t idx) const { if (idx >= m_pages.GetCount()) - return NULL; + return nullptr; return m_pages[idx].window; } @@ -863,7 +863,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const if (!m_rect.Contains(x,y)) return false; - wxAuiTabContainerButton* btn = NULL; + wxAuiTabContainerButton* btn = nullptr; if (ButtonHitTest(x, y, &btn) && !(btn->curState & wxAUI_BUTTON_STATE_DISABLED)) { if (m_buttons.Index(*btn) != wxNOT_FOUND) @@ -1015,8 +1015,8 @@ wxAuiTabCtrl::wxAuiTabCtrl(wxWindow* parent, SetName(wxT("wxAuiTabCtrl")); m_clickPt = wxDefaultPosition; m_isDragging = false; - m_hoverButton = NULL; - m_pressedButton = NULL; + m_hoverButton = nullptr; + m_pressedButton = nullptr; } wxAuiTabCtrl::~wxAuiTabCtrl() @@ -1059,8 +1059,8 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt) CaptureMouse(); m_clickPt = wxDefaultPosition; m_isDragging = false; - m_clickTab = NULL; - m_pressedButton = NULL; + m_clickTab = nullptr; + m_pressedButton = nullptr; wxWindow* wnd; @@ -1130,14 +1130,14 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) if (m_pressedButton) { // make sure we're still clicking the button - wxAuiTabContainerButton* button = NULL; + wxAuiTabContainerButton* button = nullptr; if (!ButtonHitTest(evt.m_x, evt.m_y, &button) || button->curState & wxAUI_BUTTON_STATE_DISABLED) return; if (button != m_pressedButton) { - m_pressedButton = NULL; + m_pressedButton = nullptr; return; } @@ -1153,17 +1153,17 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt) GetEventHandler()->ProcessEvent(e); } - m_pressedButton = NULL; + m_pressedButton = nullptr; } m_clickPt = wxDefaultPosition; m_isDragging = false; - m_clickTab = NULL; + m_clickTab = nullptr; } void wxAuiTabCtrl::OnMiddleUp(wxMouseEvent& evt) { - wxWindow* wnd = NULL; + wxWindow* wnd = nullptr; if (!TabHitTest(evt.m_x, evt.m_y, &wnd)) return; @@ -1175,7 +1175,7 @@ void wxAuiTabCtrl::OnMiddleUp(wxMouseEvent& evt) void wxAuiTabCtrl::OnMiddleDown(wxMouseEvent& evt) { - wxWindow* wnd = NULL; + wxWindow* wnd = nullptr; if (!TabHitTest(evt.m_x, evt.m_y, &wnd)) return; @@ -1187,7 +1187,7 @@ void wxAuiTabCtrl::OnMiddleDown(wxMouseEvent& evt) void wxAuiTabCtrl::OnRightUp(wxMouseEvent& evt) { - wxWindow* wnd = NULL; + wxWindow* wnd = nullptr; if (!TabHitTest(evt.m_x, evt.m_y, &wnd)) return; @@ -1199,7 +1199,7 @@ void wxAuiTabCtrl::OnRightUp(wxMouseEvent& evt) void wxAuiTabCtrl::OnRightDown(wxMouseEvent& evt) { - wxWindow* wnd = NULL; + wxWindow* wnd = nullptr; if (!TabHitTest(evt.m_x, evt.m_y, &wnd)) return; @@ -1232,7 +1232,7 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) if (m_hoverButton && button != m_hoverButton) { m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; - m_hoverButton = NULL; + m_hoverButton = nullptr; Refresh(); Update(); } @@ -1252,13 +1252,13 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) if (m_hoverButton) { m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; - m_hoverButton = NULL; + m_hoverButton = nullptr; Refresh(); Update(); } } - wxWindow* wnd = NULL; + wxWindow* wnd = nullptr; if (evt.Moving() && TabHitTest(evt.m_x, evt.m_y, &wnd)) { SetHoverTab(wnd); @@ -1274,7 +1274,7 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) } else { - SetHoverTab(NULL); + SetHoverTab(nullptr); #if wxUSE_TOOLTIPS UnsetToolTip(); @@ -1316,12 +1316,12 @@ void wxAuiTabCtrl::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) if (m_hoverButton) { m_hoverButton->curState = wxAUI_BUTTON_STATE_NORMAL; - m_hoverButton = NULL; + m_hoverButton = nullptr; Refresh(); Update(); } - SetHoverTab(NULL); + SetHoverTab(nullptr); } void wxAuiTabCtrl::OnButton(wxAuiNotebookEvent& event) @@ -1519,7 +1519,7 @@ public: wxTabFrame() { - m_tabs = NULL; + m_tabs = nullptr; // Both m_rect and m_tabCtrlHeight will be really initialized later. m_tabCtrlHeight = 0; @@ -1713,7 +1713,7 @@ void wxAuiNotebook::Init() { m_curPage = -1; m_tabIdCounter = wxAuiBaseTabCtrlId; - m_dummyWnd = NULL; + m_dummyWnd = nullptr; m_requestedBmpSize = wxDefaultSize; m_requestedTabCtrlHeight = -1; } @@ -1739,7 +1739,7 @@ void wxAuiNotebook::InitNotebook(long style) SetName(wxT("wxAuiNotebook")); m_curPage = -1; m_tabIdCounter = wxAuiBaseTabCtrlId; - m_dummyWnd = NULL; + m_dummyWnd = nullptr; m_flags = (unsigned int)style; m_tabCtrlHeight = FromDIP(20); @@ -1982,7 +1982,7 @@ bool wxAuiNotebook::InsertPage(size_t page_idx, bool select, const wxBitmapBundle& bitmap) { - wxASSERT_MSG(page, wxT("page pointer must be non-NULL")); + wxASSERT_MSG(page, wxT("page pointer must be non-null")); if (!page) return false; @@ -2075,13 +2075,13 @@ bool wxAuiNotebook::DeletePage(size_t page_idx) bool wxAuiNotebook::RemovePage(size_t page_idx) { // save active window pointer - wxWindow* active_wnd = NULL; + wxWindow* active_wnd = nullptr; if (m_curPage >= 0) active_wnd = m_tabs.GetWindowFromIdx(m_curPage); // save pointer of window being deleted wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx); - wxWindow* new_active = NULL; + wxWindow* new_active = nullptr; // make sure we found the page if (!wnd) @@ -2427,7 +2427,7 @@ void wxAuiNotebook::Split(size_t page, int direction) // find out which tab control the page currently belongs to wxAuiTabCtrl *src_tabs, *dest_tabs; int src_idx = -1; - src_tabs = NULL; + src_tabs = nullptr; if (!FindTab(wnd, &src_tabs, &src_idx)) return; if (!src_tabs || src_idx == -1) @@ -2535,10 +2535,10 @@ void wxAuiNotebook::OnSize(wxSizeEvent& evt) void wxAuiNotebook::OnTabClicked(wxAuiNotebookEvent& evt) { wxAuiTabCtrl* ctrl = (wxAuiTabCtrl*)evt.GetEventObject(); - wxASSERT(ctrl != NULL); + wxASSERT(ctrl != nullptr); wxWindow* wnd = ctrl->GetWindowFromIdx(evt.GetSelection()); - wxASSERT(wnd != NULL); + wxASSERT(wnd != nullptr); SetSelectionToWindow(wnd); } @@ -2549,9 +2549,9 @@ void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& evt) int selection; wxWindow* wnd; wxAuiTabCtrl* ctrl = (wxAuiTabCtrl*)evt.GetEventObject(); - if ( (ctrl != NULL) + if ( (ctrl != nullptr) && ((selection = ctrl->GetActivePage()) != wxNOT_FOUND) - && ((wnd = ctrl->GetWindowFromIdx(selection)) != NULL)) + && ((wnd = ctrl->GetWindowFromIdx(selection)) != nullptr)) { SetSelectionToWindow(wnd); } @@ -2788,7 +2788,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) wxAuiTabCtrl* dest_tabs = (wxAuiTabCtrl*)tab_ctrl; wxPoint pt = dest_tabs->ScreenToClient(mouse_screen_pt); - wxWindow* target = NULL; + wxWindow* target = nullptr; int insert_idx = -1; dest_tabs->TabHitTest(pt.x, pt.y, &target); if (target) @@ -2827,7 +2827,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) // only perform a tab split if it's allowed - wxAuiTabCtrl* dest_tabs = NULL; + wxAuiTabCtrl* dest_tabs = nullptr; if ((m_flags & wxAUI_NB_TAB_SPLIT) && m_tabs.GetPageCount() >= 2) { @@ -2846,7 +2846,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) } wxPoint pt = dest_tabs->ScreenToClient(mouse_screen_pt); - wxWindow* target = NULL; + wxWindow* target = nullptr; dest_tabs->TabHitTest(pt.x, pt.y, &target); if (target) { @@ -2960,7 +2960,7 @@ wxAuiTabCtrl* wxAuiNotebook::GetTabCtrlFromPoint(const wxPoint& pt) return tabframe->m_tabs; } - return NULL; + return nullptr; } wxWindow* wxAuiNotebook::GetTabFrameFromTabCtrl(wxWindow* tab_ctrl) @@ -2981,7 +2981,7 @@ wxWindow* wxAuiNotebook::GetTabFrameFromTabCtrl(wxWindow* tab_ctrl) } } - return NULL; + return nullptr; } void wxAuiNotebook::RemoveEmptyTabFrames() @@ -3005,7 +3005,7 @@ void wxAuiNotebook::RemoveEmptyTabFrames() if (!wxPendingDelete.Member(tab_frame->m_tabs)) wxPendingDelete.Append(tab_frame->m_tabs); - tab_frame->m_tabs = NULL; + tab_frame->m_tabs = nullptr; delete tab_frame; } @@ -3016,7 +3016,7 @@ void wxAuiNotebook::RemoveEmptyTabFrames() // if there isn't, make a frame the center pane wxAuiPaneInfoArray panes = m_mgr.GetAllPanes(); pane_count = panes.GetCount(); - wxWindow* first_good = NULL; + wxWindow* first_good = nullptr; bool center_found = false; for (i = 0; i < pane_count; ++i) { @@ -3363,7 +3363,7 @@ void wxAuiNotebook::SetPageSize (const wxSize& WXUNUSED(size)) int wxAuiNotebook::HitTest (const wxPoint &pt, long *flags) const { - wxWindow *w = NULL; + wxWindow *w = nullptr; long position = wxBK_HITTEST_NOWHERE; const wxAuiPaneInfoArray& all_panes = const_cast(m_mgr).GetAllPanes(); const size_t pane_count = all_panes.GetCount(); diff --git a/src/aui/barartmsw.cpp b/src/aui/barartmsw.cpp index c1f8b8387b..c225e8d9f2 100644 --- a/src/aui/barartmsw.cpp +++ b/src/aui/barartmsw.cpp @@ -34,20 +34,20 @@ wxAuiMSWToolBarArt::wxAuiMSWToolBarArt() wxUxThemeHandle hTheme(window, L"Rebar"); SIZE overflowSize; - ::GetThemePartSize(hTheme, NULL, RP_CHEVRON, 0, - NULL, TS_TRUE, &overflowSize); + ::GetThemePartSize(hTheme, nullptr, RP_CHEVRON, 0, + nullptr, TS_TRUE, &overflowSize); m_overflowSize = overflowSize.cx; SIZE gripperSize; - ::GetThemePartSize(hTheme, NULL, RP_GRIPPER, 0, - NULL, TS_TRUE, &gripperSize); + ::GetThemePartSize(hTheme, nullptr, RP_GRIPPER, 0, + nullptr, TS_TRUE, &gripperSize); m_gripperSize = gripperSize.cx; wxUxThemeHandle hThemeToolbar(window, L"Toolbar"); SIZE seperatorSize; - ::GetThemePartSize(hThemeToolbar, NULL, TP_SEPARATOR, 0, - NULL, TS_TRUE, &seperatorSize); + ::GetThemePartSize(hThemeToolbar, nullptr, TP_SEPARATOR, 0, + nullptr, TS_TRUE, &seperatorSize); m_separatorSize = seperatorSize.cx; // TP_DROPDOWNBUTTON is only 7px, too small to fit the dropdown arrow, @@ -55,8 +55,8 @@ wxAuiMSWToolBarArt::wxAuiMSWToolBarArt() m_dropdownSize = window->FromDIP(14); SIZE buttonSize; - ::GetThemePartSize(hThemeToolbar, NULL, TP_BUTTON, 0, - NULL, TS_TRUE, &buttonSize); + ::GetThemePartSize(hThemeToolbar, nullptr, TP_BUTTON, 0, + nullptr, TS_TRUE, &buttonSize); m_buttonSize.Set(buttonSize.cx, buttonSize.cy); } else @@ -86,7 +86,7 @@ void wxAuiMSWToolBarArt::DrawBackground( RP_BACKGROUND, 0, &r, - NULL); + nullptr); } else wxAuiGenericToolBarArt::DrawBackground(dc, wnd, rect); @@ -135,7 +135,7 @@ void wxAuiMSWToolBarArt::DrawButton( TP_BUTTON, btnState, &r, - NULL); + nullptr); int textWidth = 0, textHeight = 0; @@ -256,7 +256,7 @@ void wxAuiMSWToolBarArt::DrawDropDownButton( TP_SPLITBUTTON, btnState, &btnR, - NULL); + nullptr); ::DrawThemeBackground( hTheme, @@ -264,7 +264,7 @@ void wxAuiMSWToolBarArt::DrawDropDownButton( TP_SPLITBUTTONDROPDOWN, btnState, &dropDownR, - NULL); + nullptr); const wxBitmap& bmp = item.GetCurrentBitmapFor(wnd); if ( !bmp.IsOk() ) @@ -341,7 +341,7 @@ void wxAuiMSWToolBarArt::DrawSeparator( (m_flags & wxAUI_TB_VERTICAL) ? TP_SEPARATORVERT : TP_SEPARATOR, 0, &r, - NULL); + nullptr); } else wxAuiGenericToolBarArt::DrawSeparator(dc, wnd, rect); @@ -365,7 +365,7 @@ void wxAuiMSWToolBarArt::DrawGripper( (m_flags & wxAUI_TB_VERTICAL) ? RP_GRIPPERVERT : RP_GRIPPER, 0, &r, - NULL); + nullptr); } else wxAuiGenericToolBarArt::DrawGripper(dc, wnd, rect); @@ -398,7 +398,7 @@ void wxAuiMSWToolBarArt::DrawOverflowButton( (m_flags & wxAUI_TB_VERTICAL) ? RP_CHEVRONVERT : RP_CHEVRON, chevState, &r, - NULL); + nullptr); } else wxAuiGenericToolBarArt::DrawOverflowButton(dc, wnd, rect, state); diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp index ca710bac5e..c698f144c9 100644 --- a/src/aui/dockart.cpp +++ b/src/aui/dockart.cpp @@ -204,14 +204,14 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt() GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height ); m_sashSize = height; #elif defined(__WXGTK__) - m_sashSize = wxRendererNative::Get().GetSplitterParams(NULL).widthSash; + m_sashSize = wxRendererNative::Get().GetSplitterParams(nullptr).widthSash; #else - m_sashSize = wxWindow::FromDIP( 4, NULL); + m_sashSize = wxWindow::FromDIP( 4, nullptr); #endif - m_captionSize = wxWindow::FromDIP(17, NULL); + m_captionSize = wxWindow::FromDIP(17, nullptr); m_borderSize = 1; - m_buttonSize = wxWindow::FromDIP(14, NULL); - m_gripperSize = wxWindow::FromDIP( 9, NULL); + m_buttonSize = wxWindow::FromDIP(14, nullptr); + m_gripperSize = wxWindow::FromDIP( 9, nullptr); m_gradientType = wxAUI_GRADIENT_VERTICAL; InitBitmaps(); @@ -319,7 +319,7 @@ void wxAuiDefaultDockArt::UpdateColoursFromSystem() m_gripperBrush = wxBrush(baseColour); m_borderPen = wxPen(darker2Colour); - int pen_width = wxWindow::FromDIP(1, NULL); + int pen_width = wxWindow::FromDIP(1, nullptr); m_gripperPen1 = wxPen(darker5Colour, pen_width); m_gripperPen2 = wxPen(darker3Colour, pen_width); m_gripperPen3 = wxPen(*wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE), pen_width); @@ -478,7 +478,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - NULL /* no clipping */, + nullptr /* no clipping */, window->m_wxwindow, "paned", rect.x, @@ -539,7 +539,7 @@ void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow* window, const wxRect& _ else { // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk) - wxAuiTabArt* art = 0; + wxAuiTabArt* art = nullptr; wxAuiNotebook* nb = wxDynamicCast(window, wxAuiNotebook); if (nb) art = nb->GetArtProvider(); @@ -657,7 +657,7 @@ void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, #if WXWIN_COMPATIBILITY_3_0 void wxAuiDefaultDockArt::DrawIcon(wxDC& dc, const wxRect& rect, wxAuiPaneInfo& pane) { - DrawIcon(dc, NULL, rect, pane); + DrawIcon(dc, nullptr, rect, pane); } #endif diff --git a/src/aui/floatpane.cpp b/src/aui/floatpane.cpp index fac030ca96..6366a2e983 100644 --- a/src/aui/floatpane.cpp +++ b/src/aui/floatpane.cpp @@ -72,7 +72,7 @@ wxAuiFloatingFrame::~wxAuiFloatingFrame() // if we do not do this, then we can crash... if (m_ownerMgr && m_ownerMgr->m_actionWindow == this) { - m_ownerMgr->m_actionWindow = NULL; + m_ownerMgr->m_actionWindow = nullptr; } m_mgr.UnInit(); diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 1358be76a9..2070c9e050 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -85,7 +85,7 @@ const int auiToolBarLayer = 10; class wxPseudoTransparentFrame : public wxFrame { public: - wxPseudoTransparentFrame(wxWindow* parent = NULL, + wxPseudoTransparentFrame(wxWindow* parent = nullptr, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, @@ -223,7 +223,7 @@ gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) ) class wxPseudoTransparentFrame: public wxFrame { public: - wxPseudoTransparentFrame(wxWindow* parent = NULL, + wxPseudoTransparentFrame(wxWindow* parent = nullptr, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, @@ -469,7 +469,7 @@ static void FindDocks(wxAuiDockInfoArray& docks, } // FindPaneInDock() looks up a specified window pointer inside a dock. -// If found, the corresponding wxAuiPaneInfo pointer is returned, otherwise NULL. +// If found, the corresponding wxAuiPaneInfo pointer is returned, otherwise nullptr. static wxAuiPaneInfo* FindPaneInDock(const wxAuiDockInfo& dock, wxWindow* window) { int i, count = dock.panes.GetCount(); @@ -479,14 +479,14 @@ static wxAuiPaneInfo* FindPaneInDock(const wxAuiDockInfo& dock, wxWindow* window if (p->window == window) return p; } - return NULL; + return nullptr; } // RemovePaneFromDocks() removes a pane window from all docks // with a possible exception specified by parameter "ex_cept" static void RemovePaneFromDocks(wxAuiDockInfoArray& docks, wxAuiPaneInfo& pane, - wxAuiDockInfo* ex_cept = NULL ) + wxAuiDockInfo* ex_cept = nullptr ) { int i, dock_count; for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i) @@ -528,7 +528,7 @@ static void RenumberDockRows(wxAuiDockInfoPtrArray& docks) void wxAuiManager::SetActivePane(wxWindow* active_pane) { int i, pane_count; - wxAuiPaneInfo* active_paneinfo = NULL; + wxAuiPaneInfo* active_paneinfo = nullptr; for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i) { wxAuiPaneInfo& pane = m_panes.Item(i); @@ -592,16 +592,16 @@ wxEND_EVENT_TABLE() wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) { m_action = actionNone; - m_actionWindow = NULL; - m_hoverButton = NULL; + m_actionWindow = nullptr; + m_hoverButton = nullptr; m_art = new wxAuiDefaultDockArt; - m_hintWnd = NULL; + m_hintWnd = nullptr; m_flags = flags; m_hasMaximized = false; - m_frame = NULL; + m_frame = nullptr; m_dockConstraintX = 0.3; m_dockConstraintY = 0.3; - m_reserved = NULL; + m_reserved = nullptr; m_currentDragItem = -1; if (managed_wnd) @@ -697,7 +697,7 @@ wxAuiPaneInfoArray& wxAuiManager::GetAllPanes() // (x,y) specify a position in client coordinates wxAuiDockUIPart* wxAuiManager::HitTest(int x, int y) { - wxAuiDockUIPart* result = NULL; + wxAuiDockUIPart* result = nullptr; int i, part_count; for (i = 0, part_count = m_uiParts.GetCount(); i < part_count; ++i) @@ -797,10 +797,10 @@ wxFrame* wxAuiManager::GetFrame() const wxAuiManager* wxAuiManager::GetManager(wxWindow* window) { wxAuiManagerEvent evt(wxEVT_AUI_FIND_MANAGER); - evt.SetManager(NULL); + evt.SetManager(nullptr); evt.ResumePropagation(wxEVENT_PROPAGATE_MAX); if (!window->GetEventHandler()->ProcessEvent(evt)) - return NULL; + return nullptr; return evt.GetManager(); } @@ -829,11 +829,11 @@ void wxAuiManager::UpdateHintWindowConfig() if (m_hintWnd) { m_hintWnd->Destroy(); - m_hintWnd = NULL; + m_hintWnd = nullptr; } m_hintFadeMax = 50; - m_hintWnd = NULL; + m_hintWnd = nullptr; if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent) { @@ -894,7 +894,7 @@ void wxAuiManager::UpdateHintWindowConfig() // 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")); + wxASSERT_MSG(wnd, wxT("specified window must be non-null")); UnInit(); @@ -911,7 +911,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd) wxMDIParentFrame* mdi_frame = (wxMDIParentFrame*)m_frame; wxWindow* client_window = mdi_frame->GetClientWindow(); - wxASSERT_MSG(client_window, wxT("Client window is NULL!")); + wxASSERT_MSG(client_window, wxT("Client window is null!")); AddPane(client_window, wxAuiPaneInfo().Name(wxT("mdiclient")). @@ -921,7 +921,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd) { wxAuiMDIParentFrame* mdi_frame = (wxAuiMDIParentFrame*)m_frame; wxAuiMDIClientWindow* client_window = mdi_frame->GetClientWindow(); - wxASSERT_MSG(client_window, wxT("Client window is NULL!")); + wxASSERT_MSG(client_window, wxT("Client window is null!")); AddPane(client_window, wxAuiPaneInfo().Name(wxT("mdiclient")). @@ -943,7 +943,7 @@ void wxAuiManager::UnInit() if (m_frame) { m_frame->RemoveEventHandler(this); - m_frame = NULL; + m_frame = nullptr; } } @@ -987,7 +987,7 @@ void wxAuiManager::SetArtProvider(wxAuiDockArt* art_provider) bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) { - wxASSERT_MSG(window, wxT("NULL window ptrs are not allowed")); + wxASSERT_MSG(window, wxT("null window ptrs are not allowed")); // check if the pane has a valid window if (!window) @@ -1056,7 +1056,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), + (unsigned int)time(nullptr), (unsigned int)clock(), (unsigned long)m_panes.GetCount()); } @@ -1144,7 +1144,7 @@ bool wxAuiManager::AddPane(wxWindow* window, bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& paneInfo, int insert_level) { - wxASSERT_MSG(window, wxT("NULL window ptrs are not allowed")); + wxASSERT_MSG(window, wxT("null window ptrs are not allowed")); // shift the panes around, depending on the insert level switch (insert_level) @@ -1206,7 +1206,7 @@ bool wxAuiManager::InsertPane(wxWindow* window, const wxAuiPaneInfo& paneInfo, // method will not destroy the window that is removed. bool wxAuiManager::DetachPane(wxWindow* window) { - wxASSERT_MSG(window, wxT("NULL window ptrs are not allowed")); + wxASSERT_MSG(window, wxT("null window ptrs are not allowed")); int i, count; for (i = 0, count = m_panes.GetCount(); i < count; ++i) @@ -1228,13 +1228,13 @@ bool wxAuiManager::DetachPane(wxWindow* window) // reparent to m_frame and destroy the pane if (m_actionWindow == p.frame) { - m_actionWindow = NULL; + m_actionWindow = nullptr; } p.window->Reparent(m_frame); - p.frame->SetSizer(NULL); + p.frame->SetSizer(nullptr); p.frame->Destroy(); - p.frame = NULL; + p.frame = nullptr; } // make sure there are no references to this pane in our uiparts, @@ -1286,7 +1286,7 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& paneInfo) if (paneInfo.frame) { paneInfo.frame->Destroy(); - paneInfo.frame = NULL; + paneInfo.frame = nullptr; } // now we need to either destroy or hide the pane @@ -1927,7 +1927,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeDockSizer; part.orientation = orientation; part.dock = &dock; - part.pane = NULL; + part.pane = nullptr; part.button = 0; part.cont_sizer = cont; part.sizer_item = sizer_item; @@ -1969,7 +1969,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeBackground; part.dock = &dock; - part.pane = NULL; + part.pane = nullptr; part.button = 0; part.orientation = (orientation==wxHORIZONTAL) ? wxVERTICAL:wxHORIZONTAL; part.cont_sizer = dock_sizer; @@ -1989,7 +1989,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeBackground; part.dock = &dock; - part.pane = NULL; + part.pane = nullptr; part.button = 0; part.orientation = orientation; part.cont_sizer = dock_sizer; @@ -2032,7 +2032,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeDock; part.dock = &dock; - part.pane = NULL; + part.pane = nullptr; part.button = 0; part.orientation = orientation; part.cont_sizer = cont; @@ -2054,7 +2054,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeDockSizer; part.dock = &dock; - part.pane = NULL; + part.pane = nullptr; part.button = 0; part.orientation = orientation; part.cont_sizer = cont; @@ -2330,8 +2330,8 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, // create a bunch of box sizers, // from the innermost level outwards. - wxSizer* cont = NULL; - wxSizer* middle = NULL; + wxSizer* cont = nullptr; + wxSizer* middle = nullptr; int layer = 0; int row, row_count; @@ -2392,8 +2392,8 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND); wxAuiDockUIPart part; part.type = wxAuiDockUIPart::typeBackground; - part.pane = NULL; - part.dock = NULL; + part.pane = nullptr; + part.dock = nullptr; part.button = 0; part.cont_sizer = middle; part.sizer_item = sizer_item; @@ -2438,8 +2438,8 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, wxSizerItem* sizer_item = cont->Add(1,1, 1, wxEXPAND); wxAuiDockUIPart part; part.type = wxAuiDockUIPart::typeBackground; - part.pane = NULL; - part.dock = NULL; + part.pane = nullptr; + part.dock = nullptr; part.button = 0; part.cont_sizer = middle; part.sizer_item = sizer_item; @@ -2478,8 +2478,8 @@ void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct) void wxAuiManager::Update() { - m_hoverButton = NULL; - m_actionPart = NULL; + m_hoverButton = nullptr; + m_actionPart = nullptr; wxSizer* sizer; int i, pane_count = m_panes.GetCount(); @@ -2511,7 +2511,7 @@ void wxAuiManager::Update() if (wxWindow::GetCapture() == m_frame) m_frame->ReleaseMouse(); m_action = actionNone; - m_actionWindow = NULL; + m_actionWindow = nullptr; } // hide the frame @@ -2520,9 +2520,9 @@ void wxAuiManager::Update() // reparent to m_frame and destroy the pane p.window->Reparent(m_frame); - p.frame->SetSizer(NULL); + p.frame->SetSizer(nullptr); p.frame->Destroy(); - p.frame = NULL; + p.frame = nullptr; } } @@ -2542,7 +2542,7 @@ void wxAuiManager::Update() #endif // __WXMSW__ // delete old sizer first - m_frame->SetSizer(NULL); + m_frame->SetSizer(nullptr); // create a layout for all of the panes sizer = LayoutAll(m_panes, m_docks, m_uiParts, false); @@ -2555,7 +2555,7 @@ void wxAuiManager::Update() if (p.IsFloating()) { - if (p.frame == NULL) + if (p.frame == nullptr) { // we need to create a frame for this // pane, which has recently been floated @@ -2762,7 +2762,7 @@ wxAuiDockUIPart* wxAuiManager::GetPanePart(wxWindow* wnd) part.pane && part.pane->window == wnd) return ∂ } - return NULL; + return nullptr; } @@ -3886,7 +3886,7 @@ void wxAuiManager::Render(wxDC* dc) void wxAuiManager::Repaint(wxDC* dc) { #ifdef __WXMAC__ - if ( dc == NULL ) + if ( dc == nullptr ) { m_frame->Refresh() ; m_frame->Update() ; @@ -3899,7 +3899,7 @@ void wxAuiManager::Repaint(wxDC* dc) // figure out which dc to use; if one // has been specified, use it, otherwise // make a client dc - wxClientDC* client_dc = NULL; + wxClientDC* client_dc = nullptr; if (!dc) { client_dc = new wxClientDC(m_frame); @@ -3984,11 +3984,11 @@ void wxAuiManager::OnSize(wxSizeEvent& event) void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt) { - // get the window we are managing, if none, return NULL + // get the window we are managing, if none, return nullptr wxWindow* window = GetManagedWindow(); if (!window) { - evt.SetManager(NULL); + evt.SetManager(nullptr); return; } @@ -4459,7 +4459,7 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) } else if (m_action == actionClickButton) { - m_hoverButton = NULL; + m_hoverButton = nullptr; m_frame->ReleaseMouse(); if (m_actionPart) @@ -4711,7 +4711,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) { if (m_hoverButton) { - m_hoverButton = NULL; + m_hoverButton = nullptr; Repaint(); } else @@ -4726,7 +4726,7 @@ void wxAuiManager::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) { if (m_hoverButton) { - m_hoverButton = NULL; + m_hoverButton = nullptr; Repaint(); } } diff --git a/src/aui/tabart.cpp b/src/aui/tabart.cpp index 99424d241f..b1b1d92af7 100644 --- a/src/aui/tabart.cpp +++ b/src/aui/tabart.cpp @@ -177,7 +177,7 @@ wxAuiGenericTabArt::wxAuiGenericTabArt() m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); m_measuringFont = m_selectedFont; - m_fixedTabWidth = wxWindow::FromDIP(100, NULL); + m_fixedTabWidth = wxWindow::FromDIP(100, nullptr); m_tabCtrlHeight = 0; m_flags = 0; @@ -656,7 +656,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, int wxAuiGenericTabArt::GetIndentSize() { - return wxWindow::FromDIP(5, NULL); + return wxWindow::FromDIP(5, nullptr); } int wxAuiGenericTabArt::GetBorderWidth(wxWindow* wnd) @@ -817,7 +817,7 @@ int wxAuiGenericTabArt::ShowDropDown(wxWindow* wnd, if (caption.IsEmpty()) caption = wxT(" "); - wxMenuItem* item = new wxMenuItem(NULL, 1000+i, caption); + wxMenuItem* item = new wxMenuItem(nullptr, 1000+i, caption); if (page.bitmap.IsOk()) item->SetBitmap(page.bitmap.GetBitmapFor(wnd)); menuPopup.Append(item); @@ -938,7 +938,7 @@ wxAuiSimpleTabArt::wxAuiSimpleTabArt() m_measuringFont = m_selectedFont; m_flags = 0; - m_fixedTabWidth = wxWindow::FromDIP(100, NULL); + m_fixedTabWidth = wxWindow::FromDIP(100, nullptr); wxColour baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); diff --git a/src/aui/tabartgtk.cpp b/src/aui/tabartgtk.cpp index ac59c2e219..adb6784db0 100644 --- a/src/aui/tabartgtk.cpp +++ b/src/aui/tabartgtk.cpp @@ -69,7 +69,7 @@ void wxAuiGtkTabArt::DrawBackground(wxDC& dc, wxWindow* WXUNUSED(wnd), const wxR window, true, GTK_STATE_NORMAL, - NULL, + nullptr, rect.x, rect.y, rect.width, rect.height); } @@ -84,7 +84,7 @@ void wxAuiGtkTabArt::DrawBorder(wxDC& WXUNUSED(dc), wxWindow* wnd, const wxRect& GtkStyle *style_notebook = gtk_widget_get_style(wxGTKPrivate::GetNotebookWidget()); gtk_paint_box(style_notebook, wnd->GTKGetDrawingWindow(), GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, wnd->m_wxwindow, + nullptr, wnd->m_wxwindow, const_cast("notebook"), rect.x + generic_border_width + 1, rect.y + generic_border_width + 1, rect.width - (generic_border_width + 1), rect.height - (generic_border_width + 1)); @@ -183,7 +183,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p gtk_widget_style_get(wxGTKPrivate::GetNotebookWidget(), "focus-line-width", &focus_width, - NULL); + nullptr); int tab_pos; if (m_flags &wxAUI_NB_BOTTOM) @@ -250,7 +250,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p // have transparent gaps and a line would be visible at the bottom of the tab if (page.active) gtk_paint_box(style_notebook, window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, - NULL, widget, + nullptr, widget, const_cast("notebook"), gap_rect_x, gap_rect_y, gap_rect_width, gap_rect_height); @@ -260,7 +260,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p if (page.active) { gtk_paint_box_gap(style_notebook, window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, + nullptr, widget, const_cast("notebook"), gap_rect_x, gap_rect_y, gap_rect_width, gap_rect_height, @@ -279,7 +279,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p if (page.active) { gtk_paint_box_gap(style_notebook, window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, + nullptr, widget, const_cast("notebook"), gap_rect_x, gap_rect_y, gap_rect_width, gap_rect_height, @@ -298,7 +298,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p // otherwise we don't get a gap-box, if the active tab is invisible if (!page.active) gtk_paint_box(style_notebook, window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, widget, + nullptr, widget, const_cast("notebook"), gap_rect_x, gap_rect_y, gap_rect_width, gap_rect_height); @@ -359,7 +359,7 @@ void wxAuiGtkTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& p if((focus_area.x + focus_area.width) > (area.x + area.width)) focus_area.width = area.x + area.width - focus_area.x + focus_width - GTK_NOTEBOOK (wxGTKPrivate::GetNotebookWidget())->tab_vborder; gtk_paint_focus (style_notebook, window, - GTK_STATE_ACTIVE, NULL, widget, "tab", + GTK_STATE_ACTIVE, nullptr, widget, "tab", focus_area.x, focus_area.y, focus_area.width, focus_area.height); } @@ -397,7 +397,7 @@ wxRect DrawSimpleArrow(wxDC& dc, gtk_widget_style_get(widget, "scroll-arrow-hlength", &scroll_arrow_hlength, "scroll-arrow-vlength", &scroll_arrow_vlength, - NULL); + nullptr); GtkStateType state; GtkShadowType shadow; @@ -415,7 +415,7 @@ wxRect DrawSimpleArrow(wxDC& dc, wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); GdkWindow* window = impldc->GetGDKWindow(); - gtk_paint_arrow (gtk_widget_get_style(wxGTKPrivate::GetButtonWidget()), window, state, shadow, NULL, widget, "notebook", + gtk_paint_arrow (gtk_widget_get_style(wxGTKPrivate::GetButtonWidget()), window, state, shadow, nullptr, widget, "notebook", arrow_type, TRUE, out_rect.x, out_rect.y, out_rect.width, out_rect.height); return out_rect; @@ -437,7 +437,7 @@ void wxAuiGtkTabArt::DrawButton(wxDC& dc, wxWindow* wnd, { case wxAUI_BUTTON_CLOSE: rect.y -= 2 * gtk_widget_get_style(wxGTKPrivate::GetButtonWidget())->ythickness; - rect = DrawCloseButton(dc, widget, button_state, rect, orientation, NULL); + rect = DrawCloseButton(dc, widget, button_state, rect, orientation, nullptr); break; case wxAUI_BUTTON_LEFT: @@ -502,7 +502,7 @@ wxSize wxAuiGtkTabArt::GetTabSize(wxDC& dc, int overlap = 0; gtk_widget_style_get (wnd->GetHandle(), "focus-line-width", &overlap, - NULL); + nullptr); *x_extent -= overlap; return s; } diff --git a/src/aui/tabartmsw.cpp b/src/aui/tabartmsw.cpp index 2ebda36065..0f663a0641 100644 --- a/src/aui/tabartmsw.cpp +++ b/src/aui/tabartmsw.cpp @@ -69,7 +69,7 @@ void wxAuiMSWTabArt::DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect) TABP_PANE, 0, &r, - NULL); + nullptr); } void wxAuiMSWTabArt::DrawBackground(wxDC& dc, @@ -109,7 +109,7 @@ void wxAuiMSWTabArt::DrawBackground(wxDC& dc, TABP_PANE, 0, &r, - NULL); + nullptr); } void wxAuiMSWTabArt::DrawTab(wxDC& dc, @@ -178,7 +178,7 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc, wxCopyRectToRECT(tabRect, tabR); ::DrawThemeBackground(hTabTheme, GetHdcOf(dc.GetTempHDC()), TABP_TABITEM, tabState, - &tabR, NULL); + &tabR, nullptr); // Apparently, in at least some Windows 10 installations the call above // does not draw the left edge of the first tab and it needs to be drawn @@ -192,7 +192,7 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc, TABP_TABITEMLEFTEDGE, tabState, &tabR, - NULL + nullptr ); } @@ -239,7 +239,7 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc, RECT btnR; wxCopyRectToRECT(rect, btnR); - ::DrawThemeBackground(hToolTipTheme, GetHdcOf(dc.GetTempHDC()), TTP_CLOSE, btnState, &btnR, NULL); + ::DrawThemeBackground(hToolTipTheme, GetHdcOf(dc.GetTempHDC()), TTP_CLOSE, btnState, &btnR, nullptr); if ( out_button_rect ) *out_button_rect = rect; @@ -253,7 +253,7 @@ void wxAuiMSWTabArt::DrawTab(wxDC& dc, int wxAuiMSWTabArt::GetIndentSize() { if ( IsThemed() ) - return wxWindow::FromDIP(3, NULL); // This should be 1 but we can't draw into the border from DrawTab + return wxWindow::FromDIP(3, nullptr); // This should be 1 but we can't draw into the border from DrawTab else return wxAuiGenericTabArt::GetIndentSize(); } @@ -267,7 +267,7 @@ int wxAuiMSWTabArt::GetAdditionalBorderSpace(wxWindow* wnd) { if ( IsThemed() ) { - return wnd->FromDIP(4, NULL); + return wnd->FromDIP(4, nullptr); } else return wxAuiGenericTabArt::GetAdditionalBorderSpace(wnd); @@ -350,7 +350,7 @@ void wxAuiMSWTabArt::DrawButton(wxDC& dc, return; } - const wchar_t* themeId = NULL; + const wchar_t* themeId = nullptr; int part = 0; switch (bitmap_id) @@ -417,7 +417,7 @@ void wxAuiMSWTabArt::DrawButton(wxDC& dc, RECT btnR; wxCopyRectToRECT(btnRect, btnR); - ::DrawThemeBackground(hTheme, GetHdcOf(dc.GetTempHDC()), part, btnState, &btnR, NULL); + ::DrawThemeBackground(hTheme, GetHdcOf(dc.GetTempHDC()), part, btnState, &btnR, nullptr); if ( out_rect ) *out_rect = rect; @@ -445,12 +445,12 @@ void wxAuiMSWTabArt::InitSizes(wxWindow* wnd, wxDC& dc) wxUxThemeHandle hTooltipTheme(wnd, L"Tooltip"); ::GetThemePartSize(hTooltipTheme, GetHdcOf(dc.GetTempHDC()), - TTP_CLOSE, 0, NULL, TS_TRUE, &uxSize); + TTP_CLOSE, 0, nullptr, TS_TRUE, &uxSize); m_closeBtnSize.Set(uxSize.cx, uxSize.cy); wxUxThemeHandle hTabTheme(wnd, L"Tab"); ::GetThemePartSize(hTabTheme, GetHdcOf(dc.GetTempHDC()), - TABP_TABITEM, 0, NULL, TS_TRUE, &uxSize); + TABP_TABITEM, 0, nullptr, TS_TRUE, &uxSize); m_tabSize.Set(uxSize.cx, uxSize.cy); } diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 50ede3a8d0..2a244fad30 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -115,7 +115,7 @@ bool wxAuiMDIParentFrame::Create(wxWindow *parent, return false; m_pClientWindow = OnCreateClient(); - return m_pClientWindow != NULL; + return m_pClientWindow != nullptr; } @@ -130,7 +130,7 @@ void wxAuiMDIParentFrame::SetArtProvider(wxAuiTabArt* provider) wxAuiTabArt* wxAuiMDIParentFrame::GetArtProvider() { if (!m_pClientWindow) - return NULL; + return nullptr; return m_pClientWindow->GetArtProvider(); } @@ -186,15 +186,15 @@ void wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame* pChild) SetMenuBar(GetMenuBar()); // Make sure we know our menu bar is in use - m_pMyMenuBar = NULL; + m_pMyMenuBar = nullptr; } else { - if (pChild->GetMenuBar() == NULL) + if (pChild->GetMenuBar() == nullptr) return; // Do we need to save the current bar? - if (m_pMyMenuBar == NULL) + if (m_pMyMenuBar == nullptr) m_pMyMenuBar = GetMenuBar(); SetMenuBar(pChild->GetMenuBar()); @@ -234,7 +234,7 @@ bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event) res = wxEvtHandler::ProcessEvent(event); } - m_pLastEvt = NULL; + m_pLastEvt = nullptr; return res; } @@ -250,7 +250,7 @@ void wxAuiMDIParentFrame::OnClose(wxCloseEvent& event) bool wxAuiMDIParentFrame::CloseAll() { wxAuiMDIChildFrame* pActiveChild; - while ((pActiveChild = GetActiveChild()) != NULL) + while ((pActiveChild = GetActiveChild()) != nullptr) { if (!pActiveChild->Close()) { @@ -267,7 +267,7 @@ wxAuiMDIChildFrame *wxAuiMDIParentFrame::GetActiveChild() const // We can be called before the client window is created, so check for its // existence. wxAuiMDIClientWindow* const client = GetClientWindow(); - return client ? client->GetActiveChild() : NULL; + return client ? client->GetActiveChild() : nullptr; } void wxAuiMDIParentFrame::SetActiveChild(wxAuiMDIChildFrame* pChildFrame) @@ -315,11 +315,11 @@ void wxAuiMDIParentFrame::ActivatePrevious() void wxAuiMDIParentFrame::Init() { - m_pLastEvt = NULL; - m_pClientWindow = NULL; + m_pLastEvt = nullptr; + m_pClientWindow = nullptr; #if wxUSE_MENUS - m_pWindowMenu = NULL; - m_pMyMenuBar = NULL; + m_pWindowMenu = nullptr; + m_pMyMenuBar = nullptr; #endif // wxUSE_MENUS } @@ -478,8 +478,8 @@ wxAuiMDIChildFrame::~wxAuiMDIChildFrame() { if (pParentFrame->GetActiveChild() == this) { - pParentFrame->SetActiveChild(NULL); - pParentFrame->SetChildMenuBar(NULL); + pParentFrame->SetActiveChild(nullptr); + pParentFrame->SetChildMenuBar(nullptr); } wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); wxASSERT(pClientWindow); @@ -504,7 +504,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, const wxString& name) { wxAuiMDIClientWindow* pClientWindow = parent->GetClientWindow(); - wxASSERT_MSG((pClientWindow != NULL), wxT("Missing MDI client window.")); + wxASSERT_MSG((pClientWindow != nullptr), wxT("Missing MDI client window.")); // see comment in constructor if (style & wxMINIMIZE) @@ -555,7 +555,7 @@ bool wxAuiMDIChildFrame::Destroy() event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); - pParentFrame->SetChildMenuBar(NULL); + pParentFrame->SetChildMenuBar(nullptr); } size_t page_count = pClientWindow->GetPageCount(); @@ -584,7 +584,7 @@ void wxAuiMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar) { // replace current menu bars if (pOldMenuBar) - pParentFrame->SetChildMenuBar(NULL); + pParentFrame->SetChildMenuBar(nullptr); pParentFrame->SetChildMenuBar(this); } } @@ -604,7 +604,7 @@ void wxAuiMDIChildFrame::SetTitle(const wxString& title) wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame")); wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); - if (pClientWindow != NULL) + if (pClientWindow != nullptr) { size_t pos; for (pos = 0; pos < pClientWindow->GetPageCount(); pos++) @@ -631,7 +631,7 @@ void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons) bmp.CopyFromIcon(icons.GetIcon(sizeIcon)); wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); - if (pClientWindow != NULL) + if (pClientWindow != nullptr) { int idx = pClientWindow->GetPageIndex(this); @@ -649,7 +649,7 @@ void wxAuiMDIChildFrame::Activate() wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); - if (pClientWindow != NULL) + if (pClientWindow != nullptr) { size_t pos; for (pos = 0; pos < pClientWindow->GetPageCount(); pos++) @@ -690,9 +690,9 @@ wxAuiMDIParentFrame* wxAuiMDIChildFrame::GetMDIParentFrame() const void wxAuiMDIChildFrame::Init() { m_activateOnCreate = true; - m_pMDIParentFrame = NULL; + m_pMDIParentFrame = nullptr; #if wxUSE_MENUS - m_pMenuBar = NULL; + m_pMenuBar = nullptr; #endif // wxUSE_MENUS } @@ -760,7 +760,7 @@ wxAuiMDIChildFrame* wxAuiMDIClientWindow::GetActiveChild() { const int sel = GetSelection(); if ( sel == wxNOT_FOUND || sel >= (int)GetPageCount() ) - return NULL; + return nullptr; return wxStaticCast(GetPage(sel), wxAuiMDIChildFrame); } diff --git a/src/common/accelcmn.cpp b/src/common/accelcmn.cpp index bc113eda54..176862e4fa 100644 --- a/src/common/accelcmn.cpp +++ b/src/common/accelcmn.cpp @@ -307,14 +307,14 @@ wxAcceleratorEntry *wxAcceleratorEntry::Create(const wxString& str) { // It's ok to pass strings not containing any accelerators at all to // this function, wxMenuItem code does it and we should just return - // NULL in this case. - return NULL; + // nullptr in this case. + return nullptr; } int flags, keyCode; if ( !ParseAccel(accelStr, &flags, &keyCode) ) - return NULL; + return nullptr; return new wxAcceleratorEntry(flags, keyCode); } diff --git a/src/common/animatecmn.cpp b/src/common/animatecmn.cpp index 59885e6868..1f6361530d 100644 --- a/src/common/animatecmn.cpp +++ b/src/common/animatecmn.cpp @@ -202,7 +202,7 @@ void wxAnimationCtrlBase::SetInactiveBitmap(const wxBitmapBundle &bmp) void wxAnimation::AddHandler( wxAnimationDecoder *handler ) { // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) + if (FindHandler( handler->GetType() ) == nullptr) { sm_handlers.Append( handler ); } @@ -222,7 +222,7 @@ void wxAnimation::AddHandler( wxAnimationDecoder *handler ) void wxAnimation::InsertHandler( wxAnimationDecoder *handler ) { // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) + if (FindHandler( handler->GetType() ) == nullptr) { sm_handlers.Insert( handler ); } @@ -244,7 +244,7 @@ const wxAnimationDecoder *wxAnimation::FindHandler( wxAnimationType animType ) if (handler->GetType() == animType) return handler; node = node->GetNext(); } - return 0; + return nullptr; } void wxAnimation::InitStandardHandlers() diff --git a/src/common/any.cpp b/src/common/any.cpp index 815045faa4..e203228e10 100644 --- a/src/common/any.cpp +++ b/src/common/any.cpp @@ -110,7 +110,7 @@ public: } // Nothing found - return NULL; + return nullptr; } private: @@ -185,7 +185,7 @@ bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) wxVariantDataFactory f = GetAnyValueTypeGlobals()->FindVariantDataFactory(any.GetType()); - wxVariantData* data = NULL; + wxVariantData* data = nullptr; if ( f ) { @@ -524,7 +524,7 @@ public: virtual const wxTypeInfo* GetTypeInfo() const { wxFAIL_MSG("Null Type Info not available"); - return NULL; + return nullptr; } #endif diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index d0f90d1374..46faf130c8 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -97,7 +97,7 @@ const wxString& func, const wxString& cond, const wxString& msg, - wxAppTraits *traits = NULL); + wxAppTraits *traits = nullptr); #endif // wxDEBUG_LEVEL #ifdef __WXDEBUG__ @@ -109,11 +109,11 @@ // global vars // ---------------------------------------------------------------------------- -wxAppConsole *wxAppConsoleBase::ms_appInstance = NULL; +wxAppConsole *wxAppConsoleBase::ms_appInstance = nullptr; -wxAppInitializerFunction wxAppConsoleBase::ms_appInitFn = NULL; +wxAppInitializerFunction wxAppConsoleBase::ms_appInitFn = nullptr; -wxSocketManager *wxAppTraitsBase::ms_manager = NULL; +wxSocketManager *wxAppTraitsBase::ms_manager = nullptr; WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; @@ -134,8 +134,8 @@ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopBase) wxAppConsoleBase::wxAppConsoleBase() { - m_traits = NULL; - m_mainLoop = NULL; + m_traits = nullptr; + m_mainLoop = nullptr; m_bDoPendingEventProcessing = true; ms_appInstance = reinterpret_cast(this); @@ -159,7 +159,7 @@ wxAppConsoleBase::~wxAppConsoleBase() // we're being destroyed and using this object from now on may not work or // even crash so don't leave dangling pointers to it - ms_appInstance = NULL; + ms_appInstance = nullptr; delete m_traits; } @@ -185,7 +185,7 @@ wxString wxAppConsoleBase::GetAppName() const if ( argv ) { // the application name is, by default, the name of its executable file - wxFileName::SplitPath(argv[0], NULL, &name, NULL); + wxFileName::SplitPath(argv[0], nullptr, &name, nullptr); } #if wxUSE_STDPATHS else // fall back to the executable file name, if we can determine it @@ -193,7 +193,7 @@ wxString wxAppConsoleBase::GetAppName() const const wxString pathExe = wxStandardPaths::Get().GetExecutablePath(); if ( !pathExe.empty() ) { - wxFileName::SplitPath(pathExe, NULL, &name, NULL); + wxFileName::SplitPath(pathExe, nullptr, &name, nullptr); } } #endif // wxUSE_STDPATHS @@ -226,7 +226,7 @@ void wxAppConsoleBase::CleanUp() { #if wxUSE_CONFIG // Delete the global wxConfig object, if any, and reset it. - delete wxConfigBase::Set(NULL); + delete wxConfigBase::Set(nullptr); #endif // wxUSE_CONFIG wxDELETE(m_mainLoop); @@ -291,7 +291,7 @@ int wxAppConsoleBase::OnExit() void wxAppConsoleBase::Exit() { - if (m_mainLoop != NULL) + if (m_mainLoop != nullptr) ExitMainLoop(); else exit(-1); @@ -323,7 +323,7 @@ wxAppTraits *wxAppConsoleBase::GetTraits() wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() { wxAppConsole * const app = GetInstance(); - return app ? app->GetTraits() : NULL; + return app ? app->GetTraits() : nullptr; } /* static */ @@ -418,7 +418,7 @@ bool wxAppConsoleBase::UsesEventLoop() const { // in console applications we don't know whether we're going to have an // event loop so assume we won't -- unless we already have one running - return wxEventLoopBase::GetActive() != NULL; + return wxEventLoopBase::GetActive() != nullptr; } // ---------------------------------------------------------------------------- @@ -430,7 +430,7 @@ bool wxAppConsoleBase::IsMainLoopRunning() { const wxAppConsole * const app = GetInstance(); - return app && app->m_mainLoop != NULL; + return app && app->m_mainLoop != nullptr; } int wxAppConsoleBase::FilterEvent(wxEvent& WXUNUSED(event)) @@ -740,7 +740,7 @@ void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser& parser) #if wxUSE_LOG { wxCMD_LINE_SWITCH, - NULL, + nullptr, OPTION_VERBOSE, gettext_noop("generate verbose log messages"), wxCMD_LINE_VAL_NONE, @@ -839,7 +839,7 @@ void wxAppConsoleBase::OnAssert(const wxChar *file, const wxChar *cond, const wxChar *msg) { - OnAssertFailure(file, line, NULL, cond, msg); + OnAssertFailure(file, line, nullptr, cond, msg); } // ---------------------------------------------------------------------------- @@ -888,7 +888,7 @@ wxFontMapper *wxConsoleAppTraitsBase::CreateFontMapper() wxRendererNative *wxConsoleAppTraitsBase::CreateRenderer() { // console applications don't use renderers - return NULL; + return nullptr; } bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString& msg) @@ -1175,7 +1175,7 @@ void wxOnAssert(const wxChar *file, { // this is the backwards-compatible version (unless we don't use Unicode) // so it could be called directly from the user code and this might happen - // even when wxTheAssertHandler is NULL + // even when wxTheAssertHandler is null #if wxUSE_UNICODE if ( wxTheAssertHandler ) #endif // wxUSE_UNICODE @@ -1269,7 +1269,7 @@ bool DoShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); - switch ( ::MessageBox(NULL, msgDlg.t_str(), wxT("wxWidgets Debug Alert"), + switch ( ::MessageBox(nullptr, msgDlg.t_str(), wxT("wxWidgets Debug Alert"), MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONSTOP ) ) { case IDYES: diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index bd05a6d895..c752a09b43 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -59,7 +59,7 @@ WX_CHECK_BUILD_OPTIONS("wxCore") wxAppBase::wxAppBase() { - m_topWindow = NULL; + m_topWindow = nullptr; m_useBestVisual = false; m_forceTrueColour = false; @@ -174,7 +174,7 @@ wxWindow* wxAppBase::GetTopWindow() const // we need to search for the first TLW which is not pending delete if ( !window || wxPendingDelete.Member(window) ) { - window = NULL; + window = nullptr; wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); while ( node ) { @@ -196,7 +196,7 @@ wxWindow* wxAppBase::GetMainTopWindow() { const wxAppBase* const app = GetGUIInstance(); - return app ? app->GetTopWindow() : NULL; + return app ? app->GetTopWindow() : nullptr; } wxVideoMode wxAppBase::GetDisplayMode() const @@ -238,7 +238,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) #ifdef __WXUNIVERSAL__ { wxCMD_LINE_OPTION, - NULL, + nullptr, OPTION_THEME, gettext_noop("specify the theme to use"), wxCMD_LINE_VAL_STRING, @@ -252,7 +252,7 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) // and not dfb/app.cpp { wxCMD_LINE_OPTION, - NULL, + nullptr, OPTION_MODE, gettext_noop("specify display mode to use (e.g. 640x480-16)"), wxCMD_LINE_VAL_STRING, @@ -337,7 +337,7 @@ int wxAppBase::OnRun() int wxAppBase::OnExit() { #ifdef __WXUNIVERSAL__ - delete wxTheme::Set(NULL); + delete wxTheme::Set(nullptr); #endif // __WXUNIVERSAL__ return wxAppConsole::OnExit(); @@ -465,7 +465,7 @@ wxFontMapper *wxGUIAppTraitsBase::CreateFontMapper() wxRendererNative *wxGUIAppTraitsBase::CreateRenderer() { // use the default native renderer by default - return NULL; + return nullptr; } bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) @@ -505,7 +505,7 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) #endif // wxUSE_STACKWALKER #if wxUSE_RICHMSGDLG - wxRichMessageDialog dlg(NULL, msgDlg, caption, flags); + wxRichMessageDialog dlg(nullptr, msgDlg, caption, flags); dlg.SetYesNoLabels("Stop", "Continue"); @@ -525,7 +525,7 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); - wxMessageDialog dlg(NULL, msg, caption, flags); + wxMessageDialog dlg(nullptr, msg, caption, flags); #endif // wxUSE_RICHMSGDLG/!wxUSE_RICHMSGDLG switch ( dlg.ShowModal() ) diff --git a/src/common/arcfind.cpp b/src/common/arcfind.cpp index f32cff78fc..1cc32cbd56 100644 --- a/src/common/arcfind.cpp +++ b/src/common/arcfind.cpp @@ -25,7 +25,7 @@ wxArchiveClassFactory::Find(const wxString& protocol, wxStreamProtocolType type) if (f->CanHandle(protocol, type)) return f; - return NULL; + return nullptr; } // static diff --git a/src/common/archive.cpp b/src/common/archive.cpp index d3b772514c..370eda4bcd 100644 --- a/src/common/archive.cpp +++ b/src/common/archive.cpp @@ -66,7 +66,7 @@ void wxArchiveEntry::SetNotifier(wxArchiveNotifier& notifier) wxArchiveEntry& wxArchiveEntry::operator=(const wxArchiveEntry& WXUNUSED(e)) { - m_notifier = NULL; + m_notifier = nullptr; return *this; } @@ -74,7 +74,7 @@ wxArchiveEntry& wxArchiveEntry::operator=(const wxArchiveEntry& WXUNUSED(e)) ///////////////////////////////////////////////////////////////////////////// // wxArchiveClassFactory -wxArchiveClassFactory *wxArchiveClassFactory::sm_first = NULL; +wxArchiveClassFactory *wxArchiveClassFactory::sm_first = nullptr; void wxArchiveClassFactory::Remove() { diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index ccfd669910..1c41258f53 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -135,8 +135,8 @@ void wxArrayString::Init(bool autoSort) { m_nSize = m_nCount = 0; - m_pItems = NULL; - m_compareFunction = NULL; + m_pItems = nullptr; + m_compareFunction = nullptr; m_autoSort = autoSort; } @@ -183,7 +183,7 @@ wxString *wxArrayString::Grow(size_t nIncrement) if ( (m_nSize - m_nCount) >= nIncrement ) { // We already have enough space. - return NULL; + return nullptr; } // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would @@ -200,7 +200,7 @@ wxString *wxArrayString::Grow(size_t nIncrement) m_pItems = new wxString[m_nSize]; // Nothing to free, we hadn't had any memory before. - return NULL; + return nullptr; } else { // otherwise when it's called for the first time, nIncrement would be 0 diff --git a/src/common/artprov.cpp b/src/common/artprov.cpp index e5c724d6fa..1ac25a0add 100644 --- a/src/common/artprov.cpp +++ b/src/common/artprov.cpp @@ -211,8 +211,8 @@ private: wxIMPLEMENT_ABSTRACT_CLASS(wxArtProvider, wxObject); -wxArtProvidersList *wxArtProvider::sm_providers = NULL; -wxArtProviderCache *wxArtProvider::sm_cache = NULL; +wxArtProvidersList *wxArtProvider::sm_providers = nullptr; +wxArtProviderCache *wxArtProvider::sm_cache = nullptr; // ---------------------------------------------------------------------------- // wxArtProvider ctors/dtor diff --git a/src/common/base64.cpp b/src/common/base64.cpp index 1577c7f340..c8f30ae93a 100644 --- a/src/common/base64.cpp +++ b/src/common/base64.cpp @@ -16,7 +16,7 @@ size_t wxBase64Encode(char *dst, size_t dstLen, const void *src_, size_t srcLen) { - wxCHECK_MSG( src_, wxCONV_FAILED, wxT("NULL input buffer") ); + wxCHECK_MSG( src_, wxCONV_FAILED, wxT("null input buffer") ); const unsigned char *src = static_cast(src_); @@ -69,7 +69,7 @@ wxBase64Decode(void *dst_, size_t dstLen, wxBase64DecodeMode mode, size_t *posErr) { - wxCHECK_MSG( src, wxCONV_FAILED, wxT("NULL input buffer") ); + wxCHECK_MSG( src, wxCONV_FAILED, wxT("null input buffer") ); unsigned char *dst = static_cast(dst_); @@ -219,7 +219,7 @@ wxMemoryBuffer wxBase64Decode(const char *src, size_t *posErr) { wxMemoryBuffer buf; - wxCHECK_MSG( src, buf, wxT("NULL input buffer") ); + wxCHECK_MSG( src, buf, wxT("null input buffer") ); if ( srcLen == wxNO_LEN ) srcLen = strlen(src); diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp index aef0caf3bb..aa1608011b 100644 --- a/src/common/bmpbase.cpp +++ b/src/common/bmpbase.cpp @@ -145,7 +145,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) return handler; node = node->GetNext(); } - return NULL; + return nullptr; } wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType) @@ -159,7 +159,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapTy return handler; node = node->GetNext(); } - return NULL; + return nullptr; } wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) @@ -172,7 +172,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) return handler; node = node->GetNext(); } - return NULL; + return nullptr; } void wxBitmapBase::CleanUpHandlers() @@ -294,7 +294,7 @@ bool wxBitmapBase::UseAlpha(bool WXUNUSED(use)) wxBitmap::wxBitmap(const char* const* bits) { - wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data")); + wxCHECK2_MSG(bits != nullptr, return, wxT("invalid bitmap data")); #if wxUSE_IMAGE && wxUSE_XPM wxImage image(bits); diff --git a/src/common/bmpbndl.cpp b/src/common/bmpbndl.cpp index 244f711c9d..b108a67281 100644 --- a/src/common/bmpbndl.cpp +++ b/src/common/bmpbndl.cpp @@ -66,7 +66,7 @@ public: virtual wxClassInfo* GetValueClassInfo() override { - return NULL; + return nullptr; } virtual wxVariantData* Clone() const override @@ -311,7 +311,7 @@ wxBitmap wxBitmapBundleImplSet::GetBitmap(const wxSize& size) #ifdef __WXOSX__ void wxBitmapBundleImplSet::OSXCreateNSImage() { - WXImage image = NULL; + WXImage image = nullptr; const size_t n = m_entries.size(); if ( n == 1 ) { @@ -366,17 +366,17 @@ wxBitmapBundle::wxBitmapBundle(wxBitmapBundleImpl* impl) } wxBitmapBundle::wxBitmapBundle(const wxBitmap& bitmap) - : m_impl(bitmap.IsOk() ? new wxBitmapBundleImplSet(bitmap) : NULL) + : m_impl(bitmap.IsOk() ? new wxBitmapBundleImplSet(bitmap) : nullptr) { } wxBitmapBundle::wxBitmapBundle(const wxIcon& icon) - : m_impl(icon.IsOk() ? new wxBitmapBundleImplSet(wxBitmap(icon)) : NULL) + : m_impl(icon.IsOk() ? new wxBitmapBundleImplSet(wxBitmap(icon)) : nullptr) { } wxBitmapBundle::wxBitmapBundle(const wxImage& image) - : m_impl(image.IsOk() ? new wxBitmapBundleImplSet(wxBitmap(image)) : NULL) + : m_impl(image.IsOk() ? new wxBitmapBundleImplSet(wxBitmap(image)) : nullptr) { } @@ -403,7 +403,7 @@ wxBitmapBundle::~wxBitmapBundle() void wxBitmapBundle::Clear() { - m_impl.reset(NULL); + m_impl.reset(nullptr); } /* static */ @@ -672,8 +672,8 @@ wxImageList* wxBitmapBundle::CreateImageList(wxWindow* win, const wxVector& bundles) { - wxCHECK_MSG( win, NULL, "must have a valid window" ); - wxCHECK_MSG( !bundles.empty(), NULL, "should have some images" ); + wxCHECK_MSG( win, nullptr, "must have a valid window" ); + wxCHECK_MSG( !bundles.empty(), nullptr, "should have some images" ); wxSize size = GetConsensusSizeFor(win, bundles); diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index 7fcc20c247..6cf4bff9da 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -50,13 +50,13 @@ wxEND_EVENT_TABLE() void wxBookCtrlBase::Init() { m_selection = wxNOT_FOUND; - m_bookctrl = NULL; + m_bookctrl = nullptr; m_fitToCurrentPage = false; m_internalBorder = 5; m_controlMargin = 0; - m_controlSizer = NULL; + m_controlSizer = nullptr; Bind(wxEVT_DPI_CHANGED, &wxBookCtrlBase::WXHandleDPIChanged, this); } @@ -315,7 +315,7 @@ void wxBookCtrlBase::OnHelp(wxHelpEvent& event) if ( FindPage(source) != wxNOT_FOUND ) { // The event comes from our own page, don't send it back to it. - source = NULL; + source = nullptr; } else { @@ -336,7 +336,7 @@ void wxBookCtrlBase::OnHelp(wxHelpEvent& event) { // this event is for the book control itself, redirect it to the // corresponding page - wxWindow *page = NULL; + wxWindow *page = nullptr; if ( event.GetOrigin() == wxHelpEvent::Origin_HelpButton ) { @@ -386,7 +386,7 @@ wxBookCtrlBase::InsertPage(size_t nPage, int WXUNUSED(imageId)) { wxCHECK_MSG( page || AllowNullPage(), false, - wxT("NULL page in wxBookCtrlBase::InsertPage()") ); + wxT("null page in wxBookCtrlBase::InsertPage()") ); wxCHECK_MSG( nPage <= m_pages.size(), false, wxT("invalid page index in wxBookCtrlBase::InsertPage()") ); @@ -405,7 +405,7 @@ bool wxBookCtrlBase::DeletePage(size_t nPage) if ( !(page || AllowNullPage()) ) return false; - // delete NULL is harmless + // deleting null pointer is harmless delete page; return true; @@ -413,7 +413,7 @@ bool wxBookCtrlBase::DeletePage(size_t nPage) wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage) { - wxCHECK_MSG( nPage < m_pages.size(), NULL, + wxCHECK_MSG( nPage < m_pages.size(), nullptr, wxT("invalid page index in wxBookCtrlBase::DoRemovePage()") ); wxWindow *pageRemoved = m_pages[nPage]; diff --git a/src/common/btncmn.cpp b/src/common/btncmn.cpp index dca951f5cb..d2198111c2 100644 --- a/src/common/btncmn.cpp +++ b/src/common/btncmn.cpp @@ -98,7 +98,7 @@ wxWindow *wxButtonBase::SetDefault() wxTopLevelWindow * const tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - wxCHECK_MSG( tlw, NULL, wxT("button without top level window?") ); + wxCHECK_MSG( tlw, nullptr, wxT("button without top level window?") ); return tlw->SetDefaultItem(this); } diff --git a/src/common/cairo.cpp b/src/common/cairo.cpp index 441aa9c6dc..f4d0be8956 100644 --- a/src/common/cairo.cpp +++ b/src/common/cairo.cpp @@ -42,7 +42,7 @@ static wxCAIRO_METHOD_TYPE(name) name; #define wxCAIRO_STATIC_VOIDMETHOD_DEFINE(name, args, argnames) \ - wxCAIRO_STATIC_METHOD_DEFINE(void, name, args, argnames, NULL) + wxCAIRO_STATIC_METHOD_DEFINE(void, name, args, argnames, nullptr) #define wxFOR_ALL_CAIRO_VOIDMETHODS(m) \ m( cairo_append_path, \ @@ -191,50 +191,50 @@ #ifdef __WXMAC__ #define wxCAIRO_PLATFORM_METHODS(m) \ m( cairo_font_face_t*, cairo_quartz_font_face_create_for_cgfont, \ - (CGFontRef font), (font), NULL ) \ + (CGFontRef font), (font), nullptr ) \ m( cairo_surface_t*, cairo_quartz_surface_create_for_cg_context, \ - (CGContextRef cgContext, unsigned int width, unsigned int height), (cgContext, width, height), NULL ) + (CGContextRef cgContext, unsigned int width, unsigned int height), (cgContext, width, height), nullptr ) #elif defined(__WXMSW__) #define wxCAIRO_PLATFORM_METHODS(m) \ m( cairo_surface_t*, cairo_win32_surface_create, \ - (HDC hdc), (hdc), NULL ) \ + (HDC hdc), (hdc), nullptr ) \ m( cairo_surface_t*, cairo_win32_surface_create_with_format, \ - (HDC hdc, cairo_format_t format), (hdc, format), NULL ) \ + (HDC hdc, cairo_format_t format), (hdc, format), nullptr ) \ m( cairo_surface_t*, cairo_win32_printing_surface_create, \ - (HDC hdc), (hdc), NULL ) \ + (HDC hdc), (hdc), nullptr ) \ m( HDC, cairo_win32_surface_get_dc, \ - (cairo_surface_t *surface), (surface), NULL ) + (cairo_surface_t *surface), (surface), nullptr ) #else #define wxCAIRO_PLATFORM_METHODS(m) #endif #define wxFOR_ALL_CAIRO_METHODS(m) \ m( cairo_path_t*, cairo_copy_path, \ - (cairo_t *cr), (cr), NULL ) \ + (cairo_t *cr), (cr), nullptr ) \ m( cairo_t*, cairo_create, \ - (cairo_surface_t *target), (target), NULL) \ + (cairo_surface_t *target), (target), nullptr) \ m( cairo_surface_t*, cairo_get_target, \ - (cairo_t *cr), (cr), NULL) \ + (cairo_t *cr), (cr), nullptr) \ m( cairo_surface_t*, cairo_image_surface_create, \ - (cairo_format_t format, int width, int height), (format, width, height), NULL ) \ + (cairo_format_t format, int width, int height), (format, width, height), nullptr ) \ m( cairo_surface_t*, cairo_image_surface_create_for_data, \ - (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), NULL) \ + (unsigned char *data, cairo_format_t format, int width, int height, int stride), (data, format, width, height, stride), nullptr) \ m( cairo_bool_t, cairo_in_fill, \ (cairo_t *cr, double x, double y), (cr, x, y), false ) \ m( cairo_status_t, cairo_matrix_invert, \ - (cairo_matrix_t *matrix), (matrix), NULL) \ + (cairo_matrix_t *matrix), (matrix), nullptr) \ m( cairo_pattern_t*, cairo_pattern_create_for_surface, \ - (cairo_surface_t *surface), (surface), NULL) \ + (cairo_surface_t *surface), (surface), nullptr) \ m( cairo_pattern_t*, cairo_pattern_create_linear, \ - (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), NULL) \ + (double x0, double y0, double x1, double y1), (x0, y0, x1, y1), nullptr) \ m( cairo_pattern_t*, cairo_pattern_create_radial, \ - (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), NULL) \ + (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1), (cx0, cy0, radius0, cx1, cy1, radius1), nullptr) \ m( cairo_status_t, cairo_pattern_status, \ (cairo_pattern_t *pattern), (pattern), 4) \ m( cairo_t*, cairo_reference, \ - (cairo_t *cr), (cr), NULL ) \ + (cairo_t *cr), (cr), nullptr ) \ m( cairo_surface_t*, cairo_surface_create_similar, \ - (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), NULL) \ + (cairo_surface_t *other, cairo_content_t content, int width, int height), (other, content, width, height), nullptr) \ m( int, cairo_format_stride_for_width, \ (cairo_format_t format, int width), (format, width), 0) \ m( int, cairo_version, \ @@ -246,18 +246,18 @@ m( int, cairo_image_surface_get_stride, \ (cairo_surface_t *surface), (surface), 0) \ m( unsigned char *, cairo_image_surface_get_data, \ - (cairo_surface_t *surface), (surface), NULL) \ + (cairo_surface_t *surface), (surface), nullptr) \ m( cairo_format_t, cairo_image_surface_get_format, \ (cairo_surface_t *surface), (surface), CAIRO_FORMAT_INVALID) \ m( cairo_surface_type_t, cairo_surface_get_type, \ (cairo_surface_t *surface), (surface), -1) \ m( const char *, cairo_version_string, \ - (), () , NULL ) \ + (), () , nullptr ) \ m( cairo_surface_t*, cairo_surface_create_similar_image, \ - (cairo_surface_t *other, cairo_format_t format, int width, int height), (other, format, width, height), NULL) \ + (cairo_surface_t *other, cairo_format_t format, int width, int height), (other, format, width, height), nullptr) \ m( cairo_status_t, cairo_surface_status, \ (cairo_surface_t *surface), (surface), CAIRO_STATUS_SUCCESS) \ - m( cairo_font_options_t*, cairo_font_options_create, (), (), NULL ) \ + m( cairo_font_options_t*, cairo_font_options_create, (), (), nullptr ) \ wxCAIRO_PLATFORM_METHODS(m) #define wxCAIRO_DECLARE_TYPE(rettype, name, args, argnames, defret) \ @@ -265,7 +265,7 @@ wxCAIRO_METHOD_TYPE(name) wxDL_METHOD_NAME(name); #define wxCAIRO_DECLARE_VOIDTYPE(name, args, argnames) \ - wxCAIRO_DECLARE_TYPE(void, name, args, argnames, NULL) + wxCAIRO_DECLARE_TYPE(void, name, args, argnames, nullptr) wxFOR_ALL_CAIRO_VOIDMETHODS(wxCAIRO_DECLARE_VOIDTYPE) wxFOR_ALL_CAIRO_METHODS(wxCAIRO_DECLARE_TYPE) @@ -280,7 +280,7 @@ public: static void CleanUp(); private: - // the single wxCairo instance or NULL + // the single wxCairo instance or nullptr static wxCairo *ms_lib; wxCairo(); @@ -306,17 +306,17 @@ public: }; #define wxINIT_CAIRO_VOIDFUNC(name, params, args) \ - wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; + wxCAIRO_METHOD_TYPE(name) wxCairo::name = nullptr; #define wxINIT_CAIRO_FUNC(rettype, name, params, args, defret) \ - wxCAIRO_METHOD_TYPE(name) wxCairo::name = NULL; + wxCAIRO_METHOD_TYPE(name) wxCairo::name = nullptr; wxFOR_ALL_CAIRO_VOIDMETHODS(wxINIT_CAIRO_VOIDFUNC) wxFOR_ALL_CAIRO_METHODS(wxINIT_CAIRO_FUNC) #undef wxINIT_CAIRO_FUNC -wxCairo *wxCairo::ms_lib = NULL; +wxCairo *wxCairo::ms_lib = nullptr; //---------------------------------------------------------------------------- // wxCairoLibrary @@ -380,11 +380,11 @@ wxCairo::~wxCairo() if ( !ms_lib->m_ok ) { delete ms_lib; - ms_lib = NULL; + ms_lib = nullptr; } } - return ms_lib != NULL; + return ms_lib != nullptr; } /* static */ void wxCairo::CleanUp() @@ -392,7 +392,7 @@ wxCairo::~wxCairo() if (ms_lib) { delete ms_lib; - ms_lib = NULL; + ms_lib = nullptr; } } @@ -420,7 +420,7 @@ extern "C" } #define wxIMPL_CAIRO_VOIDFUNC(name, params, args) \ - wxIMPL_CAIRO_FUNC(void, name, params, args, NULL) + wxIMPL_CAIRO_FUNC(void, name, params, args, nullptr) // 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 diff --git a/src/common/clipcmn.cpp b/src/common/clipcmn.cpp index 8f6dc6d253..292616327c 100644 --- a/src/common/clipcmn.cpp +++ b/src/common/clipcmn.cpp @@ -64,7 +64,7 @@ void wxClipboardEvent::AddFormat(const wxDataFormat& format) // wxClipboardBase // --------------------------------------------------------- -static wxClipboard *gs_clipboard = NULL; +static wxClipboard *gs_clipboard = nullptr; /*static*/ wxClipboard *wxClipboardBase::Get() { diff --git a/src/common/clntdata.cpp b/src/common/clntdata.cpp index 6ee5541545..18046919bc 100644 --- a/src/common/clntdata.cpp +++ b/src/common/clntdata.cpp @@ -21,7 +21,7 @@ wxClientDataContainer::wxClientDataContainer() { // no client data (yet) - m_clientData = NULL; + m_clientData = nullptr; m_clientDataType = wxClientData_None; } @@ -45,7 +45,7 @@ void wxClientDataContainer::DoSetClientObject( wxClientData *data ) wxClientData *wxClientDataContainer::DoGetClientObject() const { // it's not an error to call GetClientObject() on a window which doesn't - // have client data at all - NULL will be returned + // have client data at all - nullptr will be returned wxASSERT_MSG( m_clientDataType != wxClientData_Void, wxT("this window doesn't have object client data") ); @@ -64,7 +64,7 @@ void wxClientDataContainer::DoSetClientData( void *data ) void *wxClientDataContainer::DoGetClientData() const { // it's not an error to call GetClientData() on a window which doesn't have - // client data at all - NULL will be returned + // client data at all - nullptr will be returned wxASSERT_MSG( m_clientDataType != wxClientData_Object, wxT("this window doesn't have void client data") ); @@ -79,7 +79,7 @@ void wxSharedClientDataContainer::SetClientObject(wxClientData *data) wxClientData *wxSharedClientDataContainer::GetClientObject() const { - return HasClientDataContainer() ? m_data->GetClientObject() : NULL; + return HasClientDataContainer() ? m_data->GetClientObject() : nullptr; } void wxSharedClientDataContainer::SetClientData(void *data) @@ -89,7 +89,7 @@ void wxSharedClientDataContainer::SetClientData(void *data) void *wxSharedClientDataContainer::GetClientData() const { - return HasClientDataContainer() ? m_data->GetClientData() : NULL; + return HasClientDataContainer() ? m_data->GetClientData() : nullptr; } wxClientDataContainer *wxSharedClientDataContainer::GetValidClientData() diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 50699b97f0..56cdbac6c8 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -217,7 +217,7 @@ struct wxCmdLineParserData // Find the option by either its short or long name. // - // Asserts and returns NULL if option with this name is not found. + // Asserts and returns nullptr if option with this name is not found. const wxCmdLineOption* FindOptionByAnyName(const wxString& name); }; @@ -425,7 +425,7 @@ 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. - const wxCharBuffer locOld(SetAllLocaleFacets(NULL)); + const wxCharBuffer locOld(SetAllLocaleFacets(nullptr)); SetAllLocaleFacets(""); wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld.data() ); @@ -521,7 +521,7 @@ wxCmdLineParserData::FindOptionByAnyName(const wxString& name) if ( i == wxNOT_FOUND ) { wxFAIL_MSG( wxS("Unknown option ") + name ); - return NULL; + return nullptr; } } @@ -728,7 +728,7 @@ bool wxCmdLineParser::Found(const wxString& name, wxString *value) const if ( !opt || !opt->HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, wxT("null pointer in wxCmdLineOption::Found") ); *value = opt->GetStrVal(); @@ -742,7 +742,7 @@ bool wxCmdLineParser::Found(const wxString& name, long *value) const if ( !opt || !opt->HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, wxT("null pointer in wxCmdLineOption::Found") ); *value = opt->GetLongVal(); @@ -756,7 +756,7 @@ bool wxCmdLineParser::Found(const wxString& name, double *value) const if ( !opt || !opt->HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, wxT("null pointer in wxCmdLineOption::Found") ); *value = opt->GetDoubleVal(); @@ -771,7 +771,7 @@ bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const if ( !opt || !opt->HasValue() ) return false; - wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); + wxCHECK_MSG( value, false, wxT("null pointer in wxCmdLineOption::Found") ); *value = opt->GetDateVal(); diff --git a/src/common/cmdproc.cpp b/src/common/cmdproc.cpp index ecff9ad044..f92cd14f7d 100644 --- a/src/common/cmdproc.cpp +++ b/src/common/cmdproc.cpp @@ -58,7 +58,7 @@ wxCommandProcessor::wxCommandProcessor(int maxCommands) { m_maxNoCommands = maxCommands; #if wxUSE_MENUS - m_commandEditMenu = NULL; + m_commandEditMenu = nullptr; #endif // wxUSE_MENUS } @@ -162,10 +162,10 @@ bool wxCommandProcessor::Undo() bool wxCommandProcessor::Redo() { - wxCommand *redoCommand = NULL; + wxCommand *redoCommand = nullptr; wxList::compatibility_iterator redoNode #if !wxUSE_STD_CONTAINERS - = NULL // just to avoid warnings + = nullptr // just to avoid warnings #endif // !wxUSE_STD_CONTAINERS ; @@ -294,7 +294,7 @@ wxString wxCommandProcessor::GetRedoMenuLabel() const } else { - // currentCommand is NULL but there are commands: this means that + // currentCommand is null but there are commands: this means that // we've undone to the start of the list, but can redo the first. wxCommand *redoCommand = (wxCommand *)m_commands.GetFirst()->GetData(); wxString redoCommandName(redoCommand->GetName()); diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index ac4f04376b..6306facf92 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -73,7 +73,7 @@ wxPrintData::wxPrintData() // the default system settings will be used for them m_paperId = wxPAPER_NONE; - m_privData = NULL; + m_privData = nullptr; m_privDataLen = 0; m_nativeData = wxPrintFactory::GetFactory()->CreatePrintNativeData(); @@ -82,8 +82,8 @@ wxPrintData::wxPrintData() wxPrintData::wxPrintData(const wxPrintData& printData) : wxObject() { - m_nativeData = NULL; - m_privData = NULL; + m_nativeData = nullptr; + m_privData = nullptr; (*this) = printData; } @@ -352,8 +352,8 @@ void wxPageSetupDialogData::SetPrintData(const wxPrintData& printData) // paper id void wxPageSetupDialogData::CalculateIdFromPaperSize() { - wxASSERT_MSG( (wxThePrintPaperDatabase != NULL), - wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); + wxASSERT_MSG( (wxThePrintPaperDatabase != nullptr), + wxT("wxThePrintPaperDatabase should not be null. Do not create global print dialog data objects.") ); wxSize sz = GetPaperSize(); @@ -367,8 +367,8 @@ void wxPageSetupDialogData::CalculateIdFromPaperSize() // Use paper id in wxPrintData to set this object's paper size void wxPageSetupDialogData::CalculatePaperSizeFromId() { - wxASSERT_MSG( (wxThePrintPaperDatabase != NULL), - wxT("wxThePrintPaperDatabase should not be NULL. Do not create global print dialog data objects.") ); + wxASSERT_MSG( (wxThePrintPaperDatabase != nullptr), + wxT("wxThePrintPaperDatabase should not be null. Do not create global print dialog data objects.") ); wxSize sz = wxThePrintPaperDatabase->GetSize(m_printData.GetPaperId()); diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp index d284dc44a9..aff5390b27 100644 --- a/src/common/colourcmn.cpp +++ b/src/common/colourcmn.cpp @@ -397,7 +397,7 @@ wxString wxToString(const wxColourBase& col) bool wxFromString(const wxString& str, wxColourBase *col) { - wxCHECK_MSG( col, false, wxT("NULL output parameter") ); + wxCHECK_MSG( col, false, wxT("null output parameter") ); if ( str.empty() ) { diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 90b263537a..965525d110 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -749,16 +749,16 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl); void wxComboCtrlBase::Init() { - m_winPopup = NULL; - m_popup = NULL; + m_winPopup = nullptr; + m_popup = nullptr; m_popupWinState = Hidden; - m_btn = NULL; - m_text = NULL; - m_mainWindow = NULL; - m_popupInterface = NULL; + m_btn = nullptr; + m_text = nullptr; + m_mainWindow = nullptr; + m_popupInterface = nullptr; #if !wxUSE_POPUPWIN - m_toplevEvtHandler = NULL; + m_toplevEvtHandler = nullptr; #endif m_mainCtrlWnd = this; @@ -843,10 +843,10 @@ wxComboCtrlBase::SetMainControl(wxWindow* win) { m_text->Destroy(); - // Note that we currently always set it to NULL, even if the custom + // Note that we currently always set it to nullptr, even if the custom // window is a (subclass of) wxTextCtrl because our m_text must be a // wxComboCtrlTextCtrl for things to work correctly. - m_text = NULL; + m_text = nullptr; } // We don't do anything with the previous main window, if any, it's the @@ -939,7 +939,7 @@ wxComboCtrlBase::~wxComboCtrlBase() #if !wxUSE_POPUPWIN delete ((wxComboFrameEventHandler*)m_toplevEvtHandler); - m_toplevEvtHandler = NULL; + m_toplevEvtHandler = nullptr; #endif DestroyPopup(); @@ -1324,8 +1324,8 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) } else { - if ( m_mainWindow ) m_mainWindow->SetToolTip( NULL ); - if ( m_btn ) m_btn->SetToolTip( NULL ); + if ( m_mainWindow ) m_mainWindow->SetToolTip( nullptr ); + if ( m_btn ) m_btn->SetToolTip( nullptr ); } } #endif // wxUSE_TOOLTIPS @@ -1970,16 +1970,16 @@ void wxComboCtrlBase::DestroyPopup() { // NB: DestroyPopup() performs 'delete this'. m_popupInterface->DestroyPopup(); - m_popupInterface = NULL; + m_popupInterface = nullptr; } if ( m_winPopup ) { m_winPopup->Destroy(); - m_winPopup = NULL; + m_winPopup = nullptr; } - m_popup = NULL; + m_popup = nullptr; } void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) @@ -1999,7 +1999,7 @@ void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) } else { - m_popup = NULL; + m_popup = nullptr; } // This must be done after creation @@ -2014,7 +2014,7 @@ void wxComboCtrlBase::DoSetPopupControl(wxComboPopup* iface) void wxComboCtrlBase::EnsurePopupControl() { if ( !m_popupInterface ) - SetPopupControl(NULL); + SetPopupControl(nullptr); } void wxComboCtrlBase::OnButtonClick() diff --git a/src/common/config.cpp b/src/common/config.cpp index a5e04ec1ca..e87e09c029 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -44,7 +44,7 @@ // global and class static variables // ---------------------------------------------------------------------------- -wxConfigBase *wxConfigBase::ms_pConfig = NULL; +wxConfigBase *wxConfigBase::ms_pConfig = nullptr; bool wxConfigBase::ms_bAutoCreate = true; // ============================================================================ @@ -97,9 +97,9 @@ wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) wxConfigBase *wxConfigBase::Create() { - if ( ms_bAutoCreate && ms_pConfig == NULL ) { + if ( ms_bAutoCreate && ms_pConfig == nullptr ) { wxAppTraits * const traits = wxApp::GetTraitsIfExists(); - wxCHECK_MSG( traits, NULL, wxT("create wxApp before calling this") ); + wxCHECK_MSG( traits, nullptr, wxT("create wxApp before calling this") ); ms_pConfig = traits->CreateConfig(); } @@ -115,7 +115,7 @@ wxConfigBase *wxConfigBase::Create() #define IMPLEMENT_READ_FOR_TYPE(name, type, deftype, extra) \ bool wxConfigBase::Read(const wxString& key, type *val) const \ { \ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); \ + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); \ \ if ( !DoRead##name(key, val) ) \ return false; \ @@ -129,7 +129,7 @@ wxConfigBase *wxConfigBase::Create() type *val, \ deftype defVal) const \ { \ - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); \ + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); \ \ bool read = DoRead##name(key, val); \ if ( !read ) \ @@ -188,7 +188,7 @@ bool wxConfigBase::Read(const wxString& key, int *pi, int defVal) const bool wxConfigBase::Read(const wxString& key, size_t* val) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); SizeSameSizeAsSizeT tmp; if ( !Read(key, &tmp) ) @@ -200,7 +200,7 @@ bool wxConfigBase::Read(const wxString& key, size_t* val) const bool wxConfigBase::Read(const wxString& key, size_t* val, size_t defVal) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); if ( !Read(key, val) ) { @@ -214,7 +214,7 @@ bool wxConfigBase::Read(const wxString& key, size_t* val, size_t defVal) const // Read floats as doubles then just type cast it down. bool wxConfigBase::Read(const wxString& key, float* val) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); double temp; if ( !Read(key, &temp) ) @@ -232,7 +232,7 @@ bool wxConfigBase::Read(const wxString& key, float* val) const bool wxConfigBase::Read(const wxString& key, float* val, float defVal) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); if ( Read(key, val) ) return true; @@ -245,7 +245,7 @@ bool wxConfigBase::Read(const wxString& key, float* val, float defVal) const // but can be overridden in the derived ones bool wxConfigBase::DoReadBool(const wxString& key, bool* val) const { - wxCHECK_MSG( val, false, wxT("wxConfig::Read(): NULL parameter") ); + wxCHECK_MSG( val, false, wxT("wxConfig::Read(): null parameter") ); long l; if ( !DoReadLong(key, &l) ) diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 55aceb4dcd..8b812cac27 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -185,7 +185,7 @@ bool wxControlContainerBase::HasTransparentBackground() const wxControlContainer::wxControlContainer() { - m_winLastFocused = NULL; + m_winLastFocused = nullptr; } void wxControlContainer::SetLastFocus(wxWindow *win) @@ -246,7 +246,7 @@ wxRadioButton* wxGetSelectedButtonInGroup(const wxRadioButton *btn) return const_cast(btn); if (btn->HasFlag(wxRB_SINGLE)) - return NULL; + return nullptr; wxRadioButton *selBtn; @@ -260,7 +260,7 @@ wxRadioButton* wxGetSelectedButtonInGroup(const wxRadioButton *btn) if (selBtn->GetValue()) return selBtn; - return NULL; + return nullptr; } } // anonymous namespace @@ -279,7 +279,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) { // for a TLW we shouldn't involve the parent window, it has nothing to do // with keyboard navigation inside this TLW - wxWindow *parent = m_winParent->IsTopLevel() ? NULL + wxWindow *parent = m_winParent->IsTopLevel() ? nullptr : m_winParent->GetParent(); // the event is propagated downwards if the event emitter was our parent @@ -297,7 +297,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) if ( event.IsWindowChange() && !goingDown ) { // check if we have a unique notebook-like child - wxWindow *bookctrl = NULL; + wxWindow *bookctrl = nullptr; for ( wxWindowList::const_iterator i = children.begin(), end = children.end(); i != end; @@ -311,7 +311,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // this is the second book-like control already so don't do // anything as we don't know which one should have its page // changed - bookctrl = NULL; + bookctrl = nullptr; break; } @@ -359,7 +359,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) { // just to be sure it's not used (normally this is not necessary, but // doesn't hurt either) - m_winLastFocused = NULL; + m_winLastFocused = nullptr; // start from first or last depending on where we're going node = forward ? children.GetFirst() : children.GetLast(); @@ -409,7 +409,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) node = forward ? start_node->GetNext() : start_node->GetPrevious(); } - // we want to cycle over all elements passing by NULL + // we want to cycle over all elements passing by nullptr for ( ;; ) { // don't go into infinite loop @@ -568,7 +568,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) void wxControlContainer::HandleOnWindowDestroy(wxWindowBase *child) { if ( child == m_winLastFocused ) - m_winLastFocused = NULL; + m_winLastFocused = nullptr; } // ---------------------------------------------------------------------------- @@ -592,7 +592,7 @@ void wxControlContainer::HandleOnFocus(wxFocusEvent& event) bool wxControlContainer::SetFocusToChild() { - return wxSetFocusToChild(m_winParent, NULL); + return wxSetFocusToChild(m_winParent, nullptr); } @@ -607,7 +607,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) { wxCHECK_MSG( win, false, wxT("wxSetFocusToChild(): invalid window") ); // wxCHECK_MSG( childLastFocused, false, - // wxT("wxSetFocusToChild(): NULL child pointer") ); + // wxT("wxSetFocusToChild(): null child pointer") ); if ( childLastFocused && *childLastFocused ) { @@ -616,7 +616,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) { // And it also could have become hidden in the meanwhile // We want to focus on the deepest widget visible - wxWindow *deepestVisibleWindow = NULL; + wxWindow *deepestVisibleWindow = nullptr; while ( *childLastFocused ) { @@ -626,7 +626,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) deepestVisibleWindow = *childLastFocused; } else - deepestVisibleWindow = NULL; + deepestVisibleWindow = nullptr; // We shouldn't be looking for the child to focus beyond the // TLW boundary. And we use IsTopNavigationDomain() here @@ -658,7 +658,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused) else { // it doesn't count as such any more - *childLastFocused = NULL; + *childLastFocused = nullptr; } } diff --git a/src/common/convauto.cpp b/src/common/convauto.cpp index 41e89fc9f5..89f91fe5ac 100644 --- a/src/common/convauto.cpp +++ b/src/common/convauto.cpp @@ -55,7 +55,7 @@ void wxConvAuto::SetFallbackEncoding(wxFontEncoding enc) /* static */ const char* wxConvAuto::GetBOMChars(wxBOM bom, size_t* count) { - wxCHECK_MSG( count , NULL, wxS("count pointer must be provided") ); + wxCHECK_MSG( count , nullptr, wxS("count pointer must be provided") ); switch ( bom ) { @@ -67,11 +67,11 @@ const char* wxConvAuto::GetBOMChars(wxBOM bom, size_t* count) case wxBOM_Unknown: case wxBOM_None: wxFAIL_MSG( wxS("Invalid BOM type") ); - return NULL; + return nullptr; } wxFAIL_MSG( wxS("Unknown BOM type") ); - return NULL; + return nullptr; } /* static */ @@ -287,8 +287,8 @@ wxConvAuto::ToWChar(wchar_t *dst, size_t dstLen, { // we check BOM and create the appropriate conversion the first time we're // called but we also need to ensure that the BOM is skipped not only - // during this initial call but also during the first call with non-NULL - // dst as typically we're first called with NULL dst to calculate the + // during this initial call but also during the first call with non-null + // dst as typically we're first called with null dst to calculate the // needed buffer size wxConvAuto *self = const_cast(this); diff --git a/src/common/cshelp.cpp b/src/common/cshelp.cpp index 2678ebfb28..e99221173a 100644 --- a/src/common/cshelp.cpp +++ b/src/common/cshelp.cpp @@ -199,7 +199,7 @@ bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event) // Dispatch the help event to the relevant window bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) { - wxCHECK_MSG( win, false, wxT("win parameter can't be NULL") ); + wxCHECK_MSG( win, false, wxT("win parameter can't be null") ); wxHelpEvent helpEvent(wxEVT_HELP, win->GetId(), pt, wxHelpEvent::Origin_HelpButton); @@ -261,7 +261,7 @@ void wxContextHelpButton::OnContextHelp(wxCommandEvent& WXUNUSED(event)) // wxHelpProvider // ---------------------------------------------------------------------------- -wxHelpProvider *wxHelpProvider::ms_helpProvider = NULL; +wxHelpProvider *wxHelpProvider::ms_helpProvider = nullptr; // trivial implementation of some methods which we don't want to make pure // virtual for convenience @@ -290,7 +290,7 @@ wxString wxHelpProvider::GetHelpTextMaybeAtPoint(wxWindowBase *window) if ( m_helptextAtPoint != wxDefaultPosition || m_helptextOrigin != wxHelpEvent::Origin_Unknown ) { - wxCHECK_MSG( window, wxEmptyString, wxT("window must not be NULL") ); + wxCHECK_MSG( window, wxEmptyString, wxT("window must not be null") ); wxPoint pt = m_helptextAtPoint; wxHelpEvent::Origin origin = m_helptextOrigin; @@ -366,13 +366,13 @@ bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window) #endif // wxUSE_MS_HTML_HELP { #if wxUSE_TIPWINDOW - static wxTipWindow* s_tipWindow = NULL; + static wxTipWindow* s_tipWindow = nullptr; if ( s_tipWindow ) { // Prevent s_tipWindow being nulled in OnIdle, thereby removing // the chance for the window to be closed by ShowHelp - s_tipWindow->SetTipWindowPtr(NULL); + s_tipWindow->SetTipWindowPtr(nullptr); s_tipWindow->Close(); } @@ -463,7 +463,7 @@ void wxHelpProviderModule::OnExit() if (wxHelpProvider::Get()) { delete wxHelpProvider::Get(); - wxHelpProvider::Set(NULL); + wxHelpProvider::Set(nullptr); } } diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index 2450d3b655..dfeddbd316 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -182,10 +182,10 @@ void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) wxClientData *wxItemContainer::GetClientObject(unsigned int n) const { - wxCHECK_MSG( HasClientObjectData(), NULL, + wxCHECK_MSG( HasClientObjectData(), nullptr, wxT("this window doesn't have object client data") ); - wxCHECK_MSG( IsValid(n), NULL, + wxCHECK_MSG( IsValid(n), nullptr, "Invalid index passed to GetClientObject()" ); return static_cast(DoGetItemClientData(n)); @@ -197,7 +197,7 @@ wxClientData *wxItemContainer::DetachClientObject(unsigned int n) if ( data ) { // reset the pointer as we don't own it any more - DoSetItemClientData(n, NULL); + DoSetItemClientData(n, nullptr); } return data; @@ -221,10 +221,10 @@ void wxItemContainer::SetClientData(unsigned int n, void *data) void *wxItemContainer::GetClientData(unsigned int n) const { - wxCHECK_MSG( HasClientUntypedData(), NULL, + wxCHECK_MSG( HasClientUntypedData(), nullptr, wxT("this window doesn't have void client data") ); - wxCHECK_MSG( IsValid(n), NULL, + wxCHECK_MSG( IsValid(n), nullptr, "Invalid index passed to GetClientData()" ); return DoGetItemClientData(n); @@ -265,7 +265,7 @@ void wxItemContainer::ResetItemClientObject(unsigned int n) if ( data ) { delete data; - DoSetItemClientData(n, NULL); + DoSetItemClientData(n, nullptr); } } diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index b465b20d1d..1461e88f7b 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -473,7 +473,7 @@ void wxDataViewIndexListModel::RowPrepended() wxDataViewItem item( wxUIntToPtr(id) ); m_hash.Insert( item, 0 ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } @@ -486,7 +486,7 @@ void wxDataViewIndexListModel::RowInserted( unsigned int before ) wxDataViewItem item( wxUIntToPtr(id) ); m_hash.Insert( item, before ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } void wxDataViewIndexListModel::RowAppended() @@ -496,7 +496,7 @@ void wxDataViewIndexListModel::RowAppended() wxDataViewItem item( wxUIntToPtr(id) ); m_hash.Add( item ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } void wxDataViewIndexListModel::RowDeleted( unsigned int row ) @@ -505,7 +505,7 @@ void wxDataViewIndexListModel::RowDeleted( unsigned int row ) wxDataViewItem item( m_hash[row] ); m_hash.RemoveAt( row ); - /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(0), item ); + /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(nullptr), item ); } void wxDataViewIndexListModel::RowsDeleted( const wxArrayInt &rows ) @@ -525,7 +525,7 @@ void wxDataViewIndexListModel::RowsDeleted( const wxArrayInt &rows ) for (i = 0; i < sorted.GetCount(); i++) m_hash.RemoveAt( sorted[i] ); - /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(0), array ); + /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(nullptr), array ); } void wxDataViewIndexListModel::RowChanged( unsigned int row ) @@ -587,28 +587,28 @@ void wxDataViewVirtualListModel::RowPrepended() { m_size++; wxDataViewItem item( wxUIntToPtr(1) ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } void wxDataViewVirtualListModel::RowInserted( unsigned int before ) { m_size++; wxDataViewItem item( wxUIntToPtr(before+1) ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } void wxDataViewVirtualListModel::RowAppended() { m_size++; wxDataViewItem item( wxUIntToPtr(m_size) ); - ItemAdded( wxDataViewItem(0), item ); + ItemAdded( wxDataViewItem(nullptr), item ); } void wxDataViewVirtualListModel::RowDeleted( unsigned int row ) { m_size--; wxDataViewItem item( wxUIntToPtr(row+1) ); - /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(0), item ); + /* wxDataViewModel:: */ ItemDeleted( wxDataViewItem(nullptr), item ); } void wxDataViewVirtualListModel::RowsDeleted( const wxArrayInt &rows ) @@ -625,7 +625,7 @@ void wxDataViewVirtualListModel::RowsDeleted( const wxArrayInt &rows ) wxDataViewItem item( wxUIntToPtr(sorted[i]+1) ); array.Add( item ); } - /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(0), array ); + /* wxDataViewModel:: */ ItemsDeleted( wxDataViewItem(nullptr), array ); } void wxDataViewVirtualListModel::RowChanged( unsigned int row ) @@ -693,8 +693,8 @@ wxDataViewRendererBase::wxDataViewRendererBase( const wxString &varianttype, int WXUNUSED(align) ) : m_variantType(varianttype) { - m_owner = NULL; - m_valueAdjuster = NULL; + m_owner = nullptr; + m_valueAdjuster = nullptr; } wxDataViewRendererBase::~wxDataViewRendererBase() @@ -781,7 +781,7 @@ void wxDataViewRendererBase::CancelEditing() if ( m_editorCtrl ) DestroyEditControl(); - DoHandleEditingDone(NULL); + DoHandleEditingDone(nullptr); } bool wxDataViewRendererBase::FinishEditing() @@ -805,7 +805,7 @@ bool wxDataViewRendererBase::FinishEditing() GetView()->GetMainWindow()->SetFocus(); - return DoHandleEditingDone(gotValue ? &value : NULL); + return DoHandleEditingDone(gotValue ? &value : nullptr); } bool @@ -817,7 +817,7 @@ wxDataViewRendererBase::DoHandleEditingDone(wxVariant* value) { // Invalid value can't be used, so if it's the same as if we hadn't // got it in the first place. - value = NULL; + value = nullptr; } } @@ -939,7 +939,7 @@ int wxDataViewRendererBase::GetEffectiveAlignmentIfKnown() const if ( alignment == wxDVR_DEFAULT_ALIGNMENT ) { - if ( GetOwner() != NULL ) + if ( GetOwner() != nullptr ) { // if we don't have an explicit alignment ourselves, use that of the // column in horizontal direction and default vertical alignment @@ -1065,7 +1065,7 @@ wxSize wxDataViewCustomRendererBase::GetTextExtent(const wxString& str) const { wxFont font(m_attr.GetEffectiveFont(view->GetFont())); wxSize size; - view->GetTextExtent(str, &size.x, &size.y, NULL, NULL, &font); + view->GetTextExtent(str, &size.x, &size.y, nullptr, nullptr, &font); return size; } else @@ -1215,7 +1215,7 @@ void wxDataViewColumnBase::Init(wxDataViewRenderer *renderer, { m_renderer = renderer; m_model_column = model_column; - m_owner = NULL; + m_owner = nullptr; m_renderer->SetOwner( (wxDataViewColumn*) this ); } @@ -1232,8 +1232,8 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl); wxDataViewCtrlBase::wxDataViewCtrlBase() { - m_model = NULL; - m_expander_column = 0; + m_model = nullptr; + m_expander_column = nullptr; m_indent = 8; } @@ -1242,7 +1242,7 @@ wxDataViewCtrlBase::~wxDataViewCtrlBase() if (m_model) { m_model->DecRef(); - m_model = NULL; + m_model = nullptr; } } @@ -1696,7 +1696,7 @@ wxDataViewCtrlBase::CreateDataObject(const wxVector& formats) { if (formats.empty()) { - return NULL; + return nullptr; } wxDataObjectComposite *dataObject(new wxDataObjectComposite); @@ -1788,15 +1788,15 @@ void wxDataViewEvent::Init(wxDataViewCtrlBase* dvc, { m_item = item; m_col = column ? column->GetModelColumn() : -1; - m_model = dvc ? dvc->GetModel() : NULL; + m_model = dvc ? dvc->GetModel() : nullptr; m_column = column; m_pos = wxDefaultPosition; m_cacheFrom = 0; m_cacheTo = 0; m_editCancelled = false; #if wxUSE_DRAG_AND_DROP - m_dataObject = NULL; - m_dataBuffer = NULL; + m_dataObject = nullptr; + m_dataBuffer = nullptr; m_dataSize = 0; m_dragFlags = 0; m_dropEffect = wxDragNone; @@ -2548,7 +2548,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendToggleColumn( const wxString &label, new wxDataViewToggleRenderer( wxT("bool"), mode ), GetColumnCount(), width, align, flags ); - return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : nullptr; } wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &label, @@ -2560,7 +2560,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &labe new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), GetColumnCount(), width, align, flags ); - return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : nullptr; } wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &label, @@ -2572,7 +2572,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &labe new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), GetColumnCount(), width, align, flags ); - return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : nullptr; } //----------------------------------------------------------------------------- @@ -2636,7 +2636,7 @@ void wxDataViewTreeStoreContainerNode::DestroyChildren() wxDataViewTreeStore::wxDataViewTreeStore() { - m_root = new wxDataViewTreeStoreContainerNode( NULL, wxEmptyString ); + m_root = new wxDataViewTreeStoreContainerNode( nullptr, wxEmptyString ); } wxDataViewTreeStore::~wxDataViewTreeStore() @@ -2648,7 +2648,7 @@ wxDataViewItem wxDataViewTreeStore::AppendItem( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon, wxClientData *data ) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *node = new wxDataViewTreeStoreNode( parent_node, text, icon, data ); @@ -2661,7 +2661,7 @@ wxDataViewItem wxDataViewTreeStore::PrependItem( const wxDataViewItem& parent, const wxString &text, const wxBitmapBundle &icon, wxClientData *data ) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *node = new wxDataViewTreeStoreNode( parent_node, text, icon, data ); @@ -2679,12 +2679,12 @@ wxDataViewTreeStore::InsertItem(const wxDataViewItem& parent, wxClientData *data) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *previous_node = FindNode( previous ); wxDataViewTreeStoreNodes& children = parent_node->GetChildren(); const wxDataViewTreeStoreNodes::iterator iter = parent_node->FindChild( previous_node ); - if (iter == children.end()) return wxDataViewItem(0); + if (iter == children.end()) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *node = new wxDataViewTreeStoreNode( parent_node, text, icon, data ); @@ -2698,7 +2698,7 @@ wxDataViewItem wxDataViewTreeStore::PrependContainer( const wxDataViewItem& pare wxClientData *data ) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreContainerNode *node = new wxDataViewTreeStoreContainerNode( parent_node, text, icon, expanded, data ); @@ -2716,7 +2716,7 @@ wxDataViewTreeStore::AppendContainer(const wxDataViewItem& parent, wxClientData * data) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreContainerNode *node = new wxDataViewTreeStoreContainerNode( parent_node, text, icon, expanded, data ); @@ -2734,12 +2734,12 @@ wxDataViewTreeStore::InsertContainer(const wxDataViewItem& parent, wxClientData * data) { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *previous_node = FindNode( previous ); wxDataViewTreeStoreNodes& children = parent_node->GetChildren(); const wxDataViewTreeStoreNodes::iterator iter = parent_node->FindChild( previous_node ); - if (iter == children.end()) return wxDataViewItem(0); + if (iter == children.end()) return wxDataViewItem(nullptr); wxDataViewTreeStoreContainerNode *node = new wxDataViewTreeStoreContainerNode( parent_node, text, icon, expanded, data ); @@ -2759,13 +2759,13 @@ bool wxDataViewTreeStore::IsContainer( const wxDataViewItem& item ) const wxDataViewItem wxDataViewTreeStore::GetNthChild( const wxDataViewItem& parent, unsigned int pos ) const { wxDataViewTreeStoreContainerNode *parent_node = FindContainerNode( parent ); - if (!parent_node) return wxDataViewItem(0); + if (!parent_node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode* const node = parent_node->GetChildren()[pos]; if (node) return node->GetItem(); - return wxDataViewItem(0); + return wxDataViewItem(nullptr); } int wxDataViewTreeStore::GetChildCount( const wxDataViewItem& parent ) const @@ -2839,7 +2839,7 @@ void wxDataViewTreeStore::SetItemData( const wxDataViewItem& item, wxClientData wxClientData *wxDataViewTreeStore::GetItemData( const wxDataViewItem& item ) const { wxDataViewTreeStoreNode *node = FindNode( item ); - if (!node) return NULL; + if (!node) return nullptr; return node->GetData(); } @@ -2924,13 +2924,13 @@ wxDataViewTreeStore::SetValue(const wxVariant& variant, wxDataViewItem wxDataViewTreeStore::GetParent( const wxDataViewItem &item ) const { wxDataViewTreeStoreNode *node = FindNode( item ); - if (!node) return wxDataViewItem(0); + if (!node) return wxDataViewItem(nullptr); wxDataViewTreeStoreNode *parent = node->GetParent(); - if (!parent) return wxDataViewItem(0); + if (!parent) return wxDataViewItem(nullptr); if (parent == m_root) - return wxDataViewItem(0); + return wxDataViewItem(nullptr); return parent->GetItem(); } @@ -3001,7 +3001,7 @@ wxDataViewTreeStoreContainerNode *wxDataViewTreeStore::FindContainerNode( const wxDataViewTreeStoreNode* node = (wxDataViewTreeStoreNode*) item.GetID(); if (!node->IsContainer()) - return NULL; + return nullptr; return (wxDataViewTreeStoreContainerNode*) node; } diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index b0d26bd402..1bc9401e14 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -91,7 +91,7 @@ template<> void wxStringReadValue(const wxString &s , wxDateTime &data ) { - data.ParseFormat(s,"%Y-%m-%d %H:%M:%S", NULL); + data.ParseFormat(s,"%Y-%m-%d %H:%M:%S", nullptr); } template<> void wxStringWriteValue(wxString &s , const wxDateTime &data ) @@ -306,7 +306,7 @@ wxString wxCallStrftime(const wxString& format, const tm* tm) static void ReplaceDefaultYearMonthWithCurrent(int *year, wxDateTime::Month *month) { - struct tm *tmNow = NULL; + struct tm *tmNow = nullptr; struct tm tmstruct; if ( *year == wxDateTime::Inv_Year ) @@ -880,7 +880,7 @@ wxDateTime::Country wxDateTime::GetCountry() if ( ms_country == Country_Unknown ) { // try to guess from the time zone name - time_t t = time(NULL); + time_t t = time(nullptr); struct tm tmstruct; struct tm *tm = wxLocaltime_r(&t, &tmstruct); @@ -1461,7 +1461,7 @@ const tm* wxTryGetTm(tm& tmstruct, time_t t, const wxDateTime::TimeZone& tz) t += (time_t)tz.GetOffset(); #if !defined(__VMS__) // time is unsigned so avoid warning if ( t < 0 ) - return NULL; + return nullptr; #endif return wxGmtime_r(&t, &tmstruct); } diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 78a5dc5a46..118e39d1a2 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -95,7 +95,7 @@ bool GetNumericToken(size_t len, wxString::const_iterator& p, const wxString::const_iterator& end, unsigned long *number, - size_t *numScannedDigits = NULL) + size_t *numScannedDigits = nullptr) { size_t n = 1; wxString s; @@ -316,7 +316,7 @@ ParseFormatAt(wxString::const_iterator& p, wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const { wxCHECK_MSG( !formatp.empty(), wxEmptyString, - wxT("NULL format in wxDateTime::Format") ); + wxT("null format in wxDateTime::Format") ); wxString format = formatp; #ifdef __WXOSX__ @@ -1014,7 +1014,7 @@ const char* wxDateTime::ParseRfc822Date(const char* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseRfc822Date(dateStr, &end) ) - return NULL; + return nullptr; return date + dateStr.IterOffsetInMBStr(end); } @@ -1024,7 +1024,7 @@ const wchar_t* wxDateTime::ParseRfc822Date(const wchar_t* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseRfc822Date(dateStr, &end) ) - return NULL; + return nullptr; return date + (end - dateStr.begin()); } @@ -1715,7 +1715,7 @@ wxDateTime::ParseFormat(const char* date, wxString::const_iterator end; wxString dateStr(date); if ( !ParseFormat(dateStr, format, dateDef, &end) ) - return NULL; + return nullptr; return date + dateStr.IterOffsetInMBStr(end); } @@ -1728,7 +1728,7 @@ wxDateTime::ParseFormat(const wchar_t* date, wxString::const_iterator end; wxString dateStr(date); if ( !ParseFormat(dateStr, format, dateDef, &end) ) - return NULL; + return nullptr; return date + (end - dateStr.begin()); } @@ -1804,7 +1804,7 @@ const char* wxDateTime::ParseDateTime(const char* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseDateTime(dateStr, &end) ) - return NULL; + return nullptr; return date + dateStr.IterOffsetInMBStr(end); } @@ -1814,7 +1814,7 @@ const wchar_t* wxDateTime::ParseDateTime(const wchar_t* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseDateTime(dateStr, &end) ) - return NULL; + return nullptr; return date + (end - dateStr.begin()); } @@ -2188,7 +2188,7 @@ const char* wxDateTime::ParseDate(const char* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseDate(dateStr, &end) ) - return NULL; + return nullptr; return date + dateStr.IterOffsetInMBStr(end); } @@ -2198,7 +2198,7 @@ const wchar_t* wxDateTime::ParseDate(const wchar_t* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseDate(dateStr, &end) ) - return NULL; + return nullptr; return date + (end - dateStr.begin()); } @@ -2264,7 +2264,7 @@ const char* wxDateTime::ParseTime(const char* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseTime(dateStr, &end) ) - return NULL; + return nullptr; return date + dateStr.IterOffsetInMBStr(end); } @@ -2274,7 +2274,7 @@ const wchar_t* wxDateTime::ParseTime(const wchar_t* date) wxString::const_iterator end; wxString dateStr(date); if ( !ParseTime(dateStr, &end) ) - return NULL; + return nullptr; return date + (end - dateStr.begin()); } @@ -2350,7 +2350,7 @@ wxString wxTimeSpan::Format(const wxString& format) const } wxCHECK_MSG( !format.empty(), str, - wxT("NULL format in wxTimeSpan::Format") ); + wxT("null format in wxTimeSpan::Format") ); str.Alloc(format.length()); diff --git a/src/common/datstrm.cpp b/src/common/datstrm.cpp index a8ce2485e9..89f16ac104 100644 --- a/src/common/datstrm.cpp +++ b/src/common/datstrm.cpp @@ -184,7 +184,7 @@ wxString wxDataInputStream::ReadString() if ( tmp ) { m_input->Read(tmp.data(), len); - ret = m_conv->cMB2WC(tmp.data(), len, NULL); + ret = m_conv->cMB2WC(tmp.data(), len, nullptr); } #else wxStringBuffer buf(ret, len); diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index d020ad8446..6a7255e0c0 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -83,7 +83,7 @@ // wxDCFactory //---------------------------------------------------------------------------- -wxDCFactory *wxDCFactory::m_factory = NULL; +wxDCFactory *wxDCFactory::m_factory = nullptr; void wxDCFactory::Set(wxDCFactory *factory) { @@ -104,7 +104,7 @@ class wxDCFactoryCleanupModule : public wxModule { public: virtual bool OnInit() override { return true; } - virtual void OnExit() override { wxDCFactory::Set(NULL); } + virtual void OnExit() override { wxDCFactory::Set(nullptr); } private: wxDECLARE_DYNAMIC_CLASS(wxDCFactoryCleanupModule); @@ -310,7 +310,7 @@ int wxPrinterDC::GetResolution() const wxIMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject); wxDCImpl::wxDCImpl( wxDC *owner ) - : m_window(NULL) + : m_window(nullptr) , m_colour(true) , m_ok(true) , m_clipping(false) @@ -919,7 +919,7 @@ static void wx_spline_draw_point_array(wxDC *dc) void wxDCImpl::DoDrawSpline( const wxPointList *points ) { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); - wxCHECK_RET(points, "NULL pointer to spline points?"); + wxCHECK_RET(points, "null pointer to spline points?"); wxCHECK_RET(points->size() >= 2, "incomplete list of spline points?"); const wxPoint *p; @@ -1135,7 +1135,7 @@ void wxDCImpl::DoGradientFillConcentric(const wxRect& rect, void wxDCImpl::InheritAttributes(wxWindow *win) { - wxCHECK_RET( win, "window can't be NULL" ); + wxCHECK_RET( win, "window can't be null" ); SetFont(win->GetFont()); SetTextForeground(win->GetForegroundColour()); @@ -1271,7 +1271,7 @@ void wxDC::DrawLabel(const wxString& text, if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) ) { wxCoord widthLine; - GetTextExtent(curLine, &widthLine, NULL); + GetTextExtent(curLine, &widthLine, nullptr); if ( alignment & wxALIGN_RIGHT ) { @@ -1308,9 +1308,9 @@ void wxDC::DrawLabel(const wxString& text, if ( pc - text.begin() == indexAccel ) { // remember to draw underscore here - GetTextExtent(curLine, &startUnderscore, NULL); + GetTextExtent(curLine, &startUnderscore, nullptr); curLine += *pc; - GetTextExtent(curLine, &endUnderscore, NULL); + GetTextExtent(curLine, &endUnderscore, nullptr); yUnderscore = y + heightLine; } diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp index 26e565efb2..16af9241b7 100644 --- a/src/common/dcbufcmn.cpp +++ b/src/common/dcbufcmn.cpp @@ -96,7 +96,7 @@ private: wxDECLARE_DYNAMIC_CLASS(wxSharedDCBufferManager); }; -wxBitmap* wxSharedDCBufferManager::ms_buffer = NULL; +wxBitmap* wxSharedDCBufferManager::ms_buffer = nullptr; bool wxSharedDCBufferManager::ms_usingSharedBuffer = false; wxIMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule); @@ -162,7 +162,7 @@ void wxBufferedDC::UnMask() const wxPoint origin = GetLogicalOrigin(); m_dc->Blit(-origin.x, -origin.y, width, height, this, -x, -y); - m_dc = NULL; + m_dc = nullptr; if ( m_style & wxBUFFER_USES_SHARED_BUFFER ) wxSharedDCBufferManager::ReleaseBuffer(m_buffer); diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 37f5ef2b1f..e3c9bec257 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -119,7 +119,7 @@ wxGCDC::~wxGCDC() WXHDC wxGCDC::AcquireHDC() { wxGraphicsContext* const gc = GetGraphicsContext(); - wxCHECK_MSG(gc, NULL, "can't acquire HDC because there is no wxGraphicsContext"); + wxCHECK_MSG(gc, nullptr, "can't acquire HDC because there is no wxGraphicsContext"); return gc->GetNativeHDC(); } @@ -208,7 +208,7 @@ wxGCDCImpl::wxGCDCImpl(wxDC* owner, int) : wxDCImpl(owner) { // derived class will set a context - Init(NULL); + Init(nullptr); } void wxGCDCImpl::CommonInit() @@ -231,7 +231,7 @@ void wxGCDCImpl::Init(wxGraphicsContext* ctx) m_font = *wxNORMAL_FONT; m_brush = *wxWHITE_BRUSH; - m_graphicContext = NULL; + m_graphicContext = nullptr; if (ctx) SetGraphicsContext(ctx); } @@ -239,7 +239,7 @@ void wxGCDCImpl::Init(wxGraphicsContext* ctx) bool wxGCDCImpl::DoInitContext(wxGraphicsContext* ctx) { m_graphicContext = ctx; - m_ok = m_graphicContext != NULL; + m_ok = m_graphicContext != nullptr; if ( m_ok ) { @@ -280,7 +280,7 @@ void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, // it the copy is cheap as bitmaps are reference-counted wxBitmap bmpCopy(bmp); if ( !useMask && bmp.GetMask() ) - bmpCopy.SetMask(NULL); + bmpCopy.SetMask(nullptr); m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h ); } @@ -530,7 +530,7 @@ void wxGCDCImpl::ComputeScaleAndOrigin() void* wxGCDCImpl::GetHandle() const { - void* cgctx = NULL; + void* cgctx = nullptr; wxGraphicsContext* gc = GetGraphicsContext(); if (gc) { cgctx = gc->GetNativeContext(); @@ -859,7 +859,7 @@ void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[], void wxGCDCImpl::DoDrawSpline(const wxPointList *points) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") ); - wxCHECK_RET(points, "NULL pointer to spline points?"); + wxCHECK_RET(points, "null pointer to spline points?"); wxCHECK_RET(points->size() >= 2, "incomplete list of spline points?"); if ( !m_logicalFunctionSupported ) @@ -1101,7 +1101,7 @@ bool wxGCDCImpl::DoStretchBlit( if ( blit.IsOk() ) { if ( !useMask && blit.GetMask() ) - blit.SetMask(NULL); + blit.SetMask(nullptr); double x = xdest; double y = ydest; @@ -1251,15 +1251,15 @@ void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord * d wxDUMMY_INITIALIZE(0), e wxDUMMY_INITIALIZE(0); - // Don't pass non-NULL pointers for the parts we don't need, this could + // Don't pass non-null pointers for the parts we don't need, this could // result in doing extra unnecessary work inside GetTextExtent(). m_graphicContext->GetTextExtent ( str, - width ? &w : NULL, - height ? &h : NULL, - descent ? &d : NULL, - externalLeading ? &e : NULL + width ? &w : nullptr, + height ? &h : nullptr, + descent ? &d : nullptr, + externalLeading ? &e : nullptr ); if ( height ) @@ -1297,7 +1297,7 @@ bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& width wxCoord wxGCDCImpl::GetCharWidth() const { wxCoord width = 0; - DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL ); + DoGetTextExtent( wxT("g") , &width , nullptr , nullptr , nullptr , nullptr ); return width; } @@ -1305,7 +1305,7 @@ wxCoord wxGCDCImpl::GetCharWidth() const wxCoord wxGCDCImpl::GetCharHeight() const { wxCoord height = 0; - DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL ); + DoGetTextExtent( wxT("g") , nullptr , &height , nullptr , nullptr , nullptr ); return height; } diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index bb82a70957..d0b73b938a 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -64,7 +64,7 @@ inline wxString NumStr(float f) // Return the colour representation as HTML-like "#rrggbb" string and also // returns its alpha as opacity number in 0..1 range. -wxString Col2SVG(wxColour c, float* opacity = NULL) +wxString Col2SVG(wxColour c, float* opacity = nullptr) { if ( c.Alpha() != wxALPHA_OPAQUE ) { @@ -170,7 +170,7 @@ wxString GetPenPattern(const wxPen& pen) s = wxS("stroke-dasharray=\""); wxDash* dashes; int count = pen.GetDashes(&dashes); - if ((dashes != NULL) && (count > 0)) + if ((dashes != nullptr) && (count > 0)) { for (int i = 0; i < count; ++i) { @@ -402,7 +402,7 @@ wxSVGBitmapEmbedHandler::ProcessBitmap(const wxBitmap& bmp, #if wxUSE_BASE64 static int sub_images = 0; - if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) + if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr ) wxImage::AddHandler(new wxPNGHandler); // write the bitmap as a PNG to a memory stream and Base64 encode @@ -461,7 +461,7 @@ wxSVGBitmapFileHandler::ProcessBitmap(const wxBitmap& bmp, { static int sub_images = 0; - if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) + if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr ) wxImage::AddHandler(new wxPNGHandler); // find a suitable file name @@ -665,7 +665,7 @@ void wxSVGFileDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset #if wxUSE_SPLINES void wxSVGFileDCImpl::DoDrawSpline(const wxPointList* points) { - wxCHECK_RET(points, "NULL pointer to spline points"); + wxCHECK_RET(points, "null pointer to spline points"); wxCHECK_RET(points->size() >= 2, "incomplete list of spline points"); NewGraphicsIfNeeded(); diff --git a/src/common/debugrpt.cpp b/src/common/debugrpt.cpp index 88d3f73c4c..93d6aea1c1 100644 --- a/src/common/debugrpt.cpp +++ b/src/common/debugrpt.cpp @@ -380,7 +380,7 @@ bool wxDebugReport::DoAddLoadedModules(wxXmlNode *nodeModules) if ( !path.empty() ) nodeModule->AddAttribute(wxT("path"), path); - void *addr = NULL; + void *addr = nullptr; size_t len = 0; if ( info.GetAddress(&addr, &len) ) { diff --git a/src/common/dircmn.cpp b/src/common/dircmn.cpp index f40f377b33..24d27b0af0 100644 --- a/src/common/dircmn.cpp +++ b/src/common/dircmn.cpp @@ -242,7 +242,7 @@ size_t wxDir::GetAllFiles(const wxString& dirname, const wxString& filespec, int flags) { - wxCHECK_MSG( files, (size_t)-1, wxT("NULL pointer in wxDir::GetAllFiles") ); + wxCHECK_MSG( files, (size_t)-1, wxT("null pointer in wxDir::GetAllFiles") ); size_t nFiles = 0; diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 2e78f738b2..61192f5d4e 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -110,7 +110,7 @@ wxBEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow) EVT_CHAR_HOOK(wxDialogBase::OnCharHook) wxEND_EVENT_TABLE() -wxDialogLayoutAdapter* wxDialogBase::sm_layoutAdapter = NULL; +wxDialogLayoutAdapter* wxDialogBase::sm_layoutAdapter = nullptr; bool wxDialogBase::sm_layoutAdaptation = false; wxDialogBase::wxDialogBase() @@ -133,21 +133,21 @@ wxDialogBase::CheckIfCanBeUsedAsParent(wxDialogModality modality, wxWindow *parent) const { if ( !parent ) - return NULL; + return nullptr; extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete; if ( wxPendingDelete.Member(parent) || parent->IsBeingDeleted() ) { // this window is being deleted and we shouldn't create any children // under it - return NULL; + return nullptr; } if ( parent->HasExtraStyle(wxWS_EX_TRANSIENT) ) { // this window is not being deleted yet but it's going to disappear // soon so still don't parent this window under it - return NULL; + return nullptr; } // This check is done for modal dialogs only because modeless dialogs can @@ -162,7 +162,7 @@ wxDialogBase::CheckIfCanBeUsedAsParent(wxDialogModality modality, if ( !parent->IsShownOnScreen() ) { // using hidden parent won't work correctly either - return NULL; + return nullptr; } break; } @@ -171,7 +171,7 @@ wxDialogBase::CheckIfCanBeUsedAsParent(wxDialogModality modality, { // not sure if this can really happen but it doesn't hurt to guard // against this clearly invalid situation - return NULL; + return nullptr; } return parent; @@ -186,7 +186,7 @@ wxDialogBase::DoGetParentForDialog(wxDialogModality modality, // in an unfocused dialog, so try to find a valid parent for it unless we // were explicitly asked not to if ( style & wxDIALOG_NO_PARENT ) - return NULL; + return nullptr; // first try the given parent if ( parent ) @@ -239,7 +239,7 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags) #else // !wxUSE_BUTTON wxUnusedVar(flags); - return NULL; + return nullptr; #endif // wxUSE_BUTTON/!wxUSE_BUTTON } @@ -262,7 +262,7 @@ wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags) { wxSizer *sizer = CreateButtonSizer(flags); if ( !sizer ) - return NULL; + return nullptr; return CreateSeparatedSizer(sizer); } @@ -273,9 +273,9 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) { wxStdDialogButtonSizer *sizer = new wxStdDialogButtonSizer(); - wxButton *ok = NULL; - wxButton *yes = NULL; - wxButton *no = NULL; + wxButton *ok = nullptr; + wxButton *yes = nullptr; + wxButton *no = nullptr; if (flags & wxOK) { @@ -594,7 +594,7 @@ bool wxDialogBase::CanDoLayoutAdaptation() // Check if local setting overrides the global setting bool layoutEnabled = (GetLayoutAdaptationMode() == wxDIALOG_ADAPTATION_MODE_ENABLED) || (IsLayoutAdaptationEnabled() && (GetLayoutAdaptationMode() != wxDIALOG_ADAPTATION_MODE_DISABLED)); - return (layoutEnabled && !m_layoutAdaptationDone && GetLayoutAdaptationLevel() != 0 && GetLayoutAdapter() != NULL && GetLayoutAdapter()->CanDoLayoutAdaptation((wxDialog*) this)); + return (layoutEnabled && !m_layoutAdaptationDone && GetLayoutAdaptationLevel() != 0 && GetLayoutAdapter() != nullptr && GetLayoutAdapter()->CanDoLayoutAdaptation((wxDialog*) this)); } /// Set scrolling adapter class, returning old adapter @@ -779,7 +779,7 @@ wxSizer* wxStandardDialogLayoutAdapter::FindButtonSizer(bool stdButtonSizer, wxD return s; } } - return NULL; + return nullptr; } /// Check if this sizer contains standard buttons, and so can be repositioned in the dialog @@ -980,7 +980,7 @@ class wxDialogLayoutAdapterModule: public wxModule wxDECLARE_DYNAMIC_CLASS(wxDialogLayoutAdapterModule); public: wxDialogLayoutAdapterModule() {} - virtual void OnExit() override { delete wxDialogBase::SetLayoutAdapter(NULL); } + virtual void OnExit() override { delete wxDialogBase::SetLayoutAdapter(nullptr); } virtual bool OnInit() override { wxDialogBase::SetLayoutAdapter(new wxStandardDialogLayoutAdapter); return true; } }; diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index 20ce23217d..af8f112155 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -105,7 +105,7 @@ wxDataObjectComposite::GetObject(const wxDataFormat& format, wxDataObjectBase::D return dataObj; node = node->GetNext(); } - return NULL; + return nullptr; } void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred) @@ -152,7 +152,7 @@ const void* wxDataObjectComposite::GetSizeFromBuffer( const void* buffer, { wxDataObjectSimple *dataObj = GetObject(format); - wxCHECK_MSG( dataObj, NULL, + wxCHECK_MSG( dataObj, nullptr, wxT("unsupported format in wxDataObjectComposite")); return dataObj->GetSizeFromBuffer( buffer, size, format ); @@ -164,7 +164,7 @@ void* wxDataObjectComposite::SetSizeInBuffer( void* buffer, size_t size, { wxDataObjectSimple *dataObj = GetObject( format ); - wxCHECK_MSG( dataObj, NULL, + wxCHECK_MSG( dataObj, nullptr, wxT("unsupported format in wxDataObjectComposite")); return dataObj->SetSizeInBuffer( buffer, size, format ); @@ -284,10 +284,10 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const bool wxTextDataObject::SetData(const wxDataFormat& format, size_t len, const void *buf) { - if ( buf == NULL ) + if ( buf == nullptr ) return false; - wxWCharBuffer buffer = GetConv(format).cMB2WC((const char*)buf, len, NULL); + wxWCharBuffer buffer = GetConv(format).cMB2WC((const char*)buf, len, nullptr); SetText( buffer ); @@ -337,7 +337,7 @@ bool wxTextDataObject::SetData(const wxDataFormat& format, { const char * const buf = static_cast(buf_); - if ( buf == NULL ) + if ( buf == nullptr ) return false; if ( format == wxDF_UNICODETEXT || wxLocaleIsUtf8 ) @@ -351,7 +351,7 @@ bool wxTextDataObject::SetData(const wxDataFormat& format, } else // wxDF_TEXT, convert from current (non-UTF8) locale { - SetText(wxConvLocal.cMB2WC(buf, len, NULL)); + SetText(wxConvLocal.cMB2WC(buf, len, nullptr)); } return true; @@ -376,12 +376,12 @@ inline wxMBConv& GetConv(const wxDataFormat& format) size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { - return GetConv(format).WC2MB(NULL, GetText().wc_str(), 0); + return GetConv(format).WC2MB(nullptr, GetText().wc_str(), 0); } bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { - if ( buf == NULL ) + if ( buf == nullptr ) return false; wxCharBuffer buffer(GetConv(format).cWX2MB(GetText().c_str())); @@ -395,10 +395,10 @@ bool wxTextDataObject::SetData(const wxDataFormat& format, size_t len, const void *buf) { - if ( buf == NULL ) + if ( buf == nullptr ) return false; - SetText(GetConv(format).cMB2WC(static_cast(buf), len, NULL)); + SetText(GetConv(format).cMB2WC(static_cast(buf), len, nullptr)); return true; } @@ -420,7 +420,7 @@ bool wxTextDataObject::GetDataHere(void *buf) const const wxString textNative = wxTextBuffer::Translate(GetText()); // NOTE: use wxTmemcpy() instead of wxStrncpy() to allow - // retrieval of strings with embedded NULLs + // retrieval of strings with embedded NULs wxTmemcpy(static_cast(buf), textNative.t_str(), textNative.length() + 1); @@ -524,7 +524,7 @@ bool wxHTMLDataObject::GetDataHere(void *buf) const bool wxHTMLDataObject::SetData(size_t WXUNUSED(len), const void *buf) { - if ( buf == NULL ) + if ( buf == nullptr ) return false; // Windows and Mac always use UTF-8, and docs suggest GTK does as well. @@ -559,7 +559,7 @@ bool wxHTMLDataObject::SetData(size_t WXUNUSED(len), const void *buf) wxCustomDataObject::wxCustomDataObject(const wxDataFormat& format) : wxDataObjectSimple(format) { - m_data = NULL; + m_data = nullptr; m_size = 0; } @@ -585,7 +585,7 @@ void wxCustomDataObject::Free() { delete [] (char*)m_data; m_size = 0; - m_data = NULL; + m_data = nullptr; } size_t wxCustomDataObject::GetDataSize() const @@ -595,11 +595,11 @@ size_t wxCustomDataObject::GetDataSize() const bool wxCustomDataObject::GetDataHere(void *buf) const { - if ( buf == NULL ) + if ( buf == nullptr ) return false; void *data = GetData(); - if ( data == NULL ) + if ( data == nullptr ) return false; memcpy( buf, data, GetSize() ); @@ -612,7 +612,7 @@ bool wxCustomDataObject::SetData(size_t size, const void *buf) Free(); m_data = Alloc(size); - if ( m_data == NULL ) + if ( m_data == nullptr ) return false; m_size = size; @@ -654,7 +654,7 @@ wxImageDataObject::wxImageDataObject(const wxImage& image) void wxImageDataObject::SetImage(const wxImage& image) { - wxCHECK_RET(wxImage::FindHandler(wxIMAGE_FORMAT_BITMAP_TYPE) != NULL, + wxCHECK_RET(wxImage::FindHandler(wxIMAGE_FORMAT_BITMAP_TYPE) != nullptr, wxIMAGE_FORMAT_NAME " image handler must be installed to use clipboard with image"); wxMemoryOutputStream mem; @@ -665,7 +665,7 @@ void wxImageDataObject::SetImage(const wxImage& image) wxImage wxImageDataObject::GetImage() const { - wxCHECK_MSG(wxImage::FindHandler(wxIMAGE_FORMAT_BITMAP_TYPE) != NULL, wxNullImage, + wxCHECK_MSG(wxImage::FindHandler(wxIMAGE_FORMAT_BITMAP_TYPE) != nullptr, wxNullImage, wxIMAGE_FORMAT_NAME " image handler must be installed to use clipboard with image"); wxMemoryInputStream mem(GetData(), GetSize()); diff --git a/src/common/docview.cpp b/src/common/docview.cpp index e22b6dd99f..1b94d90ce5 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -97,7 +97,7 @@ namespace wxString FindExtension(const wxString& path) { wxString ext; - wxFileName::SplitPath(path, NULL, NULL, &ext); + wxFileName::SplitPath(path, nullptr, nullptr, &ext); // VZ: extensions are considered not case sensitive - is this really a good // idea? @@ -113,13 +113,13 @@ wxString FindExtension(const wxString& path) wxDocument::wxDocument(wxDocument *parent) { m_documentModified = false; - m_documentTemplate = NULL; + m_documentTemplate = nullptr; m_documentParent = parent; if ( parent ) parent->m_childDocuments.push_back(this); - m_commandProcessor = NULL; + m_commandProcessor = nullptr; m_savedYet = false; } @@ -252,7 +252,7 @@ bool wxDocument::DeleteAllViews() wxView *wxDocument::GetFirstView() const { if ( m_documentViews.empty() ) - return NULL; + return nullptr; return static_cast(m_documentViews.GetFirst()->GetData()); } @@ -611,7 +611,7 @@ bool wxDocument::RemoveView(wxView *view) bool wxDocument::OnCreate(const wxString& WXUNUSED(path), long flags) { - return GetDocumentTemplate()->CreateView(this, flags) != NULL; + return GetDocumentTemplate()->CreateView(this, flags) != nullptr; } // Called after a view is added or removed. @@ -726,11 +726,11 @@ bool wxDocument::DoOpenDocument(const wxString& file) wxView::wxView() { - m_viewDocument = NULL; + m_viewDocument = nullptr; - m_viewFrame = NULL; + m_viewFrame = nullptr; - m_docChildFrame = NULL; + m_docChildFrame = nullptr; } wxView::~wxView() @@ -739,20 +739,20 @@ wxView::~wxView() GetDocumentManager()->ActivateView(this, false); // reset our frame view first, before removing it from the document as - // SetView(NULL) is a simple call while RemoveView() may result in user + // SetView(nullptr) is a simple call while RemoveView() may result in user // code being executed and this user code can, for example, show a message // box which would result in an activation event for m_docChildFrame and so // could reactivate the view being destroyed -- unless we reset it first if ( m_docChildFrame && m_docChildFrame->GetView() == this ) { // prevent it from doing anything with us - m_docChildFrame->SetView(NULL); + m_docChildFrame->SetView(nullptr); // it doesn't make sense to leave the frame alive if its associated // view doesn't exist any more so unconditionally close it as well // - // notice that we only get here if m_docChildFrame is non-NULL in the - // first place and it will be always NULL if we're deleted because our + // notice that we only get here if m_docChildFrame is non-null in the + // first place and it will be always nullptr if we're deleted because our // frame was closed, so this only catches the case of directly deleting // the view, as it happens if its creation fails in wxDocTemplate:: // CreateView() for example @@ -765,7 +765,7 @@ wxView::~wxView() void wxView::SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame) { - SetFrame(docChildFrame ? docChildFrame->GetWindow() : NULL); + SetFrame(docChildFrame ? docChildFrame->GetWindow() : nullptr); m_docChildFrame = docChildFrame; } @@ -888,7 +888,7 @@ wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags) // just have to assume that it always deletes it in case of failure wxDocument * const doc = DoCreateDocument(); - return doc && InitDocument(doc, path, flags) ? doc : NULL; + return doc && InitDocument(doc, path, flags) ? doc : nullptr; } bool @@ -926,11 +926,11 @@ wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags) { wxScopedPtr view(DoCreateView()); if ( !view ) - return NULL; + return nullptr; view->SetDocument(doc); if ( !view->OnCreate(doc, flags) ) - return NULL; + return nullptr; return view.release(); } @@ -956,7 +956,7 @@ bool wxDocTemplate::FileMatchesTemplate(const wxString& path) wxDocument *wxDocTemplate::DoCreateDocument() { if (!m_docClassInfo) - return NULL; + return nullptr; return static_cast(m_docClassInfo->CreateObject()); } @@ -964,7 +964,7 @@ wxDocument *wxDocTemplate::DoCreateDocument() wxView *wxDocTemplate::DoCreateView() { if (!m_viewClassInfo) - return NULL; + return nullptr; return static_cast(m_viewClassInfo->CreateObject()); } @@ -1011,16 +1011,16 @@ wxBEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) #endif // wxUSE_PRINTING_ARCHITECTURE wxEND_EVENT_TABLE() -wxDocManager* wxDocManager::sm_docManager = NULL; +wxDocManager* wxDocManager::sm_docManager = nullptr; wxDocManager::wxDocManager(long WXUNUSED(flags), bool initialize) { sm_docManager = this; m_defaultDocumentNameCounter = 1; - m_currentView = NULL; + m_currentView = nullptr; m_maxDocsOpen = INT_MAX; - m_fileHistory = NULL; + m_fileHistory = nullptr; if ( initialize ) Initialize(); } @@ -1029,7 +1029,7 @@ wxDocManager::~wxDocManager() { Clear(); delete m_fileHistory; - sm_docManager = NULL; + sm_docManager = nullptr; } // closes the specified document @@ -1082,7 +1082,7 @@ bool wxDocManager::Clear(bool force) if (!CloseDocuments(force)) return false; - m_currentView = NULL; + m_currentView = nullptr; wxList::compatibility_iterator node = m_templates.GetFirst(); while (node) @@ -1348,7 +1348,7 @@ void wxDocManager::OnUpdateFileOpen(wxUpdateUIEvent& event) void wxDocManager::OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event) { - event.Enable( GetCurrentDocument() != NULL ); + event.Enable( GetCurrentDocument() != nullptr ); } void wxDocManager::OnUpdateFileRevert(wxUpdateUIEvent& event) @@ -1489,7 +1489,7 @@ wxDocument* wxDocManager::FindDocumentByPath(const wxString& path) const if ( fileName == wxFileName(doc->GetFilename()) ) return doc; } - return NULL; + return nullptr; } wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) @@ -1502,7 +1502,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) if ( !numTemplates ) { // no templates can be used, can't create document - return NULL; + return nullptr; } @@ -1533,7 +1533,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) } if ( !temp ) - return NULL; + return nullptr; // check whether the document with this path is already opened if ( !path.empty() ) @@ -1556,7 +1556,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) if ( !CloseDocument((wxDocument *)GetDocuments().GetFirst()->GetData()) ) { // can't open the new document if closing the old one failed - return NULL; + return nullptr; } } @@ -1564,7 +1564,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) // do create and initialize the new document finally wxDocument * const docNew = temp->CreateDocument(path, flags); if ( !docNew ) - return NULL; + return nullptr; docNew->SetDocumentName(temp->GetDocumentName()); @@ -1576,7 +1576,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags) : docNew->OnOpenDocument(path)) ) { docNew->DeleteAllViews(); - return NULL; + return nullptr; } } wxCATCH_ALL( docNew->DeleteAllViews(); throw; ) @@ -1601,14 +1601,14 @@ wxView *wxDocManager::CreateView(wxDocument *doc, long flags) const size_t numTemplates = templates.size(); if ( numTemplates == 0 ) - return NULL; + return nullptr; wxDocTemplate * const temp = numTemplates == 1 ? templates[0] : SelectViewType(&templates[0], numTemplates); if ( !temp ) - return NULL; + return nullptr; wxView *view = temp->CreateView(doc, flags); if ( view ) @@ -1631,13 +1631,13 @@ bool wxDocManager::FlushDoc(wxDocument *WXUNUSED(doc)) wxDocument *wxDocManager::GetCurrentDocument() const { wxView * const view = GetAnyUsableView(); - return view ? view->GetDocument() : NULL; + return view ? view->GetDocument() : nullptr; } wxCommandProcessor *wxDocManager::GetCurrentCommandProcessor() const { wxDocument * const doc = GetCurrentDocument(); - return doc ? doc->GetCommandProcessor() : NULL; + return doc ? doc->GetCommandProcessor() : nullptr; } // Make a default name for a new document @@ -1671,7 +1671,7 @@ wxString wxDocManager::MakeFrameTitle(wxDocument* doc) // Not yet implemented wxDocTemplate *wxDocManager::MatchTemplate(const wxString& WXUNUSED(path)) { - return NULL; + return nullptr; } // File history management @@ -1745,7 +1745,7 @@ size_t wxDocManager::GetHistoryFilesCount() const // against that of the template wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path) { - wxDocTemplate *theTemplate = NULL; + wxDocTemplate *theTemplate = nullptr; // Find the template which this extension corresponds to for (size_t i = 0; i < m_templates.GetCount(); i++) @@ -1800,7 +1800,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, descrBuf, wxFD_OPEN | wxFD_FILE_MUST_EXIST); - wxDocTemplate *theTemplate = NULL; + wxDocTemplate *theTemplate = nullptr; if (!pathTmp.empty()) { if (!wxFileExists(pathTmp)) @@ -1816,7 +1816,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, wxOK | wxICON_EXCLAMATION | wxCENTRE); path.clear(); - return NULL; + return nullptr; } SetLastDirectory(wxPathOnly(pathTmp)); @@ -1834,7 +1834,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, // can happen if the user specified the extension explicitly // but didn't bother changing the filter. if ( !theTemplate->FileMatchesTemplate(path) ) - theTemplate = NULL; + theTemplate = nullptr; } } @@ -1914,7 +1914,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, { case 0: // no visible templates, hence nothing to choose from - theTemplate = NULL; + theTemplate = nullptr; break; case 1: @@ -1990,7 +1990,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, switch ( n ) { case 0: - theTemplate = NULL; + theTemplate = nullptr; break; case 1: @@ -2033,7 +2033,7 @@ wxDocTemplate* wxDocManager::FindTemplate(const wxClassInfo* classinfo) return t; } - return NULL; + return nullptr; } // Add and remove a document from the manager's list @@ -2061,7 +2061,7 @@ void wxDocManager::ActivateView(wxView *view, bool activate) if ( m_currentView == view ) { // don't keep stale pointer - m_currentView = NULL; + m_currentView = nullptr; } } } @@ -2109,16 +2109,16 @@ bool wxDocChildFrameAnyBase::CloseView(wxCloseEvent& event) m_childView->Activate(false); - // it is important to reset m_childView frame pointer to NULL before + // it is important to reset m_childView frame pointer to nullptr before // deleting it because while normally it is the frame which deletes the // view when it's closed, the view also closes the frame if it is // deleted directly not by us as indicated by its doc child frame // pointer still being set - m_childView->SetDocChildFrame(NULL); + m_childView->SetDocChildFrame(nullptr); wxDELETE(m_childView); } - m_childDocument = NULL; + m_childDocument = nullptr; return true; } diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 9b4977e961..24a16b077a 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -46,7 +46,7 @@ const wxVideoMode wxDefaultVideoMode; // the factory object used by wxDisplay // // created on demand and destroyed by wxDisplayModule -static wxDisplayFactory *gs_factory = NULL; +static wxDisplayFactory *gs_factory = nullptr; // ---------------------------------------------------------------------------- // wxDisplayModule is used to cleanup gs_factory @@ -241,12 +241,12 @@ wxDisplayImpl* wxDisplayFactory::GetPrimaryDisplay() // This is not supposed to happen, but what else can we do if it // somehow does? - return NULL; + return nullptr; } int wxDisplayFactory::GetFromWindow(const wxWindow *window) { - wxCHECK_MSG( window, wxNOT_FOUND, "window can't be NULL" ); + wxCHECK_MSG( window, wxNOT_FOUND, "window can't be null" ); // Check if the window is created: we can't find its display before this is // done anyhow, as we simply don't know on which display will it appear, @@ -267,7 +267,7 @@ int wxDisplayFactory::GetFromWindow(const wxWindow *window) wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) { // we recognize the main display only - return n != 0 ? NULL : CreateSingleDisplay(); + return n != 0 ? nullptr : CreateSingleDisplay(); } int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt) diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 833c88ce48..45de5b7ecf 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -64,7 +64,7 @@ wxDllType wxDynamicLibrary::GetProgramHandle() bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) { - wxASSERT_MSG(m_handle == 0, wxT("Library already loaded.")); + wxASSERT_MSG(m_handle == nullptr, wxT("Library already loaded.")); // add the proper extension for the DLL ourselves unless told not to wxString libname = libnameOrig; @@ -72,7 +72,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) { // and also check that the libname doesn't already have it wxString ext; - wxFileName::SplitPath(libname, NULL, NULL, &ext); + wxFileName::SplitPath(libname, nullptr, nullptr, &ext); if ( ext.empty() ) { libname += GetDllExt(wxDL_MODULE); @@ -81,7 +81,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) m_handle = RawLoad(libname, flags); - if ( m_handle == 0 && !(flags & wxDL_QUIET) ) + if ( m_handle == nullptr && !(flags & wxDL_QUIET) ) { ReportError(_("Failed to load shared library '%s'"), libname); } @@ -91,13 +91,13 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const { - wxCHECK_MSG( IsLoaded(), NULL, + wxCHECK_MSG( IsLoaded(), nullptr, wxT("Can't load symbol from unloaded library") ); void *symbol = RawGetSymbol(m_handle, name); if ( success ) - *success = symbol != NULL; + *success = symbol != nullptr; return symbol; } diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index c54dfff298..f6300a633a 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -40,7 +40,7 @@ // --------------------------------------------------------------------------- -wxDLImports* wxPluginLibrary::ms_classes = NULL; +wxDLImports* wxPluginLibrary::ms_classes = nullptr; class wxPluginLibraryModule : public wxModule { @@ -97,10 +97,10 @@ wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) else // We didn't register any classes at all. { m_ourFirst = - m_ourLast = NULL; + m_ourLast = nullptr; } - if( m_handle != 0 ) + if( m_handle != nullptr ) { UpdateClasses(); RegisterModules(); @@ -114,7 +114,7 @@ wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) wxPluginLibrary::~wxPluginLibrary() { - if( m_handle != 0 ) + if( m_handle != nullptr ) { UnregisterModules(); RestoreClasses(); @@ -123,7 +123,7 @@ wxPluginLibrary::~wxPluginLibrary() wxPluginLibrary *wxPluginLibrary::RefLib() { - wxCHECK_MSG( m_linkcount > 0, NULL, + wxCHECK_MSG( m_linkcount > 0, nullptr, wxT("Library had been already deleted!") ); ++m_linkcount; @@ -268,7 +268,7 @@ void wxPluginLibrary::UnregisterModules() // wxPluginManager // --------------------------------------------------------------------------- -wxDLManifest* wxPluginManager::ms_manifest = NULL; +wxDLManifest* wxPluginManager::ms_manifest = nullptr; // ------------------------ // Static accessors @@ -286,7 +286,7 @@ wxPluginManager::LoadLibrary(const wxString &libname, int flags) if ( flags & wxDL_NOSHARE ) { - entry = NULL; + entry = nullptr; } else { @@ -324,7 +324,7 @@ wxPluginManager::LoadLibrary(const wxString &libname, int flags) wxFAIL_MSG( wxT("Currently linked library is not loaded?") ); } - entry = NULL; + entry = nullptr; } } @@ -393,7 +393,7 @@ void wxPluginManager::Unload() m_entry->UnrefLib(); - m_entry = NULL; + m_entry = nullptr; } #endif // wxUSE_DYNAMIC_LOADER diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index 569feac53e..398f1d1431 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -42,7 +42,7 @@ static const wxUint16* GetEncTable(wxFontEncoding enc) // create CFStringEncoding cfencoding = wxMacGetSystemEncFromFontEnc( enc ) ; if( !CFStringIsEncodingAvailable( cfencoding ) ) - return NULL; + return nullptr; memset( gMacEncodings[i] , 0 , 128 * 2 ); char s[2] = { 0 , 0 }; @@ -50,7 +50,7 @@ static const wxUint16* GetEncTable(wxFontEncoding enc) for( unsigned char c = 255 ; c >= 128 ; --c ) { s[0] = c ; - wxCFStringRef cfref( CFStringCreateWithCStringNoCopy( NULL, s, cfencoding , kCFAllocatorNull ) ); + wxCFStringRef cfref( CFStringCreateWithCStringNoCopy( nullptr, s, cfencoding , kCFAllocatorNull ) ); CFStringGetCharacters( cfref, firstchar, (UniChar*) &gMacEncodings[i][c-128] ); } gMacEncodingsInited[i]=true; @@ -59,12 +59,12 @@ static const wxUint16* GetEncTable(wxFontEncoding enc) } #endif - for (int i = 0; encodings_list[i].table != NULL; i++) + for (int i = 0; encodings_list[i].table != nullptr; i++) { if (encodings_list[i].encoding == enc) return encodings_list[i].table; } - return NULL; + return nullptr; } typedef struct { @@ -97,7 +97,7 @@ static CharsetItem* BuildReverseTable(const wxUint16 *tbl) wxEncodingConverter::wxEncodingConverter() { - m_Table = NULL; + m_Table = nullptr; m_UnicodeInput = m_UnicodeOutput = false; m_JustCopy = false; } @@ -108,7 +108,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e { unsigned i; const wxUint16 *in_tbl; - const wxUint16 *out_tbl = NULL; + const wxUint16 *out_tbl = nullptr; wxDELETEA(m_Table); @@ -119,7 +119,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e if (input_enc == wxFONTENCODING_UNICODE) { - if ((out_tbl = GetEncTable(output_enc)) == NULL) return false; + if ((out_tbl = GetEncTable(output_enc)) == nullptr) return false; m_Table = new wchar_t[65536]; for (i = 0; i < 128; i++) m_Table[i] = (wchar_t)i; // 7bit ASCII @@ -138,9 +138,9 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e } else // input !Unicode { - if ((in_tbl = GetEncTable(input_enc)) == NULL) return false; + if ((in_tbl = GetEncTable(input_enc)) == nullptr) return false; if (output_enc != wxFONTENCODING_UNICODE) - if ((out_tbl = GetEncTable(output_enc)) == NULL) return false; + if ((out_tbl = GetEncTable(output_enc)) == nullptr) return false; m_UnicodeInput = false; @@ -162,7 +162,7 @@ bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_e key.u = in_tbl[i]; CharsetItem* item; item = (CharsetItem*) bsearch(&key, rev, 128, sizeof(CharsetItem), CompareCharsetItems); - if (item == NULL && method == wxCONVERT_SUBSTITUTE) + if (item == nullptr && method == wxCONVERT_SUBSTITUTE) item = (CharsetItem*) bsearch(&key, encoding_unicode_fallback, encoding_unicode_fallback_count, sizeof(CharsetItem), CompareCharsetItems); if (item) @@ -207,7 +207,7 @@ bool wxEncodingConverter::Convert(const char* input, char* output) const return true; } - wxCHECK_MSG(m_Table != NULL, false, + wxCHECK_MSG(m_Table != nullptr, false, wxT("You must call wxEncodingConverter::Init() before actually converting!")); bool replaced = false; @@ -236,7 +236,7 @@ bool wxEncodingConverter::Convert(const char* input, wchar_t* output) const return true; } - wxCHECK_MSG(m_Table != NULL, false, + wxCHECK_MSG(m_Table != nullptr, false, wxT("You must call wxEncodingConverter::Init() before actually converting!")); bool replaced = false; @@ -266,7 +266,7 @@ bool wxEncodingConverter::Convert(const wchar_t* input, char* output) const return true; } - wxCHECK_MSG(m_Table != NULL, false, + wxCHECK_MSG(m_Table != nullptr, false, wxT("You must call wxEncodingConverter::Init() before actually converting!")); bool replaced = false; @@ -297,7 +297,7 @@ bool wxEncodingConverter::Convert(const wchar_t* input, wchar_t* output) const return true; } - wxCHECK_MSG(m_Table != NULL, false, + wxCHECK_MSG(m_Table != nullptr, false, wxT("You must call wxEncodingConverter::Init() before actually converting!")); bool replaced = false; @@ -317,7 +317,7 @@ wxString wxEncodingConverter::Convert(const wxString& input) const wxString s; const wxChar *i; - wxCHECK_MSG(m_Table != NULL, s, + wxCHECK_MSG(m_Table != nullptr, s, wxT("You must call wxEncodingConverter::Init() before actually converting!")); if (m_UnicodeInput) diff --git a/src/common/event.cpp b/src/common/event.cpp index f3fa866fb9..516357597c 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -120,7 +120,7 @@ const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } const wxEventTable wxEvtHandler::sm_eventTable = - { (const wxEventTable *)NULL, &wxEvtHandler::sm_eventTableEntries[0] }; + { (const wxEventTable *)nullptr, &wxEvtHandler::sm_eventTableEntries[0] }; wxEventHashTable &wxEvtHandler::GetEventHashTable() const { return wxEvtHandler::sm_eventHashTable; } @@ -379,15 +379,15 @@ wxEventFunctor::~wxEventFunctor() wxEvent::wxEvent(int theId, wxEventType commandType) : m_eventType(commandType) { - m_eventObject = NULL; + m_eventObject = nullptr; m_timeStamp = 0; m_id = theId; m_skipped = false; - m_callbackUserData = NULL; - m_handlerToProcessOnlyIn = NULL; + m_callbackUserData = nullptr; + m_handlerToProcessOnlyIn = nullptr; m_isCommandEvent = false; m_propagationLevel = wxEVENT_PROPAGATE_NONE; - m_propagatedFrom = NULL; + m_propagatedFrom = nullptr; m_wasProcessed = false; m_willBeProcessedAgain = false; } @@ -399,9 +399,9 @@ wxEvent::wxEvent(const wxEvent& src) , m_timeStamp(src.m_timeStamp) , m_id(src.m_id) , m_callbackUserData(src.m_callbackUserData) - , m_handlerToProcessOnlyIn(NULL) + , m_handlerToProcessOnlyIn(nullptr) , m_propagationLevel(src.m_propagationLevel) - , m_propagatedFrom(NULL) + , m_propagatedFrom(nullptr) , m_skipped(src.m_skipped) , m_isCommandEvent(src.m_isCommandEvent) , m_wasProcessed(false) @@ -418,9 +418,9 @@ wxEvent& wxEvent::operator=(const wxEvent& src) m_timeStamp = src.m_timeStamp; m_id = src.m_id; m_callbackUserData = src.m_callbackUserData; - m_handlerToProcessOnlyIn = NULL; + m_handlerToProcessOnlyIn = nullptr; m_propagationLevel = src.m_propagationLevel; - m_propagatedFrom = NULL; + m_propagatedFrom = nullptr; m_skipped = src.m_skipped; m_isCommandEvent = src.m_isCommandEvent; @@ -957,7 +957,7 @@ wxSize wxDPIChangedEvent::Scale(wxSize sz) const static const int EVENT_TYPE_TABLE_INIT_SIZE = 31; // Not too big not too small... -wxEventHashTable* wxEventHashTable::sm_first = NULL; +wxEventHashTable* wxEventHashTable::sm_first = nullptr; wxEventHashTable::wxEventHashTable(const wxEventTable &table) : m_table(table), @@ -1052,7 +1052,7 @@ void wxEventHashTable::InitHashTable() { // Retrieve all valid event handler entries const wxEventTableEntry *entry = table->entries; - while (entry->m_fn != 0) + while (entry->m_fn != nullptr) { // Add the event entry in the Hash. AddEntry(*entry); @@ -1155,14 +1155,14 @@ void wxEventHashTable::GrowEventTypeTable() wxEvtHandler::wxEvtHandler() { - m_nextHandler = NULL; - m_previousHandler = NULL; + m_nextHandler = nullptr; + m_previousHandler = nullptr; m_enabled = true; - m_dynamicEvents = NULL; - m_pendingEvents = NULL; + m_dynamicEvents = nullptr; + m_pendingEvents = nullptr; // no client data (yet) - m_clientData = NULL; + m_clientData = nullptr; m_clientDataType = wxClientData_None; } @@ -1218,21 +1218,21 @@ void wxEvtHandler::Unlink() if (m_nextHandler) m_nextHandler->SetPreviousHandler(m_previousHandler); - m_nextHandler = NULL; - m_previousHandler = NULL; + m_nextHandler = nullptr; + m_previousHandler = nullptr; } bool wxEvtHandler::IsUnlinked() const { - return m_previousHandler == NULL && - m_nextHandler == NULL; + return m_previousHandler == nullptr && + m_nextHandler == nullptr; } -wxEventFilter* wxEvtHandler::ms_filterList = NULL; +wxEventFilter* wxEvtHandler::ms_filterList = nullptr; /* static */ void wxEvtHandler::AddFilter(wxEventFilter* filter) { - wxCHECK_RET( filter, "NULL filter" ); + wxCHECK_RET( filter, "null filter" ); filter->m_next = ms_filterList; ms_filterList = filter; @@ -1240,7 +1240,7 @@ wxEventFilter* wxEvtHandler::ms_filterList = NULL; /* static */ void wxEvtHandler::RemoveFilter(wxEventFilter* filter) { - wxEventFilter* prev = NULL; + wxEventFilter* prev = nullptr; for ( wxEventFilter* f = ms_filterList; f; f = f->m_next ) { if ( f == filter ) @@ -1255,7 +1255,7 @@ wxEventFilter* wxEvtHandler::ms_filterList = NULL; // Also reset the next pointer in the filter itself just to avoid // having possibly dangling pointers, even though it's not strictly // necessary. - f->m_next = NULL; + f->m_next = nullptr; // Skip the assert below. return; @@ -1284,7 +1284,7 @@ bool wxEvtHandler::ProcessThreadEvent(const wxEvent& event) void wxEvtHandler::QueueEvent(wxEvent *event) { - wxCHECK_RET( event, "NULL event can't be posted" ); + wxCHECK_RET( event, "null event can't be posted" ); if (!wxTheApp) { @@ -1362,7 +1362,7 @@ void wxEvtHandler::ProcessPendingEvents() while (node && pEvent && !evtLoop->IsEventAllowedInsideYield(pEvent->GetEventCategory())) { node = node->GetNext(); - pEvent = node ? static_cast(node->GetData()) : NULL; + pEvent = node ? static_cast(node->GetData()) : nullptr; } if (!node) @@ -1731,7 +1731,7 @@ void wxEvtHandler::WXConsumeException() bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event) { const wxEventType eventType = event.GetEventType(); - for ( int i = 0; table.entries[i].m_fn != 0; i++ ) + for ( int i = 0; table.entries[i].m_fn != nullptr; i++ ) { const wxEventTableEntry& entry = table.entries[i]; if ( eventType == entry.m_eventType ) @@ -1820,7 +1820,7 @@ wxEvtHandler::DoUnbind(int id, // 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; + (*m_dynamicEvents)[cookie] = nullptr; delete entry; return true; @@ -1833,7 +1833,7 @@ wxDynamicEventTableEntry* wxEvtHandler::GetFirstDynamicEntry(size_t& cookie) const { if ( !m_dynamicEvents ) - return NULL; + return nullptr; // The handlers are in LIFO order, so we must start at the end. cookie = m_dynamicEvents->size(); @@ -1854,7 +1854,7 @@ wxEvtHandler::GetNextDynamicEntry(size_t& cookie) const return entry; } - return NULL; + return nullptr; } bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) @@ -1938,7 +1938,7 @@ void wxEvtHandler::DoSetClientObject( wxClientData *data ) wxClientData *wxEvtHandler::DoGetClientObject() const { // it's not an error to call GetClientObject() on a window which doesn't - // have client data at all - NULL will be returned + // have client data at all - nullptr will be returned wxASSERT_MSG( m_clientDataType != wxClientData_Void, wxT("this window doesn't have object client data") ); @@ -1957,7 +1957,7 @@ void wxEvtHandler::DoSetClientData( void *data ) void *wxEvtHandler::DoGetClientData() const { // it's not an error to call GetClientData() on a window which doesn't have - // client data at all - NULL will be returned + // client data at all - nullptr will be returned wxASSERT_MSG( m_clientDataType != wxClientData_Object, wxT("this window doesn't have void client data") ); @@ -1979,7 +1979,7 @@ wxEvtHandler::FindRefInTrackerList(wxEvtHandler *eventSink) } } - return NULL; + return nullptr; } void wxEvtHandler::OnSinkDestroyed( wxEvtHandler *sink ) @@ -1999,7 +1999,7 @@ void wxEvtHandler::OnSinkDestroyed( wxEvtHandler *sink ) // Just as in DoUnbind(), we use our knowledge of // GetNextDynamicEntry() implementation here. - (*m_dynamicEvents)[cookie] = NULL; + (*m_dynamicEvents)[cookie] = nullptr; } } } @@ -2017,7 +2017,7 @@ wxWindow* wxFindFocusDescendant(wxWindow* ancestor) wxWindow* win = focusWin; // Check if this is a descendant of this frame. - // If not, win will be set to NULL. + // If not, win will be set to nullptr. while (win) { if (win == ancestor) @@ -2025,8 +2025,8 @@ wxWindow* wxFindFocusDescendant(wxWindow* ancestor) else win = win->GetParent(); } - if (win == NULL) - focusWin = NULL; + if (win == nullptr) + focusWin = nullptr; return focusWin; } diff --git a/src/common/evtloopcmn.cpp b/src/common/evtloopcmn.cpp index 0ff7dfbe82..69a51b3bc3 100644 --- a/src/common/evtloopcmn.cpp +++ b/src/common/evtloopcmn.cpp @@ -32,7 +32,7 @@ static int gs_eventLoopCount = 0; // wxEventLoopBase // ---------------------------------------------------------------------------- -wxEventLoopBase *wxEventLoopBase::ms_activeLoop = NULL; +wxEventLoopBase *wxEventLoopBase::ms_activeLoop = nullptr; wxEventLoopBase::wxEventLoopBase() { @@ -190,11 +190,11 @@ wxEventLoopBase::AddSourceForFD(int fd, // Delegate to the event loop sources manager defined by it. wxEventLoopSourcesManagerBase* const manager = wxApp::GetValidTraits().GetEventLoopSourcesManager(); - wxCHECK_MSG( manager, NULL, wxS("Must have wxEventLoopSourcesManager") ); + wxCHECK_MSG( manager, nullptr, wxS("Must have wxEventLoopSourcesManager") ); return manager->AddSourceForFD(fd, handler, flags); #else // !wxUSE_CONSOLE_EVENTLOOP - return NULL; + return nullptr; #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP } diff --git a/src/common/fdiodispatcher.cpp b/src/common/fdiodispatcher.cpp index d74e36f370..7296cb122b 100644 --- a/src/common/fdiodispatcher.cpp +++ b/src/common/fdiodispatcher.cpp @@ -31,7 +31,7 @@ #endif static -wxFDIODispatcher *gs_dispatcher = NULL; +wxFDIODispatcher *gs_dispatcher = nullptr; // ============================================================================ // implementation @@ -75,14 +75,14 @@ wxFDIOHandler *wxMappedFDIODispatcher::FindHandler(int fd) const { const wxFDIOHandlerMap::const_iterator it = m_handlers.find(fd); - return it == m_handlers.end() ? NULL : it->second.handler; + return it == m_handlers.end() ? nullptr : it->second.handler; } bool wxMappedFDIODispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags) { - wxCHECK_MSG( handler, false, "handler can't be NULL" ); + wxCHECK_MSG( handler, false, "handler can't be null" ); // notice that it's not an error to register a handler for the same fd // twice as it can be done with different flags -- but it is an error to @@ -104,7 +104,7 @@ wxMappedFDIODispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags) bool wxMappedFDIODispatcher::ModifyFD(int fd, wxFDIOHandler *handler, int flags) { - wxCHECK_MSG( handler, false, "handler can't be NULL" ); + wxCHECK_MSG( handler, false, "handler can't be null" ); wxFDIOHandlerMap::iterator i = m_handlers.find(fd); wxCHECK_MSG( i != m_handlers.end(), false, diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index f69b7fa74d..8364c56c35 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -41,7 +41,7 @@ wxFFile::wxFFile(const wxString& filename, const wxString& mode) { - m_fp = NULL; + m_fp = nullptr; (void)Open(filename, mode); } @@ -75,7 +75,7 @@ bool wxFFile::Close() return false; } - m_fp = NULL; + m_fp = nullptr; } return true; diff --git a/src/common/file.cpp b/src/common/file.cpp index 4ddcfa40c6..a4bc8318be 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -244,7 +244,7 @@ bool wxFile::Close() bool wxFile::ReadAll(wxString *str, const wxMBConv& conv) { - wxCHECK_MSG( str, false, wxS("Output string must be non-NULL") ); + wxCHECK_MSG( str, false, wxS("Output string must be non-null") ); static const ssize_t READSIZE = 4096; @@ -324,7 +324,7 @@ ssize_t wxFile::Read(void *pBuf, size_t nCount) if ( !nCount ) return 0; - wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); + wxCHECK( (pBuf != nullptr) && IsOpened(), 0 ); ssize_t iRc = wxRead(m_fd, pBuf, nCount); @@ -343,7 +343,7 @@ size_t wxFile::Write(const void *pBuf, size_t nCount) if ( !nCount ) return 0; - wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); + wxCHECK( (pBuf != nullptr) && IsOpened(), 0 ); ssize_t iRc = wxWrite(m_fd, pBuf, nCount); diff --git a/src/common/fileback.cpp b/src/common/fileback.cpp index af65c9bff7..b1869ba614 100644 --- a/src/common/fileback.cpp +++ b/src/common/fileback.cpp @@ -70,7 +70,7 @@ wxBackingFileImpl::wxBackingFileImpl(wxInputStream *stream, : m_refcount(1), m_stream(stream), m_parenterror(wxSTREAM_NO_ERROR), - m_buf(NULL), + m_buf(nullptr), m_bufsize(bufsize), m_buflen(0), m_prefix(prefix), @@ -228,7 +228,7 @@ wxBackingFile::wxBackingFile(wxInputStream *stream, } wxBackingFile::wxBackingFile(const wxBackingFile& backer) - : m_impl(backer.m_impl ? backer.m_impl->AddRef() : NULL) + : m_impl(backer.m_impl ? backer.m_impl->AddRef() : nullptr) { } diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 8f8e0010aa..36810988df 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -101,8 +101,8 @@ public: // ctor wxFileConfigLineList(const wxString& str, - wxFileConfigLineList *pNext = NULL) : m_strLine(str) - { SetNext(pNext); SetPrev(NULL); } + wxFileConfigLineList *pNext = nullptr) : m_strLine(str) + { SetNext(pNext); SetPrev(nullptr); } // next/prev nodes in the linked list wxFileConfigLineList *Next() const { return m_pNext; } @@ -134,9 +134,9 @@ private: bool m_bImmutable:1, // can be overridden locally? m_bHasValue:1; // set after first call to SetValue() - int m_nLine; // used if m_pLine == NULL only + int m_nLine; // used if m_pLine == nullptr only - // pointer to our line in the linked list or NULL if it was found in global + // pointer to our line in the linked list or nullptr if it was found in global // file (which we don't modify) wxFileConfigLineList *m_pLine; @@ -149,7 +149,7 @@ public: const wxString& Value() const { return m_strValue; } wxFileConfigGroup *Group() const { return m_pParent; } bool IsImmutable() const { return m_bImmutable; } - bool IsLocal() const { return m_pLine != 0; } + bool IsLocal() const { return m_pLine != nullptr; } int Line() const { return m_nLine; } wxFileConfigLineList * GetLine() const { return m_pLine; } @@ -169,7 +169,7 @@ class wxFileConfigGroup { private: wxFileConfig *m_pConfig; // config object we belong to - wxFileConfigGroup *m_pParent; // parent group (NULL for root group) + wxFileConfigGroup *m_pParent; // parent group (nullptr for root group) ArrayEntries m_aEntries; // entries in this group ArrayGroups m_aSubgroups; // subgroups wxString m_strName; // group's name @@ -199,7 +199,7 @@ public: const ArrayGroups& Groups() const { return m_aSubgroups; } bool IsEmpty() const { return Entries().IsEmpty() && Groups().IsEmpty(); } - // find entry/subgroup (NULL if not found) + // find entry/subgroup (nullptr if not found) wxFileConfigGroup *FindSubgroup(const wxString& name) const; wxFileConfigEntry *FindEntry (const wxString& name) const; @@ -221,7 +221,7 @@ public: // get the last line belonging to an entry/subgroup of this group wxFileConfigLineList *GetGroupLine(); // line which contains [group] - // may be NULL for "/" only + // may be null for "/" only wxFileConfigLineList *GetLastEntryLine(); // after which our subgroups start wxFileConfigLineList *GetLastGroupLine(); // after which the next group starts @@ -292,10 +292,10 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxFileConfig, wxConfigBase); void wxFileConfig::Init() { m_pCurrentGroup = - m_pRootGroup = new wxFileConfigGroup(NULL, wxEmptyString, this); + m_pRootGroup = new wxFileConfigGroup(nullptr, wxEmptyString, this); m_linesHead = - m_linesTail = NULL; + m_linesTail = nullptr; // It's not an error if (one of the) file(s) doesn't exist. @@ -399,10 +399,10 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, const wxMBConv& conv) SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE); m_pCurrentGroup = - m_pRootGroup = new wxFileConfigGroup(NULL, wxEmptyString, this); + m_pRootGroup = new wxFileConfigGroup(nullptr, wxEmptyString, this); m_linesHead = - m_linesTail = NULL; + m_linesTail = nullptr; // read the entire stream contents in memory wxWxCharBuffer cbuf; @@ -477,7 +477,7 @@ void wxFileConfig::CleanUp() delete m_pRootGroup; wxFileConfigLineList *pCur = m_linesHead; - while ( pCur != NULL ) { + while ( pCur != nullptr ) { wxFileConfigLineList *pNext = pCur->Next(); delete pCur; pCur = pNext; @@ -611,7 +611,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) else { wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strKey); - if ( pEntry == NULL ) { + if ( pEntry == nullptr ) { // new entry pEntry = m_pCurrentGroup->AddEntry(strKey, n); } @@ -687,7 +687,7 @@ wxFileConfig::DoSetPath(const wxString& strPath, bool createMissingComponents) m_pCurrentGroup = m_pRootGroup; for ( n = 0; n < aParts.GetCount(); n++ ) { wxFileConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]); - if ( pNextGroup == NULL ) + if ( pNextGroup == nullptr ) { if ( !createMissingComponents ) return false; @@ -840,7 +840,7 @@ bool wxFileConfig::HasEntry(const wxString& entry) const // check if the entry exists in this group const bool exists = m_pCurrentGroup->FindEntry( - entry.AfterLast(wxCONFIG_PATH_SEPARATOR)) != NULL; + entry.AfterLast(wxCONFIG_PATH_SEPARATOR)) != nullptr; // restore the old path if we changed it above if ( !pathOld.empty() ) @@ -860,7 +860,7 @@ bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const wxConfigPathChanger path(this, key); wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); - if (pEntry == NULL) { + if (pEntry == nullptr) { return false; } @@ -885,7 +885,7 @@ bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const bool wxFileConfig::DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const { - wxCHECK_MSG( buf, false, wxT("NULL buffer") ); + wxCHECK_MSG( buf, false, wxT("null buffer") ); wxString str; if ( !Read(key, &str) ) @@ -938,7 +938,7 @@ bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue) wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strName); - if ( pEntry == 0 ) + if ( pEntry == nullptr ) { wxLogTrace( FILECONF_TRACE_MASK, wxT(" Adding Entry %s"), @@ -990,7 +990,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) // write all strings to file wxString filetext; filetext.reserve(4096); - for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) + for ( wxFileConfigLineList *p = m_linesHead; p != nullptr; p = p->Next() ) { filetext << p->Text() << wxTextFile::GetEOL(); } @@ -1018,7 +1018,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) bool wxFileConfig::Save(wxOutputStream& os, const wxMBConv& conv) { // save unconditionally, even if not dirty - for ( wxFileConfigLineList *p = m_linesHead; p != NULL; p = p->Next() ) + for ( wxFileConfigLineList *p = m_linesHead; p != nullptr; p = p->Next() ) { wxString line = p->Text(); line += wxTextFile::GetEOL(); @@ -1171,7 +1171,7 @@ wxFileConfigLineList *wxFileConfig::LineListAppend(const wxString& str) wxFileConfigLineList *pLine = new wxFileConfigLineList(str); - if ( m_linesTail == NULL ) + if ( m_linesTail == nullptr ) { // list is empty m_linesHead = pLine; @@ -1219,7 +1219,7 @@ wxFileConfigLineList *wxFileConfig::LineListInsert(const wxString& str, return LineListAppend(str); wxFileConfigLineList *pNewLine = new wxFileConfigLineList(str); - if ( pLine == NULL ) + if ( pLine == nullptr ) { // prepend to the list pNewLine->SetNext(m_linesHead); @@ -1267,14 +1267,14 @@ void wxFileConfig::LineListRemove(wxFileConfigLineList *pLine) // first entry? - if ( pPrev == NULL ) + if ( pPrev == nullptr ) m_linesHead = pNext; else pPrev->SetNext(pNext); // last entry? - if ( pNext == NULL ) + if ( pNext == nullptr ) m_linesTail = pPrev; else pNext->SetPrev(pPrev); @@ -1293,7 +1293,7 @@ void wxFileConfig::LineListRemove(wxFileConfigLineList *pLine) bool wxFileConfig::LineListIsEmpty() { - return m_linesHead == NULL; + return m_linesHead == nullptr; } // ============================================================================ @@ -1314,10 +1314,10 @@ wxFileConfigGroup::wxFileConfigGroup(wxFileConfigGroup *pParent, { m_pConfig = pConfig; m_pParent = pParent; - m_pLine = NULL; + m_pLine = nullptr; - m_pLastEntry = NULL; - m_pLastGroup = NULL; + m_pLastEntry = nullptr; + m_pLastGroup = nullptr; } // dtor deletes all children @@ -1359,10 +1359,10 @@ void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) m_pLastEntry points to the last entry of this group in the local file. m_pLastGroup subgroup - Initially, they're NULL all three. When the group (an entry/subgroup) is read + Initially, they're null all three. When the group (an entry/subgroup) is read from the local file, the corresponding variable is set. However, if the group was read from the global file and then modified or created by the application - these variables are still NULL and we need to create the corresponding lines. + these variables are still null and we need to create the corresponding lines. See the following functions (and comments preceding them) for the details of how we do it. @@ -1370,7 +1370,7 @@ void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine) element - the code in DeleteEntry/Subgroup does this by backtracking the list of lines until it either founds an entry/subgroup (and this is the new last element) or the m_pLine of the group, in which case there are no more entries - (or subgroups) left and m_pLast becomes NULL. + (or subgroups) left and m_pLast becomes null. NB: This last problem could be avoided for entries if we added new entries immediately after m_pLine, but in this case the entries would appear @@ -1412,7 +1412,7 @@ wxFileConfigLineList *wxFileConfigGroup::GetGroupLine() pParent->GetLastGroupLine()); pParent->SetLastGroup(this); // we're surely after all the others } - //else: this is the root group and so we return NULL because we don't + //else: this is the root group and so we return nullptr because we don't // have any group line } @@ -1430,7 +1430,7 @@ wxFileConfigLineList *wxFileConfigGroup::GetLastGroupLine() { wxFileConfigLineList *pLine = m_pLastGroup->GetLastGroupLine(); - wxASSERT_MSG( pLine, wxT("last group must have !NULL associated line") ); + wxASSERT_MSG( pLine, wxT("last group must have non-null associated line") ); return pLine; } @@ -1452,7 +1452,7 @@ wxFileConfigLineList *wxFileConfigGroup::GetLastEntryLine() { wxFileConfigLineList *pLine = m_pLastEntry->GetLine(); - wxASSERT_MSG( pLine, wxT("last entry must have !NULL associated line") ); + wxASSERT_MSG( pLine, wxT("last entry must have non-null associated line") ); return pLine; } @@ -1560,7 +1560,7 @@ wxFileConfigGroup::FindEntry(const wxString& name) const return pEntry; } - return NULL; + return nullptr; } wxFileConfigGroup * @@ -1591,7 +1591,7 @@ wxFileConfigGroup::FindSubgroup(const wxString& name) const return pGroup; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1601,7 +1601,7 @@ wxFileConfigGroup::FindSubgroup(const wxString& name) const // create a new entry and add it to the current group wxFileConfigEntry *wxFileConfigGroup::AddEntry(const wxString& strName, int nLine) { - wxASSERT( FindEntry(strName) == 0 ); + wxASSERT( FindEntry(strName) == nullptr ); wxFileConfigEntry *pEntry = new wxFileConfigEntry(this, strName, nLine); @@ -1612,7 +1612,7 @@ wxFileConfigEntry *wxFileConfigGroup::AddEntry(const wxString& strName, int nLin // create a new group and add it to the current group wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName) { - wxASSERT( FindSubgroup(strName) == 0 ); + wxASSERT( FindSubgroup(strName) == nullptr ); wxFileConfigGroup *pGroup = new wxFileConfigGroup(this, strName, m_pConfig); @@ -1651,9 +1651,9 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) wxLogTrace( FILECONF_TRACE_MASK, wxT(" (m_pLine) = prev: %p, this %p, next %p"), - m_pLine ? static_cast(m_pLine->Prev()) : 0, + m_pLine ? static_cast(m_pLine->Prev()) : nullptr, static_cast(m_pLine), - m_pLine ? static_cast(m_pLine->Next()) : 0 ); + m_pLine ? static_cast(m_pLine->Next()) : nullptr ); wxLogTrace( FILECONF_TRACE_MASK, wxT(" text: '%s'"), m_pLine ? m_pLine->Text() @@ -1704,7 +1704,7 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) : wxString()) ); // notice that we may do this test inside the previous "if" - // because the last entry's line is surely !NULL + // because the last entry's line is surely non-null if ( pGroup == m_pLastGroup ) { wxLogTrace( FILECONF_TRACE_MASK, @@ -1715,7 +1715,7 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup) // group line const size_t nSubgroups = m_aSubgroups.GetCount(); - m_pLastGroup = NULL; + m_pLastGroup = nullptr; for ( wxFileConfigLineList *pl = pLine->Prev(); pl && !m_pLastGroup; pl = pl->Prev() ) @@ -1762,15 +1762,15 @@ bool wxFileConfigGroup::DeleteEntry(const wxString& name) } wxFileConfigLineList *pLine = pEntry->GetLine(); - if ( pLine != NULL ) { + if ( pLine != nullptr ) { // notice that we may do this test inside the previous "if" because the - // last entry's line is surely !NULL + // last entry's line is surely non-null if ( pEntry == m_pLastEntry ) { // our last entry is being deleted - find the last one which stays - wxASSERT( m_pLine != NULL ); // if we have an entry with !NULL pLine... + wxASSERT( m_pLine != nullptr ); // if we have an entry with non-null pLine... // find the previous entry (if any) - wxFileConfigEntry *pNewLast = NULL; + wxFileConfigEntry *pNewLast = nullptr; const wxFileConfigLineList * const pNewLastLine = m_pLastEntry->GetLine()->Prev(); const size_t nEntries = m_aEntries.GetCount(); @@ -1781,14 +1781,14 @@ bool wxFileConfigGroup::DeleteEntry(const wxString& name) } } - // pNewLast can be NULL here -- it's ok and can happen if we have no + // pNewLast can be null here -- it's ok and can happen if we have no // entries left m_pLastEntry = pNewLast; // For the root group only, we could be removing the first group line // here, so update m_pLine to avoid keeping a dangling pointer. if ( pLine == m_pLine ) - SetLine(NULL); + SetLine(nullptr); } m_pConfig->LineListRemove(pLine); @@ -1816,7 +1816,7 @@ wxFileConfigEntry::wxFileConfigEntry(wxFileConfigGroup *pParent, m_pParent = pParent; m_nLine = nLine; - m_pLine = NULL; + m_pLine = nullptr; m_bHasValue = false; @@ -1831,7 +1831,7 @@ wxFileConfigEntry::wxFileConfigEntry(wxFileConfigGroup *pParent, void wxFileConfigEntry::SetLine(wxFileConfigLineList *pLine) { - if ( m_pLine != NULL ) { + if ( m_pLine != nullptr ) { wxLogWarning(_("entry '%s' appears more than once in group '%s'"), Name(), m_pParent->GetFullName()); } @@ -1882,8 +1882,8 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) else // this entry didn't exist in the local file { // add a new line to the file: note that line returned by - // GetLastEntryLine() may be NULL if we're in the root group and it - // doesn't have any entries yet, but this is ok as passing NULL + // GetLastEntryLine() may be null if we're in the root group and it + // doesn't have any entries yet, but this is ok as passing null // line to LineListInsert() means to prepend new line to the list wxFileConfigLineList *line = Group()->GetLastEntryLine(); m_pLine = Group()->Config()->LineListInsert(strLine, line); diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index ea0a391001..ca5e18971e 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -261,7 +261,7 @@ wxString wxFileNameFromPath (const wxString& path) return wxFileName(path).GetFullName(); } -// Return just the directory, or NULL if no directory +// Return just the directory, or nullptr if no directory wxChar * wxPathOnly (wxChar *path) { @@ -272,7 +272,7 @@ wxPathOnly (wxChar *path) int l = wxStrlen(path); int i = l - 1; if ( i >= _MAXPATHLEN ) - return NULL; + return nullptr; // Local copy wxStrcpy (buf, path); @@ -307,10 +307,10 @@ wxPathOnly (wxChar *path) } #endif } - return NULL; + return nullptr; } -// Return just the directory, or NULL if no directory +// Return just the directory, or nullptr if no directory wxString wxPathOnly (const wxString& path) { if (!path.empty()) @@ -370,7 +370,7 @@ wxString wxPathOnly (const wxString& path) CFURLRef wxOSXCreateURLFromFileSystemPath( const wxString& path) { - wxCFRef cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(path))); + wxCFRef cfMutableString(CFStringCreateMutableCopy(nullptr, 0, wxCFStringRef(path))); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false); } @@ -674,7 +674,7 @@ static wxString gs_dirPath; wxString wxFindFirstFile(const wxString& spec, int flags) { - wxFileName::SplitPath(spec, &gs_dirPath, NULL, NULL); + wxFileName::SplitPath(spec, &gs_dirPath, nullptr, nullptr); if ( gs_dirPath.empty() ) gs_dirPath = wxT("."); if ( !wxEndsWithPathSeparator(gs_dirPath ) ) @@ -717,7 +717,7 @@ wxString wxFindNextFile() // Get current working directory. -// If buf is NULL, allocates space using new, else copies into buf. +// If buf is null, allocates space using new, else copies into buf. // wxGetWorkingDirectory() is obsolete, use wxGetCwd() // wxDoGetCwd() is their common core to be moved // to wxGetCwd() once wxGetWorkingDirectory() will be removed. @@ -744,9 +744,9 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) #endif #ifdef HAVE_WGETCWD - char *cbuf = NULL; // never really used because needsANSI will always be false + char *cbuf = nullptr; // never really used because needsANSI will always be false { - ok = _wgetcwd(buf, sz) != NULL; + ok = _wgetcwd(buf, sz) != nullptr; needsANSI = false; } #endif @@ -755,9 +755,9 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) #endif // wxUSE_UNICODE { #if defined(_MSC_VER) || defined(__MINGW32__) - ok = _getcwd(cbuf, sz) != NULL; + ok = _getcwd(cbuf, sz) != nullptr; #else // !Win32/VC++ !Mac - ok = getcwd(cbuf, sz) != NULL; + ok = getcwd(cbuf, sz) != nullptr; #endif // platform #if wxUSE_UNICODE @@ -772,8 +772,8 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) // VZ: the old code used to return "." on error which didn't make any // sense at all to me - empty string is a better error indicator - // (NULL might be even better but I'm afraid this could lead to - // problems with the old code assuming the return is never NULL) + // (nullptr might be even better but I'm afraid this could lead to + // problems with the old code assuming the return is never null) buf[0] = wxT('\0'); } else // ok, but we might need to massage the path into the right format @@ -891,7 +891,7 @@ bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& sz time_t WXDLLIMPEXP_BASE wxFileModificationTime(const wxString& filename) { wxDateTime mtime; - if ( !wxFileName(filename).GetTimes(NULL, &mtime, NULL) ) + if ( !wxFileName(filename).GetTimes(nullptr, &mtime, nullptr) ) return (time_t)-1; return mtime.GetTicks(); @@ -981,12 +981,12 @@ static bool wxCheckWin32Permission(const wxString& path, DWORD access) path.t_str(), access, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, - NULL, + nullptr, OPEN_EXISTING, dwAttr & FILE_ATTRIBUTE_DIRECTORY ? FILE_FLAG_BACKUP_SEMANTICS : 0, - NULL + nullptr ); if ( h != INVALID_HANDLE_VALUE ) CloseHandle(h); @@ -1150,8 +1150,8 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) const wxChar *m = pat.c_str(), *n = text.c_str(), - *ma = NULL, - *na = NULL; + *ma = nullptr, + *na = nullptr; int just = 0, acount = 0, count = 0; @@ -1202,11 +1202,11 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) goto not_matched; } /* - * We could check for *n == NULL at this point, but + * We could check for *n == nullptr at this point, but * since it's more common to have a character there, * check to see if they match first (m and n) and * then if they don't match, THEN we can check for - * the NULL of n + * the NUL of n */ just = 0; if (*m == *n) @@ -1223,7 +1223,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) /* * If there are no more characters in the * string, but we still need to find another - * character (*m != NULL), then it will be + * character (*m != nullptr), then it will be * impossible to match it */ if (!*n) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 177cfe7e88..82811c56bf 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -170,10 +170,10 @@ public: : FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | // sharing mode FILE_SHARE_WRITE, // (allow everything) - NULL, // no secutity attr + nullptr, // no secutity attr OPEN_EXISTING, // creation disposition flags, // flags - NULL // no template file + nullptr // no template file ); if ( m_hFile == INVALID_HANDLE_VALUE ) @@ -838,8 +838,8 @@ static int wxOpenWithDeleteOnClose(const wxString& filename) DWORD attributes = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE; - HANDLE h = ::CreateFile(filename.t_str(), access, 0, NULL, - disposition, attributes, NULL); + HANDLE h = ::CreateFile(filename.t_str(), access, 0, nullptr, + disposition, attributes, nullptr); return wxOpenOSFHandle(h, wxO_BINARY); } @@ -894,10 +894,10 @@ static bool wxTempOpen(wxFFile *file, const wxString& path, bool *deleteOnClose) static wxString wxCreateTempImpl( const wxString& prefix, WXFILEARGS(wxFile *fileTemp, wxFFile *ffileTemp), - bool *deleteOnClose = NULL) + bool *deleteOnClose = nullptr) { #if wxUSE_FILE && wxUSE_FFILE - wxASSERT(fileTemp == NULL || ffileTemp == NULL); + wxASSERT(fileTemp == nullptr || ffileTemp == nullptr); #endif wxString path, dir, name; bool wantDeleteOnClose = false; @@ -915,7 +915,7 @@ static wxString wxCreateTempImpl( } // use the directory specified by the prefix - wxFileName::SplitPath(prefix, &dir, &name, NULL /* extension */); + wxFileName::SplitPath(prefix, &dir, &name, nullptr /* extension */); if (dir.empty()) { @@ -1121,13 +1121,13 @@ static void wxAssignTempImpl( void wxFileName::AssignTempFileName(const wxString& prefix) { - wxAssignTempImpl(this, prefix, WXFILEARGS(NULL, NULL)); + wxAssignTempImpl(this, prefix, WXFILEARGS(nullptr, nullptr)); } /* static */ wxString wxFileName::CreateTempFileName(const wxString& prefix) { - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, NULL)); + return wxCreateTempImpl(prefix, WXFILEARGS(nullptr, nullptr)); } #endif // wxUSE_FILE || wxUSE_FFILE @@ -1139,19 +1139,19 @@ wxString wxCreateTempFileName(const wxString& prefix, wxFile *fileTemp, bool *deleteOnClose) { - return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, NULL), deleteOnClose); + return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, nullptr), deleteOnClose); } bool wxCreateTempFile(const wxString& prefix, wxFile *fileTemp, wxString *name) { - return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, NULL), name); + return wxCreateTempImpl(prefix, WXFILEARGS(fileTemp, nullptr), name); } void wxFileName::AssignTempFileName(const wxString& prefix, wxFile *fileTemp) { - wxAssignTempImpl(this, prefix, WXFILEARGS(fileTemp, NULL)); + wxAssignTempImpl(this, prefix, WXFILEARGS(fileTemp, nullptr)); } /* static */ @@ -1170,20 +1170,20 @@ wxString wxCreateTempFileName(const wxString& prefix, wxFFile *fileTemp, bool *deleteOnClose) { - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, fileTemp), deleteOnClose); + return wxCreateTempImpl(prefix, WXFILEARGS(nullptr, fileTemp), deleteOnClose); } bool wxCreateTempFile(const wxString& prefix, wxFFile *fileTemp, wxString *name) { - return wxCreateTempImpl(prefix, WXFILEARGS(NULL, fileTemp), name); + return wxCreateTempImpl(prefix, WXFILEARGS(nullptr, fileTemp), name); } void wxFileName::AssignTempFileName(const wxString& prefix, wxFFile *fileTemp) { - wxAssignTempImpl(this, prefix, WXFILEARGS(NULL, fileTemp)); + wxAssignTempImpl(this, prefix, WXFILEARGS(nullptr, fileTemp)); } /* static */ @@ -1655,7 +1655,7 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxOleInitializer oleInit; // create a ShellLink object - hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl); if (SUCCEEDED(hres)) @@ -1673,7 +1673,7 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, if (SUCCEEDED(hres)) { wxChar buf[2048]; - psl->GetPath(buf, 2048, NULL, SLGP_UNCPRIORITY); + psl->GetPath(buf, 2048, nullptr, SLGP_UNCPRIORITY); targetFilename = wxString(buf); success = (shortcutPath != targetFilename); @@ -1726,7 +1726,7 @@ wxFileName wxFileName::ResolveLink() if ( result != -1 ) { - buf[result] = '\0'; // readlink() doesn't NULL-terminate the buffer + buf[result] = '\0'; // readlink() doesn't NUL-terminate the buffer linkTarget.Assign( wxString(buf, wxConvLibc) ); // Ensure the resulting path is absolute since readlink can return paths relative to the link @@ -2066,7 +2066,7 @@ void wxFileName::RemoveDir(size_t pos) void wxFileName::SetFullName(const wxString& fullname) { - SplitPath(fullname, NULL /* no volume */, NULL /* no path */, + SplitPath(fullname, nullptr /* no volume */, nullptr /* no path */, &m_name, &m_ext, &m_hasExt); } @@ -2203,7 +2203,7 @@ wxString wxFileName::GetShortPath() const wxString path(GetFullPath()); #if defined(__WINDOWS__) && defined(__WIN32__) - DWORD sz = ::GetShortPathName(path.t_str(), NULL, 0); + DWORD sz = ::GetShortPathName(path.t_str(), nullptr, 0); if ( sz != 0 ) { wxString pathOut; @@ -2230,7 +2230,7 @@ wxString wxFileName::GetLongPath() const #if defined(__WIN32__) - DWORD dwSize = ::GetLongPathName(path.t_str(), NULL, 0); + DWORD dwSize = ::GetLongPathName(path.t_str(), nullptr, 0); if ( dwSize > 0 ) { if ( ::GetLongPathName @@ -2745,9 +2745,9 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, if ( fh.IsOk() ) { if ( ::SetFileTime(fh, - dtCreate ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtMod ? &ftWrite : NULL) ) + dtCreate ? &ftCreate : nullptr, + dtAccess ? &ftAccess : nullptr, + dtMod ? &ftWrite : nullptr) ) { return true; } @@ -2762,7 +2762,7 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, } // if dtAccess or dtMod is not specified, use the other one (which must be - // non NULL because of the test above) for both times + // non null because of the test above) for both times utimbuf utm; utm.actime = dtAccess ? dtAccess->GetTicks() : dtMod->GetTicks(); utm.modtime = dtMod ? dtMod->GetTicks() : dtAccess->GetTicks(); @@ -2785,8 +2785,8 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, bool wxFileName::Touch() const { #if defined(__UNIX_LIKE__) - // under Unix touching file is simple: just pass NULL to utime() - if ( utime(GetFullPath().fn_str(), NULL) == 0 ) + // under Unix touching file is simple: just pass nullptr to utime() + if ( utime(GetFullPath().fn_str(), nullptr) == 0 ) { return true; } @@ -2797,7 +2797,7 @@ bool wxFileName::Touch() const #else // other platform wxDateTime dtNow = wxDateTime::Now(); - return SetTimes(&dtNow, &dtNow, NULL /* don't change create time */); + return SetTimes(&dtNow, &dtNow, nullptr /* don't change create time */); #endif // platforms } @@ -2829,9 +2829,9 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess, if ( fh.IsOk() ) { ok = ::GetFileTime(fh, - dtCreate ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtMod ? &ftWrite : NULL) != 0; + dtCreate ? &ftCreate : nullptr, + dtAccess ? &ftAccess : nullptr, + dtMod ? &ftWrite : nullptr) != 0; } else { diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 2f2309d5c9..c0a322de62 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -275,7 +275,7 @@ wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& wxString fullpath = ms_root + fn.GetFullPath(); if (!wxFileExists(fullpath)) - return NULL; + return nullptr; // we need to check whether we can really read from this file, otherwise // wxFSFile is not going to work @@ -289,7 +289,7 @@ wxFSFile* wxLocalFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& if ( !is->IsOk() ) { delete is; - return NULL; + return nullptr; } return new wxFSFile(is, @@ -455,12 +455,12 @@ wxFileSystemHandler *wxFileSystem::MakeLocal(wxFileSystemHandler *h) wxFSFile* wxFileSystem::OpenFile(const wxString& location, int flags) { if ((flags & wxFS_READ) == 0) - return NULL; + return nullptr; wxString loc = MakeCorrectPath(location); unsigned i, ln; wxChar meta; - wxFSFile *s = NULL; + wxFSFile *s = nullptr; wxList::compatibility_iterator node; ln = loc.length(); @@ -495,7 +495,7 @@ wxFSFile* wxFileSystem::OpenFile(const wxString& location, int flags) } // if failed, try absolute paths : - if (s == NULL) + if (s == nullptr) { node = m_Handlers.GetFirst(); while (node) @@ -528,7 +528,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags) wxList::compatibility_iterator node; wxString spec2(spec); - m_FindFileHandler = NULL; + m_FindFileHandler = nullptr; for (int i = spec2.length()-1; i >= 0; i--) if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe @@ -564,7 +564,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags) wxString wxFileSystem::FindNext() { - if (m_FindFileHandler == NULL) return wxEmptyString; + if (m_FindFileHandler == nullptr) return wxEmptyString; else return m_FindFileHandler -> FindNext(); } @@ -613,12 +613,12 @@ void wxFileSystem::AddHandler(wxFileSystemHandler *handler) wxFileSystemHandler* wxFileSystem::RemoveHandler(wxFileSystemHandler *handler) { // if handler has already been removed (or deleted) - // we return NULL. This is by design in case + // we return nullptr. This is by design in case // CleanUpHandlers() is called before RemoveHandler // is called, as we cannot control the order // which modules are unloaded if (!m_Handlers.DeleteObject(handler)) - return NULL; + return nullptr; return handler; } @@ -664,7 +664,7 @@ class wxFileSystemModule : public wxModule public: wxFileSystemModule() : wxModule(), - m_handler(NULL) + m_handler(nullptr) { } diff --git a/src/common/filtfind.cpp b/src/common/filtfind.cpp index 27196a96b5..a019703f2b 100644 --- a/src/common/filtfind.cpp +++ b/src/common/filtfind.cpp @@ -25,7 +25,7 @@ wxFilterClassFactory::Find(const wxString& protocol, wxStreamProtocolType type) if (f->CanHandle(protocol, type)) return f; - return NULL; + return nullptr; } // static diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 2d44a7ec7e..d1a0833d2b 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -359,7 +359,7 @@ public: new wxButton(parent, wxID_ANY, label) ) { - m_handler = NULL; + m_handler = nullptr; } virtual bool DoBind(wxEvtHandler* handler) override @@ -401,7 +401,7 @@ public: new wxCheckBox(parent, wxID_ANY, label) ) { - m_handler = NULL; + m_handler = nullptr; } virtual bool GetValue() override @@ -453,7 +453,7 @@ public: new wxRadioButton(parent, wxID_ANY, label) ) { - m_handler = NULL; + m_handler = nullptr; } virtual bool GetValue() override @@ -507,7 +507,7 @@ public: n, strings) ) { - m_handler = NULL; + m_handler = nullptr; } virtual int GetSelection() override @@ -732,9 +732,9 @@ void wxFileDialogBase::Init() m_filterIndex = 0; m_currentlySelectedFilterIndex = wxNOT_FOUND; m_windowStyle = 0; - m_customizeHook = NULL; - m_extraControl = NULL; - m_extraControlCreator = NULL; + m_customizeHook = nullptr; + m_extraControl = nullptr; + m_extraControlCreator = nullptr; } bool wxFileDialogBase::Create(wxWindow *parent, @@ -889,7 +889,7 @@ wxWindow* wxFileDialogBase::CreateExtraControlWithParent(wxWindow* parent) const // It's not an error to call this function if there are no extra controls // to create, just do nothing in this case. - return NULL; + return nullptr; } bool wxFileDialogBase::CreateExtraControl() @@ -899,7 +899,7 @@ bool wxFileDialogBase::CreateExtraControl() if ( !m_extraControl ) m_extraControl = CreateExtraControlWithParent(this); - return m_extraControl != NULL; + return m_extraControl != nullptr; } void wxFileDialogBase::DestroyExtraControl() @@ -907,7 +907,7 @@ void wxFileDialogBase::DestroyExtraControl() if ( m_extraControl ) { m_extraControl->Destroy(); - m_extraControl = NULL; + m_extraControl = nullptr; } } diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index 58cd06395d..85024a5bd0 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -240,110 +240,110 @@ static const wxChar* const gs_encodingNames[][9] = { // names from the columns correspond to these OS: // Linux Solaris and IRIX HP-UX AIX - { wxT("ISO-8859-1"), wxT("ISO8859-1"), wxT("iso88591"), wxT("8859-1"), wxT("iso_8859_1"), NULL }, - { wxT("ISO-8859-2"), wxT("ISO8859-2"), wxT("iso88592"), wxT("8859-2"), NULL }, - { wxT("ISO-8859-3"), wxT("ISO8859-3"), wxT("iso88593"), wxT("8859-3"), NULL }, - { wxT("ISO-8859-4"), wxT("ISO8859-4"), wxT("iso88594"), wxT("8859-4"), NULL }, - { wxT("ISO-8859-5"), wxT("ISO8859-5"), wxT("iso88595"), wxT("8859-5"), NULL }, - { wxT("ISO-8859-6"), wxT("ISO8859-6"), wxT("iso88596"), wxT("8859-6"), NULL }, - { wxT("ISO-8859-7"), wxT("ISO8859-7"), wxT("iso88597"), wxT("8859-7"), NULL }, - { wxT("ISO-8859-8"), wxT("ISO8859-8"), wxT("iso88598"), wxT("8859-8"), NULL }, - { wxT("ISO-8859-9"), wxT("ISO8859-9"), wxT("iso88599"), wxT("8859-9"), NULL }, - { wxT("ISO-8859-10"), wxT("ISO8859-10"), wxT("iso885910"), wxT("8859-10"), NULL }, - { wxT("ISO-8859-11"), wxT("ISO8859-11"), wxT("iso885911"), wxT("8859-11"), NULL }, - { wxT("ISO-8859-12"), wxT("ISO8859-12"), wxT("iso885912"), wxT("8859-12"), NULL }, - { wxT("ISO-8859-13"), wxT("ISO8859-13"), wxT("iso885913"), wxT("8859-13"), NULL }, - { wxT("ISO-8859-14"), wxT("ISO8859-14"), wxT("iso885914"), wxT("8859-14"), NULL }, - { wxT("ISO-8859-15"), wxT("ISO8859-15"), wxT("iso885915"), wxT("8859-15"), NULL }, + { wxT("ISO-8859-1"), wxT("ISO8859-1"), wxT("iso88591"), wxT("8859-1"), wxT("iso_8859_1"), nullptr }, + { wxT("ISO-8859-2"), wxT("ISO8859-2"), wxT("iso88592"), wxT("8859-2"), nullptr }, + { wxT("ISO-8859-3"), wxT("ISO8859-3"), wxT("iso88593"), wxT("8859-3"), nullptr }, + { wxT("ISO-8859-4"), wxT("ISO8859-4"), wxT("iso88594"), wxT("8859-4"), nullptr }, + { wxT("ISO-8859-5"), wxT("ISO8859-5"), wxT("iso88595"), wxT("8859-5"), nullptr }, + { wxT("ISO-8859-6"), wxT("ISO8859-6"), wxT("iso88596"), wxT("8859-6"), nullptr }, + { wxT("ISO-8859-7"), wxT("ISO8859-7"), wxT("iso88597"), wxT("8859-7"), nullptr }, + { wxT("ISO-8859-8"), wxT("ISO8859-8"), wxT("iso88598"), wxT("8859-8"), nullptr }, + { wxT("ISO-8859-9"), wxT("ISO8859-9"), wxT("iso88599"), wxT("8859-9"), nullptr }, + { wxT("ISO-8859-10"), wxT("ISO8859-10"), wxT("iso885910"), wxT("8859-10"), nullptr }, + { wxT("ISO-8859-11"), wxT("ISO8859-11"), wxT("iso885911"), wxT("8859-11"), nullptr }, + { wxT("ISO-8859-12"), wxT("ISO8859-12"), wxT("iso885912"), wxT("8859-12"), nullptr }, + { wxT("ISO-8859-13"), wxT("ISO8859-13"), wxT("iso885913"), wxT("8859-13"), nullptr }, + { wxT("ISO-8859-14"), wxT("ISO8859-14"), wxT("iso885914"), wxT("8859-14"), nullptr }, + { wxT("ISO-8859-15"), wxT("ISO8859-15"), wxT("iso885915"), wxT("8859-15"), nullptr }, // although koi8-ru is not strictly speaking the same as koi8-r, // they are similar enough to make mapping it to koi8 better than // not recognizing it at all - { wxT( "KOI8-R" ), wxT( "KOI8-RU" ), NULL }, - { wxT( "KOI8-U" ), NULL }, + { wxT( "KOI8-R" ), wxT( "KOI8-RU" ), nullptr }, + { wxT( "KOI8-U" ), nullptr }, - { wxT( "WINDOWS-866" ), wxT( "CP866" ), NULL }, + { wxT( "WINDOWS-866" ), wxT( "CP866" ), nullptr }, - { wxT( "WINDOWS-874" ), wxT( "CP874" ), wxT( "MS874" ), wxT( "IBM-874" ), NULL }, - { wxT( "WINDOWS-932" ), wxT( "CP932" ), wxT( "MS932" ), wxT( "IBM-932" ), wxT( "SJIS" ), wxT( "SHIFT-JIS" ), wxT( "SHIFT_JIS" ), NULL }, - { wxT( "WINDOWS-936" ), wxT( "CP936" ), wxT( "MS936" ), wxT( "IBM-936" ), wxT( "GB2312" ), wxT( "gbk" ),wxT( "GBK" ), NULL }, - { wxT( "WINDOWS-949" ), wxT( "CP949" ), wxT( "MS949" ), wxT( "IBM-949" ), wxT( "EUC-KR" ), wxT( "eucKR" ), wxT( "euc_kr" ), NULL }, - { wxT( "WINDOWS-950" ), wxT( "CP950" ), wxT( "MS950" ), wxT( "IBM-950" ), wxT( "BIG5" ), wxT( "BIG-5" ), wxT( "BIG-FIVE" ), NULL }, - { wxT( "WINDOWS-1250" ),wxT( "CP1250" ),wxT( "MS1250" ),wxT( "IBM-1250" ),NULL }, - { wxT( "WINDOWS-1251" ),wxT( "CP1251" ),wxT( "MS1251" ),wxT( "IBM-1251" ),NULL }, - { wxT( "WINDOWS-1252" ),wxT( "CP1252" ),wxT( "MS1252" ),wxT( "IBM-1252" ),NULL }, - { wxT( "WINDOWS-1253" ),wxT( "CP1253" ),wxT( "MS1253" ),wxT( "IBM-1253" ),NULL }, - { wxT( "WINDOWS-1254" ),wxT( "CP1254" ),wxT( "MS1254" ),wxT( "IBM-1254" ),NULL }, - { wxT( "WINDOWS-1255" ),wxT( "CP1255" ),wxT( "MS1255" ),wxT( "IBM-1255" ),NULL }, - { wxT( "WINDOWS-1256" ),wxT( "CP1256" ),wxT( "MS1256" ),wxT( "IBM-1256" ),NULL }, - { wxT( "WINDOWS-1257" ),wxT( "CP1257" ),wxT( "MS1257" ),wxT( "IBM-1257" ),NULL }, - { wxT( "WINDOWS-1258" ),wxT( "CP1258" ),wxT( "MS1258" ),wxT( "IBM-1258" ),NULL }, - { wxT( "WINDOWS-1361" ),wxT( "CP1361" ),wxT( "MS1361" ),wxT( "IBM-1361" ), wxT( "JOHAB" ), NULL }, - { wxT( "WINDOWS-437" ), wxT( "CP437" ), wxT( "MS437" ), wxT( "IBM-437" ), NULL }, + { wxT( "WINDOWS-874" ), wxT( "CP874" ), wxT( "MS874" ), wxT( "IBM-874" ), nullptr }, + { wxT( "WINDOWS-932" ), wxT( "CP932" ), wxT( "MS932" ), wxT( "IBM-932" ), wxT( "SJIS" ), wxT( "SHIFT-JIS" ), wxT( "SHIFT_JIS" ), nullptr }, + { wxT( "WINDOWS-936" ), wxT( "CP936" ), wxT( "MS936" ), wxT( "IBM-936" ), wxT( "GB2312" ), wxT( "gbk" ),wxT( "GBK" ), nullptr }, + { wxT( "WINDOWS-949" ), wxT( "CP949" ), wxT( "MS949" ), wxT( "IBM-949" ), wxT( "EUC-KR" ), wxT( "eucKR" ), wxT( "euc_kr" ), nullptr }, + { wxT( "WINDOWS-950" ), wxT( "CP950" ), wxT( "MS950" ), wxT( "IBM-950" ), wxT( "BIG5" ), wxT( "BIG-5" ), wxT( "BIG-FIVE" ), nullptr }, + { wxT( "WINDOWS-1250" ),wxT( "CP1250" ),wxT( "MS1250" ),wxT( "IBM-1250" ),nullptr }, + { wxT( "WINDOWS-1251" ),wxT( "CP1251" ),wxT( "MS1251" ),wxT( "IBM-1251" ),nullptr }, + { wxT( "WINDOWS-1252" ),wxT( "CP1252" ),wxT( "MS1252" ),wxT( "IBM-1252" ),nullptr }, + { wxT( "WINDOWS-1253" ),wxT( "CP1253" ),wxT( "MS1253" ),wxT( "IBM-1253" ),nullptr }, + { wxT( "WINDOWS-1254" ),wxT( "CP1254" ),wxT( "MS1254" ),wxT( "IBM-1254" ),nullptr }, + { wxT( "WINDOWS-1255" ),wxT( "CP1255" ),wxT( "MS1255" ),wxT( "IBM-1255" ),nullptr }, + { wxT( "WINDOWS-1256" ),wxT( "CP1256" ),wxT( "MS1256" ),wxT( "IBM-1256" ),nullptr }, + { wxT( "WINDOWS-1257" ),wxT( "CP1257" ),wxT( "MS1257" ),wxT( "IBM-1257" ),nullptr }, + { wxT( "WINDOWS-1258" ),wxT( "CP1258" ),wxT( "MS1258" ),wxT( "IBM-1258" ),nullptr }, + { wxT( "WINDOWS-1361" ),wxT( "CP1361" ),wxT( "MS1361" ),wxT( "IBM-1361" ), wxT( "JOHAB" ), nullptr }, + { wxT( "WINDOWS-437" ), wxT( "CP437" ), wxT( "MS437" ), wxT( "IBM-437" ), nullptr }, - { wxT( "UTF-7" ), wxT("UTF7"), NULL }, - { wxT( "UTF-8" ), wxT("UTF8"), NULL }, + { wxT( "UTF-7" ), wxT("UTF7"), nullptr }, + { wxT( "UTF-8" ), wxT("UTF8"), nullptr }, #ifdef WORDS_BIGENDIAN - { wxT( "UTF-16BE" ), wxT("UTF16BE"), wxT("UCS-2BE"), wxT("UCS2BE"), wxT("UTF-16"), wxT("UTF16"), wxT("UCS-2"), wxT("UCS2"), NULL }, - { wxT( "UTF-16LE" ), wxT("UTF16LE"), wxT("UCS-2LE"), wxT("UCS2LE"), NULL }, - { wxT( "UTF-32BE" ), wxT("UTF32BE"), wxT("UCS-4BE" ), wxT("UTF-32"), wxT("UTF32"), wxT("UCS-4"), wxT("UCS4"), NULL }, - { wxT( "UTF-32LE" ), wxT("UTF32LE"), wxT("UCS-4LE"), wxT("UCS4LE"), NULL }, + { wxT( "UTF-16BE" ), wxT("UTF16BE"), wxT("UCS-2BE"), wxT("UCS2BE"), wxT("UTF-16"), wxT("UTF16"), wxT("UCS-2"), wxT("UCS2"), nullptr }, + { wxT( "UTF-16LE" ), wxT("UTF16LE"), wxT("UCS-2LE"), wxT("UCS2LE"), nullptr }, + { wxT( "UTF-32BE" ), wxT("UTF32BE"), wxT("UCS-4BE" ), wxT("UTF-32"), wxT("UTF32"), wxT("UCS-4"), wxT("UCS4"), nullptr }, + { wxT( "UTF-32LE" ), wxT("UTF32LE"), wxT("UCS-4LE"), wxT("UCS4LE"), nullptr }, #else // WORDS_BIGENDIAN - { wxT("UTF-16BE"), wxT("UTF16BE"), wxT("UCS-2BE"), wxT("UCS2BE"), NULL }, - { wxT("UTF-16LE"), wxT("UTF16LE"), wxT("UCS-2LE"), wxT("UTF-16"), wxT("UTF16"), wxT("UCS-2"), wxT("UCS2"), NULL }, - { wxT("UTF-32BE"), wxT("UTF32BE"), wxT("UCS-4BE"), wxT("UCS4BE"), NULL }, - { wxT("UTF-32LE"), wxT("UTF32LE"), wxT("UCS-4LE"), wxT("UCS4LE"), wxT("UTF-32"), wxT("UTF32"), wxT("UCS-4"), wxT("UCS4"), NULL }, + { wxT("UTF-16BE"), wxT("UTF16BE"), wxT("UCS-2BE"), wxT("UCS2BE"), nullptr }, + { wxT("UTF-16LE"), wxT("UTF16LE"), wxT("UCS-2LE"), wxT("UTF-16"), wxT("UTF16"), wxT("UCS-2"), wxT("UCS2"), nullptr }, + { wxT("UTF-32BE"), wxT("UTF32BE"), wxT("UCS-4BE"), wxT("UCS4BE"), nullptr }, + { wxT("UTF-32LE"), wxT("UTF32LE"), wxT("UCS-4LE"), wxT("UCS4LE"), wxT("UTF-32"), wxT("UTF32"), wxT("UCS-4"), wxT("UCS4"), nullptr }, #endif // WORDS_BIGENDIAN - { wxT( "EUC-JP" ), wxT( "eucJP" ), wxT( "euc_jp" ), wxT( "IBM-eucJP" ), NULL }, + { wxT( "EUC-JP" ), wxT( "eucJP" ), wxT( "euc_jp" ), wxT( "IBM-eucJP" ), nullptr }, // 646 is for Solaris, roman8 -- for HP-UX { wxT( "US-ASCII" ), wxT( "ASCII" ), wxT("C"), wxT("POSIX"), wxT("ANSI_X3.4-1968"), - wxT("646"), wxT("roman8"), wxT( "" ), NULL }, + wxT("646"), wxT("roman8"), wxT( "" ), nullptr }, - { wxT( "ISO-2022-JP" ), NULL }, + { wxT( "ISO-2022-JP" ), nullptr }, - { wxT( "MacRoman" ), NULL }, - { wxT( "MacJapanese" ), NULL }, - { wxT( "MacChineseTrad" ), NULL }, - { wxT( "MacKorean" ), NULL }, - { wxT( "MacArabic" ), NULL }, - { wxT( "MacHebrew" ), NULL }, - { wxT( "MacGreek" ), NULL }, - { wxT( "MacCyrillic" ), NULL }, - { wxT( "MacDevanagari" ), NULL }, - { wxT( "MacGurmukhi" ), NULL }, - { wxT( "MacGujarati" ), NULL }, - { wxT( "MacOriya" ), NULL }, - { wxT( "MacBengali" ), NULL }, - { wxT( "MacTamil" ), NULL }, - { wxT( "MacTelugu" ), NULL }, - { wxT( "MacKannada" ), NULL }, - { wxT( "MacMalayalam" ), NULL }, - { wxT( "MacSinhalese" ), NULL }, - { wxT( "MacBurmese" ), NULL }, - { wxT( "MacKhmer" ), NULL }, - { wxT( "MacThai" ), NULL }, - { wxT( "MacLaotian" ), NULL }, - { wxT( "MacGeorgian" ), NULL }, - { wxT( "MacArmenian" ), NULL }, - { wxT( "MacChineseSimp" ), NULL }, - { wxT( "MacTibetan" ), NULL }, - { wxT( "MacMongolian" ), NULL }, - { wxT( "MacEthiopic" ), NULL }, - { wxT( "MacCentralEurRoman" ), NULL }, - { wxT( "MacVietnamese" ), NULL }, - { wxT( "MacExtArabic" ), NULL }, - { wxT( "MacSymbol" ), NULL }, - { wxT( "MacDingbats" ), NULL }, - { wxT( "MacTurkish" ), NULL }, - { wxT( "MacCroatian" ), NULL }, - { wxT( "MacIcelandic" ), NULL }, - { wxT( "MacRomanian" ), NULL }, - { wxT( "MacCeltic" ), NULL }, - { wxT( "MacGaelic" ), NULL }, - { wxT( "MacKeyboardGlyphs" ), NULL } + { wxT( "MacRoman" ), nullptr }, + { wxT( "MacJapanese" ), nullptr }, + { wxT( "MacChineseTrad" ), nullptr }, + { wxT( "MacKorean" ), nullptr }, + { wxT( "MacArabic" ), nullptr }, + { wxT( "MacHebrew" ), nullptr }, + { wxT( "MacGreek" ), nullptr }, + { wxT( "MacCyrillic" ), nullptr }, + { wxT( "MacDevanagari" ), nullptr }, + { wxT( "MacGurmukhi" ), nullptr }, + { wxT( "MacGujarati" ), nullptr }, + { wxT( "MacOriya" ), nullptr }, + { wxT( "MacBengali" ), nullptr }, + { wxT( "MacTamil" ), nullptr }, + { wxT( "MacTelugu" ), nullptr }, + { wxT( "MacKannada" ), nullptr }, + { wxT( "MacMalayalam" ), nullptr }, + { wxT( "MacSinhalese" ), nullptr }, + { wxT( "MacBurmese" ), nullptr }, + { wxT( "MacKhmer" ), nullptr }, + { wxT( "MacThai" ), nullptr }, + { wxT( "MacLaotian" ), nullptr }, + { wxT( "MacGeorgian" ), nullptr }, + { wxT( "MacArmenian" ), nullptr }, + { wxT( "MacChineseSimp" ), nullptr }, + { wxT( "MacTibetan" ), nullptr }, + { wxT( "MacMongolian" ), nullptr }, + { wxT( "MacEthiopic" ), nullptr }, + { wxT( "MacCentralEurRoman" ), nullptr }, + { wxT( "MacVietnamese" ), nullptr }, + { wxT( "MacExtArabic" ), nullptr }, + { wxT( "MacSymbol" ), nullptr }, + { wxT( "MacDingbats" ), nullptr }, + { wxT( "MacTurkish" ), nullptr }, + { wxT( "MacCroatian" ), nullptr }, + { wxT( "MacIcelandic" ), nullptr }, + { wxT( "MacRomanian" ), nullptr }, + { wxT( "MacCeltic" ), nullptr }, + { wxT( "MacGaelic" ), nullptr }, + { wxT( "MacKeyboardGlyphs" ), nullptr } }; wxCOMPILE_TIME_ASSERT( WXSIZEOF(gs_encodingDescs) == WXSIZEOF(gs_encodings), EncodingsArraysNotInSync ); @@ -388,7 +388,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule); // wxFontMapperBase implementation // ============================================================================ -wxFontMapper *wxFontMapperBase::sm_instance = NULL; +wxFontMapper *wxFontMapperBase::sm_instance = nullptr; // ---------------------------------------------------------------------------- // ctor and dtor @@ -397,7 +397,7 @@ wxFontMapper *wxFontMapperBase::sm_instance = NULL; wxFontMapperBase::wxFontMapperBase() { #if wxUSE_CONFIG && wxUSE_FILECONFIG - m_configDummy = NULL; + m_configDummy = nullptr; #endif // wxUSE_CONFIG } @@ -450,7 +450,7 @@ void wxFontMapperBase::Reset() // compiler can't know that it derives from wxFontMapperBase (but // run-time behaviour will be correct because the dtor is virtual) delete (wxFontMapperBase *)sm_instance; - sm_instance = NULL; + sm_instance = nullptr; } } @@ -835,7 +835,7 @@ wxString wxFontMapperBase::GetEncodingName(wxFontEncoding encoding) /* static */ const wxChar** wxFontMapperBase::GetAllEncodingNames(wxFontEncoding encoding) { - static const wxChar* const dummy[] = { NULL }; + static const wxChar* const dummy[] = { nullptr }; for ( size_t i = 0; i < WXSIZEOF(gs_encodingNames); i++ ) { diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 6df8cc2afa..e1ad364c6c 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -1361,7 +1361,7 @@ wxString wxToString(const wxFontBase& font) bool wxFromString(const wxString& str, wxFontBase *font) { - wxCHECK_MSG( font, false, wxT("NULL output parameter") ); + wxCHECK_MSG( font, false, wxT("null output parameter") ); if ( str.empty() ) { diff --git a/src/common/fontmap.cpp b/src/common/fontmap.cpp index 95875f4817..3d542c2a01 100644 --- a/src/common/fontmap.cpp +++ b/src/common/fontmap.cpp @@ -152,7 +152,7 @@ private: wxFontMapper::wxFontMapper() { - m_windowParent = NULL; + m_windowParent = nullptr; } wxFontMapper::~wxFontMapper() @@ -168,7 +168,7 @@ wxFontMapper *wxFontMapper::Get() // Now return it anyway because there's a chance the GUI code might just // only want to call wxFontMapperBase functions and it's better than - // crashing by returning NULL + // crashing by returning nullptr return (wxFontMapper *)fontmapper; } @@ -493,7 +493,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding, bool interactive) { wxCHECK_MSG( encodingAlt, false, - wxT("wxFontEncoding::GetAltForEncoding(): NULL pointer") ); + wxT("wxFontEncoding::GetAltForEncoding(): null pointer") ); wxNativeEncodingInfo info; if ( !GetAltForEncoding(encoding, &info, facename, interactive) ) diff --git a/src/common/fontmgrcmn.cpp b/src/common/fontmgrcmn.cpp index 60cc24f43c..cb8db696a4 100644 --- a/src/common/fontmgrcmn.cpp +++ b/src/common/fontmgrcmn.cpp @@ -86,7 +86,7 @@ wxFontInstance *wxFontFaceBase::GetFontInstance(float ptSize, bool aa) wxFontBundleBase::wxFontBundleBase() { for (int i = 0; i < FaceType_Max; i++) - m_faces[i] = NULL; + m_faces[i] = nullptr; } wxFontBundleBase::~wxFontBundleBase() @@ -99,7 +99,7 @@ wxFontFace *wxFontBundleBase::GetFace(FaceType type) const { wxFontFace *f = m_faces[type]; - wxCHECK_MSG( f, NULL, wxT("no such face in font bundle") ); + wxCHECK_MSG( f, nullptr, wxT("no such face in font bundle") ); f->Acquire(); @@ -139,7 +139,7 @@ wxFontBundleBase::GetFaceForFont(const wxFontMgrFontRefData& font) const } wxFAIL_MSG( wxT("no face") ); - return NULL; + return nullptr; } return GetFace((FaceType)type); @@ -149,7 +149,7 @@ wxFontBundleBase::GetFaceForFont(const wxFontMgrFontRefData& font) const // wxFontsManagerBase // ---------------------------------------------------------------------------- -wxFontsManager *wxFontsManagerBase::ms_instance = NULL; +wxFontsManager *wxFontsManagerBase::ms_instance = nullptr; wxFontsManagerBase::wxFontsManagerBase() { @@ -186,7 +186,7 @@ wxFontBundle *wxFontsManagerBase::GetBundle(const wxString& name) const wxFontBundle * wxFontsManagerBase::GetBundleForFont(const wxFontMgrFontRefData& font) const { - wxFontBundle *bundle = NULL; + wxFontBundle *bundle = nullptr; wxString facename = font.GetFaceName(); if ( !facename.empty() ) @@ -242,8 +242,8 @@ wxFontMgrFontRefData::wxFontMgrFontRefData(int size, m_info.underlined = underlined; m_info.encoding = encoding; - m_fontFace = NULL; - m_fontBundle = NULL; + m_fontFace = nullptr; + m_fontBundle = nullptr; m_fontValid = false; } diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 5df543fc05..4b9f7fd843 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -146,15 +146,15 @@ wxCONSTRUCTOR_6( wxFrame, wxWindow*, Parent, wxWindowID, Id, wxString, Title, \ wxFrameBase::wxFrameBase() { #if wxUSE_MENUBAR - m_frameMenuBar = NULL; + m_frameMenuBar = nullptr; #endif // wxUSE_MENUS #if wxUSE_TOOLBAR - m_frameToolBar = NULL; + m_frameToolBar = nullptr; #endif // wxUSE_TOOLBAR #if wxUSE_STATUSBAR - m_frameStatusBar = NULL; + m_frameStatusBar = nullptr; #endif // wxUSE_STATUSBAR m_statusBarPane = 0; @@ -268,7 +268,7 @@ bool wxFrameBase::ProcessCommand(int id) bool wxFrameBase::ProcessCommand(wxMenuItem *item) { - wxCHECK_MSG( item, false, wxS("Menu item can't be NULL") ); + wxCHECK_MSG( item, false, wxS("Menu item can't be null") ); if (!item->IsEnabled()) return true; @@ -382,7 +382,7 @@ wxStatusBar* wxFrameBase::CreateStatusBar(int number, { // the main status bar can only be created once (or else it should be // deleted before calling CreateStatusBar() again) - wxCHECK_MSG( !m_frameStatusBar, NULL, + wxCHECK_MSG( !m_frameStatusBar, nullptr, wxT("recreating status bar in wxFrame") ); SetStatusBar(OnCreateStatusBar(number, style, id, name)); @@ -404,14 +404,14 @@ wxStatusBar *wxFrameBase::OnCreateStatusBar(int number, void wxFrameBase::SetStatusText(const wxString& text, int number) { - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); + wxCHECK_RET( m_frameStatusBar != nullptr, wxT("no statusbar to set text for") ); m_frameStatusBar->SetStatusText(text, number); } void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) { - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set widths for") ); + wxCHECK_RET( m_frameStatusBar != nullptr, wxT("no statusbar to set widths for") ); m_frameStatusBar->SetStatusWidths(n, widths_field); @@ -420,14 +420,14 @@ void wxFrameBase::SetStatusWidths(int n, const int widths_field[] ) void wxFrameBase::PushStatusText(const wxString& text, int number) { - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); + wxCHECK_RET( m_frameStatusBar != nullptr, wxT("no statusbar to set text for") ); m_frameStatusBar->PushStatusText(text, number); } void wxFrameBase::PopStatusText(int number) { - wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") ); + wxCHECK_RET( m_frameStatusBar != nullptr, wxT("no statusbar to set text for") ); m_frameStatusBar->PopStatusText(number); } @@ -459,10 +459,10 @@ bool wxFrameBase::ShowMenuHelp(int menuId) void wxFrameBase::SetStatusBar(wxStatusBar *statBar) { - bool hadBar = m_frameStatusBar != NULL; + bool hadBar = m_frameStatusBar != nullptr; m_frameStatusBar = statBar; - if ( (m_frameStatusBar != NULL) != hadBar ) + if ( (m_frameStatusBar != nullptr) != hadBar ) { PositionStatusBar(); @@ -554,7 +554,7 @@ wxToolBar* wxFrameBase::CreateToolBar(long style, { // the main toolbar can't be recreated (unless it was explicitly deleted // before) - wxCHECK_MSG( !m_frameToolBar, NULL, + wxCHECK_MSG( !m_frameToolBar, nullptr, wxT("recreating toolbar in wxFrame") ); if ( style == -1 ) @@ -585,7 +585,7 @@ wxToolBar* wxFrameBase::OnCreateToolBar(long style, void wxFrameBase::SetToolBar(wxToolBar *toolbar) { - if ( (toolbar != NULL) != (m_frameToolBar != NULL) ) + if ( (toolbar != nullptr) != (m_frameToolBar != nullptr) ) { // the toolbar visibility must have changed so we need to both position // the toolbar itself (if it appeared) and to relayout the frame @@ -640,7 +640,7 @@ void wxFrameBase::DoMenuUpdates(wxMenu* menu) else { wxMenuBar* bar = GetMenuBar(); - if (bar != NULL) + if (bar != nullptr) bar->UpdateMenus(); } #endif @@ -653,7 +653,7 @@ void wxFrameBase::DetachMenuBar() if ( m_frameMenuBar ) { m_frameMenuBar->Detach(); - m_frameMenuBar = NULL; + m_frameMenuBar = nullptr; } } @@ -683,7 +683,7 @@ wxMenuItem *wxFrameBase::FindItemInMenuBar(int menuId) const { const wxMenuBar * const menuBar = GetMenuBar(); - return menuBar ? menuBar->FindItem(menuId) : NULL; + return menuBar ? menuBar->FindItem(menuId) : nullptr; } #endif // wxUSE_MENUBAR diff --git a/src/common/fs_arc.cpp b/src/common/fs_arc.cpp index 8209ced597..b1e2a954be 100644 --- a/src/common/fs_arc.cpp +++ b/src/common/fs_arc.cpp @@ -77,7 +77,7 @@ wxArchiveFSCacheDataImpl::wxArchiveFSCacheDataImpl( const wxArchiveClassFactory& factory, const wxBackingFile& backer) : m_refcount(1), - m_begin(NULL), + m_begin(nullptr), m_endptr(&m_begin), m_backer(backer), m_stream(new wxBackedInputStream(backer)), @@ -89,7 +89,7 @@ wxArchiveFSCacheDataImpl::wxArchiveFSCacheDataImpl( const wxArchiveClassFactory& factory, wxInputStream *stream) : m_refcount(1), - m_begin(NULL), + m_begin(nullptr), m_endptr(&m_begin), m_stream(stream), m_archive(factory.NewStream(*m_stream)) @@ -118,7 +118,7 @@ wxArchiveFSEntry *wxArchiveFSCacheDataImpl::AddToCache(wxArchiveEntry *entry) wxArchiveFSEntry *fse = new wxArchiveFSEntry; *m_endptr = fse; (*m_endptr)->entry = entry; - (*m_endptr)->next = NULL; + (*m_endptr)->next = nullptr; m_endptr = &(*m_endptr)->next; return fse; } @@ -137,11 +137,11 @@ wxArchiveEntry *wxArchiveFSCacheDataImpl::Get(const wxString& name) return it->second; if (!m_archive) - return NULL; + return nullptr; wxArchiveEntry *entry; - while ((entry = m_archive->GetNextEntry()) != NULL) + while ((entry = m_archive->GetNextEntry()) != nullptr) { AddToCache(entry); @@ -151,7 +151,7 @@ wxArchiveEntry *wxArchiveFSCacheDataImpl::Get(const wxString& name) CloseStreams(); - return NULL; + return nullptr; } wxInputStream* wxArchiveFSCacheDataImpl::NewStream() const @@ -159,7 +159,7 @@ wxInputStream* wxArchiveFSCacheDataImpl::NewStream() const if (m_backer) return new wxBackedInputStream(m_backer); else - return NULL; + return nullptr; } wxArchiveFSEntry *wxArchiveFSCacheDataImpl::GetNext(wxArchiveFSEntry *fse) @@ -190,7 +190,7 @@ wxArchiveFSEntry *wxArchiveFSCacheDataImpl::GetNext(wxArchiveFSEntry *fse) class wxArchiveFSCacheData { public: - wxArchiveFSCacheData() : m_impl(NULL) { } + wxArchiveFSCacheData() : m_impl(nullptr) { } wxArchiveFSCacheData(const wxArchiveClassFactory& factory, const wxBackingFile& backer); wxArchiveFSCacheData(const wxArchiveClassFactory& factory, @@ -225,7 +225,7 @@ wxArchiveFSCacheData::wxArchiveFSCacheData( } wxArchiveFSCacheData::wxArchiveFSCacheData(const wxArchiveFSCacheData& data) - : m_impl(data.m_impl ? data.m_impl->AddRef() : NULL) + : m_impl(data.m_impl ? data.m_impl->AddRef() : nullptr) { } @@ -294,7 +294,7 @@ wxArchiveFSCacheData *wxArchiveFSCache::Get(const wxString& name) if ((it = m_hash.find(name)) != m_hash.end()) return &it->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------------- @@ -306,11 +306,11 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxArchiveFSHandler, wxFileSystemHandler); wxArchiveFSHandler::wxArchiveFSHandler() : wxFileSystemHandler() { - m_Archive = NULL; - m_FindEntry = NULL; + m_Archive = nullptr; + m_FindEntry = nullptr; m_AllowDirs = m_AllowFiles = true; - m_DirsFound = NULL; - m_cache = NULL; + m_DirsFound = nullptr; + m_cache = nullptr; } wxArchiveFSHandler::~wxArchiveFSHandler() @@ -327,7 +327,7 @@ void wxArchiveFSHandler::Cleanup() bool wxArchiveFSHandler::CanOpen(const wxString& location) { wxString p = GetProtocol(location); - return wxArchiveClassFactory::Find(p) != NULL; + return wxArchiveClassFactory::Find(p) != nullptr; } wxFSFile* wxArchiveFSHandler::OpenFile( @@ -355,42 +355,42 @@ wxFSFile* wxArchiveFSHandler::OpenFile( const wxArchiveClassFactory *factory; factory = wxArchiveClassFactory::Find(protocol); if (!factory) - return NULL; + return nullptr; wxArchiveFSCacheData *cached = m_cache->Get(key); if (!cached) { wxFSFile *leftFile = m_fs.OpenFile(left); if (!leftFile) - return NULL; + return nullptr; cached = m_cache->Add(key, *factory, leftFile->DetachStream()); delete leftFile; } wxArchiveEntry *entry = cached->Get(right); if (!entry) - return NULL; + return nullptr; wxInputStream *leftStream = cached->NewStream(); if (!leftStream) { wxFSFile *leftFile = m_fs.OpenFile(left); if (!leftFile) - return NULL; + return nullptr; leftStream = leftFile->DetachStream(); delete leftFile; } wxArchiveInputStream *s = factory->NewStream(leftStream); if ( !s ) - return NULL; + return nullptr; s->OpenEntry(*entry); if (!s->IsOk()) { delete s; - return NULL; + return nullptr; } return new wxFSFile(s, @@ -430,7 +430,7 @@ wxString wxArchiveFSHandler::FindFirst(const wxString& spec, int flags) delete leftFile; } - m_FindEntry = NULL; + m_FindEntry = nullptr; switch (flags) { @@ -480,8 +480,8 @@ wxString wxArchiveFSHandler::DoFind() if (!m_FindEntry) { - m_Archive = NULL; - m_FindEntry = NULL; + m_Archive = nullptr; + m_FindEntry = nullptr; break; } namestr = m_FindEntry->entry->GetName(wxPATH_UNIX); diff --git a/src/common/fs_filter.cpp b/src/common/fs_filter.cpp index 2527db2ad1..bc4c717c91 100644 --- a/src/common/fs_filter.cpp +++ b/src/common/fs_filter.cpp @@ -27,7 +27,7 @@ wxDEFINE_SCOPED_PTR_TYPE(wxInputStream) bool wxFilterFSHandler::CanOpen(const wxString& location) { - return wxFilterClassFactory::Find(GetProtocol(location)) != NULL; + return wxFilterClassFactory::Find(GetProtocol(location)) != nullptr; } wxFSFile* wxFilterFSHandler::OpenFile( @@ -36,21 +36,21 @@ wxFSFile* wxFilterFSHandler::OpenFile( { wxString right = GetRightLocation(location); if (!right.empty()) - return NULL; + return nullptr; wxString protocol = GetProtocol(location); const wxFilterClassFactory *factory = wxFilterClassFactory::Find(protocol); if (!factory) - return NULL; + return nullptr; wxString left = GetLeftLocation(location); wxFSFilePtr leftFile(fs.OpenFile(left)); if (!leftFile.get()) - return NULL; + return nullptr; wxInputStreamPtr leftStream(leftFile->DetachStream()); if (!leftStream.get() || !leftStream->IsOk()) - return NULL; + return nullptr; wxInputStreamPtr stream(factory->NewStream(leftStream.release())); diff --git a/src/common/fs_inet.cpp b/src/common/fs_inet.cpp index 3b7685cdee..df169e33fb 100644 --- a/src/common/fs_inet.cpp +++ b/src/common/fs_inet.cpp @@ -93,7 +93,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) { #if !wxUSE_URL - return NULL; + return nullptr; #else wxString right = GetProtocol(location) + wxT(":") + StripProtocolAnchor(location); @@ -131,7 +131,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), } } - return NULL; // incorrect URL + return nullptr; // incorrect URL #endif } @@ -143,7 +143,7 @@ class wxFileSystemInternetModule : public wxModule public: wxFileSystemInternetModule() : wxModule(), - m_handler(NULL) + m_handler(nullptr) { } diff --git a/src/common/fs_mem.cpp b/src/common/fs_mem.cpp index b177a824e8..f4e943b941 100644 --- a/src/common/fs_mem.cpp +++ b/src/common/fs_mem.cpp @@ -102,7 +102,7 @@ wxFSFile * wxMemoryFSHandlerBase::OpenFile(wxFileSystem& WXUNUSED(fs), { wxMemoryFSHash::const_iterator i = m_Hash.find(GetRightLocation(location)); if ( i == m_Hash.end() ) - return NULL; + return nullptr; const wxMemoryFSFile * const obj = i->second; diff --git a/src/common/fswatchercmn.cpp b/src/common/fswatchercmn.cpp index 4728d9fb6f..1f62374115 100644 --- a/src/common/fswatchercmn.cpp +++ b/src/common/fswatchercmn.cpp @@ -77,7 +77,7 @@ wxString wxFileSystemWatcherEvent::ToString() const // ============================================================================ wxFileSystemWatcherBase::wxFileSystemWatcherBase() : - m_service(0), m_owner(this) + m_service(nullptr), m_owner(this) { } @@ -312,7 +312,7 @@ int wxFileSystemWatcherBase::GetWatchedPathsCount() const int wxFileSystemWatcherBase::GetWatchedPaths(wxArrayString* paths) const { - wxCHECK_MSG( paths != NULL, -1, "Null array passed to retrieve paths"); + wxCHECK_MSG( paths != nullptr, -1, "Null array passed to retrieve paths"); wxFSWatchInfoMap::const_iterator it = m_watches.begin(); for ( ; it != m_watches.end(); ++it) diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 2605d321c5..1e872e905a 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -541,7 +541,7 @@ wxSocketBase *wxFTP::GetPort() if ( !socket ) { m_bEncounteredError = true; - return NULL; + return nullptr; } // Now set the time for the new socket to the default or user selected @@ -591,7 +591,7 @@ wxSocketBase *wxFTP::GetActivePort() // We use IsOk() here to see if everything is ok m_lastError = wxPROTO_PROTERR; delete sockSrv; - return NULL; + return nullptr; } //gets the new address, actually it is just the port number @@ -606,7 +606,7 @@ wxSocketBase *wxFTP::GetActivePort() m_lastError = wxPROTO_PROTERR; delete sockSrv; wxLogError(_("The FTP server doesn't support the PORT command.")); - return NULL; + return nullptr; } m_lastError = wxPROTO_NOERR; @@ -620,7 +620,7 @@ wxSocketBase *wxFTP::GetPassivePort() { m_lastError = wxPROTO_PROTERR; wxLogError(_("The FTP server doesn't support passive mode.")); - return NULL; + return nullptr; } size_t addrStart = m_lastResult.find(wxT('(')); @@ -631,7 +631,7 @@ wxSocketBase *wxFTP::GetPassivePort() if ( addrEnd == wxString::npos ) { m_lastError = wxPROTO_PROTERR; - return NULL; + return nullptr; } // get the port number and address @@ -659,7 +659,7 @@ wxSocketBase *wxFTP::GetPassivePort() { m_lastError = wxPROTO_CONNERR; delete client; - return NULL; + return nullptr; } client->Notify(false); @@ -762,7 +762,7 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) if ( ( m_currentTransfermode == NONE ) && !SetTransferMode(BINARY) ) { m_lastError = wxPROTO_CONNERR; - return NULL; + return nullptr; } wxSocketBase *sock = GetPort(); @@ -770,7 +770,7 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) if ( !sock ) { m_lastError = wxPROTO_NETERR; - return NULL; + return nullptr; } wxString tmp_str = wxT("RETR ") + wxURI::Unescape(path); @@ -778,14 +778,14 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) { delete sock; - return NULL; + return nullptr; } sock = AcceptIfActive(sock); if ( !sock ) { m_lastError = wxPROTO_CONNERR; - return NULL; + return nullptr; } m_streaming = true; @@ -801,7 +801,7 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) if ( ( m_currentTransfermode == NONE ) && !SetTransferMode(BINARY) ) { m_lastError = wxPROTO_CONNERR; - return NULL; + return nullptr; } wxSocketBase *sock = GetPort(); @@ -811,7 +811,7 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) { delete sock; - return NULL; + return nullptr; } sock = AcceptIfActive(sock); diff --git a/src/common/gaugecmn.cpp b/src/common/gaugecmn.cpp index ee0ce29a57..b88885bf86 100644 --- a/src/common/gaugecmn.cpp +++ b/src/common/gaugecmn.cpp @@ -103,11 +103,11 @@ wxCONSTRUCTOR_6( wxGauge, wxWindow*, Parent, wxWindowID, Id, int, Range, \ void wxGaugeBase::InitProgressIndicatorIfNeeded() { - m_appProgressIndicator = NULL; + m_appProgressIndicator = nullptr; if ( HasFlag(wxGA_PROGRESS) ) { wxWindow* topParent = wxGetTopLevelParent(this); - if ( topParent != NULL ) + if ( topParent != nullptr ) { m_appProgressIndicator = new wxAppProgressIndicator(topParent, GetRange()); diff --git a/src/common/gbsizer.cpp b/src/common/gbsizer.cpp index f7849e0fa9..8a35d2af68 100644 --- a/src/common/gbsizer.cpp +++ b/src/common/gbsizer.cpp @@ -37,7 +37,7 @@ wxGBSizerItem::wxGBSizerItem( int width, : wxSizerItem(width, height, 0, flag, border, userData), m_pos(pos), m_span(span), - m_gbsizer(NULL) + m_gbsizer(nullptr) { } @@ -51,7 +51,7 @@ wxGBSizerItem::wxGBSizerItem( wxWindow *window, : wxSizerItem(window, 0, flag, border, userData), m_pos(pos), m_span(span), - m_gbsizer(NULL) + m_gbsizer(nullptr) { } @@ -65,14 +65,14 @@ wxGBSizerItem::wxGBSizerItem( wxSizer *sizer, : wxSizerItem(sizer, 0, flag, border, userData), m_pos(pos), m_span(span), - m_gbsizer(NULL) + m_gbsizer(nullptr) { } wxGBSizerItem::wxGBSizerItem() : wxSizerItem(), m_pos(-1,-1), - m_gbsizer(NULL) + m_gbsizer(nullptr) { } @@ -181,7 +181,7 @@ wxSizerItem* wxGridBagSizer::Add( wxWindow *window, return item; delete item; - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, @@ -193,7 +193,7 @@ wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, return item; delete item; - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Add( int width, int height, @@ -205,12 +205,12 @@ wxSizerItem* wxGridBagSizer::Add( int width, int height, return item; delete item; - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Add( wxGBSizerItem *item ) { - wxCHECK_MSG( !CheckForIntersection(item), NULL, + wxCHECK_MSG( !CheckForIntersection(item), nullptr, wxT("An item is already at that position") ); m_children.Append(item); item->SetGBSizer(this); @@ -363,7 +363,7 @@ wxGBSizerItem* wxGridBagSizer::FindItem(wxWindow* window) return item; node = node->GetNext(); } - return NULL; + return nullptr; } @@ -377,7 +377,7 @@ wxGBSizerItem* wxGridBagSizer::FindItem(wxSizer* sizer) return item; node = node->GetNext(); } - return NULL; + return nullptr; } @@ -393,7 +393,7 @@ wxGBSizerItem* wxGridBagSizer::FindItemAtPosition(const wxGBPosition& pos) return item; node = node->GetNext(); } - return NULL; + return nullptr; } @@ -411,7 +411,7 @@ wxGBSizerItem* wxGridBagSizer::FindItemAtPoint(const wxPoint& pt) return item; node = node->GetNext(); } - return NULL; + return nullptr; } @@ -427,7 +427,7 @@ wxGBSizerItem* wxGridBagSizer::FindItemWithData(const wxObject* userData) return item; node = node->GetNext(); } - return NULL; + return nullptr; } @@ -730,56 +730,56 @@ wxSizerItem* wxGridBagSizer::Add( int width, int height, int, int flag, int bord wxSizerItem* wxGridBagSizer::Add( wxSizerItem * ) { wxFAIL_MSG(wxT("Invalid Add form called.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Prepend( wxWindow *, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Prepend( wxSizer *, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Prepend( int, int, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Prepend( wxSizerItem * ) { wxFAIL_MSG(wxT("Prepend should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Insert( size_t, wxWindow *, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizer *, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Insert( size_t, int, int, int, int, int, wxObject* ) { wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } wxSizerItem* wxGridBagSizer::Insert( size_t, wxSizerItem * ) { wxFAIL_MSG(wxT("Insert should not be used with wxGridBagSizer.")); - return NULL; + return nullptr; } diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index c700cb153a..1bdbeed4b5 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -266,7 +266,7 @@ wxRealPoint::wxRealPoint(const wxPoint& pt) wxColourDatabase::wxColourDatabase () { // will be created on demand in Initialize() - m_map = NULL; + m_map = nullptr; } wxColourDatabase::~wxColourDatabase () @@ -498,7 +498,7 @@ void wxStockGDI::DeleteAll() const wxBrush* wxStockGDI::GetBrush(Item item) { wxBrush* brush = static_cast(ms_stockObject[item]); - if (brush == NULL) + if (brush == nullptr) { switch (item) { @@ -546,7 +546,7 @@ const wxBrush* wxStockGDI::GetBrush(Item item) const wxColour* wxStockGDI::GetColour(Item item) { wxColour* colour = static_cast(ms_stockObject[item]); - if (colour == NULL) + if (colour == nullptr) { switch (item) { @@ -585,7 +585,7 @@ const wxColour* wxStockGDI::GetColour(Item item) const wxCursor* wxStockGDI::GetCursor(Item item) { wxCursor* cursor = static_cast(ms_stockObject[item]); - if (cursor == NULL) + if (cursor == nullptr) { switch (item) { @@ -609,7 +609,7 @@ const wxCursor* wxStockGDI::GetCursor(Item item) const wxFont* wxStockGDI::GetFont(Item item) { wxFont* font = static_cast(ms_stockObject[item]); - if (font == NULL) + if (font == nullptr) { switch (item) { @@ -650,7 +650,7 @@ const wxFont* wxStockGDI::GetFont(Item item) const wxPen* wxStockGDI::GetPen(Item item) { wxPen* pen = static_cast(ms_stockObject[item]); - if (pen == NULL) + if (pen == nullptr) { switch (item) { @@ -745,7 +745,7 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, wxPenStyle return pen; } - wxPen* pen = NULL; + wxPen* pen = nullptr; wxPen penTmp(colour, width, style); if (penTmp.IsOk()) { @@ -767,7 +767,7 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, wxBrushStyle st return brush; } - wxBrush* brush = NULL; + wxBrush* brush = nullptr; wxBrush brushTmp(colour, style); if (brushTmp.IsOk()) { @@ -847,7 +847,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, } // font not found, create the new one - font = NULL; + font = nullptr; wxFont fontTmp(pointSize, family, style, weight, underline, facename, encoding); if (fontTmp.IsOk()) { diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 7f5c07333d..c716c55f7b 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -81,8 +81,8 @@ GIFImage::GIFImage() transparent = 0; disposal = wxANIM_DONOTREMOVE; delay = -1; - p = (unsigned char *) NULL; - pal = (unsigned char *) NULL; + p = (unsigned char *) nullptr; + pal = (unsigned char *) nullptr; ncolours = 0; } diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index 00c64e9ca0..5452f494ce 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -78,12 +78,12 @@ wxGraphicsObject::~wxGraphicsObject() bool wxGraphicsObject::IsNull() const { - return m_refData == NULL; + return m_refData == nullptr; } wxGraphicsRenderer* wxGraphicsObject::GetRenderer() const { - return ( IsNull() ? NULL : GetGraphicsData()->GetRenderer() ); + return ( IsNull() ? nullptr : GetGraphicsData()->GetRenderer() ); } wxGraphicsObjectRefData* wxGraphicsObject::GetGraphicsData() const @@ -94,7 +94,7 @@ wxGraphicsObjectRefData* wxGraphicsObject::GetGraphicsData() const wxObjectRefData* wxGraphicsObject::CreateRefData() const { wxLogDebug(wxT("A Null Object cannot be changed")); - return NULL; + return nullptr; } wxObjectRefData* wxGraphicsObject::CloneRefData(const wxObjectRefData* data) const @@ -1090,7 +1090,7 @@ wxGraphicsContext* wxGraphicsRenderer::CreateContextFromUnknownDC(const wxDC& dc #endif #endif - return NULL; + return nullptr; } #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/src/common/hash.cpp b/src/common/hash.cpp index 72b86e7e46..313abcf39e 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -47,7 +47,7 @@ wxHashTableBase_Node::~wxHashTableBase_Node() // wxHashTableBase::wxHashTableBase() - : m_size( 0 ), m_count( 0 ), m_table( NULL ), m_keyType( wxKEY_NONE ), + : m_size( 0 ), m_count( 0 ), m_table( nullptr ), m_keyType( wxKEY_NONE ), m_deleteContents( false ) { } @@ -59,7 +59,7 @@ void wxHashTableBase::Create( wxKeyType keyType, size_t size ) m_table = new wxHashTableBase_Node*[ m_size ]; for( size_t i = 0; i < m_size; ++i ) - m_table[i] = NULL; + m_table[i] = nullptr; } void wxHashTableBase::Clear() @@ -68,7 +68,7 @@ void wxHashTableBase::Clear() { Node* end = m_table[i]; - if( end == NULL ) + if( end == nullptr ) continue; Node *curr, *next = end->GetNext(); @@ -84,7 +84,7 @@ void wxHashTableBase::Clear() } while( curr != end ); - m_table[i] = NULL; + m_table[i] = nullptr; } m_count = 0; @@ -99,7 +99,7 @@ void wxHashTableBase::DoRemoveNode( wxHashTableBase_Node* node ) if( node->GetNext() == node ) { // single-node chain (common case) - m_table[bucket] = NULL; + m_table[bucket] = nullptr; } else { @@ -119,7 +119,7 @@ void wxHashTableBase::DoDestroyNode( wxHashTableBase_Node* node ) { // if it is called from DoRemoveNode, node has already been // removed, from other places it does not matter - node->m_hashPtr = NULL; + node->m_hashPtr = nullptr; if( m_keyType == wxKEY_STRING ) delete node->m_key.string; @@ -137,7 +137,7 @@ void wxHashTableBase::Destroy() void wxHashTableBase::DoInsertNode( size_t bucket, wxHashTableBase_Node* node ) { - if( m_table[bucket] == NULL ) + if( m_table[bucket] == nullptr ) { m_table[bucket] = node->m_next = node; } @@ -180,8 +180,8 @@ void* wxHashTableBase::DoGet( long key, long hash ) const size_t bucket = size_t(hash) % m_size; - if( m_table[bucket] == NULL ) - return NULL; + if( m_table[bucket] == nullptr ) + return nullptr; Node *first = m_table[bucket]->GetNext(), *curr = first; @@ -195,7 +195,7 @@ void* wxHashTableBase::DoGet( long key, long hash ) const } while( curr != first ); - return NULL; + return nullptr; } void* wxHashTableBase::DoGet( const wxString& key, long hash ) const @@ -204,8 +204,8 @@ void* wxHashTableBase::DoGet( const wxString& key, long hash ) const size_t bucket = size_t(hash) % m_size; - if( m_table[bucket] == NULL ) - return NULL; + if( m_table[bucket] == nullptr ) + return nullptr; Node *first = m_table[bucket]->GetNext(), *curr = first; @@ -219,7 +219,7 @@ void* wxHashTableBase::DoGet( const wxString& key, long hash ) const } while( curr != first ); - return NULL; + return nullptr; } void wxHashTableBase::DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, @@ -229,7 +229,7 @@ void wxHashTableBase::DoUnlinkNode( size_t bucket, wxHashTableBase_Node* node, m_table[bucket] = prev; if( prev == node && prev == node->GetNext() ) - m_table[bucket] = NULL; + m_table[bucket] = nullptr; else prev->m_next = node->m_next; @@ -243,8 +243,8 @@ void* wxHashTableBase::DoDelete( long key, long hash ) size_t bucket = size_t(hash) % m_size; - if( m_table[bucket] == NULL ) - return NULL; + if( m_table[bucket] == nullptr ) + return nullptr; Node *first = m_table[bucket]->GetNext(), *curr = first, @@ -255,7 +255,7 @@ void* wxHashTableBase::DoDelete( long key, long hash ) if( curr->m_key.integer == key ) { void* retval = curr->m_value; - curr->m_value = NULL; + curr->m_value = nullptr; DoUnlinkNode( bucket, curr, prev ); delete curr; @@ -268,7 +268,7 @@ void* wxHashTableBase::DoDelete( long key, long hash ) } while( curr != first ); - return NULL; + return nullptr; } void* wxHashTableBase::DoDelete( const wxString& key, long hash ) @@ -277,8 +277,8 @@ void* wxHashTableBase::DoDelete( const wxString& key, long hash ) size_t bucket = size_t(hash) % m_size; - if( m_table[bucket] == NULL ) - return NULL; + if( m_table[bucket] == nullptr ) + return nullptr; Node *first = m_table[bucket]->GetNext(), *curr = first, @@ -289,7 +289,7 @@ void* wxHashTableBase::DoDelete( const wxString& key, long hash ) if( *curr->m_key.string == key ) { void* retval = curr->m_value; - curr->m_value = NULL; + curr->m_value = nullptr; DoUnlinkNode( bucket, curr, prev ); delete curr; @@ -302,7 +302,7 @@ void* wxHashTableBase::DoDelete( const wxString& key, long hash ) } while( curr != first ); - return NULL; + return nullptr; } long wxHashTableBase::MakeKey( const wxString& str ) @@ -350,7 +350,7 @@ void wxHashTable::GetNextNode( size_t bucketStart ) { for( size_t i = bucketStart; i < m_size; ++i ) { - if( m_table[i] != NULL ) + if( m_table[i] != nullptr ) { m_curr = ((Node*)m_table[i])->GetNext(); m_currBucket = i; @@ -358,13 +358,13 @@ void wxHashTable::GetNextNode( size_t bucketStart ) } } - m_curr = NULL; + m_curr = nullptr; m_currBucket = 0; } wxHashTable::Node* wxHashTable::Next() { - if( m_curr == NULL ) + if( m_curr == nullptr ) GetNextNode( 0 ); else { diff --git a/src/common/http.cpp b/src/common/http.cpp index 06221dc4a0..0d42553eb5 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -40,7 +40,7 @@ IMPLEMENT_PROTOCOL(wxHTTP, wxT("http"), wxT("80"), true) wxHTTP::wxHTTP() : wxProtocol() { - m_addr = NULL; + m_addr = nullptr; m_read = false; m_proxy_mode = false; m_http_response = 0; @@ -490,7 +490,7 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) m_lastError = wxPROTO_CONNERR; // all following returns share this type of error if (!m_addr) - return NULL; + return nullptr; // We set m_connected back to false so wxSocketBase will know what to do. #ifdef __WXMAC__ @@ -498,10 +498,10 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) wxSocketClient::WaitOnConnect(10); if (!wxSocketClient::IsConnected()) - return NULL; + return nullptr; #else if (!wxProtocol::Connect(*m_addr)) - return NULL; + return nullptr; #endif // Use the user-specified method if any or determine the method to use @@ -511,7 +511,7 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) method = m_postBuffer.IsEmpty() ? wxS("GET"): wxS("POST"); if (!BuildRequest(path, method)) - return NULL; + return nullptr; inp_stream = new wxHTTPStream(this); diff --git a/src/common/iconbndl.cpp b/src/common/iconbndl.cpp index 6094d5b8f0..1922582e55 100644 --- a/src/common/iconbndl.cpp +++ b/src/common/iconbndl.cpp @@ -215,7 +215,7 @@ void wxIconBundle::AddIcon(wxInputStream& stream, wxBitmapType type) void wxIconBundle::AddIcon(const wxString& resourceName, WXHINSTANCE module) { #ifdef __WXMSW__ - const void* data = NULL; + const void* data = nullptr; size_t outLen = 0; // load the icon directory resource diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 4642d7d2c6..8011b7dfc7 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -288,11 +288,11 @@ bool wxBMPHandler::SaveDib(wxImage *image, // fill the destination too, it gives much nicer 4bpp images #if wxUSE_PALETTE wxPalette* paletteTmp; - wxQuantize::Quantize( *image, *q_image, &paletteTmp, quantize, 0, + wxQuantize::Quantize( *image, *q_image, &paletteTmp, quantize, nullptr, wxQUANTIZE_FILL_DESTINATION_IMAGE ); palette.reset(paletteTmp); #else // !wxUSE_PALETTE - wxQuantize::Quantize( *image, *q_image, NULL, quantize, 0, + wxQuantize::Quantize( *image, *q_image, nullptr, quantize, 0, wxQUANTIZE_FILL_DESTINATION_IMAGE ); #endif // wxUSE_PALETTE/!wxUSE_PALETTE } @@ -360,7 +360,7 @@ bool wxBMPHandler::SaveDib(wxImage *image, const unsigned char* const data = q_image && q_image->IsOk() ? q_image->GetData() : image->GetData(); - const unsigned char* const alpha = saveAlpha ? image->GetAlpha() : NULL; + const unsigned char* const alpha = saveAlpha ? image->GetAlpha() : nullptr; wxScopedArray buffer(row_width); memset(buffer.get(), 0, row_width); @@ -533,7 +533,7 @@ bool LoadBMPData(wxImage * image, const BMPDesc& desc, wxUint16 aWord; BMPPalette cmapMono[2]; - BMPPalette* cmap = NULL; + BMPPalette* cmap = nullptr; bool isUpsideDown = true; @@ -575,7 +575,7 @@ bool LoadBMPData(wxImage * image, const BMPDesc& desc, } else // no alpha { - alpha = NULL; + alpha = nullptr; } // Reading the palette, if it exists: diff --git a/src/common/image.cpp b/src/common/image.cpp index 287aa03e02..056a1e3377 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -73,7 +73,7 @@ public: bool m_hasMask; unsigned char m_maskRed,m_maskGreen,m_maskBlue; - // alpha channel data, may be NULL for the formats without alpha support + // alpha channel data, may be null for the formats without alpha support unsigned char *m_alpha; bool m_ok; @@ -107,7 +107,7 @@ wxImageRefData::wxImageRefData() m_height = 0; m_type = wxBITMAP_TYPE_INVALID; m_data = - m_alpha = (unsigned char *) NULL; + m_alpha = (unsigned char *) nullptr; m_maskRed = 0; m_maskGreen = 0; @@ -167,7 +167,7 @@ bool wxImage::Create( int width, int height, bool clear ) return false; unsigned char* p = (unsigned char*)malloc(size_t(size)); - if (p == NULL) + if (p == nullptr) return false; m_refData = new wxImageRefData; @@ -188,7 +188,7 @@ bool wxImage::Create( int width, int height, unsigned char* data, bool static_da { UnRef(); - wxCHECK_MSG( data, false, wxT("NULL data in wxImage::Create") ); + wxCHECK_MSG( data, false, wxT("null data in wxImage::Create") ); m_refData = new wxImageRefData(); @@ -205,7 +205,7 @@ bool wxImage::Create( int width, int height, unsigned char* data, unsigned char* { UnRef(); - wxCHECK_MSG( data, false, wxT("NULL data in wxImage::Create") ); + wxCHECK_MSG( data, false, wxT("null data in wxImage::Create") ); m_refData = new wxImageRefData(); @@ -238,7 +238,7 @@ wxObjectRefData* wxImage::CreateRefData() const wxObjectRefData* wxImage::CloneRefData(const wxObjectRefData* that) const { const wxImageRefData* refData = static_cast(that); - wxCHECK_MSG(refData->m_ok, NULL, wxT("invalid image") ); + wxCHECK_MSG(refData->m_ok, nullptr, wxT("invalid image") ); wxImageRefData* refData_new = new wxImageRefData; refData_new->m_width = refData->m_width; @@ -249,7 +249,7 @@ wxObjectRefData* wxImage::CloneRefData(const wxObjectRefData* that) const refData_new->m_hasMask = refData->m_hasMask; refData_new->m_ok = true; unsigned size = unsigned(refData->m_width) * unsigned(refData->m_height); - if (refData->m_alpha != NULL) + if (refData->m_alpha != nullptr) { refData_new->m_alpha = (unsigned char*)malloc(size); memcpy(refData_new->m_alpha, refData->m_alpha, size); @@ -348,8 +348,8 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const const unsigned char *source_data = M_IMGDATA->m_data; unsigned char *target_data = data; - const unsigned char *source_alpha = 0 ; - unsigned char *target_alpha = 0 ; + const unsigned char *source_alpha = nullptr ; + unsigned char *target_alpha = nullptr ; if (M_IMGDATA->m_hasMask) { hasMask = true ; @@ -532,8 +532,8 @@ wxImage wxImage::ResampleNearest(int width, int height) const const unsigned char *source_data = M_IMGDATA->m_data; unsigned char *target_data = data; - const unsigned char *source_alpha = 0 ; - unsigned char *target_alpha = 0 ; + const unsigned char *source_alpha = nullptr ; + unsigned char *target_alpha = nullptr ; if ( !M_IMGDATA->m_hasMask ) { @@ -554,13 +554,13 @@ wxImage wxImage::ResampleNearest(int width, int height) const for (int j = 0; j < height; j++) { const unsigned char* src_line = &source_data[(y>>16)*old_width*3]; - const unsigned char* src_alpha_line = source_alpha ? &source_alpha[(y>>16)*old_width] : 0 ; + const unsigned char* src_alpha_line = source_alpha ? &source_alpha[(y>>16)*old_width] : nullptr ; wxUIntPtr x = 0; for (int i = 0; i < width; i++) { const unsigned char* src_pixel = &src_line[(x>>16)*3]; - const unsigned char* src_alpha_pixel = source_alpha ? &src_alpha_line[(x>>16)] : 0 ; + const unsigned char* src_alpha_pixel = source_alpha ? &src_alpha_line[(x>>16)] : nullptr ; dest_pixel[0] = src_pixel[0]; dest_pixel[1] = src_pixel[1]; dest_pixel[2] = src_pixel[2]; @@ -649,7 +649,7 @@ wxImage wxImage::ResampleBox(int width, int height) const const unsigned char* src_data = M_IMGDATA->m_data; const unsigned char* src_alpha = M_IMGDATA->m_alpha; unsigned char* dst_data = ret_image.GetData(); - unsigned char* dst_alpha = NULL; + unsigned char* dst_alpha = nullptr; wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") ); @@ -797,7 +797,7 @@ wxImage wxImage::ResampleBilinear(int width, int height) const const unsigned char* src_data = M_IMGDATA->m_data; const unsigned char* src_alpha = M_IMGDATA->m_alpha; unsigned char* dst_data = ret_image.GetData(); - unsigned char* dst_alpha = NULL; + unsigned char* dst_alpha = nullptr; wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") ); @@ -978,7 +978,7 @@ wxImage wxImage::ResampleBicubic(int width, int height) const const unsigned char* src_data = M_IMGDATA->m_data; const unsigned char* src_alpha = M_IMGDATA->m_alpha; unsigned char* dst_data = ret_image.GetData(); - unsigned char* dst_alpha = NULL; + unsigned char* dst_alpha = nullptr; wxCHECK_MSG( dst_data, ret_image, wxS("unable to create image") ); @@ -1474,7 +1474,7 @@ wxImage wxImage::Mirror( bool horizontally ) const } } - if (alpha != NULL) + if (alpha != nullptr) { // src_alpha starts at the first pixel and increases by 1 after each step // (a step here is the copy of the alpha value of one pixel) @@ -1541,7 +1541,7 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const const unsigned char *src_data = GetData(); const unsigned char *src_alpha = M_IMGDATA->m_alpha; unsigned char *subdata = image.GetData(); - unsigned char *subalpha = NULL; + unsigned char *subalpha = nullptr; wxCHECK_MSG( subdata, image, wxT("unable to create image") ); @@ -1558,14 +1558,14 @@ wxImage wxImage::GetSubImage( const wxRect &rect ) const const int pixsoff = rect.GetLeft() + width * rect.GetTop(); src_data += 3 * pixsoff; - src_alpha += pixsoff; // won't be used if was NULL, so this is ok + src_alpha += pixsoff; // won't be used if was nullptr, so this is ok for (long j = 0; j < subheight; ++j) { memcpy( subdata, src_data, 3 * subwidth ); subdata += 3 * subwidth; src_data += 3 * width; - if (subalpha != NULL) { + if (subalpha != nullptr) { memcpy( subalpha, src_alpha, subwidth ); subalpha += subwidth; src_alpha += width; @@ -1763,7 +1763,7 @@ wxImage::Paste(const wxImage & image, int x, int y, unsigned char* target_data = GetData() + 3 * ((x + xx) + (y + yy) * M_IMGDATA->m_width); int target_step = M_IMGDATA->m_width * 3; - unsigned char* alpha_target_data = NULL; + unsigned char* alpha_target_data = nullptr; const int target_alpha_step = M_IMGDATA->m_width; if (HasAlpha()) { @@ -1780,7 +1780,7 @@ wxImage::Paste(const wxImage & image, int x, int y, source_data += source_step; target_data += target_step; // Make all the copied pixels fully opaque - if (alpha_target_data != NULL) + if (alpha_target_data != nullptr) { memset(alpha_target_data, wxALPHA_OPAQUE, width); alpha_target_data += target_alpha_step; @@ -1804,13 +1804,13 @@ wxImage::Paste(const wxImage & image, int x, int y, { // Copy the non masked pixel memcpy(target_data + i, source_data + i, 3); - if (alpha_target_data != NULL) // Make the copied pixel fully opaque + if (alpha_target_data != nullptr) // Make the copied pixel fully opaque alpha_target_data[i / 3] = wxALPHA_OPAQUE; } } source_data += source_step; target_data += target_step; - if (alpha_target_data != NULL) + if (alpha_target_data != nullptr) alpha_target_data += target_alpha_step; } } @@ -2068,7 +2068,7 @@ bool wxImage::IsOk() const unsigned char *wxImage::GetData() const { - wxCHECK_MSG( IsOk(), (unsigned char *)NULL, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), (unsigned char *)nullptr, wxT("invalid image") ); return M_IMGDATA->m_data; } @@ -2152,7 +2152,7 @@ unsigned char wxImage::GetAlpha(int x, int y) const bool wxImage::ConvertColourToAlpha(unsigned char r, unsigned char g, unsigned char b) { - SetAlpha(NULL); + SetAlpha(nullptr); const int w = M_IMGDATA->m_width; const int h = M_IMGDATA->m_height; @@ -2194,7 +2194,7 @@ void wxImage::SetAlpha( unsigned char *alpha, bool static_data ) unsigned char *wxImage::GetAlpha() const { - wxCHECK_MSG( IsOk(), (unsigned char *)NULL, wxT("invalid image") ); + wxCHECK_MSG( IsOk(), (unsigned char *)nullptr, wxT("invalid image") ); return M_IMGDATA->m_alpha; } @@ -2244,7 +2244,7 @@ void wxImage::ClearAlpha() if ( !M_IMGDATA->m_staticAlpha ) free( M_IMGDATA->m_alpha ); - M_IMGDATA->m_alpha = NULL; + M_IMGDATA->m_alpha = nullptr; } @@ -2447,7 +2447,7 @@ bool wxImage::ConvertAlphaToMask(unsigned char mr, if ( !M_IMGDATA->m_staticAlpha ) free(M_IMGDATA->m_alpha); - M_IMGDATA->m_alpha = NULL; + M_IMGDATA->m_alpha = nullptr; M_IMGDATA->m_staticAlpha = false; return true; @@ -3043,7 +3043,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const void wxImage::AddHandler( wxImageHandler *handler ) { // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) + if (FindHandler( handler->GetType() ) == nullptr) { sm_handlers.Append( handler ); } @@ -3064,7 +3064,7 @@ void wxImage::AddHandler( wxImageHandler *handler ) void wxImage::InsertHandler( wxImageHandler *handler ) { // Check for an existing handler of the type being added. - if (FindHandler( handler->GetType() ) == 0) + if (FindHandler( handler->GetType() ) == nullptr) { sm_handlers.Insert( handler ); } @@ -3100,7 +3100,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& name ) node = node->GetNext(); } - return NULL; + return nullptr; } wxImageHandler *wxImage::FindHandler( const wxString& extension, wxBitmapType bitmapType ) @@ -3118,7 +3118,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& extension, wxBitmapType bi } node = node->GetNext(); } - return NULL; + return nullptr; } wxImageHandler *wxImage::FindHandler(wxBitmapType bitmapType ) @@ -3130,7 +3130,7 @@ wxImageHandler *wxImage::FindHandler(wxBitmapType bitmapType ) if (handler->GetType() == bitmapType) return handler; node = node->GetNext(); } - return NULL; + return nullptr; } wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) @@ -3142,7 +3142,7 @@ wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) if (handler->GetMimeType().IsSameAs(mimetype, false)) return handler; node = node->GetNext(); } - return NULL; + return nullptr; } void wxImage::InitStandardHandlers() @@ -3473,7 +3473,7 @@ bool wxImageHandler::CallDoCanRead(wxInputStream& stream) wxImageResolution wxImageHandler::GetResolutionFromOptions(const wxImage& image, int *x, int *y) { - wxCHECK_MSG( x && y, wxIMAGE_RESOLUTION_NONE, wxT("NULL pointer") ); + wxCHECK_MSG( x && y, wxIMAGE_RESOLUTION_NONE, wxT("null pointer") ); if ( image.HasOption(wxIMAGE_OPTION_RESOLUTIONX) && image.HasOption(wxIMAGE_OPTION_RESOLUTIONY) ) @@ -3553,7 +3553,7 @@ unsigned long wxImage::CountColours( unsigned long stopafter ) const b = *(p++); key = wxImageHistogram::MakeKey(r, g, b); - if (h.Get(key) == NULL) + if (h.Get(key) == nullptr) { h.Put(key, &dummy); nentries++; @@ -3638,7 +3638,7 @@ wxImage wxImage::Rotate(double angle, data[i] = data[i - 1] + (3 * w); // Same for alpha channel - unsigned char ** alpha = NULL; + unsigned char ** alpha = nullptr; if (has_alpha) { alpha = new unsigned char * [h]; @@ -3673,7 +3673,7 @@ wxImage wxImage::Rotate(double angle, if (has_alpha) rotated.SetAlpha(); - if (offset_after_rotation != NULL) + if (offset_after_rotation != nullptr) { *offset_after_rotation = wxPoint (x1a, y1a); } @@ -3682,7 +3682,7 @@ wxImage wxImage::Rotate(double angle, // pointer, there is no need for pointer-based arrays here unsigned char *dst = rotated.GetData(); - unsigned char *alpha_dst = has_alpha ? rotated.GetAlpha() : NULL; + unsigned char *alpha_dst = has_alpha ? rotated.GetAlpha() : nullptr; // if the original image has a mask, use its RGB values as the blank pixel, // else, fall back to default (black). diff --git a/src/common/imagiff.cpp b/src/common/imagiff.cpp index 9cac7d7343..6254e89dce 100644 --- a/src/common/imagiff.cpp +++ b/src/common/imagiff.cpp @@ -67,7 +67,7 @@ public: unsigned char *p; /* bitmap */ unsigned char *pal; /* palette */ - IFFImage() : w(0), h(0), colors(0), p(0), pal(0) {} + IFFImage() : w(0), h(0), colors(0), p(nullptr), pal(nullptr) {} ~IFFImage() { delete [] p; delete [] pal; } }; @@ -109,9 +109,9 @@ public: wxIFFDecoder::wxIFFDecoder(wxInputStream *s) { m_f = s; - m_image = 0; - databuf = 0; - decomp_mem = 0; + m_image = nullptr; + databuf = nullptr; + decomp_mem = nullptr; } void wxIFFDecoder::Destroy() @@ -320,7 +320,7 @@ int wxIFFDecoder::ReadIFF() Destroy(); m_image = new IFFImage(); - if (m_image == 0) { + if (m_image == nullptr) { Destroy(); return wxIFF_MEMERR; } @@ -339,7 +339,7 @@ int wxIFFDecoder::ReadIFF() } // allocate memory for complete file - if ((databuf = new byte[filesize]) == 0) { + if ((databuf = new byte[filesize]) == nullptr) { Destroy(); return wxIFF_MEMERR; } @@ -461,7 +461,7 @@ int wxIFFDecoder::ReadIFF() size_t decomp_bufsize = (((bmhd_width + 15) >> 4) << 1) * bmhd_height * bmhd_bitplanes; - if ((decomp_mem = new byte[decomp_bufsize]) == 0) { + if ((decomp_mem = new byte[decomp_bufsize]) == nullptr) { Destroy(); return wxIFF_MEMERR; } diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index b6737d75f7..363be60e9a 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -175,7 +175,7 @@ CPP_METHODDEF(void) wx_error_exit (j_common_ptr cinfo) /* * This will replace the standard output_message method when the user * wants us to be silent (verbose==false). We must have such method instead of - * simply using NULL for cinfo->err->output_message because it's called + * simply using nullptr for cinfo->err->output_message because it's called * unconditionally from within libjpeg when there's "garbage input". */ CPP_METHODDEF(void) wx_ignore_message (j_common_ptr WXUNUSED(cinfo)) @@ -189,7 +189,7 @@ void wx_jpeg_io_src( j_decompress_ptr cinfo, wxInputStream& infile ) { wx_src_ptr src; - if (cinfo->src == NULL) { /* first time for this JPEG object? */ + if (cinfo->src == nullptr) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(wx_source_mgr)); @@ -197,7 +197,7 @@ void wx_jpeg_io_src( j_decompress_ptr cinfo, wxInputStream& infile ) src = (wx_src_ptr) cinfo->src; src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ src->buffer = new JOCTET[JPEG_IO_BUFFER_SIZE]; - src->pub.next_input_byte = NULL; /* until buffer loaded */ + src->pub.next_input_byte = nullptr; /* until buffer loaded */ src->stream = &infile; src->pub.init_source = wx_init_source; @@ -231,7 +231,7 @@ static inline void wx_cmyk_to_rgb(unsigned char* rgb, const unsigned char* cmyk) bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int WXUNUSED(index) ) { - wxCHECK_MSG( image, false, "NULL image pointer" ); + wxCHECK_MSG( image, false, "null image pointer" ); struct jpeg_decompress_struct cinfo; wx_error_mgr jerr; @@ -399,7 +399,7 @@ static void wx_jpeg_io_dest(j_compress_ptr cinfo, wxOutputStream& outfile) { wx_dest_ptr dest; - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + if (cinfo->dest == nullptr) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(wx_destination_mgr)); diff --git a/src/common/imagpcx.cpp b/src/common/imagpcx.cpp index 4bab4b6375..92d5894a76 100644 --- a/src/common/imagpcx.cpp +++ b/src/common/imagpcx.cpp @@ -217,7 +217,7 @@ int ReadPCX(wxImage *image, wxInputStream& stream) if (!image->IsOk()) return wxPCX_MEMERR; - if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == NULL) + if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == nullptr) return wxPCX_MEMERR; // Now start reading the file, line by line, and store @@ -339,7 +339,7 @@ int SavePCX(wxImage *image, wxOutputStream& stream) if (bytesperline % 2) bytesperline++; - if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == NULL) + if ((p = (unsigned char *) malloc(bytesperline * nplanes)) == nullptr) return wxPCX_MEMERR; // Build header data and write it to the stream. Initially, diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 6d03f16ddf..0da9536163 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -103,10 +103,10 @@ struct wxPNGImageData { wxPNGImageData() { - lines = NULL; - m_buf = NULL; - info_ptr = (png_infop) NULL; - png_ptr = (png_structp) NULL; + lines = nullptr; + m_buf = nullptr; + info_ptr = (png_infop) nullptr; + png_ptr = (png_structp) nullptr; ok = false; } @@ -145,9 +145,9 @@ struct wxPNGImageData if ( png_ptr ) { if ( info_ptr ) - png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) NULL ); + png_destroy_read_struct( &png_ptr, &info_ptr, (png_infopp) nullptr ); else - png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL ); + png_destroy_read_struct( &png_ptr, (png_infopp) nullptr, (png_infopp) nullptr ); } } @@ -184,7 +184,7 @@ static void PNGLINKAGEMODE wx_PNG_stream_writer( png_structp png_ptr, png_bytep static void PNGLINKAGEMODE wx_PNG_warning(png_structp png_ptr, png_const_charp message) { - wxPNGInfoStruct *info = png_ptr ? WX_PNG_INFO(png_ptr) : NULL; + wxPNGInfoStruct *info = png_ptr ? WX_PNG_INFO(png_ptr) : nullptr; if ( !info || info->verbose ) { wxLogWarning( wxString::FromAscii(message) ); @@ -196,7 +196,7 @@ PNGLINKAGEMODE wx_PNG_warning(png_structp png_ptr, png_const_charp message) static void PNGLINKAGEMODE wx_PNG_error(png_structp png_ptr, png_const_charp message) { - wx_PNG_warning(NULL, message); + wx_PNG_warning(nullptr, message); // we're not using libpng built-in jump buffer (see comment before // wxPNGInfoStruct above) so we have to return ourselves, otherwise libpng @@ -249,7 +249,7 @@ void CopyDataFromPNG(wxImage *image, png_uint_32 height) { // allocated on demand if we have any non-opaque pixels - unsigned char *alpha = NULL; + unsigned char *alpha = nullptr; unsigned char *ptrDst = image->GetData(); { @@ -301,7 +301,7 @@ wxPNGImageData::DoLoadPNGFile(wxImage* image, wxPNGInfoStruct& wxinfo) png_ptr = png_create_read_struct ( PNG_LIBPNG_VER_STRING, - NULL, + nullptr, wx_PNG_error, wx_PNG_warning ); @@ -320,7 +320,7 @@ wxPNGImageData::DoLoadPNGFile(wxImage* image, wxPNGInfoStruct& wxinfo) return; png_read_info( png_ptr, info_ptr ); - png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL ); + png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr ); png_set_expand(png_ptr); png_set_gray_to_rgb(png_ptr); @@ -336,7 +336,7 @@ wxPNGImageData::DoLoadPNGFile(wxImage* image, wxPNGInfoStruct& wxinfo) (color_type & PNG_COLOR_MASK_ALPHA) || png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS); - if (!Alloc(width, height, needCopy ? NULL : image->GetData())) + if (!Alloc(width, height, needCopy ? nullptr : image->GetData())) return; png_read_image( png_ptr, lines ); @@ -345,7 +345,7 @@ wxPNGImageData::DoLoadPNGFile(wxImage* image, wxPNGInfoStruct& wxinfo) #if wxUSE_PALETTE if (color_type == PNG_COLOR_TYPE_PALETTE) { - png_colorp palette = NULL; + png_colorp palette = nullptr; int numPalette = 0; (void) png_get_PLTE(png_ptr, info_ptr, &palette, &numPalette); @@ -500,7 +500,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos png_structp png_ptr = png_create_write_struct ( PNG_LIBPNG_VER_STRING, - NULL, + nullptr, wx_PNG_error, wx_PNG_warning ); @@ -514,9 +514,9 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos } png_infop info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) + if (info_ptr == nullptr) { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); + png_destroy_write_struct( &png_ptr, (png_infopp)nullptr ); if (verbose) { wxLogError(_("Couldn't save PNG image.")); @@ -526,7 +526,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos if (setjmp(wxinfo.jmpbuf)) { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); + png_destroy_write_struct( &png_ptr, (png_infopp)nullptr ); if (verbose) { wxLogError(_("Couldn't save PNG image.")); @@ -536,7 +536,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos // NB: please see the comment near wxPNGInfoStruct declaration for // explanation why this line is mandatory - png_set_write_fn( png_ptr, &wxinfo, wx_PNG_stream_writer, NULL); + png_set_write_fn( png_ptr, &wxinfo, wx_PNG_stream_writer, nullptr); const int iHeight = image->GetHeight(); const int iWidth = image->GetWidth(); @@ -620,11 +620,11 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos { wxASSERT(PaletteFind(palette, mask) == 0); png_trans[0] = 0; - png_set_tRNS(png_ptr, info_ptr, png_trans, 1, NULL); + png_set_tRNS(png_ptr, info_ptr, png_trans, 1, nullptr); } else if (pAlpha && !bHasMask) { - png_set_tRNS(png_ptr, info_ptr, png_trans, palette.size(), NULL); + png_set_tRNS(png_ptr, info_ptr, png_trans, palette.size(), nullptr); } } } @@ -743,12 +743,12 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos data = (unsigned char *)malloc( image->GetWidth() * iElements ); if ( !data ) { - png_destroy_write_struct( &png_ptr, (png_infopp)NULL ); + png_destroy_write_struct( &png_ptr, (png_infopp)nullptr ); return false; } const unsigned char * - pAlpha = (const unsigned char *)(bHasAlpha ? image->GetAlpha() : NULL); + pAlpha = (const unsigned char *)(bHasAlpha ? image->GetAlpha() : nullptr); const unsigned char *pColors = image->GetData(); @@ -849,7 +849,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos { // The version string seems to always have a leading space and a trailing // new line, get rid of them both. - wxString str = png_get_header_version(NULL) + 1; + wxString str = png_get_header_version(nullptr) + 1; str.Replace("\n", ""); return wxVersionInfo("libpng", diff --git a/src/common/imagtga.cpp b/src/common/imagtga.cpp index da436c04bd..dec61a22f5 100644 --- a/src/common/imagtga.cpp +++ b/src/common/imagtga.cpp @@ -276,7 +276,7 @@ int ReadTGA(wxImage* image, wxInputStream& stream) return wxTGA_INVFORMAT; } - unsigned char* alpha = NULL; + unsigned char* alpha = nullptr; if ((colorType != wxTGA_MAPPED && (bpp == 16 || bpp == 32)) || (colorType == wxTGA_MAPPED && (palettebpp == 16 || palettebpp == 32))) { diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index 2de0ab7177..359946d0bd 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -62,7 +62,7 @@ FormatTiffMessage(const char *module, const char *fmt, va_list ap) // than nothing strcpy(buf, "Incorrectly formatted TIFF message"); } - buf[WXSIZEOF(buf)-1] = 0; // make sure it is always NULL-terminated + buf[WXSIZEOF(buf)-1] = 0; // make sure it is always NUL-terminated wxString msg(buf); if ( module ) @@ -745,7 +745,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo } else { - buf = NULL; + buf = nullptr; } TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,TIFFDefaultStripSize(tif, (wxUint32) -1)); diff --git a/src/common/init.cpp b/src/common/init.cpp index 1ad8389806..5fb771b3f3 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -79,14 +79,14 @@ wxDEFINE_SCOPED_PTR(wxAppConsole, wxAppPtrBase) class wxAppPtr : public wxAppPtrBase { public: - explicit wxAppPtr(wxAppConsole *ptr = NULL) : wxAppPtrBase(ptr) { } + explicit wxAppPtr(wxAppConsole *ptr = nullptr) : wxAppPtrBase(ptr) { } ~wxAppPtr() { if ( get() ) { // the pointer is going to be deleted in the base class dtor, don't // leave the dangling pointer! - wxApp::SetInstance(NULL); + wxApp::SetInstance(nullptr); } } @@ -108,7 +108,7 @@ public: wxCallAppCleanup(wxAppConsole *app) : m_app(app) { } ~wxCallAppCleanup() { if ( m_app ) m_app->CleanUp(); } - void Dismiss() { m_app = NULL; } + void Dismiss() { m_app = nullptr; } private: wxAppConsole *m_app; @@ -134,7 +134,7 @@ static struct InitData { #if wxUSE_UNICODE argc = argcOrig = 0; - // argv = argvOrig = NULL; -- not even really needed + // argv = argvOrig = nullptr; -- not even really needed #endif // wxUSE_UNICODE } @@ -200,7 +200,7 @@ static void ConvertArgsToUnicode(int argc, char **argv) } gs_initData.argcOrig = gs_initData.argc = wargc; - gs_initData.argvOrig[wargc] =gs_initData.argv[wargc] = NULL; + gs_initData.argvOrig[wargc] =gs_initData.argv[wargc] = nullptr; } static void FreeConvertedArgs() @@ -266,7 +266,7 @@ static bool DoCommonPreInit() // they may need it too, so set it here if it wasn't done yet if ( !wxGetInstance() ) { - wxSetInstance(::GetModuleHandle(NULL)); + wxSetInstance(::GetModuleHandle(nullptr)); } #endif // __WINDOWS__ @@ -359,7 +359,7 @@ bool wxEntryStart(int& argc, wxChar **argv) // it before now), we can delete the temporary sink we had created for the // initialization messages -- the next time logging function is called, the // sink will be recreated but this time wxAppTraits will be used - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); #endif // wxUSE_LOG return true; @@ -400,7 +400,7 @@ static void DoCommonPreCleanup() // // notice that wxLog will still recreate a default log target if any // messages are logged but that one will be safe to use until the very end - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); #endif // wxUSE_LOG } @@ -415,9 +415,9 @@ static void DoCommonPostCleanup() FreeConvertedArgs(); #endif // wxUSE_UNICODE - // use Set(NULL) and not Get() to avoid creating a message output object on + // use Set(nullptr) and not Get() to avoid creating a message output object on // demand when we just want to delete it - delete wxMessageOutput::Set(NULL); + delete wxMessageOutput::Set(nullptr); #if wxUSE_LOG // call this first as it has a side effect: in addition to flushing all @@ -432,7 +432,7 @@ static void DoCommonPostCleanup() // to leak memory which doesn't matter much considering the application is // exiting anyhow than to not show messages which could still be logged // from the user code (e.g. static dtors and such) - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); #endif // wxUSE_LOG } @@ -446,11 +446,11 @@ void wxEntryCleanup() { wxTheApp->CleanUp(); - // reset the global pointer to it to NULL before destroying it as in + // reset the global pointer to it to nullptr before destroying it as in // some circumstances this can result in executing the code using // wxTheApp and using half-destroyed object is no good wxAppConsole * const app = wxApp::GetInstance(); - wxApp::SetInstance(NULL); + wxApp::SetInstance(nullptr); delete app; } @@ -476,7 +476,7 @@ int wxEntryReal(int& argc, wxChar **argv) { #if wxUSE_LOG // flush any log messages explaining why we failed - delete wxLog::SetActiveTarget(NULL); + delete wxLog::SetActiveTarget(nullptr); #endif return -1; } @@ -524,7 +524,7 @@ int wxEntry(int& argc, char **argv) bool wxInitialize() { int argc = 0; - return wxInitialize(argc, (wxChar**)NULL); + return wxInitialize(argc, (wxChar**)nullptr); } bool wxInitialize(int& argc, wxChar **argv) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index b4fa0fce18..f6e6504939 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -136,7 +136,7 @@ const char* wxLanguageInfo::TrySetLocale() const if ( !::GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, buffer, WXSIZEOF(buffer)) ) { wxLogLastError(wxT("GetLocaleInfo(LOCALE_SENGLANGUAGE)")); - return NULL; + return nullptr; } locale = buffer; @@ -239,8 +239,8 @@ void wxLocale::DoCommonInit() { m_language = wxLANGUAGE_UNKNOWN; - m_pszOldLocale = NULL; - m_pOldLocale = NULL; + m_pszOldLocale = nullptr; + m_pOldLocale = nullptr; #ifdef __WIN32__ m_oldLCID = 0; @@ -323,7 +323,7 @@ bool wxLocale::Init(const wxString& name, // Under (non-Darwin) Unix wxUILocale already set the C locale, but under // the other platforms we still have to do it here. #if defined(__WIN32__) || defined(__WXOSX__) - ok = wxSetlocale(LC_ALL, szLocale) != NULL; + ok = wxSetlocale(LC_ALL, szLocale) != nullptr; #endif // __WIN32__ #else @@ -346,7 +346,7 @@ void wxLocale::DoInit(const wxString& name, m_language = language; // Store the current locale in order to be able to restore it in the dtor. - m_pszOldLocale = wxSetlocale(LC_ALL, NULL); + m_pszOldLocale = wxSetlocale(LC_ALL, nullptr); if ( m_pszOldLocale ) m_pszOldLocale = wxStrdup(m_pszOldLocale); @@ -387,7 +387,7 @@ bool wxLocale::DoCommonPostInit(bool success, // 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; + m_pszOldLocale = nullptr; // continue nevertheless and try to load at least the translations for // this language @@ -416,7 +416,7 @@ bool wxLocale::Init(int lang, int flags) const wxLanguageInfo *info = GetLanguageInfo(lang); // Unknown language: - if (info == NULL) + if (info == nullptr) { // This could have happened because some concrete language has been // requested and we just don't know anything about it. In this case, we @@ -553,7 +553,7 @@ wxString wxLocale::GetSystemEncodingName() // the environment variables (in most cases this won't work, but I was // out of ideas) char* lang = getenv("LC_ALL"); - char* dot = lang ? strchr(lang, '.') : NULL; + char* dot = lang ? strchr(lang, '.') : nullptr; if (!dot) { lang = getenv("LC_CTYPE"); @@ -686,7 +686,7 @@ const wxLanguageInfo* wxLocale::FindLanguageInfo(const wxString& locale) wxString wxLocale::GetSysName() const { - return wxSetlocale(LC_ALL, NULL); + return wxSetlocale(LC_ALL, nullptr); } // clean up @@ -705,7 +705,7 @@ wxLocale::~wxLocale() if ( m_pOldLocale ) wxTranslations::SetNonOwned(&m_pOldLocale->m_translations); else - wxTranslations::Set(NULL); + wxTranslations::Set(nullptr); } // restore old locale pointer @@ -1358,7 +1358,7 @@ wxGetInfoFromCFLocale(CFLocaleRef cfloc, wxLocaleInfo index, wxLocaleCategory WX return wxString(); } wxCFRef dateFormatter( CFDateFormatterCreate - (NULL, cfloc, dateStyle, timeStyle)); + (nullptr, cfloc, dateStyle, timeStyle)); wxCFStringRef cfs = wxCFRetain( CFDateFormatterGetFormat(dateFormatter )); wxString format = wxTranslateFromUnicodeFormat(cfs.AsString()); // we always want full years @@ -1540,7 +1540,7 @@ wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat) // ------------------------------ // the current locale object -static wxLocale *g_pLocale = NULL; +static wxLocale *g_pLocale = nullptr; wxLocale *wxGetLocale() { diff --git a/src/common/ipcbase.cpp b/src/common/ipcbase.cpp index 3b5498b09d..6712c32d0b 100644 --- a/src/common/ipcbase.cpp +++ b/src/common/ipcbase.cpp @@ -27,7 +27,7 @@ wxConnectionBase::wxConnectionBase(void *buffer, size_t bytes) m_deletebufferwhendone(false), m_connected(true) { - if ( buffer == NULL ) + if ( buffer == nullptr ) { // behave like next constructor m_buffersize = 0; m_deletebufferwhendone = true; @@ -35,7 +35,7 @@ wxConnectionBase::wxConnectionBase(void *buffer, size_t bytes) } wxConnectionBase::wxConnectionBase() - : m_buffer(NULL), + : m_buffer(nullptr), m_buffersize(0), m_deletebufferwhendone(true), m_connected(true) @@ -122,6 +122,6 @@ void *wxConnectionBase::GetBufferAtLeast( size_t bytes ) return m_buffer; } // user-supplied buffer, fail else - return NULL; + return nullptr; } } diff --git a/src/common/languageinfo.cpp b/src/common/languageinfo.cpp index 24d81f641f..60738ea715 100644 --- a/src/common/languageinfo.cpp +++ b/src/common/languageinfo.cpp @@ -967,7 +967,7 @@ tabLangData[] = { wxLANGUAGE_ZULU, "zu" , "zu" , "zu_ZA" , 0x35, 0x01, wxLayout_LeftToRight, "isiZulu","isiZulu" }, { wxLANGUAGE_ZULU_SOUTH_AFRICA, "zu-ZA" , "zu_ZA" , "" , 0x35, 0x01, wxLayout_LeftToRight, "isiZulu (South Africa)","isiZulu (iNingizimu Afrika)" }, - { 0, NULL, NULL, NULL, 0, 0, wxLayout_Default, NULL, NULL } + { 0, nullptr, nullptr, nullptr, 0, 0, wxLayout_Default, nullptr, nullptr } }; // Data table for known language scripts @@ -1138,7 +1138,7 @@ tabScriptData[] = { "Zyyy", "common" }, { "Zzzz", "unknown" }, - { NULL, NULL } + { nullptr, nullptr } }; void wxUILocale::InitLanguagesDB() diff --git a/src/common/layout.cpp b/src/common/layout.cpp index e06643f8f7..defc7fca6e 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -71,7 +71,7 @@ wxIndividualLayoutConstraint::wxIndividualLayoutConstraint() percent = 0; otherEdge = wxTop; done = false; - otherWin = NULL; + otherWin = nullptr; } void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg) @@ -154,7 +154,7 @@ bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW) value = 0; percent = 0; otherEdge = wxTop; - otherWin = NULL; + otherWin = nullptr; return true; } diff --git a/src/common/list.cpp b/src/common/list.cpp index d887d6913a..6a5d212a28 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -101,7 +101,7 @@ wxNodeBase::~wxNodeBase() // handle the case when we're being deleted from the list by the user (i.e. // not by the list itself from DeleteNode) - we must do it for // compatibility with old code - if ( m_list != NULL ) + if ( m_list != nullptr ) { if ( m_list->m_keyType == wxKEY_STRING ) { @@ -138,7 +138,7 @@ int wxNodeBase::IndexOf() const void wxListBase::Init(wxKeyType keyType) { m_nodeFirst = - m_nodeLast = NULL; + m_nodeLast = nullptr; m_count = 0; m_destroy = false; m_keyType = keyType; @@ -152,7 +152,7 @@ void wxListBase::DoCopy(const wxListBase& list) m_destroy = list.m_destroy; m_keyType = list.m_keyType; m_nodeFirst = - m_nodeLast = NULL; + m_nodeLast = nullptr; switch (m_keyType) { @@ -190,7 +190,7 @@ void wxListBase::DoCopy(const wxListBase& list) wxListBase::~wxListBase() { wxNodeBase *each = m_nodeFirst; - while ( each != NULL ) + while ( each != nullptr ) { wxNodeBase *next = each->GetNext(); DoDeleteNode(each); @@ -219,12 +219,12 @@ wxNodeBase *wxListBase::AppendCommon(wxNodeBase *node) wxNodeBase *wxListBase::Append(void *object) { // all objects in a keyed list should have a key - wxCHECK_MSG( m_keyType == wxKEY_NONE, NULL, + wxCHECK_MSG( m_keyType == wxKEY_NONE, nullptr, wxT("need a key for the object to append") ); // we use wxDefaultListKey even though it is the default parameter value // because gcc under Mac OS X seems to miscompile this call otherwise - wxNodeBase *node = CreateNode(m_nodeLast, NULL, object, + wxNodeBase *node = CreateNode(m_nodeLast, nullptr, object, wxDefaultListKey); return AppendCommon(node); @@ -234,10 +234,10 @@ wxNodeBase *wxListBase::Append(long key, void *object) { wxCHECK_MSG( (m_keyType == wxKEY_INTEGER) || (m_keyType == wxKEY_NONE && m_count == 0), - NULL, + nullptr, wxT("can't append object with numeric key to this list") ); - wxNodeBase *node = CreateNode(m_nodeLast, NULL, object, key); + wxNodeBase *node = CreateNode(m_nodeLast, nullptr, object, key); return AppendCommon(node); } @@ -245,20 +245,20 @@ wxNodeBase *wxListBase::Append (const wxString& key, void *object) { wxCHECK_MSG( (m_keyType == wxKEY_STRING) || (m_keyType == wxKEY_NONE && m_count == 0), - NULL, + nullptr, wxT("can't append object with string key to this list") ); - wxNodeBase *node = CreateNode(m_nodeLast, NULL, object, key); + wxNodeBase *node = CreateNode(m_nodeLast, nullptr, object, key); return AppendCommon(node); } wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object) { // all objects in a keyed list should have a key - wxCHECK_MSG( m_keyType == wxKEY_NONE, NULL, + wxCHECK_MSG( m_keyType == wxKEY_NONE, nullptr, wxT("need a key for the object to insert") ); - wxCHECK_MSG( !position || position->m_list == this, NULL, + wxCHECK_MSG( !position || position->m_list == this, nullptr, wxT("can't insert before a node from another list") ); // previous and next node for the node being inserted @@ -271,7 +271,7 @@ wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object) else { // inserting in the beginning of the list - prev = NULL; + prev = nullptr; next = m_nodeFirst; } @@ -282,7 +282,7 @@ wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object) m_nodeLast = node; } - if ( prev == NULL ) + if ( prev == nullptr ) { m_nodeFirst = node; } @@ -304,7 +304,7 @@ wxNodeBase *wxListBase::Item(size_t n) const wxFAIL_MSG( wxT("invalid index in wxListBase::Item") ); - return NULL; + return nullptr; } wxNodeBase *wxListBase::Find(const wxListKey& key) const @@ -321,7 +321,7 @@ wxNodeBase *wxListBase::Find(const wxListKey& key) const } // not found - return NULL; + return nullptr; } wxNodeBase *wxListBase::Find(const void *object) const @@ -333,7 +333,7 @@ wxNodeBase *wxListBase::Find(const void *object) const } // not found - return NULL; + return nullptr; } int wxListBase::IndexOf(void *object) const @@ -357,14 +357,14 @@ void wxListBase::DoDeleteNode(wxNodeBase *node) } // so that the node knows that it's being deleted by the list - node->m_list = NULL; + node->m_list = nullptr; delete node; } wxNodeBase *wxListBase::DetachNode(wxNodeBase *node) { - wxCHECK_MSG( node, NULL, wxT("detaching NULL wxNodeBase") ); - wxCHECK_MSG( node->m_list == this, NULL, + wxCHECK_MSG( node, nullptr, wxT("detaching null wxNodeBase") ); + wxCHECK_MSG( node->m_list == this, nullptr, wxT("detaching node which is not from this list") ); // update the list @@ -379,7 +379,7 @@ wxNodeBase *wxListBase::DetachNode(wxNodeBase *node) m_count--; // mark the node as not belonging to this list any more - node->m_list = NULL; + node->m_list = nullptr; return node; } @@ -420,7 +420,7 @@ void wxListBase::Clear() } m_nodeFirst = - m_nodeLast = NULL; + m_nodeLast = nullptr; m_count = 0; } @@ -441,7 +441,7 @@ void *wxListBase::FirstThat(wxListIterateFunction F) return current->GetData(); } - return NULL; + return nullptr; } void *wxListBase::LastThat(wxListIterateFunction F) @@ -452,7 +452,7 @@ void *wxListBase::LastThat(wxListIterateFunction F) return current->GetData(); } - return NULL; + return nullptr; } // (stefan.hammes@urz.uni-heidelberg.de) diff --git a/src/common/listctrlcmn.cpp b/src/common/listctrlcmn.cpp index 22b5e68e49..6ef0fd3d82 100644 --- a/src/common/listctrlcmn.cpp +++ b/src/common/listctrlcmn.cpp @@ -246,7 +246,7 @@ wxItemAttr *wxListCtrlBase::OnGetItemAttr(long item) const { return (m_alternateRowColour.GetBackgroundColour().IsOk() && (item % 2)) ? wxConstCast(&m_alternateRowColour, wxItemAttr) - : NULL; // no attributes by default + : nullptr; // no attributes by default } wxString wxListCtrlBase::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const @@ -320,7 +320,7 @@ wxWithImages* wxListCtrlBase::GetImages(int which) { return &m_imagesState; } - return NULL; + return nullptr; } const wxWithImages* wxListCtrlBase::GetImages(int which) const @@ -331,13 +331,13 @@ const wxWithImages* wxListCtrlBase::GetImages(int which) const wxImageList* wxListCtrlBase::GetUpdatedImageList(int which) { wxWithImages* const images = GetImages(which); - return images ? images->GetUpdatedImageListFor(this) : NULL; + return images ? images->GetUpdatedImageListFor(this) : nullptr; } wxImageList *wxListCtrlBase::GetImageList(int which) const { const wxWithImages* const images = GetImages(which); - return images ? images->GetImageList() : NULL; + return images ? images->GetImageList() : nullptr; } void wxListCtrlBase::SetImageList(wxImageList *imageList, int which) diff --git a/src/common/log.cpp b/src/common/log.cpp index e716690f00..38231abbee 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -509,7 +509,7 @@ wxLog *wxLog::GetActiveTarget() /* static */ wxLog *wxLog::GetMainThreadActiveTarget() { - if ( ms_bAutoCreate && ms_pLogger == NULL ) { + if ( ms_bAutoCreate && ms_pLogger == nullptr ) { // prevent infinite recursion if someone calls wxLogXXX() from // wxApp::CreateLogTarget() static bool s_bInGetActiveTarget = false; @@ -517,7 +517,7 @@ wxLog *wxLog::GetMainThreadActiveTarget() s_bInGetActiveTarget = true; // ask the application to create a log target for us - if ( wxTheApp != NULL ) + if ( wxTheApp != nullptr ) ms_pLogger = wxTheApp->GetTraits()->CreateLogTarget(); else ms_pLogger = new wxLogOutputBest; @@ -533,7 +533,7 @@ wxLog *wxLog::GetMainThreadActiveTarget() wxLog *wxLog::SetActiveTarget(wxLog *pLogger) { - if ( ms_pLogger != NULL ) { + if ( ms_pLogger != nullptr ) { // flush the old messages before changing because otherwise they might // get lost later if this target is not restored ms_pLogger->Flush(); @@ -883,7 +883,7 @@ void wxLogStderr::DoLogText(const wxString& msg) wxLogStream::wxLogStream(wxSTD ostream *ostr, const wxMBConv& conv) : wxMessageOutputWithConv(conv) { - if ( ostr == NULL ) + if ( ostr == nullptr ) m_ostr = &wxSTD cerr; else m_ostr = ostr; @@ -999,7 +999,7 @@ wxLogInterposerTemp::wxLogInterposerTemp() bool wxLog::ms_bRepetCounting = false; -wxLog *wxLog::ms_pLogger = NULL; +wxLog *wxLog::ms_pLogger = nullptr; bool wxLog::ms_doLog = true; bool wxLog::ms_bAutoCreate = true; bool wxLog::ms_bVerbose = false; @@ -1081,7 +1081,7 @@ wxString wxMSWFormatMessage(DWORD nErrCode, HMODULE hModule) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, - NULL + nullptr ) == 0 ) { wxLogDebug(wxS("FormatMessage failed with error 0x%lx"), GetLastError()); diff --git a/src/common/lzmastream.cpp b/src/common/lzmastream.cpp index fe3a2a0584..4d8aac19a6 100644 --- a/src/common/lzmastream.cpp +++ b/src/common/lzmastream.cpp @@ -384,11 +384,11 @@ wxLZMAClassFactory::wxLZMAClassFactory() const wxChar * const * wxLZMAClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *mime[] = { wxT("application/xz"), NULL }; - static const wxChar *encs[] = { wxT("xz"), NULL }; - static const wxChar *exts[] = { wxT(".xz"), NULL }; + static const wxChar *mime[] = { wxT("application/xz"), nullptr }; + static const wxChar *encs[] = { wxT("xz"), nullptr }; + static const wxChar *exts[] = { wxT(".xz"), nullptr }; - const wxChar* const* ret = NULL; + const wxChar* const* ret = nullptr; switch ( type ) { case wxSTREAM_PROTOCOL: ret = encs; break; diff --git a/src/common/mediactrlcmn.cpp b/src/common/mediactrlcmn.cpp index e4bc3f2a7e..c3f4fccc74 100644 --- a/src/common/mediactrlcmn.cpp +++ b/src/common/mediactrlcmn.cpp @@ -95,7 +95,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, if(!pClassInfo || !DoCreate(pClassInfo, parent, id, pos, size, style, validator, name)) { - m_imp = NULL; + m_imp = nullptr; return false; } @@ -117,7 +117,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxClassInfo* classInfo; - while((classInfo = NextBackend(&it)) != NULL) + while((classInfo = NextBackend(&it)) != nullptr) { if(!DoCreate(classInfo, parent, id, pos, size, style, validator, name)) @@ -140,7 +140,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, } } - m_imp = NULL; + m_imp = nullptr; return false; } } @@ -160,7 +160,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, if(!pClassInfo || !DoCreate(pClassInfo, parent, id, pos, size, style, validator, name)) { - m_imp = NULL; + m_imp = nullptr; return false; } @@ -179,7 +179,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxClassInfo* classInfo; - while((classInfo = NextBackend(&it)) != NULL) + while((classInfo = NextBackend(&it)) != nullptr) { if(!DoCreate(classInfo, parent, id, pos, size, style, validator, name)) @@ -194,7 +194,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, delete m_imp; } - m_imp = NULL; + m_imp = nullptr; return false; } } @@ -255,7 +255,7 @@ const wxClassInfo* wxMediaCtrl::NextBackend(wxClassInfo::const_iterator* it) // // Nope - couldn't successfully find one... fail // - return NULL; + return nullptr; } diff --git a/src/common/memory.cpp b/src/common/memory.cpp index 38dd3e315e..7f40322d58 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -436,13 +436,13 @@ int wxMemStruct::ValidateNode () The wxDebugContext class. */ -wxMemStruct *wxDebugContext::m_head = NULL; -wxMemStruct *wxDebugContext::m_tail = NULL; +wxMemStruct *wxDebugContext::m_head = nullptr; +wxMemStruct *wxDebugContext::m_tail = nullptr; bool wxDebugContext::m_checkPrevious = false; int wxDebugContext::debugLevel = 1; bool wxDebugContext::debugOn = true; -wxMemStruct *wxDebugContext::checkPoint = NULL; +wxMemStruct *wxDebugContext::checkPoint = nullptr; // For faster alignment calculation static wxMarkerType markerCalc[2]; @@ -554,7 +554,7 @@ void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) if (!from) from = wxDebugContext::GetHead (); - wxMemStruct * st = NULL; + wxMemStruct * st = nullptr; for (st = from; st != 0; st = st->m_next) { void* data = st->GetActualData(); @@ -572,7 +572,7 @@ void wxDebugContext::TraverseList (PmSFV func, wxMemStruct *from) */ bool wxDebugContext::PrintList() { - TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : NULL)); + TraverseList ((PmSFV)&wxMemStruct::PrintNode, (checkPoint ? checkPoint->m_next : nullptr)); return true; } @@ -594,7 +594,7 @@ bool wxDebugContext::Dump() } } - TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : NULL)); + TraverseList ((PmSFV)&wxMemStruct::Dump, (checkPoint ? checkPoint->m_next : nullptr)); OutputDumpLine(wxEmptyString); OutputDumpLine(wxEmptyString); @@ -618,7 +618,7 @@ static wxDebugStatsStruct *FindStatsStruct(wxDebugStatsStruct *st, wxChar *name) return st; st = st->next; } - return NULL; + return nullptr; } static wxDebugStatsStruct *InsertStatsStruct(wxDebugStatsStruct *head, wxDebugStatsStruct *st) @@ -651,9 +651,9 @@ bool wxDebugContext::PrintStatistics(bool detailed) long noObjectNodes = 0; long totalSize = 0; - wxDebugStatsStruct *list = NULL; + wxDebugStatsStruct *list = nullptr; - wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL ); + wxMemStruct *from = (checkPoint ? checkPoint->m_next : nullptr ); if (!from) from = wxDebugContext::GetHead (); @@ -772,7 +772,7 @@ bool wxDebugContext::PrintClasses() void wxDebugContext::SetCheckpoint(bool all) { if (all) - checkPoint = NULL; + checkPoint = nullptr; else checkPoint = m_tail; } @@ -782,7 +782,7 @@ int wxDebugContext::Check(bool checkAll) { int nFailures = 0; - wxMemStruct *from = (checkPoint ? checkPoint->m_next : NULL ); + wxMemStruct *from = (checkPoint ? checkPoint->m_next : nullptr ); if (!from || checkAll) from = wxDebugContext::GetHead (); @@ -803,7 +803,7 @@ int wxDebugContext::CountObjectsLeft(bool sinceCheckpoint) { int n = 0; - wxMemStruct *from = NULL; + wxMemStruct *from = nullptr; if (sinceCheckpoint && checkPoint) from = checkPoint->m_next; else @@ -893,7 +893,7 @@ void * operator new (size_t size, wxChar * fileName, int lineNum) void * operator new (size_t size) { - return wxDebugAlloc(size, NULL, 0, false); + return wxDebugAlloc(size, nullptr, 0, false); } void operator delete (void * buf) @@ -904,7 +904,7 @@ void operator delete (void * buf) #if wxUSE_ARRAY_MEMORY_OPERATORS void * operator new[] (size_t size) { - return wxDebugAlloc(size, NULL, 0, false, true); + return wxDebugAlloc(size, nullptr, 0, false, true); } void * operator new[] (size_t size, wxChar * fileName, int lineNum) diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 1a646928a6..6e39601483 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -259,7 +259,7 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, m_id = itemid; } - // notice that parentMenu can be NULL: the item can be attached to the menu + // notice that parentMenu can be null: the item can be attached to the menu // later with SetMenu() m_parentMenu = parentMenu; @@ -372,12 +372,12 @@ bool wxMenuBase::ms_locked = true; void wxMenuBase::Init(long style) { - m_menuBar = NULL; - m_menuParent = NULL; + m_menuBar = nullptr; + m_menuParent = nullptr; - m_invokingWindow = NULL; + m_invokingWindow = nullptr; m_style = style; - m_clientData = NULL; + m_clientData = nullptr; m_eventHandler = this; } @@ -392,14 +392,14 @@ wxMenuBase::~wxMenuBase() void wxMenuBase::AddSubMenu(wxMenu *submenu) { - wxCHECK_RET( submenu, wxT("can't add a NULL submenu") ); + wxCHECK_RET( submenu, wxT("can't add a null submenu") ); submenu->SetParent((wxMenu *)this); } wxMenuItem* wxMenuBase::DoAppend(wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Append()") ); + wxCHECK_MSG( item, nullptr, wxT("invalid item in wxMenu::Append()") ); m_items.Append(item); item->SetMenu((wxMenu*)this); @@ -413,7 +413,7 @@ wxMenuItem* wxMenuBase::DoAppend(wxMenuItem *item) wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") ); + wxCHECK_MSG( item, nullptr, wxT("invalid item in wxMenu::Insert") ); if ( pos == GetMenuItemCount() ) { @@ -421,7 +421,7 @@ wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item) } else { - wxCHECK_MSG( pos < GetMenuItemCount(), NULL, + wxCHECK_MSG( pos < GetMenuItemCount(), nullptr, wxT("invalid index in wxMenu::Insert") ); return DoInsert(pos, item); @@ -430,10 +430,10 @@ wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item) wxMenuItem* wxMenuBase::DoInsert(size_t pos, wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert()") ); + wxCHECK_MSG( item, nullptr, wxT("invalid item in wxMenu::Insert()") ); wxMenuItemList::compatibility_iterator node = m_items.Item(pos); - wxCHECK_MSG( node, NULL, wxT("invalid index in wxMenu::Insert()") ); + wxCHECK_MSG( node, nullptr, wxT("invalid index in wxMenu::Insert()") ); m_items.Insert(node, item); item->SetMenu((wxMenu*)this); @@ -447,12 +447,12 @@ wxMenuItem* wxMenuBase::DoInsert(size_t pos, wxMenuItem *item) wxMenuItem *wxMenuBase::Remove(wxMenuItem *item) { - wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Remove") ); + wxCHECK_MSG( item, nullptr, wxT("invalid item in wxMenu::Remove") ); wxMenuItemList::compatibility_iterator node = m_items.Find(item); // if we get here, the item is valid or one of Remove() functions is broken - wxCHECK_MSG( node, NULL, wxT("removing item not in the menu?") ); + wxCHECK_MSG( node, nullptr, wxT("removing item not in the menu?") ); // call DoRemove() before removing the item from the list of items as the // existing code in port-specific implementation may rely on the item still @@ -468,11 +468,11 @@ wxMenuItem *wxMenuBase::Remove(wxMenuItem *item) wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item) { - item->SetMenu(NULL); + item->SetMenu(nullptr); wxMenu *submenu = item->GetSubMenu(); if ( submenu ) { - submenu->SetParent(NULL); + submenu->SetParent(nullptr); #if wxUSE_MENUBAR if ( submenu->IsAttached() ) submenu->Detach(); @@ -495,7 +495,7 @@ bool wxMenuBase::DoDelete(wxMenuItem *item) wxCHECK_MSG( item2, false, wxT("failed to delete menu item") ); // don't delete the submenu - item2->SetSubMenu(NULL); + item2->SetSubMenu(nullptr); delete item2; @@ -555,9 +555,9 @@ int wxMenuBase::FindItem(const wxString& text) const wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const { if ( itemMenu ) - *itemMenu = NULL; + *itemMenu = nullptr; - wxMenuItem *item = NULL; + wxMenuItem *item = nullptr; for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst(); node && !item; node = node->GetNext() ) @@ -576,7 +576,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const else { // don't exit the loop - item = NULL; + item = nullptr; } } @@ -586,7 +586,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const // non recursive search wxMenuItem *wxMenuBase::FindChildItem(int itemid, size_t *ppos) const { - wxMenuItem *item = NULL; + wxMenuItem *item = nullptr; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); size_t pos; @@ -613,7 +613,7 @@ wxMenuItem *wxMenuBase::FindChildItem(int itemid, size_t *ppos) const // find by position wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const { - wxCHECK_MSG( position < m_items.GetCount(), NULL, + wxCHECK_MSG( position < m_items.GetCount(), nullptr, wxT("wxMenu::FindItemByPosition(): invalid menu index") ); return m_items.Item( position )->GetData(); @@ -682,7 +682,7 @@ bool wxMenuBase::DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win) event.SetEventObject(menu); #if wxUSE_MENUBAR - wxMenuBar* const mb = menu ? menu->GetMenuBar() : NULL; + wxMenuBar* const mb = menu ? menu->GetMenuBar() : nullptr; #else bool mb = false; #endif @@ -762,7 +762,7 @@ wxMenuBar* wxMenuBase::GetMenuBar() const void wxMenuBase::Attach(wxMenuBarBase *menubar) { // use Detach() instead! - wxASSERT_MSG( menubar, wxT("menu can't be attached to NULL menubar") ); + wxASSERT_MSG( menubar, wxT("menu can't be attached to null menubar") ); // use IsAttached() to prevent this from happening wxASSERT_MSG( !m_menuBar, wxT("attaching menu twice?") ); @@ -775,7 +775,7 @@ void wxMenuBase::Detach() // use IsAttached() to prevent this from happening wxASSERT_MSG( m_menuBar, wxT("detaching unattached menu?") ); - m_menuBar = NULL; + m_menuBar = nullptr; } #endif // wxUSE_MENUBAR @@ -796,7 +796,7 @@ void wxMenuBase::SetInvokingWindow(wxWindow *win) wxWindow *wxMenuBase::GetWindow() const { - // only the top level menus have non-NULL invoking window or a pointer to + // only the top level menus have non-null invoking window or a pointer to // the menu bar so recurse upwards until we find it const wxMenuBase *menu = this; while ( menu->GetParent() ) @@ -897,7 +897,7 @@ wxString wxMenuBase::GetHelpString( int itemid ) const wxMenuBarBase::wxMenuBarBase() { // not attached yet - m_menuBarFrame = NULL; + m_menuBarFrame = nullptr; } wxMenuBarBase::~wxMenuBarBase() @@ -913,14 +913,14 @@ wxMenuBarBase::~wxMenuBarBase() wxMenu *wxMenuBarBase::GetMenu(size_t pos) const { wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::GetMenu()") ); + wxCHECK_MSG( node, nullptr, wxT("bad index in wxMenuBar::GetMenu()") ); return node->GetData(); } bool wxMenuBarBase::Append(wxMenu *menu, const wxString& title) { - wxCHECK_MSG( menu, false, wxT("can't append NULL menu") ); + wxCHECK_MSG( menu, false, wxT("can't append null menu") ); wxCHECK_MSG( !title.empty(), false, wxT("can't append menu with empty title") ); m_menus.Append(menu); @@ -938,7 +938,7 @@ bool wxMenuBarBase::Insert(size_t pos, wxMenu *menu, } else // not at the end { - wxCHECK_MSG( menu, false, wxT("can't insert NULL menu") ); + wxCHECK_MSG( menu, false, wxT("can't insert null menu") ); wxMenuList::compatibility_iterator node = m_menus.Item(pos); wxCHECK_MSG( node, false, wxT("bad index in wxMenuBar::Insert()") ); @@ -953,10 +953,10 @@ bool wxMenuBarBase::Insert(size_t pos, wxMenu *menu, wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu, const wxString& WXUNUSED(title)) { - wxCHECK_MSG( menu, NULL, wxT("can't insert NULL menu") ); + wxCHECK_MSG( menu, nullptr, wxT("can't insert null menu") ); wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Replace()") ); + wxCHECK_MSG( node, nullptr, wxT("bad index in wxMenuBar::Replace()") ); wxMenu *menuOld = node->GetData(); node->SetData(menu); @@ -970,7 +970,7 @@ wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu, wxMenu *wxMenuBarBase::Remove(size_t pos) { wxMenuList::compatibility_iterator node = m_menus.Item(pos); - wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") ); + wxCHECK_MSG( node, nullptr, wxT("bad index in wxMenuBar::Remove()") ); wxMenu *menu = node->GetData(); m_menus.Erase(node); @@ -1015,8 +1015,8 @@ void wxMenuBarBase::Detach() { wxASSERT_MSG( IsAttached(), wxT("detaching unattached menubar") ); - m_menuBarFrame = NULL; - SetParent(NULL); + m_menuBarFrame = nullptr; + SetParent(nullptr); } // ---------------------------------------------------------------------------- @@ -1026,9 +1026,9 @@ void wxMenuBarBase::Detach() wxMenuItem *wxMenuBarBase::FindItem(int itemid, wxMenu **menu) const { if ( menu ) - *menu = NULL; + *menu = nullptr; - wxMenuItem *item = NULL; + wxMenuItem *item = nullptr; size_t count = GetMenuCount(), i; wxMenuList::const_iterator it; for ( i = 0, it = m_menus.begin(); !item && (i < count); i++, ++it ) @@ -1140,7 +1140,7 @@ void wxMenuBarBase::UpdateMenus() { wxMenu* menu; menu = GetMenu( n ); - if (menu != NULL) + if (menu != nullptr) menu->UpdateUI(); } } diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index 109e7e7dbc..df1570dfed 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -129,7 +129,7 @@ void wxFileTypeInfo::DoVarArgInit(const wxString& mimeType, #endif if ( !ext ) { - // NULL terminates the list + // nullptr terminates the list break; } @@ -216,7 +216,7 @@ wxString wxFileType::ExpandCommand(const wxString& command, case wxT('{'): { const wxChar *pEnd = wxStrchr(pc, wxT('}')); - if ( pEnd == NULL ) { + if ( pEnd == nullptr ) { wxString mimetype; wxLogWarning(_("Unmatched '{' in an entry for mime type %s."), params.GetMimeType().c_str()); @@ -276,12 +276,12 @@ wxString wxFileType::ExpandCommand(const wxString& command, wxFileType::wxFileType(const wxFileTypeInfo& info) { m_info = &info; - m_impl = NULL; + m_impl = nullptr; } wxFileType::wxFileType() { - m_info = NULL; + m_info = nullptr; m_impl = new wxFileTypeImpl; } @@ -521,7 +521,7 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) // wxMimeTypesManagerFactory // ---------------------------------------------------------------------------- -wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = NULL; +wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = nullptr; /* static */ void wxMimeTypesManagerFactory::Set(wxMimeTypesManagerFactory *factory) @@ -580,7 +580,7 @@ bool wxMimeTypesManager::IsOfType(const wxString& mimeType, wxMimeTypesManager::wxMimeTypesManager() { - m_impl = NULL; + m_impl = nullptr; } wxMimeTypesManager::~wxMimeTypesManager() @@ -610,7 +610,7 @@ wxMimeTypesManager::Associate(const wxFileTypeInfo& ftInfo) #else // other platforms wxUnusedVar(ftInfo); wxFAIL_MSG( wxT("not implemented") ); // TODO - return NULL; + return nullptr; #endif // platforms } @@ -627,7 +627,7 @@ wxMimeTypesManager::GetFileTypeFromExtension(const wxString& ext) else extWithoutDot = ext; - wxCHECK_MSG( !ext.empty(), NULL, wxT("extension can't be empty") ); + wxCHECK_MSG( !ext.empty(), nullptr, wxT("extension can't be empty") ); wxFileType *ft = m_impl->GetFileTypeFromExtension(extWithoutDot); @@ -740,9 +740,9 @@ public: virtual bool OnInit() override { return true; } virtual void OnExit() override { - wxMimeTypesManagerFactory::Set(NULL); + wxMimeTypesManagerFactory::Set(nullptr); - if ( gs_mimeTypesManager.m_impl != NULL ) + if ( gs_mimeTypesManager.m_impl != nullptr ) { wxDELETE(gs_mimeTypesManager.m_impl); gs_mimeTypesManager.m_fallbacks.Clear(); diff --git a/src/common/mousemanager.cpp b/src/common/mousemanager.cpp index 543e83fdc1..050bbb7075 100644 --- a/src/common/mousemanager.cpp +++ b/src/common/mousemanager.cpp @@ -43,7 +43,7 @@ wxEND_EVENT_TABLE() void wxMouseEventsManager::Init() { - m_win = NULL; + m_win = nullptr; m_state = State_Normal; m_item = wxNOT_FOUND; } diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index 1ea9e2c21f..dcce3d4e1d 100644 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -50,7 +50,7 @@ // wxMessageOutput // ---------------------------------------------------------------------------- -wxMessageOutput* wxMessageOutput::ms_msgOut = 0; +wxMessageOutput* wxMessageOutput::ms_msgOut = nullptr; wxMessageOutput* wxMessageOutput::Get() { @@ -120,7 +120,7 @@ void wxMessageOutputBest::Output(const wxString& str) else // Use some title to avoid default "Error" title = _("Message"); - ::MessageBox(NULL, str.t_str(), title.t_str(), MB_ICONINFORMATION | MB_OK); + ::MessageBox(nullptr, str.t_str(), title.t_str(), MB_ICONINFORMATION | MB_OK); #else // !__WINDOWS__ wxUnusedVar(m_flags); diff --git a/src/common/mstream.cpp b/src/common/mstream.cpp index 7b9f472b9e..9df71df414 100644 --- a/src/common/mstream.cpp +++ b/src/common/mstream.cpp @@ -55,7 +55,7 @@ wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream) const wxFileOffset lenFile = stream.GetLength(); if ( lenFile == wxInvalidOffset ) { - m_i_streambuf = NULL; + m_i_streambuf = nullptr; m_lasterror = wxSTREAM_EOF; return; } @@ -79,7 +79,7 @@ wxMemoryInputStream::InitFromStream(wxInputStream& stream, wxFileOffset lenFile) if ( lenFile == wxInvalidOffset ) { - m_i_streambuf = NULL; + m_i_streambuf = nullptr; m_lasterror = wxSTREAM_EOF; return; } diff --git a/src/common/object.cpp b/src/common/object.cpp index 258ed6ed61..96daf2c74c 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -30,7 +30,7 @@ #endif #if wxUSE_EXTENDED_RTTI -const wxClassInfo* wxObject::ms_classParents[] = { NULL } ; +const wxClassInfo* wxObject::ms_classParents[] = { nullptr } ; wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data ) { return data.As(); } wxAny wxObjectToVariantConverterwxObject ( wxObject *data ) @@ -39,18 +39,18 @@ wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data ) wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"), (int) sizeof(wxObject), \ (wxObjectConstructorFn) 0 , - NULL,NULL,0 , 0 , + nullptr,nullptr,0 , 0 , 0 , wxVariantOfPtrToObjectConverterwxObject , 0 , wxObjectToVariantConverterwxObject); template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); } template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); } - wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ; - wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ; + wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , nullptr , nullptr , typeid(wxObject*).name() ) ; + wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , nullptr , nullptr , typeid(wxObject).name() ) ; #else -wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), 0, 0, +wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), nullptr, nullptr, (int) sizeof(wxObject), - (wxObjectConstructorFn) 0 ); + (wxObjectConstructorFn) nullptr ); #endif // restore optimizations @@ -58,8 +58,8 @@ wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), 0, 0, #pragma optimize("", on) #endif -wxClassInfo* wxClassInfo::sm_first = NULL; -wxHashTable* wxClassInfo::sm_classTable = NULL; +wxClassInfo* wxClassInfo::sm_first = nullptr; +wxHashTable* wxClassInfo::sm_classTable = nullptr; // when using XTI, this method is already implemented inline inside // wxDECLARE_DYNAMIC_CLASS but otherwise we intentionally make this function @@ -188,7 +188,7 @@ wxClassInfo *wxClassInfo::FindClass(const wxString& className) return info; } - return NULL; + return nullptr; } } @@ -230,7 +230,7 @@ void wxClassInfo::Register() // 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 // detect if you're unaware of this, try to do some checks here. - wxASSERT_MSG( classTable->Get(m_className) == NULL, + wxASSERT_MSG( classTable->Get(m_className) == nullptr, wxString::Format ( wxT("Class \"%s\" already in RTTI table - have you used wxIMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"), @@ -279,7 +279,7 @@ wxObject *wxCreateDynamicObject(const wxString& name) if ( wxClassInfo::sm_classTable ) { wxClassInfo *info = (wxClassInfo *)wxClassInfo::sm_classTable->Get(name); - return info ? info->CreateObject() : NULL; + return info ? info->CreateObject() : nullptr; } else // no sm_classTable yet { @@ -291,7 +291,7 @@ wxObject *wxCreateDynamicObject(const wxString& name) return info->CreateObject(); } - return NULL; + return nullptr; } } @@ -324,7 +324,7 @@ wxClassInfo::const_iterator wxClassInfo::begin_classinfo() wxClassInfo::const_iterator wxClassInfo::end_classinfo() { - return const_iterator(NULL, NULL); + return const_iterator(nullptr, nullptr); } // ---------------------------------------------------------------------------- @@ -366,7 +366,7 @@ void wxObject::UnRef() if ( m_refData ) { m_refData->DecRef(); - m_refData = NULL; + m_refData = nullptr; } } @@ -396,7 +396,7 @@ wxObjectRefData *wxObject::CreateRefData() const // if you use AllocExclusive() you must override this method wxFAIL_MSG( wxT("CreateRefData() must be overridden if called!") ); - return NULL; + return nullptr; } wxObjectRefData * @@ -405,5 +405,5 @@ wxObject::CloneRefData(const wxObjectRefData * WXUNUSED(data)) const // if you use AllocExclusive() you must override this method wxFAIL_MSG( wxT("CloneRefData() must be overridden if called!") ); - return NULL; + return nullptr; } diff --git a/src/common/overlaycmn.cpp b/src/common/overlaycmn.cpp index bc991ce61a..ff7d57b6a2 100644 --- a/src/common/overlaycmn.cpp +++ b/src/common/overlaycmn.cpp @@ -166,7 +166,7 @@ public: wxOverlayImpl::wxOverlayImpl() { - m_window = NULL ; + m_window = nullptr ; m_x = m_y = m_width = m_height = 0 ; } @@ -261,7 +261,7 @@ wxOverlay::wxOverlay() { m_impl = Create(); #if defined(wxHAS_GENERIC_OVERLAY) && defined(wxHAS_NATIVE_OVERLAY) - if (m_impl == NULL) + if (m_impl == nullptr) m_impl = new wxOverlayImpl; #endif m_inDrawing = false; diff --git a/src/common/paper.cpp b/src/common/paper.cpp index 16fe8d57bd..5c54ed5de3 100644 --- a/src/common/paper.cpp +++ b/src/common/paper.cpp @@ -74,7 +74,7 @@ WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList); #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxPrintPaperTypeList) -wxPrintPaperDatabase* wxThePrintPaperDatabase = NULL; +wxPrintPaperDatabase* wxThePrintPaperDatabase = nullptr; wxPrintPaperDatabase::wxPrintPaperDatabase() { @@ -242,7 +242,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) cons if (it != m_map->end()) return it->second; else - return NULL; + return nullptr; } wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) const @@ -256,7 +256,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) const return paperType; } - return NULL; + return nullptr; } wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) const @@ -270,7 +270,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) const return paperType; } - return NULL; + return nullptr; } wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) const @@ -287,7 +287,7 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) const return paperType; } - return NULL; + return nullptr; } // Convert name to size id diff --git a/src/common/persist.cpp b/src/common/persist.cpp index 0ab0924911..efa8a5239b 100644 --- a/src/common/persist.cpp +++ b/src/common/persist.cpp @@ -29,7 +29,7 @@ namespace { -wxPersistenceManager* gs_manager = NULL; +wxPersistenceManager* gs_manager = nullptr; } // anonymous namespace @@ -76,7 +76,7 @@ wxPersistentObject *wxPersistenceManager::Find(void *obj) const { const wxPersistentObjectsMap::const_iterator it = m_persistentObjects.find(obj); - return it == m_persistentObjects.end() ? NULL : it->second; + return it == m_persistentObjects.end() ? nullptr : it->second; } wxPersistentObject * diff --git a/src/common/pickerbase.cpp b/src/common/pickerbase.cpp index 8905d8d0ce..342aff796a 100644 --- a/src/common/pickerbase.cpp +++ b/src/common/pickerbase.cpp @@ -142,7 +142,7 @@ void wxPickerBase::DoSetToolTip(wxToolTip *tip) // do a copy as wxWindow will own the pointer we pass if ( m_text ) - m_text->SetToolTip(tip ? new wxToolTip(tip->GetTip()) : NULL); + m_text->SetToolTip(tip ? new wxToolTip(tip->GetTip()) : nullptr); } #endif // wxUSE_TOOLTIPS @@ -183,7 +183,7 @@ void wxPickerBase::OnTextCtrlKillFocus(wxFocusEvent& event) void wxPickerBase::OnTextCtrlDelete(wxWindowDestroyEvent &) { // the textctrl has been deleted; our pointer is invalid! - m_text = NULL; + m_text = nullptr; } void wxPickerBase::OnTextCtrlUpdate(wxCommandEvent &) diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 3ff84a78ef..a89e4354e0 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -231,10 +231,10 @@ bool wxPopupTransientWindowBase::Destroy() void wxPopupTransientWindow::Init() { m_child = - m_focus = NULL; + m_focus = nullptr; - m_handlerFocus = NULL; - m_handlerPopup = NULL; + m_handlerFocus = nullptr; + m_handlerPopup = nullptr; } wxPopupTransientWindow::wxPopupTransientWindow(wxWindow *parent, int style) @@ -264,13 +264,13 @@ void wxPopupTransientWindow::PopHandlers() { // something is very wrong and someone else probably deleted our // handler - so don't risk deleting it second time - m_handlerPopup = NULL; + m_handlerPopup = nullptr; } if (m_child->HasCapture()) { m_child->ReleaseMouse(); } - m_child = NULL; + m_child = nullptr; } if ( m_focus ) @@ -278,10 +278,10 @@ void wxPopupTransientWindow::PopHandlers() if ( !m_focus->RemoveEventHandler(m_handlerFocus) ) { // see above - m_handlerFocus = NULL; + m_handlerFocus = nullptr; } } - m_focus = NULL; + m_focus = nullptr; } void wxPopupTransientWindow::Popup(wxWindow *winFocus) @@ -382,7 +382,7 @@ bool wxPopupTransientWindow::Show( bool show ) #ifdef __WXGTK4__ GdkDisplay* display = gdk_window_get_display(window); GdkSeat* seat = gdk_display_get_default_seat(display); - gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_POINTER, false, NULL, NULL, NULL, 0); + gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_POINTER, false, nullptr, nullptr, nullptr, 0); #else const GdkEventMask mask = GdkEventMask( GDK_BUTTON_PRESS_MASK | @@ -395,13 +395,13 @@ 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, true, mask, NULL, unsigned(GDK_CURRENT_TIME)); + GDK_OWNERSHIP_NONE, true, mask, nullptr, unsigned(GDK_CURRENT_TIME)); wxGCC_WARNING_RESTORE() #else gdk_pointer_grab( window, true, mask, - NULL, - NULL, + nullptr, + nullptr, (guint32)GDK_CURRENT_TIME ); #endif #endif // !__WXGTK4__ @@ -555,7 +555,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) // in non-Univ ports the system manages scrollbars for us #if defined(__WXUNIVERSAL__) && wxUSE_SCROLLBAR // scrollbar on which the click occurred - wxWindow *sbar = NULL; + wxWindow *sbar = nullptr; #endif // __WXUNIVERSAL__ && wxUSE_SCROLLBAR wxWindow *win = (wxWindow *)event.GetEventObject(); diff --git a/src/common/preferencescmn.cpp b/src/common/preferencescmn.cpp index 2c0563f00d..8fedd56c0e 100644 --- a/src/common/preferencescmn.cpp +++ b/src/common/preferencescmn.cpp @@ -55,7 +55,7 @@ wxPreferencesEditor::~wxPreferencesEditor() void wxPreferencesEditor::AddPage(wxPreferencesPage* page) { - wxCHECK_RET( page, "can't set NULL page" ); + wxCHECK_RET( page, "can't set null page" ); m_impl->AddPage(page); } diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 318f6d2a62..c616438ffe 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -80,7 +80,7 @@ static const int DEFAULT_MAX_PAGES = 32000; // wxPrintFactory //---------------------------------------------------------------------------- -wxPrintFactory *wxPrintFactory::m_factory = NULL; +wxPrintFactory *wxPrintFactory::m_factory = nullptr; void wxPrintFactory::SetPrintFactory( wxPrintFactory *factory ) { @@ -205,15 +205,15 @@ wxDialog *wxNativePrintFactory::CreatePrintSetupDialog( wxWindow *parent, #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) wxUnusedVar(parent); wxUnusedVar(data); - return NULL; + return nullptr; #elif defined(__WXMAC__) wxUnusedVar(parent); wxUnusedVar(data); - return NULL; + return nullptr; #elif defined(__WXQT__) wxUnusedVar(parent); wxUnusedVar(data); - return NULL; + return nullptr; #else // Only here do we need to provide the print setup // dialog ourselves, the other platforms either have @@ -302,7 +302,7 @@ class wxPrintFactoryModule: public wxModule public: wxPrintFactoryModule() {} bool OnInit() override { return true; } - void OnExit() override { wxPrintFactory::SetPrintFactory( NULL ); } + void OnExit() override { wxPrintFactory::SetPrintFactory( nullptr ); } private: wxDECLARE_DYNAMIC_CLASS(wxPrintFactoryModule); @@ -318,15 +318,15 @@ wxIMPLEMENT_CLASS(wxPrinterBase, wxObject); wxPrinterBase::wxPrinterBase(wxPrintDialogData *data) { - m_currentPrintout = NULL; - sm_abortWindow = NULL; + m_currentPrintout = nullptr; + sm_abortWindow = nullptr; sm_abortIt = false; if (data) m_printDialogData = (*data); sm_lastError = wxPRINTER_NO_ERROR; } -wxWindow *wxPrinterBase::sm_abortWindow = NULL; +wxWindow *wxPrinterBase::sm_abortWindow = nullptr; bool wxPrinterBase::sm_abortIt = false; wxPrinterError wxPrinterBase::sm_lastError = wxPRINTER_NO_ERROR; @@ -573,10 +573,10 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages, void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { - wxCHECK_RET( wxPrinterBase::sm_abortWindow != NULL, "OnCancel called twice" ); + wxCHECK_RET( wxPrinterBase::sm_abortWindow != nullptr, "OnCancel called twice" ); wxPrinterBase::sm_abortIt = true; wxPrinterBase::sm_abortWindow->Destroy(); - wxPrinterBase::sm_abortWindow = NULL; + wxPrinterBase::sm_abortWindow = nullptr; } //---------------------------------------------------------------------------- @@ -588,7 +588,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject); wxPrintout::wxPrintout(const wxString& title) : m_printoutTitle(title) { - m_printoutDC = NULL; + m_printoutDC = nullptr; m_pageWidthMM = 0; m_pageHeightMM = 0; m_pageWidthPixels = 0; @@ -597,7 +597,7 @@ wxPrintout::wxPrintout(const wxString& title) m_PPIScreenY = 0; m_PPIPrinterX = 0; m_PPIPrinterY = 0; - m_preview = NULL; + m_preview = nullptr; } wxPrintout::~wxPrintout() @@ -1301,10 +1301,10 @@ wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long butto wxPanel(parent, wxID_ANY, pos, size, style, name) { m_printPreview = preview; - m_closeButton = NULL; - m_zoomControl = NULL; - m_currentPageText = NULL; - m_maxPageText = NULL; + m_closeButton = nullptr; + m_zoomControl = nullptr; + m_currentPageText = nullptr; + m_maxPageText = nullptr; m_buttonFlags = buttons; } @@ -1706,9 +1706,9 @@ wxFrame(parent, wxID_ANY, title, pos, size, style, name), m_initialSize(size) { m_printPreview = preview; - m_controlBar = NULL; - m_previewCanvas = NULL; - m_windowDisabler = NULL; + m_controlBar = nullptr; + m_previewCanvas = nullptr; + m_windowDisabler = nullptr; m_modalityKind = wxPreviewFrame_NonModal; // Give the application icon @@ -1725,12 +1725,12 @@ wxPreviewFrame::~wxPreviewFrame() if (printout) { delete printout; - m_printPreview->SetPrintout(NULL); - m_printPreview->SetCanvas(NULL); - m_printPreview->SetFrame(NULL); + m_printPreview->SetPrintout(nullptr); + m_printPreview->SetCanvas(nullptr); + m_printPreview->SetFrame(nullptr); } - m_previewCanvas->SetPreview(NULL); + m_previewCanvas->SetPreview(nullptr); delete m_printPreview; } @@ -1742,7 +1742,7 @@ void wxPreviewFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { case wxPreviewFrame_AppModal: delete m_windowDisabler; - m_windowDisabler = NULL; + m_windowDisabler = nullptr; break; case wxPreviewFrame_WindowModal: @@ -1874,9 +1874,9 @@ void wxPrintPreviewBase::Init(wxPrintout *printout, m_printPrintout = printoutForPrinting; - m_previewCanvas = NULL; - m_previewFrame = NULL; - m_previewBitmap = NULL; + m_previewCanvas = nullptr; + m_previewFrame = nullptr; + m_previewBitmap = nullptr; m_previewFailed = false; m_currentPage = 1; m_currentZoom = 70; @@ -2065,7 +2065,7 @@ bool wxPrintPreviewBase::RenderPageIntoDC(wxDC& dc, int pageNum) m_previewPrintout->OnEndDocument(); m_previewPrintout->OnEndPrinting(); - m_previewPrintout->SetDC(NULL); + m_previewPrintout->SetDC(nullptr); return true; } @@ -2215,9 +2215,9 @@ wxPrintPreview::~wxPrintPreview() delete m_pimpl; // don't delete twice - m_printPrintout = NULL; - m_previewPrintout = NULL; - m_previewBitmap = NULL; + m_printPrintout = nullptr; + m_previewPrintout = nullptr; + m_previewBitmap = nullptr; } bool wxPrintPreview::SetCurrentPage(int pageNum) diff --git a/src/common/process.cpp b/src/common/process.cpp index f0d3309c59..a5ffdb74b9 100644 --- a/src/common/process.cpp +++ b/src/common/process.cpp @@ -50,9 +50,9 @@ void wxProcess::Init(wxEvtHandler *parent, int id, int flags) m_redirect = (flags & wxPROCESS_REDIRECT) != 0; #if wxUSE_STREAMS - m_inputStream = NULL; - m_errorStream = NULL; - m_outputStream = NULL; + m_inputStream = nullptr; + m_errorStream = nullptr; + m_outputStream = nullptr; #endif // wxUSE_STREAMS } @@ -66,7 +66,7 @@ wxProcess *wxProcess::Open(const wxString& cmd, int flags) { // couldn't launch the process delete process; - return NULL; + return nullptr; } process->SetPid(pid); @@ -105,7 +105,7 @@ void wxProcess::Detach() if (m_nextHandler) m_nextHandler->SetPreviousHandler(m_previousHandler); - m_nextHandler = NULL; + m_nextHandler = nullptr; } // ---------------------------------------------------------------------------- diff --git a/src/common/protocol.cpp b/src/common/protocol.cpp index c0fa8fe4e7..27b338647a 100644 --- a/src/common/protocol.cpp +++ b/src/common/protocol.cpp @@ -44,7 +44,7 @@ wxProtoInfo::wxProtoInfo(const wxChar *name, const wxChar *serv, next = wxURL::ms_protocols; wxURL::ms_protocols = this; #else - next = NULL; + next = nullptr; #endif } @@ -66,7 +66,7 @@ wxProtocol::wxProtocol() #endif { m_lastError = wxPROTO_NOERR; - m_log = NULL; + m_log = nullptr; SetDefaultTimeout(60); // default timeout is 60 seconds } @@ -145,7 +145,7 @@ wxProtocolError wxProtocol::ReadLine(wxSocketBase *sock, wxString& result) if ( result.empty() || result.Last() != wxT('\r') ) { // ignore the stray '\n' - eol = NULL; + eol = nullptr; } //else: ok, got real EOL @@ -160,7 +160,7 @@ wxProtocolError wxProtocol::ReadLine(wxSocketBase *sock, wxString& result) if ( eol[-1] != '\r' ) { // as above, simply ignore stray '\n' - eol = NULL; + eol = nullptr; } } } diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp index ffd77d4744..7943fdc6a9 100644 --- a/src/common/quantize.cpp +++ b/src/common/quantize.cpp @@ -293,7 +293,7 @@ typedef my_cquantizer * my_cquantize_ptr; * initialized to zeroes by start_pass. * An output_buf parameter is required by the method signature, but no data * is actually output (in fact the buffer controller is probably passing a - * NULL pointer). + * null pointer). */ void @@ -352,12 +352,12 @@ typedef box * boxptr; boxptr find_biggest_color_pop (boxptr boxlist, int numboxes) /* Find the splittable box with the largest color population */ -/* Returns NULL if no splittable boxes remain */ +/* Returns nullptr if no splittable boxes remain */ { boxptr boxp; int i; long maxc = 0; - boxptr which = NULL; + boxptr which = nullptr; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->colorcount > maxc && boxp->volume > 0) { @@ -372,12 +372,12 @@ find_biggest_color_pop (boxptr boxlist, int numboxes) boxptr find_biggest_volume (boxptr boxlist, int numboxes) /* Find the splittable box with the largest (scaled) volume */ -/* Returns NULL if no splittable boxes remain */ +/* Returns nullptr if no splittable boxes remain */ { boxptr boxp; int i; wxInt32 maxv = 0; - boxptr which = NULL; + boxptr which = nullptr; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { if (boxp->volume > maxv) { @@ -518,7 +518,7 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, } else { b1 = find_biggest_volume(boxlist, numboxes); } - if (b1 == NULL) /* no splittable boxes left! */ + if (b1 == nullptr) /* no splittable boxes left! */ break; b2 = &boxlist[numboxes]; /* where new box will go */ /* Copy the color bounds to the new box. */ @@ -1283,12 +1283,12 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) size_t arraysize = (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR))); /* Allocate Floyd-Steinberg workspace if we didn't already. */ - if (cquantize->fserrors == NULL) + if (cquantize->fserrors == nullptr) 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. */ - if (cquantize->error_limiter == NULL) + if (cquantize->error_limiter == nullptr) init_error_limit(cinfo); cquantize->on_odd_row = false; } @@ -1333,8 +1333,8 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo) cinfo->cquantize = (jpeg_color_quantizer *) cquantize; cquantize->pub.start_pass = start_pass_2_quant; cquantize->pub.new_color_map = new_color_map_2_quant; - cquantize->fserrors = NULL; /* flag optional arrays not allocated */ - cquantize->error_limiter = NULL; + cquantize->fserrors = nullptr; /* flag optional arrays not allocated */ + cquantize->error_limiter = nullptr; /* Allocate the histogram/inverse colormap storage */ @@ -1424,7 +1424,7 @@ void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, uns j_decompress dec; my_cquantize_ptr cquantize; - dec.colormap = NULL; + dec.colormap = nullptr; dec.output_width = w; dec.desired_number_of_colors = desiredNoColours; prepare_range_limit_table(&dec); @@ -1556,10 +1556,10 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, // Fill the first 20 entries with Windows system colours if (flags & wxQUANTIZE_INCLUDE_WINDOWS_COLOURS) { - HDC hDC = ::GetDC(NULL); + HDC hDC = ::GetDC(nullptr); PALETTEENTRY* entries = new PALETTEENTRY[windowsSystemColourCount]; ::GetSystemPaletteEntries(hDC, 0, windowsSystemColourCount, entries); - ::ReleaseDC(NULL, hDC); + ::ReleaseDC(nullptr, hDC); for (i = 0; i < windowsSystemColourCount; i++) { @@ -1606,7 +1606,7 @@ bool wxQuantize::Quantize(const wxImage& src, unsigned char** eightBitData, int flags) { - wxPalette* palette = NULL; + wxPalette* palette = nullptr; if ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) ) return false; diff --git a/src/common/radiobtncmn.cpp b/src/common/radiobtncmn.cpp index 957c1e00da..ef98a5de7d 100644 --- a/src/common/radiobtncmn.cpp +++ b/src/common/radiobtncmn.cpp @@ -124,15 +124,15 @@ wxRadioButton* wxRadioButtonBase::GetLastInGroup() const wxRadioButton* wxRadioButtonBase::GetPreviousInGroup() const { if ( HasFlag(wxRB_GROUP) || HasFlag(wxRB_SINGLE) ) - return NULL; + return nullptr; const wxWindowList& siblings = GetParent()->GetChildren(); wxWindowList::compatibility_iterator nodeThis = siblings.Find(this); - wxCHECK_MSG( nodeThis, NULL, wxT("radio button not a child of its parent?") ); + wxCHECK_MSG( nodeThis, nullptr, wxT("radio button not a child of its parent?") ); // Iterate over all previous siblings until we find the next radio button wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious(); - wxRadioButton *prevBtn = 0; + wxRadioButton *prevBtn = nullptr; while (nodeBefore) { prevBtn = wxDynamicCast(nodeBefore->GetData(), wxRadioButton); @@ -145,7 +145,7 @@ wxRadioButton* wxRadioButtonBase::GetPreviousInGroup() const if (!prevBtn || prevBtn->HasFlag(wxRB_SINGLE)) { // no more buttons in group - return NULL; + return nullptr; } return prevBtn; @@ -154,15 +154,15 @@ wxRadioButton* wxRadioButtonBase::GetPreviousInGroup() const wxRadioButton* wxRadioButtonBase::GetNextInGroup() const { if ( HasFlag(wxRB_SINGLE) ) - return NULL; + return nullptr; const wxWindowList& siblings = GetParent()->GetChildren(); wxWindowList::compatibility_iterator nodeThis = siblings.Find(this); - wxCHECK_MSG( nodeThis, NULL, wxT("radio button not a child of its parent?") ); + wxCHECK_MSG( nodeThis, nullptr, wxT("radio button not a child of its parent?") ); // Iterate over all previous siblings until we find the next radio button wxWindowList::compatibility_iterator nodeNext = nodeThis->GetNext(); - wxRadioButton *nextBtn = 0; + wxRadioButton *nextBtn = nullptr; while (nodeNext) { nextBtn = wxDynamicCast(nodeNext->GetData(), wxRadioButton); @@ -175,7 +175,7 @@ wxRadioButton* wxRadioButtonBase::GetNextInGroup() const if ( !nextBtn || nextBtn->HasFlag(wxRB_GROUP) || nextBtn->HasFlag(wxRB_SINGLE) ) { // no more buttons or the first button of the next group - return NULL; + return nullptr; } return nextBtn; diff --git a/src/common/rearrangectrl.cpp b/src/common/rearrangectrl.cpp index a5eb70fdcf..d7e35432d6 100644 --- a/src/common/rearrangectrl.cpp +++ b/src/common/rearrangectrl.cpp @@ -244,7 +244,7 @@ wxEND_EVENT_TABLE() void wxRearrangeCtrl::Init() { - m_list = NULL; + m_list = nullptr; } bool @@ -378,7 +378,7 @@ void wxRearrangeDialog::AddExtraControls(wxWindow *win) wxRearrangeList *wxRearrangeDialog::GetList() const { - wxCHECK_MSG( m_ctrl, NULL, "the dialog must be created first" ); + wxCHECK_MSG( m_ctrl, nullptr, "the dialog must be created first" ); return m_ctrl->GetList(); } diff --git a/src/common/regex.cpp b/src/common/regex.cpp index c30556e5fe..63c9b3f633 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -157,7 +157,7 @@ int wx_regcomp(regex_t* preg, const wxRegChar* pattern, int cflags) options, &preg->errorcode, &preg->erroroffset, - NULL // use default context + nullptr // use default context ); if ( !preg->code ) @@ -168,7 +168,7 @@ int wx_regcomp(regex_t* preg, const wxRegChar* pattern, int cflags) return REG_BADPAT; } - preg->match_data = pcre2_match_data_create_from_pattern(preg->code, NULL); + preg->match_data = pcre2_match_data_create_from_pattern(preg->code, nullptr); return REG_NOERROR; } @@ -194,7 +194,7 @@ wx_regexec(const regex_t* preg, const wxRegChar* string, size_t len, 0, // start offset options, preg->match_data, - NULL // use default context + nullptr // use default context ); if ( rc == PCRE2_ERROR_NOMATCH ) @@ -384,7 +384,7 @@ private: void Init() { m_isCompiled = false; - m_Matches = NULL; + m_Matches = nullptr; m_nMatches = 0; } @@ -441,7 +441,7 @@ wxString wxRegExImpl::GetErrorMsg(int errorcode) const wxString szError; // first get the string length needed - int len = wx_regerror(errorcode, &m_RegEx, NULL, 0); + int len = wx_regerror(errorcode, &m_RegEx, nullptr, 0); if ( len > 0 ) { wxCharTypeBuffer errbuf(len + 1); @@ -987,7 +987,7 @@ static wxString ConvertWordBoundaries(const wxString& expr) break; } - const char* replacement = NULL; + const char* replacement = nullptr; switch ( (*it).GetValue() ) { case 'm': @@ -1202,11 +1202,11 @@ bool wxRegExImpl::Matches(const wxRegChar *str, self->m_Matches = new wxRegExMatches(m_nMatches); } - wxRegExMatches::match_type matches = m_Matches ? m_Matches->get() : NULL; + wxRegExMatches::match_type matches = m_Matches ? m_Matches->get() : nullptr; // do match it #if defined WXREGEX_USING_BUILTIN - int rc = wx_re_exec(&self->m_RegEx, str, len, NULL, m_nMatches, matches, flagsRE); + int rc = wx_re_exec(&self->m_RegEx, str, len, nullptr, m_nMatches, matches, flagsRE); #elif defined WXREGEX_USING_RE_SEARCH int rc = ReSearch(&self->m_RegEx, str, len, matches, flagsRE); #else @@ -1258,7 +1258,7 @@ int wxRegExImpl::Replace(wxString *text, const wxString& replacement, size_t maxMatches) const { - wxCHECK_MSG( text, wxNOT_FOUND, wxT("NULL text in wxRegEx::Replace") ); + wxCHECK_MSG( text, wxNOT_FOUND, wxT("null text in wxRegEx::Replace") ); wxCHECK_MSG( IsValid(), wxNOT_FOUND, wxT("must successfully Compile() first") ); // the input string @@ -1392,7 +1392,7 @@ int wxRegExImpl::Replace(wxString *text, void wxRegEx::Init() { - m_impl = NULL; + m_impl = nullptr; } wxRegEx::~wxRegEx() diff --git a/src/common/rendcmn.cpp b/src/common/rendcmn.cpp index d17940b427..232f29091e 100644 --- a/src/common/rendcmn.cpp +++ b/src/common/rendcmn.cpp @@ -54,14 +54,14 @@ public: DoInit(); } - return get() != NULL; + return get() != nullptr; } // return the global and unique wxRendererPtr static wxRendererPtr& Get(); private: - wxRendererPtr() : wxRendererPtrBase(NULL) { m_initialized = false; } + wxRendererPtr() : wxRendererPtrBase(nullptr) { m_initialized = false; } void DoInit() { @@ -168,7 +168,7 @@ wxRendererNative *wxRendererNative::Load(const wxString& name) wxDynamicLibrary dll(fullname); if ( !dll.IsLoaded() ) - return NULL; + return nullptr; // each theme DLL must export a wxCreateRenderer() function with this // signature @@ -176,12 +176,12 @@ wxRendererNative *wxRendererNative::Load(const wxString& name) wxDYNLIB_FUNCTION(wxCreateRenderer_t, wxCreateRenderer, dll); if ( !pfnwxCreateRenderer ) - return NULL; + return nullptr; // create a renderer object wxRendererNative *renderer = (*pfnwxCreateRenderer)(); if ( !renderer ) - return NULL; + return nullptr; // check that its version is compatible with ours wxRendererVersion ver = renderer->GetVersion(); @@ -191,7 +191,7 @@ wxRendererNative *wxRendererNative::Load(const wxString& name) name.c_str(), ver.version, ver.age); delete renderer; - return NULL; + return nullptr; } // finally wrap the renderer in an object which will delete it and unload diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 979dc4ebd4..6695f5ee5c 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -197,7 +197,7 @@ hostent *deepCopyHostent(hostent *h, if (len > size) { *err = ENOMEM; - return NULL; + return nullptr; } memcpy(buffer, h->h_name, len); buffer[len] = '\0'; @@ -226,7 +226,7 @@ hostent *deepCopyHostent(hostent *h, if (size < pos + len) { *err = ENOMEM; - return NULL; + return nullptr; } memcpy(buffer + pos, *p, len); /* copy content */ *q = buffer + pos; /* set copied pointer to copied content */ @@ -253,7 +253,7 @@ hostent *deepCopyHostent(hostent *h, if (size <= pos + len) { *err = ENOMEM; - return NULL; + return nullptr; } memcpy(buffer + pos, *p, len); /* copy content */ buffer[pos + len] = '\0'; @@ -342,7 +342,7 @@ servent *deepCopyServent(servent *s, int len = strlen(s->s_name); if (len >= size) { - return NULL; + return nullptr; } memcpy(buffer, s->s_name, len); buffer[len] = '\0'; @@ -355,7 +355,7 @@ servent *deepCopyServent(servent *s, len = strlen(s->s_proto); if (pos + len >= size) { - return NULL; + return nullptr; } memcpy(buffer + pos, s->s_proto, len); buffer[pos + len] = '\0'; @@ -380,7 +380,7 @@ servent *deepCopyServent(servent *s, len = strlen(*p); if (size <= pos + len) { - return NULL; + return nullptr; } memcpy(buffer + pos, *p, len); /* copy content */ buffer[pos + len] = '\0'; @@ -407,7 +407,7 @@ servent *wxGetservbyname_r(const char *port, #elif defined(HAVE_FUNC_GETSERVBYNAME_R_4) wxUnusedVar(size); if ( getservbyname_r(port, protocol, serv, &buffer) != 0 ) - return NULL; + return nullptr; #elif defined(HAVE_GETSERVBYNAME) wxLOCK_GETBY_MUTEX(serv); @@ -610,8 +610,8 @@ bool wxSockAddressImpl::SetHostName6(const wxString& hostname) memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET6; - addrinfo *info = NULL; - int rc = getaddrinfo(hostname.utf8_str(), NULL, &hints, &info); + addrinfo *info = nullptr; + int rc = getaddrinfo(hostname.utf8_str(), nullptr, &hints, &info); if ( rc ) { // use gai_strerror()? @@ -686,7 +686,7 @@ bool wxSockAddressImpl::SetToAnyAddress6() // ---------------------------------------------------------------------------- #ifndef UNIX_PATH_MAX - #define UNIX_PATH_MAX (WXSIZEOF(((sockaddr_un *)NULL)->sun_path)) + #define UNIX_PATH_MAX (WXSIZEOF(((sockaddr_un *)nullptr)->sun_path)) #endif void wxSockAddressImpl::CreateUnix() diff --git a/src/common/sckfile.cpp b/src/common/sckfile.cpp index 465f0cd570..762a8ba3b0 100644 --- a/src/common/sckfile.cpp +++ b/src/common/sckfile.cpp @@ -27,7 +27,7 @@ // ---------------------------------------------------------------------------- wxIMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol); -IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false) +IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), nullptr, false) wxFileProto::wxFileProto() : wxProtocol() @@ -50,7 +50,7 @@ wxInputStream *wxFileProto::GetInputStream(const wxString& path) m_lastError = wxPROTO_NOFILE; delete retval; - return NULL; + return nullptr; } #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 6cb7761bfc..c936c6b650 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -164,7 +164,7 @@ private: wxIMPLEMENT_DYNAMIC_CLASS(wxTCPEventHandlerModule, wxModule); -wxTCPEventHandler *wxTCPEventHandlerModule::ms_handler = NULL; +wxTCPEventHandler *wxTCPEventHandlerModule::ms_handler = nullptr; // -------------------------------------------------------------------------- // wxIPCSocketStreams @@ -233,13 +233,13 @@ public: { Flush(); - wxCHECK_MSG( conn, NULL, "NULL connection parameter" ); - wxCHECK_MSG( size, NULL, "NULL size parameter" ); + wxCHECK_MSG( conn, nullptr, "null connection parameter" ); + wxCHECK_MSG( size, nullptr, "null size parameter" ); *size = Read32(); void * const data = conn->GetBufferAtLeast(*size); - wxCHECK_MSG( data, NULL, "IPC buffer allocation failed" ); + wxCHECK_MSG( data, nullptr, "IPC buffer allocation failed" ); m_socketStream.Read(data, *size); @@ -250,7 +250,7 @@ public: void * ReadFormatData(wxConnectionBase *conn, wxIPCFormat *format, size_t *size) { - wxCHECK_MSG( format, NULL, "NULL format parameter" ); + wxCHECK_MSG( format, nullptr, "null format parameter" ); *format = static_cast(Read8()); @@ -299,7 +299,7 @@ public: IPCOutput(wxIPCSocketStreams *streams) : m_streams(*streams) { - wxASSERT_MSG( streams, "NULL streams pointer" ); + wxASSERT_MSG( streams, "null streams pointer" ); } // dtor calls Flush() really sending the IPC data to the network @@ -372,7 +372,7 @@ wxConnectionBase *wxTCPClient::MakeConnection(const wxString& host, { wxSockAddress *addr = GetAddressFromName(serverName, host); if ( !addr ) - return NULL; + return nullptr; wxSocketClient * const client = new wxSocketClient(wxSOCKET_WAITALL); wxIPCSocketStreams * const streams = new wxIPCSocketStreams(*client); @@ -420,7 +420,7 @@ wxConnectionBase *wxTCPClient::MakeConnection(const wxString& host, delete streams; client->Destroy(); - return NULL; + return nullptr; } wxConnectionBase *wxTCPClient::OnMakeConnection() @@ -435,7 +435,7 @@ wxConnectionBase *wxTCPClient::OnMakeConnection() wxTCPServer::wxTCPServer() : wxServerBase() { - m_server = NULL; + m_server = nullptr; } bool wxTCPServer::Create(const wxString& serverName) @@ -443,9 +443,9 @@ bool wxTCPServer::Create(const wxString& serverName) // Destroy previous server, if any if (m_server) { - m_server->SetClientData(NULL); + m_server->SetClientData(nullptr); m_server->Destroy(); - m_server = NULL; + m_server = nullptr; } wxSockAddress *addr = GetAddressFromName(serverName); @@ -497,7 +497,7 @@ bool wxTCPServer::Create(const wxString& serverName) if (!m_server->IsOk()) { m_server->Destroy(); - m_server = NULL; + m_server = nullptr; return false; } @@ -515,7 +515,7 @@ wxTCPServer::~wxTCPServer() { if ( m_server ) { - m_server->SetClientData(NULL); + m_server->SetClientData(nullptr); m_server->Destroy(); } @@ -542,8 +542,8 @@ wxTCPServer::OnAcceptConnection(const wxString& WXUNUSED(topic)) void wxTCPConnection::Init() { - m_sock = NULL; - m_streams = NULL; + m_sock = nullptr; + m_streams = nullptr; } wxTCPConnection::~wxTCPConnection() @@ -552,7 +552,7 @@ wxTCPConnection::~wxTCPConnection() if ( m_sock ) { - m_sock->SetClientData(NULL); + m_sock->SetClientData(nullptr); m_sock->Destroy(); } @@ -606,16 +606,16 @@ const void *wxTCPConnection::Request(const wxString& item, wxIPCFormat format) { if ( !m_sock->IsConnected() ) - return NULL; + return nullptr; IPCOutput(m_streams).Write(IPC_REQUEST, item, format); const int ret = m_streams->Read8(); if ( ret != IPC_REQUEST_REPLY ) - return NULL; + return nullptr; - // ReadData() needs a non-NULL size pointer but the client code can call us - // with NULL pointer (this makes sense if it knows that it always works + // ReadData() needs a non-null size pointer but the client code can call us + // with null pointer (this makes sense if it knows that it always works // with NUL-terminated strings) size_t sizeFallback; return m_streams->ReadData(this, size ? size : &sizeFallback); @@ -694,7 +694,7 @@ void wxTCPEventHandler::HandleDisconnect(wxTCPConnection *connection) // don't leave references to this soon-to-be-dangling connection in the // socket as it won't be destroyed immediately as its destruction will be // delayed in case there are more events pending for it - connection->m_sock->SetClientData(NULL); + connection->m_sock->SetClientData(nullptr); connection->SetConnected(false); connection->OnDisconnect(); diff --git a/src/common/secretstore.cpp b/src/common/secretstore.cpp index 3970c3446f..213df459c8 100644 --- a/src/common/secretstore.cpp +++ b/src/common/secretstore.cpp @@ -99,7 +99,7 @@ size_t wxSecretValue::GetSize() const const void *wxSecretValue::GetData() const { - return m_impl ? m_impl->GetData() : NULL; + return m_impl ? m_impl->GetData() : nullptr; } wxString wxSecretValue::GetAsString(const wxMBConv& conv) const @@ -197,7 +197,7 @@ wxSecretStore::Load(const wxString& service, return false; wxString err; - wxSecretValueImpl* secretImpl = NULL; + wxSecretValueImpl* secretImpl = nullptr; if ( !m_impl->Load(service, &user, &secretImpl, err) ) { if ( !err.empty() ) diff --git a/src/common/selectdispatcher.cpp b/src/common/selectdispatcher.cpp index d508231b80..89371c6e87 100644 --- a/src/common/selectdispatcher.cpp +++ b/src/common/selectdispatcher.cpp @@ -204,7 +204,7 @@ int wxSelectDispatcher::ProcessSets(const wxSelectSets& sets) wxFDIOHandler * const handler = FindHandler(fd); if ( !handler ) { - wxFAIL_MSG( wxT("NULL handler in wxSelectDispatcher?") ); + wxFAIL_MSG( wxT("null handler in wxSelectDispatcher?") ); continue; } @@ -227,7 +227,7 @@ int wxSelectDispatcher::DoSelect(wxSelectSets& sets, int timeout) const } else // no timeout { - ptv = NULL; + ptv = nullptr; } int ret = sets.Select(m_maxFD + 1, ptv); diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 41999d16ff..82ff3b1c67 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -159,7 +159,7 @@ bool CheckSizerFlags(bool cond) // Once-only initialization: check if disabled via environment. if ( gs_disableFlagChecks == -1 ) { - gs_disableFlagChecks = wxGetEnv("WXSUPPRESS_SIZER_FLAGS_CHECK", NULL); + gs_disableFlagChecks = wxGetEnv("WXSUPPRESS_SIZER_FLAGS_CHECK", nullptr); } return gs_disableFlagChecks || cond; @@ -316,7 +316,7 @@ wxSizerItem::wxSizerItem() // window item void wxSizerItem::DoSetWindow(wxWindow *window) { - wxCHECK_RET( window, wxT("NULL window in wxSizerItem::SetWindow()") ); + wxCHECK_RET( window, wxT("null window in wxSizerItem::SetWindow()") ); m_kind = Item_Window; m_window = window; @@ -361,7 +361,7 @@ wxSizerItem::wxSizerItem(wxSizer *sizer, int border, wxObject* userData) : m_kind(Item_None), - m_sizer(NULL), + m_sizer(nullptr), m_proportion(proportion), m_border(border), m_flag(flag), @@ -419,7 +419,7 @@ wxSizerItem::wxSizerItem(int width, int border, wxObject* userData) : m_kind(Item_None), - m_sizer(NULL), + m_sizer(nullptr), m_minSize(width, height), // minimal size is the initial size m_proportion(proportion), m_border(border), @@ -446,7 +446,7 @@ void wxSizerItem::Free() break; case Item_Window: - m_window->SetContainingSizer(NULL); + m_window->SetContainingSizer(nullptr); break; case Item_Sizer: @@ -720,7 +720,7 @@ void wxSizerItem::DeleteWindows() //We are deleting the window from this sizer - normally //the window destroys the sizer associated with it, //which might destroy this, which we don't want - m_window->SetContainingSizer(NULL); + m_window->SetContainingSizer(nullptr); m_window->Destroy(); //Putting this after the switch will result in a spacer //not being deleted properly on destruction @@ -891,7 +891,7 @@ void wxSizer::SetContainingWindow(wxWindow *win) bool wxSizer::Remove( wxSizer *sizer ) { - wxASSERT_MSG( sizer, wxT("Removing NULL sizer") ); + wxASSERT_MSG( sizer, wxT("Removing null sizer") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -929,7 +929,7 @@ bool wxSizer::Remove( int index ) bool wxSizer::Detach( wxSizer *sizer ) { - wxASSERT_MSG( sizer, wxT("Detaching NULL sizer") ); + wxASSERT_MSG( sizer, wxT("Detaching null sizer") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -951,7 +951,7 @@ bool wxSizer::Detach( wxSizer *sizer ) bool wxSizer::Detach( wxWindow *window ) { - wxASSERT_MSG( window, wxT("Detaching NULL window") ); + wxASSERT_MSG( window, wxT("Detaching null window") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -992,8 +992,8 @@ bool wxSizer::Detach( int index ) bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive ) { - wxASSERT_MSG( oldwin, wxT("Replacing NULL window") ); - wxASSERT_MSG( newwin, wxT("Replacing with NULL window") ); + wxASSERT_MSG( oldwin, wxT("Replacing null window") ); + wxASSERT_MSG( newwin, wxT("Replacing with null window") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -1020,8 +1020,8 @@ bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive ) bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive ) { - wxASSERT_MSG( oldsz, wxT("Replacing NULL sizer") ); - wxASSERT_MSG( newsz, wxT("Replacing with NULL sizer") ); + wxASSERT_MSG( oldsz, wxT("Replacing null sizer") ); + wxASSERT_MSG( newsz, wxT("Replacing with null sizer") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -1048,7 +1048,7 @@ bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive ) bool wxSizer::Replace( size_t old, wxSizerItem *newitem ) { wxCHECK_MSG( old < m_children.GetCount(), false, wxT("Replace index is out of range") ); - wxCHECK_MSG( newitem, false, wxT("Replacing with NULL item") ); + wxCHECK_MSG( newitem, false, wxT("Replacing with null item") ); wxSizerItemList::compatibility_iterator node = m_children.Item( old ); @@ -1058,7 +1058,7 @@ bool wxSizer::Replace( size_t old, wxSizerItem *newitem ) node->SetData(newitem); if (wxWindow* const w = item->GetWindow()) - w->SetContainingSizer(NULL); + w->SetContainingSizer(nullptr); delete item; @@ -1077,7 +1077,7 @@ void wxSizer::Clear( bool delete_windows ) wxSizerItem *item = node->GetData(); if (item->IsWindow()) - item->GetWindow()->SetContainingSizer( NULL ); + item->GetWindow()->SetContainingSizer( nullptr ); node = node->GetNext(); } @@ -1103,7 +1103,7 @@ void wxSizer::DeleteWindows() wxSize wxSizer::ComputeFittingClientSize(wxWindow *window) { - wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" ); + wxCHECK_MSG( window, wxDefaultSize, "window can't be null" ); // take the min size by default and limit it by max size wxSize size = GetMinClientSize(window); @@ -1145,14 +1145,14 @@ wxSize wxSizer::ComputeFittingClientSize(wxWindow *window) wxSize wxSizer::ComputeFittingWindowSize(wxWindow *window) { - wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" ); + wxCHECK_MSG( window, wxDefaultSize, "window can't be null" ); return window->ClientToWindowSize(ComputeFittingClientSize(window)); } wxSize wxSizer::Fit( wxWindow *window ) { - wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" ); + wxCHECK_MSG( window, wxDefaultSize, "window can't be null" ); // set client size window->WXSetInitialFittingClientSize(wxSIZE_SET_CURRENT, this); @@ -1243,7 +1243,7 @@ void wxSizer::DoSetMinSize( int width, int height ) bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height ) { - wxASSERT_MSG( window, wxT("SetMinSize for NULL window") ); + wxASSERT_MSG( window, wxT("SetMinSize for null window") ); // Is it our immediate child? @@ -1281,7 +1281,7 @@ bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height ) bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height ) { - wxASSERT_MSG( sizer, wxT("SetMinSize for NULL sizer") ); + wxASSERT_MSG( sizer, wxT("SetMinSize for null sizer") ); // Is it our immediate child? @@ -1341,7 +1341,7 @@ bool wxSizer::DoSetItemMinSize( size_t index, int width, int height ) wxSizerItem* wxSizer::GetItem( wxWindow *window, bool recursive ) { - wxASSERT_MSG( window, wxT("GetItem for NULL window") ); + wxASSERT_MSG( window, wxT("GetItem for null window") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -1362,12 +1362,12 @@ wxSizerItem* wxSizer::GetItem( wxWindow *window, bool recursive ) node = node->GetNext(); } - return NULL; + return nullptr; } wxSizerItem* wxSizer::GetItem( wxSizer *sizer, bool recursive ) { - wxASSERT_MSG( sizer, wxT("GetItem for NULL sizer") ); + wxASSERT_MSG( sizer, wxT("GetItem for null sizer") ); wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -1388,13 +1388,13 @@ wxSizerItem* wxSizer::GetItem( wxSizer *sizer, bool recursive ) node = node->GetNext(); } - return NULL; + return nullptr; } wxSizerItem* wxSizer::GetItem( size_t index ) { wxCHECK_MSG( index < m_children.GetCount(), - NULL, + nullptr, wxT("GetItem index is out of range") ); return m_children.Item( index )->GetData(); @@ -1424,7 +1424,7 @@ wxSizerItem* wxSizer::GetItemById( int id, bool recursive ) node = node->GetNext(); } - return NULL; + return nullptr; } bool wxSizer::Show( wxWindow *window, bool show, bool recursive ) @@ -1998,7 +1998,7 @@ void wxFlexGridSizer::AdjustForFlexDirection() // delta: the extra space, we do nothing unless it's positive // growable: indices or growable rows/cols in sizes array // sizes: the height/widths of rows/cols to adjust -// proportions: proportions of the growable rows/cols or NULL if they all +// proportions: proportions of the growable rows/cols or nullptr if they all // should be assumed to have proportion of 1 static void DoAdjustForGrowables(int delta, @@ -2113,7 +2113,7 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz, const wxSize& origina m_growableCols, m_colWidths, m_growMode == wxFLEX_GROWMODE_SPECIFIED ? &m_growableColsProportions - : NULL + : nullptr ); // This gives nested objects that benefit from knowing one size @@ -2142,14 +2142,14 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz, const wxSize& origina m_growableCols, m_colWidths, m_growMode == wxFLEX_GROWMODE_SPECIFIED ? &m_growableColsProportions - : NULL + : nullptr ); } } if ( (m_flexDirection & wxVERTICAL) || (m_growMode != wxFLEX_GROWMODE_NONE) ) { - // pass NULL instead of proportions if the grow mode is ALL as we + // pass nullptr instead of proportions if the grow mode is ALL as we // should treat all rows as having proportion of 1 then DoAdjustForGrowables ( @@ -2157,7 +2157,7 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz, const wxSize& origina m_growableRows, m_rowHeights, m_growMode == wxFLEX_GROWMODE_SPECIFIED ? &m_growableRowsProportions - : NULL + : nullptr ); } } @@ -2870,7 +2870,7 @@ bool wxStaticBoxSizer::Detach( wxWindow *window ) // example) if ( window == m_staticBox ) { - m_staticBox = NULL; + m_staticBox = nullptr; return true; } @@ -2894,11 +2894,11 @@ wxStdDialogButtonSizer::wxStdDialogButtonSizer() if (is_pda) m_orient = wxVERTICAL; - m_buttonAffirmative = NULL; - m_buttonApply = NULL; - m_buttonNegative = NULL; - m_buttonCancel = NULL; - m_buttonHelp = NULL; + m_buttonAffirmative = nullptr; + m_buttonApply = nullptr; + m_buttonNegative = nullptr; + m_buttonCancel = nullptr; + m_buttonHelp = nullptr; } void wxStdDialogButtonSizer::AddButton(wxButton *mybutton) @@ -2952,7 +2952,7 @@ void wxStdDialogButtonSizer::Realize() { public: TabOrderUpdater() - : m_lastAdded(NULL) + : m_lastAdded(nullptr) { } diff --git a/src/common/socket.cpp b/src/common/socket.cpp index c245cb17a4..670240f218 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -256,7 +256,7 @@ private: // wxSocketManager // ============================================================================ -wxSocketManager *wxSocketManager::ms_manager = NULL; +wxSocketManager *wxSocketManager::ms_manager = nullptr; /* static */ void wxSocketManager::Set(wxSocketManager *manager) @@ -531,17 +531,17 @@ wxSocketImpl *wxSocketImpl::Accept(wxSocketBase& wxsocket) ReenableEvents(wxSOCKET_INPUT_FLAG); if ( fd == INVALID_SOCKET ) - return NULL; + return nullptr; wxScopeGuard closeSocket = wxMakeGuard(wxCloseSocket, fd); wxSocketManager * const manager = wxSocketManager::Get(); if ( !manager ) - return NULL; + return nullptr; wxSocketImpl * const sock = manager->CreateSocket(wxsocket); if ( !sock ) - return NULL; + return nullptr; // Ownership of the socket now passes to wxSocketImpl object. closeSocket.Dismiss(); @@ -810,7 +810,7 @@ void wxSocketBase::Shutdown() void wxSocketBase::Init() { - m_impl = NULL; + m_impl = nullptr; m_type = wxSOCKET_UNINIT; // state @@ -827,14 +827,14 @@ void wxSocketBase::Init() m_beingDeleted = false; // pushback buffer - m_unread = NULL; + m_unread = nullptr; m_unrd_size = 0; m_unrd_cur = 0; // events m_id = wxID_ANY; - m_handler = NULL; - m_clientData = NULL; + m_handler = nullptr; + m_clientData = nullptr; m_notify = false; m_eventmask = m_eventsgot = 0; @@ -973,7 +973,7 @@ wxUint32 wxSocketBase::DoRead(void* buffer_, wxUint32 nbytes) // We use pointer arithmetic here which doesn't work with void pointers. char *buffer = static_cast(buffer_); - wxCHECK_MSG( buffer, 0, "NULL buffer" ); + wxCHECK_MSG( buffer, 0, "null buffer" ); // Try the push back buffer first, even before checking whether the socket // is valid to allow reading previously pushed back data from an already @@ -1161,7 +1161,7 @@ wxUint32 wxSocketBase::DoWrite(const void *buffer_, wxUint32 nbytes) wxCHECK_MSG( m_impl, 0, "socket must be valid" ); const char *buffer = static_cast(buffer_); - wxCHECK_MSG( buffer, 0, "NULL buffer" ); + wxCHECK_MSG( buffer, 0, "null buffer" ); wxUint32 total = 0; while ( nbytes ) @@ -1312,10 +1312,10 @@ wxSocketEventFlags wxSocketImpl::Select(wxSocketEventFlags flags, else tv.tv_sec = tv.tv_usec = 0; - // prepare the FD sets, passing NULL for the one(s) we don't use + // prepare the FD sets, passing nullptr for the one(s) we don't use fd_set - readfds, *preadfds = NULL, - writefds, *pwritefds = NULL, + readfds, *preadfds = nullptr, + writefds, *pwritefds = nullptr, exceptfds; // always want to know about errors if ( flags & wxSOCKET_INPUT_FLAG ) @@ -1454,7 +1454,7 @@ wxSocketBase::DoWait(long timeout, wxSocketEventFlags flags) else // in worker thread { // We never dispatch messages from threads other than the main one. - eventLoop = NULL; + eventLoop = nullptr; } // Make sure the events we're interested in are enabled before waiting for @@ -1777,7 +1777,7 @@ void wxSocketBase::Pushback(const void *buffer, wxUint32 size) { if (!size) return; - if (m_unread == NULL) + if (m_unread == nullptr) m_unread = malloc(size); else { @@ -1797,7 +1797,7 @@ void wxSocketBase::Pushback(const void *buffer, wxUint32 size) wxUint32 wxSocketBase::GetPushback(void *buffer, wxUint32 size, bool peek) { - wxCHECK_MSG( buffer, 0, "NULL buffer" ); + wxCHECK_MSG( buffer, 0, "null buffer" ); if (!m_unrd_size) return 0; @@ -1813,7 +1813,7 @@ wxUint32 wxSocketBase::GetPushback(void *buffer, wxUint32 size, bool peek) if (m_unrd_size == m_unrd_cur) { free(m_unread); - m_unread = NULL; + m_unread = nullptr; m_unrd_size = 0; m_unrd_cur = 0; } @@ -1838,7 +1838,7 @@ wxSocketServer::wxSocketServer(const wxSockAddress& addr, wxLogTrace( wxTRACE_Socket, wxT("Opening wxSocketServer") ); wxSocketManager * const manager = wxSocketManager::Get(); - m_impl = manager ? manager->CreateSocket(*this) : NULL; + m_impl = manager ? manager->CreateSocket(*this) : nullptr; if (!m_impl) { @@ -1924,7 +1924,7 @@ wxSocketBase *wxSocketServer::Accept(bool wait) if (!AcceptWith(*sock, wait)) { sock->Destroy(); - sock = NULL; + sock = nullptr; } return sock; @@ -2017,7 +2017,7 @@ bool wxSocketClient::DoConnect(const wxSockAddress& remote, // Create and set up the new one wxSocketManager * const manager = wxSocketManager::Get(); - m_impl = manager ? manager->CreateSocket(*this) : NULL; + m_impl = manager ? manager->CreateSocket(*this) : nullptr; if ( !m_impl ) return false; @@ -2062,7 +2062,7 @@ bool wxSocketClient::DoConnect(const wxSockAddress& remote, bool wxSocketClient::Connect(const wxSockAddress& remote, bool wait) { - return DoConnect(remote, NULL, wait); + return DoConnect(remote, nullptr, wait); } bool wxSocketClient::Connect(const wxSockAddress& remote, @@ -2100,7 +2100,7 @@ wxDatagramSocket::wxDatagramSocket( const wxSockAddress& addr, { // Create the socket wxSocketManager * const manager = wxSocketManager::Get(); - m_impl = manager ? manager->CreateSocket(*this) : NULL; + m_impl = manager ? manager->CreateSocket(*this) : nullptr; if (!m_impl) return; diff --git a/src/common/socketiohandler.cpp b/src/common/socketiohandler.cpp index 33850cfffb..7322b2a1e2 100644 --- a/src/common/socketiohandler.cpp +++ b/src/common/socketiohandler.cpp @@ -38,7 +38,7 @@ bool wxSocketFDBasedManager::OnInit() return false; m_fdioManager = traits->GetFDIOManager(); - return m_fdioManager != NULL; + return m_fdioManager != nullptr; } void wxSocketFDBasedManager::Install_Callback(wxSocketImpl *socket_, diff --git a/src/common/sstream.cpp b/src/common/sstream.cpp index f40a371a48..47aa953930 100644 --- a/src/common/sstream.cpp +++ b/src/common/sstream.cpp @@ -43,7 +43,7 @@ wxStringInputStream::wxStringInputStream(const wxString& s) #endif { #if wxUSE_UNICODE - wxASSERT_MSG(m_buf.data() != NULL, wxT("Could not convert string to UTF8!")); + wxASSERT_MSG(m_buf.data() != nullptr, wxT("Could not convert string to UTF8!")); #endif m_pos = 0; } @@ -142,7 +142,7 @@ wxStringOutputStream::wxStringOutputStream(wxString *pString, wxMBConv& conv) m_pos = m_str->utf8_length(); else #endif // wxUSE_UNICODE_UTF8 - m_pos = m_conv.FromWChar(NULL, 0, m_str->wc_str(), m_str->length()); + m_pos = m_conv.FromWChar(nullptr, 0, m_str->wc_str(), m_str->length()); #else // !wxUSE_UNICODE m_pos = m_str->length(); #endif // wxUSE_UNICODE/!wxUSE_UNICODE diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index af297e01ae..44ae50494c 100644 --- a/src/common/statbar.cpp +++ b/src/common/statbar.cpp @@ -124,7 +124,7 @@ wxStatusBarBase::~wxStatusBarBase() // dangling pointers wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame && frame->GetStatusBar() == this ) - frame->SetStatusBar(NULL); + frame->SetStatusBar(nullptr); } // ---------------------------------------------------------------------------- @@ -159,7 +159,7 @@ void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n), { wxASSERT_MSG( (size_t)n == m_panes.GetCount(), wxT("field number mismatch") ); - if (widths == NULL) + if (widths == nullptr) { // special value meaning: override explicit pane widths and make them all // of the same size @@ -180,7 +180,7 @@ void wxStatusBarBase::SetStatusWidths(int WXUNUSED_UNLESS_DEBUG(n), void wxStatusBarBase::SetStatusStyles(int WXUNUSED_UNLESS_DEBUG(n), const int styles[]) { - wxCHECK_RET( styles, wxT("NULL pointer in SetStatusStyles") ); + wxCHECK_RET( styles, wxT("null pointer in SetStatusStyles") ); wxASSERT_MSG( (size_t)n == m_panes.GetCount(), wxT("field number mismatch") ); diff --git a/src/common/statboxcmn.cpp b/src/common/statboxcmn.cpp index 110199a490..9502db8e9a 100644 --- a/src/common/statboxcmn.cpp +++ b/src/common/statboxcmn.cpp @@ -28,7 +28,7 @@ extern WXDLLEXPORT_DATA(const char) wxStaticBoxNameStr[] = "groupBox"; wxStaticBoxBase::wxStaticBoxBase() { - m_labelWin = NULL; + m_labelWin = nullptr; m_areChildrenEnabled = true; #ifndef __WXGTK__ diff --git a/src/common/stdstream.cpp b/src/common/stdstream.cpp index 499555bffe..71e89759ca 100644 --- a/src/common/stdstream.cpp +++ b/src/common/stdstream.cpp @@ -72,7 +72,7 @@ std::streambuf * wxStdInputStreamBuffer::setbuf(char *WXUNUSED(s), std::streamsize WXUNUSED(n)) { - return NULL; + return nullptr; } std::streampos @@ -192,7 +192,7 @@ std::streambuf * wxStdOutputStreamBuffer::setbuf(char *WXUNUSED(s), std::streamsize WXUNUSED(n)) { - return NULL; + return nullptr; } std::streampos @@ -250,13 +250,13 @@ wxStdOutputStreamBuffer::overflow(int c) // ========================================================================== wxStdInputStream::wxStdInputStream(wxInputStream& stream) : - std::istream(NULL), m_streamBuffer(stream) + std::istream(nullptr), m_streamBuffer(stream) { std::ios::init(&m_streamBuffer); } wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) : - std::ostream(NULL), m_streamBuffer(stream) + std::ostream(nullptr), m_streamBuffer(stream) { std::ios::init(&m_streamBuffer); } diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 04205b3a32..275f5ddd29 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -105,7 +105,7 @@ static size_t encode_utf16(wxUint32 input, wxUint16 *output) // "end" pointer (the caller must ensure that on input "*pSrc < end") and // advances the pointer to the character after this one. // -// If an invalid or incomplete character is found, *pSrc is set to NULL, the +// If an invalid or incomplete character is found, *pSrc is set to nullptr, the // caller must check for this. static wxUint32 wxDecodeSurrogate(const wxChar16 **pSrc, const wxChar16* end) { @@ -120,12 +120,12 @@ static wxUint32 wxDecodeSurrogate(const wxChar16 **pSrc, const wxChar16* end) } // No, we have the first half of a surrogate, check if we also have the - // second half (notice that this check does nothing if end == NULL, as it + // second half (notice that this check does nothing if end == nullptr, as it // is allowed to be, and this is correct). if ( src == end ) { // No, we don't because this is the end of input. - src = NULL; + src = nullptr; return 0; } @@ -133,7 +133,7 @@ static wxUint32 wxDecodeSurrogate(const wxChar16 **pSrc, const wxChar16* end) if ( (u2 < 0xdc00) || (u2 > 0xdfff) ) { // No, it's not in the low surrogate range. - src = NULL; + src = nullptr; return 0; } @@ -160,7 +160,7 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, // directly, the primary example is wxConvLibc: mbstowcs() only handles // NUL-terminated strings - // the number of chars [which would be] written to dst [if it were not NULL] + // the number of chars [which would be] written to dst [if it were not null] size_t dstWritten = 0; // the number of NULs terminating this string @@ -196,7 +196,7 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, } else // quit after the first loop iteration { - srcEnd = NULL; + srcEnd = nullptr; } // the idea of this code is straightforward: it converts a NUL-terminated @@ -206,7 +206,7 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, // all the complication come from the fact that this function, for // historical reasons, must behave in 2 subtly different ways when it's // called with a fixed number of characters and when it's called for the - // entire NUL-terminated string: in the former case (srcEnd != NULL) we + // entire NUL-terminated string: in the former case (srcEnd != nullptr) we // must count all characters we convert, NUL or not; but in the latter we // do not count the trailing NUL -- but still count all the NULs inside the // string @@ -217,7 +217,7 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, for ( ;; ) { // try to convert the current chunk - size_t lenChunk = MB2WC(NULL, src, 0); + size_t lenChunk = MB2WC(nullptr, src, 0); if ( lenChunk == wxCONV_FAILED ) return wxCONV_FAILED; @@ -281,7 +281,7 @@ size_t wxMBConv::FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen) const { - // the number of chars [which would be] written to dst [if it were not NULL] + // the number of chars [which would be] written to dst [if it were not null] size_t dstWritten = 0; // if we don't know its length we have no choice but to assume that it is @@ -310,7 +310,7 @@ wxMBConv::FromWChar(char *dst, size_t dstLen, src++ /* skip L'\0' too */ ) { // try to convert the current chunk - size_t lenChunk = WC2MB(NULL, src, 0); + size_t lenChunk = WC2MB(nullptr, src, 0); if ( lenChunk == wxCONV_FAILED ) return wxCONV_FAILED; @@ -398,7 +398,7 @@ size_t wxMBConv::WC2MB(char *outBuff, const wchar_t *inBuff, size_t outLen) cons wxWCharBuffer wxMBConv::cMB2WC(const char *inBuff, size_t inLen, size_t *outLen) const { - const size_t dstLen = ToWChar(NULL, 0, inBuff, inLen); + const size_t dstLen = ToWChar(nullptr, 0, inBuff, inLen); if ( dstLen != wxCONV_FAILED ) { // notice that we allocate space for dstLen+1 wide characters here @@ -433,7 +433,7 @@ wxMBConv::cMB2WC(const char *inBuff, size_t inLen, size_t *outLen) const wxCharBuffer wxMBConv::cWC2MB(const wchar_t *inBuff, size_t inLen, size_t *outLen) const { - size_t dstLen = FromWChar(NULL, 0, inBuff, inLen); + size_t dstLen = FromWChar(nullptr, 0, inBuff, inLen); if ( dstLen != wxCONV_FAILED ) { const size_t nulLen = GetMBNulLen(); @@ -473,13 +473,13 @@ wxMBConv::cWC2MB(const wchar_t *inBuff, size_t inLen, size_t *outLen) const wxWCharBuffer wxMBConv::DoConvertMB2WC(const char* buf, size_t srcLen) const { - // Notice that converting NULL pointer should work, i.e. return an empty + // Notice that converting null pointer should work, i.e. return an empty // buffer instead of crashing, so we need to check both the length and the // pointer because length is wxNO_LEN if it's a raw pointer and doesn't // come from wxScopedCharBuffer. if ( srcLen && buf ) { - const size_t dstLen = ToWChar(NULL, 0, buf, srcLen); + const size_t dstLen = ToWChar(nullptr, 0, buf, srcLen); if ( dstLen != wxCONV_FAILED ) { wxWCharBuffer wbuf(dstLen); @@ -504,7 +504,7 @@ wxCharBuffer wxMBConv::DoConvertWC2MB(const wchar_t* wbuf, size_t srcLen) const { if ( srcLen && wbuf ) { - const size_t dstLen = FromWChar(NULL, 0, wbuf, srcLen); + const size_t dstLen = FromWChar(nullptr, 0, wbuf, srcLen); if ( dstLen != wxCONV_FAILED ) { wxCharBuffer buf(dstLen); @@ -629,7 +629,7 @@ size_t wxMBConvUTF7::ToWChar(wchar_t *dst, size_t dstLen, // number of characters [which would have been] written to dst [if it were - // not NULL] + // not null] size_t len = 0; const char * const srcEnd = src + srcLen; @@ -957,7 +957,7 @@ size_t wxMBConvStrictUTF8::ToWChar(wchar_t *dst, size_t dstLen, const char *src, size_t srcLen) const { - wchar_t *out = dstLen ? dst : NULL; + wchar_t *out = dstLen ? dst : nullptr; size_t written = 0; if ( srcLen == wxNO_LEN ) @@ -967,7 +967,7 @@ wxMBConvStrictUTF8::ToWChar(wchar_t *dst, size_t dstLen, { if ( (srcLen == wxNO_LEN ? !*p : !srcLen) ) { - // all done successfully, just add the trailing NULL if we are not + // all done successfully, just add the trailing NUL if we are not // using explicit length if ( srcLen == wxNO_LEN ) { @@ -1072,15 +1072,15 @@ size_t wxMBConvStrictUTF8::FromWChar(char *dst, size_t dstLen, const wchar_t *src, size_t srcLen) const { - char *out = dstLen ? dst : NULL; + char *out = dstLen ? dst : nullptr; size_t written = 0; - const wchar_t* const end = srcLen == wxNO_LEN ? NULL : src + srcLen; + const wchar_t* const end = srcLen == wxNO_LEN ? nullptr : src + srcLen; for ( const wchar_t *wp = src; ; ) { if ( end ? wp == end : !*wp ) { - // all done successfully, just add the trailing NULL if we are not + // all done successfully, just add the trailing NUL if we are not // using explicit length if ( srcLen == wxNO_LEN ) { @@ -1362,7 +1362,7 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n, // The length can be either given explicitly or computed implicitly for the // NUL-terminated strings. - const wchar_t* const end = srcLen == wxNO_LEN ? NULL : psz + srcLen; + const wchar_t* const end = srcLen == wxNO_LEN ? nullptr : psz + srcLen; while ((end ? psz < end : *psz) && ((!buf) || (len < n))) { wxUint32 cc; @@ -2102,7 +2102,7 @@ protected: private: // the name (for iconv_open()) of a wide char charset -- if none is - // available on this machine, it will remain NULL + // available on this machine, it will remain empty static wxString ms_wcCharsetName; // true if the wide char encoding we use (i.e. ms_wcCharsetName) has @@ -2125,7 +2125,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const char* name ) if ( !result->IsOk() ) { delete result; - return 0; + return nullptr; } return result; @@ -2154,7 +2154,7 @@ wxMBConv_iconv::wxMBConv_iconv(const char *name) #elif SIZEOF_WCHAR_T == 2 wxT("UCS-2"), #endif - NULL + nullptr }; const wxChar *const *names = names_static; #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP @@ -2380,7 +2380,7 @@ size_t wxMBConv_iconv::FromWChar(char *dst, size_t dstLen, size_t outbuflen = dstLen; size_t res, cres; - wchar_t *tmpbuf = 0; + wchar_t *tmpbuf = nullptr; if (ms_wcNeedsSwap) { @@ -2547,8 +2547,8 @@ public: if ( !len ) 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 + // note that it returns count of written chars for buf != nullptr and size + // of the needed buffer for buf == nullptr so in either case the length of // the string (which never includes the terminating NUL) is one less return len - 1; } @@ -2578,7 +2578,7 @@ public: else // old system or unsupported encoding { flags = 0; - pUsedDef = NULL; + pUsedDef = nullptr; } const size_t len = ::WideCharToMultiByte @@ -2589,7 +2589,7 @@ public: -1, // it is (wide) NUL-terminated buf, // output buffer buf ? n : 0, // and its size - NULL, // default "replacement" char + nullptr, // default "replacement" char pUsedDef // [out] was it used? ); @@ -2610,7 +2610,7 @@ public: else // we must resort to double tripping... { // first we need to ensure that we really have the MB data: this is - // not the case if we're called with NULL buffer, in which case we + // not the case if we're called with null buffer, in which case we // need to do the conversion yet again wxCharBuffer bufDef; if ( !buf ) @@ -2618,7 +2618,7 @@ public: bufDef = wxCharBuffer(len); buf = bufDef.data(); if ( !::WideCharToMultiByte(m_CodePage, flags, pwz, -1, - buf, len, NULL, NULL) ) + buf, len, nullptr, nullptr) ) return wxCONV_FAILED; } @@ -2648,10 +2648,10 @@ public: 0, // no flags L"", // input string 1, // translate just the NUL - NULL, // output buffer + nullptr, // output buffer 0, // and its size - NULL, // no replacement char - NULL // [out] don't care if it was used + nullptr, // no replacement char + nullptr // [out] don't care if it was used ); wxMBConv_win32 * const self = wxConstCast(this, wxMBConv_win32); @@ -2793,7 +2793,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name ) if ( !result->IsOk() ) { delete result; - return 0; + return nullptr; } return result; @@ -2807,8 +2807,8 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name ) void wxCSConv::Init() { - m_name = NULL; - m_convReal = NULL; + m_name = nullptr; + m_convReal = nullptr; } void wxCSConv::SetEncoding(wxFontEncoding encoding) @@ -2911,7 +2911,7 @@ wxCSConv& wxCSConv::operator=(const wxCSConv& conv) void wxCSConv::Clear() { free(m_name); - m_name = NULL; + m_name = nullptr; wxDELETE(m_convReal); } @@ -2945,7 +2945,7 @@ wxMBConv *wxCSConv::DoCreate() const if ( m_encoding == wxFONTENCODING_ISO8859_1 ) { // don't convert at all - return NULL; + return nullptr; } // we trust OS to do conversion better than we can so try external @@ -2985,7 +2985,7 @@ wxMBConv *wxCSConv::DoCreate() const if ( it != gs_nameCache.end() ) { if ( it->second.empty() ) - return NULL; + return nullptr; wxMBConv_iconv *conv = new wxMBConv_iconv(it->second.ToAscii()); if ( conv->IsOk() ) @@ -3000,7 +3000,7 @@ wxMBConv *wxCSConv::DoCreate() const // although it just has to be created using a different method, so // only store failed iconv creation attempts (or perhaps we // shoulnd't do this at all ?) - if ( names[0] != NULL ) + if ( names[0] != nullptr ) { for ( ; *names; ++names ) { @@ -3114,7 +3114,7 @@ wxMBConv *wxCSConv::DoCreate() const : wxFontMapperBase::GetEncodingName(m_encoding))); #endif // wxUSE_FONTMAP - return NULL; + return nullptr; } bool wxCSConv::IsOk() const @@ -3124,8 +3124,8 @@ bool wxCSConv::IsOk() const return true; // always ok as we do it ourselves // m_convReal->IsOk() is called at its own creation, so we know it must - // be ok if m_convReal is non-NULL - return m_convReal != NULL; + // be ok if m_convReal is non-null + return m_convReal != nullptr; } size_t wxCSConv::ToWChar(wchar_t *dst, size_t dstLen, @@ -3258,7 +3258,7 @@ wxWhateverWorksConv::FromWChar(char *dst, size_t dstLen, #undef wxConvISO8859_1 #define WX_DEFINE_GLOBAL_CONV2(klass, impl_klass, name, ctor_args) \ - WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr = NULL; \ + WXDLLIMPEXP_DATA_BASE(klass*) name##Ptr = nullptr; \ WXDLLIMPEXP_BASE klass* wxGet_##name##Ptr() \ { \ static impl_klass name##Obj ctor_args; \ diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 22d8312e7d..e64a9fa109 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -59,7 +59,7 @@ void wxStreamBuffer::InitBuffer() { m_buffer_start = m_buffer_end = - m_buffer_pos = NULL; + m_buffer_pos = nullptr; // if we are going to allocate the buffer, we should free it later as well m_destroybuf = true; @@ -86,7 +86,7 @@ wxStreamBuffer::wxStreamBuffer(BufMode mode) { Init(); - m_stream = NULL; + m_stream = nullptr; m_mode = mode; m_flushable = false; @@ -114,7 +114,7 @@ void wxStreamBuffer::FreeBuffer() if ( m_destroybuf ) { free(m_buffer_start); - m_buffer_start = NULL; + m_buffer_start = nullptr; } } @@ -125,12 +125,12 @@ wxStreamBuffer::~wxStreamBuffer() wxInputStream *wxStreamBuffer::GetInputStream() const { - return m_mode == write ? NULL : (wxInputStream *)m_stream; + return m_mode == write ? nullptr : (wxInputStream *)m_stream; } wxOutputStream *wxStreamBuffer::GetOutputStream() const { - return m_mode == read ? NULL : (wxOutputStream *)m_stream; + return m_mode == read ? nullptr : (wxOutputStream *)m_stream; } void wxStreamBuffer::SetBufferIO(void *buffer_start, @@ -387,7 +387,7 @@ char wxStreamBuffer::GetChar() size_t wxStreamBuffer::Read(void *buffer, size_t size) { - wxCHECK_MSG( buffer, 0, wxT("NULL data pointer") ); + wxCHECK_MSG( buffer, 0, wxT("null data pointer") ); /* Clear buffer first */ memset(buffer, 0x00, size); @@ -468,7 +468,7 @@ size_t wxStreamBuffer::Read(wxStreamBuffer *dbuf) size_t wxStreamBuffer::Write(const void *buffer, size_t size) { - wxCHECK_MSG( buffer, 0, wxT("NULL data pointer") ); + wxCHECK_MSG( buffer, 0, wxT("null data pointer") ); if (m_stream) { @@ -715,7 +715,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxStreamBase); wxInputStream::wxInputStream() { - m_wback = NULL; + m_wback = nullptr; m_wbacksize = m_wbackcur = 0; } @@ -749,7 +749,7 @@ char *wxInputStream::AllocSpaceWBack(size_t needed_size) char *temp_b = (char *)malloc(needed_size + toget); if (!temp_b) - return NULL; + return nullptr; // copy previous data (and free old buffer) if needed if (m_wback) @@ -768,7 +768,7 @@ char *wxInputStream::AllocSpaceWBack(size_t needed_size) size_t wxInputStream::GetWBack(void *buf, size_t size) { - wxCHECK_MSG( buf, 0, wxT("NULL data pointer") ); + wxCHECK_MSG( buf, 0, wxT("null data pointer") ); /* Clear buffer first */ memset(buf, 0x00, size); @@ -793,7 +793,7 @@ size_t wxInputStream::GetWBack(void *buf, size_t size) { // TODO: should we really free it here all the time? maybe keep it? free(m_wback); - m_wback = NULL; + m_wback = nullptr; m_wbacksize = 0; m_wbackcur = 0; } @@ -804,7 +804,7 @@ size_t wxInputStream::GetWBack(void *buf, size_t size) size_t wxInputStream::Ungetch(const void *buf, size_t bufsize) { - wxCHECK_MSG( buf, 0, wxT("NULL data pointer") ); + wxCHECK_MSG( buf, 0, wxT("null data pointer") ); if ( m_lasterror != wxSTREAM_NO_ERROR && m_lasterror != wxSTREAM_EOF ) { @@ -838,7 +838,7 @@ int wxInputStream::GetC() wxInputStream& wxInputStream::Read(void *buf, size_t size) { - wxCHECK_MSG( buf, *this, wxT("NULL data pointer") ); + wxCHECK_MSG( buf, *this, wxT("null data pointer") ); char *p = (char *)buf; m_lastcount = 0; @@ -1011,7 +1011,7 @@ wxFileOffset wxInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) wxLogDebug( wxT("Seeking in stream which has data written back to it.") ); free(m_wback); - m_wback = NULL; + m_wback = nullptr; m_wbacksize = 0; m_wbackcur = 0; } @@ -1186,7 +1186,7 @@ wxFileOffset wxCountingOutputStream::OnSysTell() const wxIMPLEMENT_ABSTRACT_CLASS(wxFilterInputStream, wxInputStream); wxFilterInputStream::wxFilterInputStream() - : m_parent_i_stream(NULL), + : m_parent_i_stream(nullptr), m_owns(false) { } @@ -1216,7 +1216,7 @@ wxFilterInputStream::~wxFilterInputStream() wxIMPLEMENT_ABSTRACT_CLASS(wxFilterOutputStream, wxOutputStream); wxFilterOutputStream::wxFilterOutputStream() - : m_parent_o_stream(NULL), + : m_parent_o_stream(nullptr), m_owns(false) { } @@ -1289,7 +1289,7 @@ bool wxFilterClassFactoryBase::CanHandle(const wxString& protocol, wxIMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxFilterClassFactoryBase); -wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL; +wxFilterClassFactory *wxFilterClassFactory::sm_first = nullptr; void wxFilterClassFactory::Remove() { @@ -1315,7 +1315,7 @@ namespace // helper function used for initializing the buffer used by // wxBufferedInput/OutputStream: it simply returns the provided buffer if it's -// not NULL or creates a buffer of the given size otherwise +// not null or creates a buffer of the given size otherwise template wxStreamBuffer * CreateBufferIfNeeded(T& stream, wxStreamBuffer *buffer, size_t bufsize = 1024) @@ -1336,7 +1336,7 @@ wxBufferedInputStream::wxBufferedInputStream(wxInputStream& stream, size_t bufsize) : wxFilterInputStream(stream) { - m_i_streambuf = CreateBufferIfNeeded(*this, NULL, bufsize); + m_i_streambuf = CreateBufferIfNeeded(*this, nullptr, bufsize); } wxBufferedInputStream::~wxBufferedInputStream() @@ -1393,7 +1393,7 @@ wxFileOffset wxBufferedInputStream::SeekI(wxFileOffset pos, wxSeekMode mode) wxLogDebug( wxT("Seeking in stream which has data written back to it.") ); free(m_wback); - m_wback = NULL; + m_wback = nullptr; m_wbacksize = 0; m_wbackcur = 0; } @@ -1449,7 +1449,7 @@ wxBufferedOutputStream::wxBufferedOutputStream(wxOutputStream& stream, size_t bufsize) : wxFilterOutputStream(stream) { - m_o_streambuf = CreateBufferIfNeeded(*this, NULL, bufsize); + m_o_streambuf = CreateBufferIfNeeded(*this, nullptr, bufsize); } wxBufferedOutputStream::~wxBufferedOutputStream() diff --git a/src/common/string.cpp b/src/common/string.cpp index f10a3a4797..c5520bcc93 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -65,7 +65,7 @@ namespace wxPrivate // to make it safe to access it even before all global statics are initialized UntypedBufferData *GetUntypedNullData() { - static UntypedBufferData s_untypedNullData(NULL, 0); + static UntypedBufferData s_untypedNullData(nullptr, 0); return &s_untypedNullData; } @@ -479,9 +479,9 @@ const wchar_t *wxString::AsWChar(const wxMBConv& conv) const const size_t lenMB = m_impl.length(); // find out the size of the buffer needed - const size_t lenWC = conv.ToWChar(NULL, 0, strMB, lenMB); + const size_t lenWC = conv.ToWChar(nullptr, 0, strMB, lenMB); if ( lenWC == wxCONV_FAILED ) - return NULL; + return nullptr; // keep the same buffer if the string size didn't change: this is not only // an optimization but also ensure that code which modifies string @@ -496,14 +496,14 @@ const wchar_t *wxString::AsWChar(const wxMBConv& conv) const if ( !m_convertedToWChar.m_str || lenWC != m_convertedToWChar.m_len ) { if ( !const_cast(this)->m_convertedToWChar.Extend(lenWC) ) - return NULL; + return nullptr; } // finally do convert m_convertedToWChar.m_str[lenWC] = L'\0'; if ( conv.ToWChar(m_convertedToWChar.m_str, lenWC, strMB, lenMB) == wxCONV_FAILED ) - return NULL; + return nullptr; return m_convertedToWChar.m_str; } @@ -530,20 +530,20 @@ const char *wxString::AsChar(const wxMBConv& conv) const const size_t lenWC = m_impl.length(); #endif // wxUSE_UNICODE_UTF8/wxUSE_UNICODE_WCHAR - const size_t lenMB = conv.FromWChar(NULL, 0, strWC, lenWC); + const size_t lenMB = conv.FromWChar(nullptr, 0, strWC, lenWC); if ( lenMB == wxCONV_FAILED ) - return NULL; + return nullptr; if ( !m_convertedToChar.m_str || lenMB != m_convertedToChar.m_len ) { if ( !const_cast(this)->m_convertedToChar.Extend(lenMB) ) - return NULL; + return nullptr; } m_convertedToChar.m_str[lenMB] = '\0'; if ( conv.FromWChar(m_convertedToChar.m_str, lenMB, strWC, lenWC) == wxCONV_FAILED ) - return NULL; + return nullptr; return m_convertedToChar.m_str; } @@ -1025,22 +1025,22 @@ size_t wxString::find_first_of(const wxOtherCharType* sz, size_t nStart) const size_t wxString::find_first_of(const wxOtherCharType* sz, size_t nStart, size_t n) const - { return find_first_of(STRCONV(sz, n, NULL), nStart, n); } + { return find_first_of(STRCONV(sz, n, nullptr), nStart, n); } size_t wxString::find_last_of(const wxOtherCharType* sz, size_t nStart) const { return find_last_of(STRCONV(sz), nStart); } size_t wxString::find_last_of(const wxOtherCharType* sz, size_t nStart, size_t n) const - { return find_last_of(STRCONV(sz, n, NULL), nStart, n); } + { return find_last_of(STRCONV(sz, n, nullptr), nStart, n); } size_t wxString::find_first_not_of(const wxOtherCharType* sz, size_t nStart) const { return find_first_not_of(STRCONV(sz), nStart); } size_t wxString::find_first_not_of(const wxOtherCharType* sz, size_t nStart, size_t n) const - { return find_first_not_of(STRCONV(sz, n, NULL), nStart, n); } + { return find_first_not_of(STRCONV(sz, n, nullptr), nStart, n); } size_t wxString::find_last_not_of(const wxOtherCharType* sz, size_t nStart) const { return find_last_not_of(STRCONV(sz), nStart); } size_t wxString::find_last_not_of(const wxOtherCharType* sz, size_t nStart, size_t n) const - { return find_last_not_of(STRCONV(sz, n, NULL), nStart, n); } + { return find_last_not_of(STRCONV(sz, n, nullptr), nStart, n); } #undef wxOtherCharType #undef STRCONV @@ -1236,7 +1236,7 @@ wxString wxString::Mid(size_t nFirst, size_t nCount) const } // check that the string starts with prefix and return the rest of the string -// in the provided pointer if it is not NULL, otherwise return false +// in the provided pointer if it is not null, otherwise return false bool wxString::StartsWith(const wxString& prefix, wxString *rest) const { if ( compare(0, prefix.length(), prefix) != 0 ) @@ -1253,7 +1253,7 @@ bool wxString::StartsWith(const wxString& prefix, wxString *rest) const // check that the string ends with suffix and return the rest of it in the -// provided pointer if it is not NULL, otherwise return false +// provided pointer if it is not null, otherwise return false bool wxString::EndsWith(const wxString& suffix, wxString *rest) const { int start = length() - suffix.length(); @@ -1645,7 +1645,7 @@ int wxString::Find(wxUniChar ch, bool bFromEnd) const // we can use wxStringCharType and wx_str() for maximum efficiency. #define WX_STRING_TO_X_TYPE_START \ - wxCHECK_MSG( pVal, false, wxT("NULL output pointer") ); \ + wxCHECK_MSG( pVal, false, wxT("null output pointer") ); \ errno = 0; \ const wxStringCharType *start = wx_str(); \ wxStringCharType *end; @@ -2193,8 +2193,8 @@ bool wxString::Matches(const wxString& mask) const #endif // the last location where '*' matched - const wxChar *pszLastStarInText = NULL; - const wxChar *pszLastStarInMask = NULL; + const wxChar *pszLastStarInText = nullptr; + const wxChar *pszLastStarInMask = nullptr; match: for ( ; *pszMask != wxT('\0'); pszMask++, pszTxt++ ) { @@ -2226,7 +2226,7 @@ match: size_t uiLenMask; const wxChar *pEndMask = wxStrpbrk(pszMask, wxT("*?")); - if ( pEndMask != NULL ) { + if ( pEndMask != nullptr ) { // we have to match the string between two metachars uiLenMask = pEndMask - pszMask; } @@ -2237,7 +2237,7 @@ match: wxString strToMatch(pszMask, uiLenMask); const wxChar* pMatch = wxStrstr(pszTxt, strToMatch); - if ( pMatch == NULL ) + if ( pMatch == nullptr ) return false; // -1 to compensate "++" in the loop @@ -2262,7 +2262,7 @@ match: pszTxt = pszLastStarInText + 1; pszMask = pszLastStarInMask; - pszLastStarInText = NULL; + pszLastStarInText = nullptr; // don't bother resetting pszLastStarInMask, it's unnecessary diff --git a/src/common/stringimpl.cpp b/src/common/stringimpl.cpp index 33bac108eb..0ab6b7925c 100644 --- a/src/common/stringimpl.cpp +++ b/src/common/stringimpl.cpp @@ -217,7 +217,7 @@ bool wxStringImpl::AllocBuffer(size_t nLen) wxStringData* pData = (wxStringData*) malloc(sizeof(wxStringData) + (nLen + EXTRA_ALLOC + 1)*sizeof(wxStringCharType)); - if ( pData == NULL ) { + if ( pData == nullptr ) { // allocation failures are handled by the caller return false; } @@ -277,7 +277,7 @@ bool wxStringImpl::AllocBeforeWrite(size_t nLen) realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType)); - if ( pData == NULL ) { + if ( pData == nullptr ) { // allocation failures are handled by the caller // keep previous data since reallocation failed return false; @@ -341,7 +341,7 @@ bool wxStringImpl::Alloc(size_t nLen) pData = (wxStringData *) malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType)); - if ( pData == NULL ) { + if ( pData == nullptr ) { // allocation failure handled by caller return false; } @@ -369,7 +369,7 @@ bool wxStringImpl::Alloc(size_t nLen) pData = (wxStringData *) realloc(pData, sizeof(wxStringData) + (nLen + 1)*sizeof(wxStringCharType)); - if ( pData == NULL ) { + if ( pData == nullptr ) { // allocation failure handled by caller // keep previous data since reallocation failed return false; @@ -509,7 +509,7 @@ size_t wxStringImpl::find(wxStringCharType ch, size_t nStart) const const wxStringCharType *p = (const wxStringCharType*) wxStringMemchr(c_str() + nStart, ch, length() - nStart); - return p == NULL ? npos : p - c_str(); + return p == nullptr ? npos : p - c_str(); } size_t wxStringImpl::rfind(const wxStringImpl& str, size_t nStart) const @@ -761,7 +761,7 @@ wxStringCharType *wxStringImpl::DoGetWriteBuf(size_t nLen) { if ( !AllocBeforeWrite(nLen) ) { // allocation failure handled by caller - return NULL; + return nullptr; } wxASSERT( GetStringData()->nRefs == 1 ); diff --git a/src/common/stringops.cpp b/src/common/stringops.cpp index 0eff2189d6..98a9e5e14c 100644 --- a/src/common/stringops.cpp +++ b/src/common/stringops.cpp @@ -128,15 +128,15 @@ bool wxStringOperationsUtf8::IsValidUtf8String(const char *str, size_t len) return true; // empty string is UTF8 string const unsigned char *c = (const unsigned char*)str; - const unsigned char * const end = (len == wxStringImpl::npos) ? NULL : c + len; + const unsigned char * const end = (len == wxStringImpl::npos) ? nullptr : c + len; - for ( ; end != NULL ? c != end : *c; ++c ) + for ( ; end != nullptr ? c != end : *c; ++c ) { unsigned char b = *c; - if ( end != NULL ) + if ( end != nullptr ) { - // if the string is not NULL-terminated, verify we have enough + // if the string is not null-terminated, verify we have enough // bytes in it left for current character's encoding: if ( c + GetUTF8IterOffset(*c) > end ) return false; diff --git a/src/common/strvararg.cpp b/src/common/strvararg.cpp index 3b2d5a2ddd..dc5e8ed9b6 100644 --- a/src/common/strvararg.cpp +++ b/src/common/strvararg.cpp @@ -143,14 +143,14 @@ public: wxFormatConverterBase() { - m_fmtOrig = NULL; - m_fmtLast = NULL; + m_fmtOrig = nullptr; + m_fmtLast = nullptr; m_nCopied = 0; } wxScopedCharTypeBuffer Convert(const CharType *format) { - // this is reset to NULL if we modify the format string + // this is reset to nullptr if we modify the format string m_fmtOrig = format; while ( *format ) @@ -284,7 +284,7 @@ public: } } - // notice that we only translated the string if m_fmtOrig == NULL (as + // notice that we only translated the string if m_fmtOrig == nullptr (as // set by CopyAllBefore()), otherwise we should simply use the original // format if ( m_fmtOrig ) @@ -369,7 +369,7 @@ private: void CopyAllBefore() { - wxASSERT_MSG( m_fmtOrig && m_fmt.data() == NULL, "logic error" ); + wxASSERT_MSG( m_fmtOrig && m_fmt.data() == nullptr, "logic error" ); // the modified format string is guaranteed to be no longer than // 3/2 of the original (worst case: the entire format string consists @@ -386,7 +386,7 @@ private: // we won't need it any longer and resetting it also indicates that we // modified the format - m_fmtOrig = NULL; + m_fmtOrig = nullptr; } static bool IsFlagChar(CharType ch) @@ -700,7 +700,7 @@ wxFormatString::ArgumentType DoGetArgumentType(const CharType *format, return wxFormatString::Arg_Unused; } - wxCHECK_MSG( parser.pspec[n-1] != NULL, wxFormatString::Arg_Unknown, + wxCHECK_MSG( parser.pspec[n-1] != nullptr, wxFormatString::Arg_Unknown, "requested argument not found - invalid format string?" ); switch ( parser.pspec[n-1]->m_type ) diff --git a/src/common/tarstrm.cpp b/src/common/tarstrm.cpp index 7324b3ac3c..688241504a 100644 --- a/src/common/tarstrm.cpp +++ b/src/common/tarstrm.cpp @@ -98,10 +98,10 @@ wxTarClassFactory::wxTarClassFactory() const wxChar * const * wxTarClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *protocols[] = { wxT("tar"), NULL }; - static const wxChar *mimetypes[] = { wxT("application/x-tar"), NULL }; - static const wxChar *fileexts[] = { wxT(".tar"), NULL }; - static const wxChar *empty[] = { NULL }; + static const wxChar *protocols[] = { wxT("tar"), nullptr }; + static const wxChar *mimetypes[] = { wxT("application/x-tar"), nullptr }; + static const wxChar *fileexts[] = { wxT(".tar"), nullptr }; + static const wxChar *empty[] = { nullptr }; switch (type) { case wxSTREAM_PROTOCOL: return protocols; @@ -170,7 +170,7 @@ const wxTarField wxTarHeaderBlock::fields[] = { wxT("devminor"), 337 }, // 8 { wxT("prefix"), 345 }, // 155 { wxT("unused"), 500 }, // 12 - { NULL, TAR_BLOCKSIZE } + { nullptr, TAR_BLOCKSIZE } }; void wxTarHeaderBlock::check() @@ -358,7 +358,7 @@ static wxString wxTarUserName(int uid) if (getpwuid_r(uid, &pw, buf.data(), bufsize, &ppw) == 0 && pw.pw_name) return wxString(pw.pw_name, wxConvLibc); #else - if ((ppw = getpwuid(uid)) != NULL) + if ((ppw = getpwuid(uid)) != nullptr) return wxString(ppw->pw_name, wxConvLibc); #endif return _("unknown"); @@ -381,7 +381,7 @@ static wxString wxTarGroupName(int gid) if (getgrgid_r(gid, &gr, buf.data(), bufsize, &pgr) == 0 && gr.gr_name) return wxString(gr.gr_name, wxConvLibc); #else - if ((pgr = getgrgid(gid)) != NULL) + if ((pgr = getgrgid(gid)) != nullptr) return wxString(pgr->gr_name, wxConvLibc); #endif return _("unknown"); @@ -569,7 +569,7 @@ void wxTarEntry::SetName(const wxString& name, wxPathFormat format) // wxString wxTarEntry::GetInternalName(const wxString& name, wxPathFormat format /*=wxPATH_NATIVE*/, - bool *pIsDir /*=NULL*/) + bool *pIsDir /*=nullptr*/) { wxString internal; @@ -658,8 +658,8 @@ void wxTarInputStream::Init() m_sumType = SUM_UNKNOWN; m_tarType = TYPE_USTAR; m_hdr = new wxTarHeaderBlock; - m_HeaderRecs = NULL; - m_GlobalHeaderRecs = NULL; + m_HeaderRecs = nullptr; + m_GlobalHeaderRecs = nullptr; m_lasterror = m_parent_i_stream->GetLastError(); } @@ -675,7 +675,7 @@ wxTarEntry *wxTarInputStream::GetNextEntry() m_lasterror = ReadHeaders(); if (!IsOk()) - return NULL; + return nullptr; wxTarEntryPtr entry(new wxTarEntry); @@ -1076,8 +1076,8 @@ void wxTarOutputStream::Init(wxTarFormat format) m_chksum = 0; m_large = false; m_hdr = new wxTarHeaderBlock; - m_hdr2 = NULL; - m_extendedHdr = NULL; + m_hdr2 = nullptr; + m_extendedHdr = nullptr; m_extendedSize = 0; m_lasterror = m_parent_o_stream->GetLastError(); m_endrecWritten = false; @@ -1122,7 +1122,7 @@ bool wxTarOutputStream::PutNextEntry(wxTarEntry *entry) // pax does now allow data for wxTAR_LNKTYPE if (!m_pax || typeflag != wxTAR_LNKTYPE) - if (strchr(nodata, typeflag) != NULL) + if (strchr(nodata, typeflag) != nullptr) CloseEntry(); } diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index cb83f208f6..1ef80ae35d 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -177,7 +177,7 @@ wxToolBarToolBase *wxToolBarBase::InsertTool(size_t pos, const wxString& longHelp, wxObject *clientData) { - wxCHECK_MSG( pos <= GetToolsCount(), NULL, + wxCHECK_MSG( pos <= GetToolsCount(), nullptr, wxT("invalid position in wxToolBar::InsertTool()") ); return DoInsertNewTool(pos, CreateTool(toolid, label, bitmap, bmpDisabled, kind, @@ -192,12 +192,12 @@ wxToolBarToolBase *wxToolBarBase::AddTool(wxToolBarToolBase *tool) wxToolBarToolBase * wxToolBarBase::InsertTool(size_t pos, wxToolBarToolBase *tool) { - wxCHECK_MSG( pos <= GetToolsCount(), NULL, + wxCHECK_MSG( pos <= GetToolsCount(), nullptr, wxT("invalid position in wxToolBar::InsertTool()") ); if ( !tool || !DoInsertTool(pos, tool) ) { - return NULL; + return nullptr; } m_tools.Insert(pos, tool); @@ -217,10 +217,10 @@ wxToolBarBase::InsertControl(size_t pos, wxControl *control, const wxString& label) { - wxCHECK_MSG( control, NULL, - wxT("toolbar: can't insert NULL control") ); + wxCHECK_MSG( control, nullptr, + wxT("toolbar: can't insert null control") ); - wxCHECK_MSG( control->GetParent() == this, NULL, + wxCHECK_MSG( control->GetParent() == this, nullptr, wxT("control must have toolbar as parent") ); return DoInsertNewTool(pos, CreateTool(control, label)); @@ -239,7 +239,7 @@ wxControl *wxToolBarBase::FindControl( int toolid ) if ( !control ) { - wxFAIL_MSG( wxT("NULL control in toolbar?") ); + wxFAIL_MSG( wxT("null control in toolbar?") ); } else if ( control->GetId() == toolid ) { @@ -249,7 +249,7 @@ wxControl *wxToolBarBase::FindControl( int toolid ) } } - return NULL; + return nullptr; } wxToolBarToolBase *wxToolBarBase::AddSeparator() @@ -300,14 +300,14 @@ wxToolBarToolBase *wxToolBarBase::RemoveTool(int toolid) { // don't give any error messages - sometimes we might call RemoveTool() // without knowing whether the tool is or not in the toolbar - return NULL; + return nullptr; } wxToolBarToolBase *tool = node->GetData(); - wxCHECK_MSG( tool, NULL, "NULL tool in the tools list?" ); + wxCHECK_MSG( tool, nullptr, "null tool in the tools list?" ); if ( !DoDeleteTool(pos, tool) ) - return NULL; + return nullptr; m_tools.Erase(node); @@ -359,7 +359,7 @@ bool wxToolBarBase::DeleteTool(int toolid) wxToolBarToolBase *wxToolBarBase::FindById(int toolid) const { - wxToolBarToolBase *tool = NULL; + wxToolBarToolBase *tool = nullptr; for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; @@ -372,7 +372,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int toolid) const break; } - tool = NULL; + tool = nullptr; } return tool; @@ -380,7 +380,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int toolid) const void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool) { - wxCHECK_RET( tool, wxT("NULL tool in wxToolBarTool::UnToggleRadioGroup") ); + wxCHECK_RET( tool, wxT("null tool in wxToolBarTool::UnToggleRadioGroup") ); if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) return; @@ -536,7 +536,7 @@ wxToolBarBase::~wxToolBarBase() wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame && frame->GetToolBar() == this ) { - frame->SetToolBar(NULL); + frame->SetToolBar(nullptr); } } @@ -603,7 +603,7 @@ wxObject *wxToolBarBase::GetToolClientData(int toolid) const { wxToolBarToolBase *tool = FindById(toolid); - return tool ? tool->GetClientData() : NULL; + return tool ? tool->GetClientData() : nullptr; } void wxToolBarBase::SetToolClientData(int toolid, wxObject *clientData) diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index 01261b9fa6..a9c1d8b714 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -340,7 +340,7 @@ struct ForceUpperFunctor { // This class must have default ctor in wxNO_RTTI case, so allow creating // it with null entry even if this never actually happens in practice. - explicit ForceUpperFunctor(wxTextEntryBase* entry = NULL) + explicit ForceUpperFunctor(wxTextEntryBase* entry = nullptr) : m_entry(entry) { } @@ -410,7 +410,7 @@ bool wxTextEntryBase::SetHint(const wxString& hint) { // Setting empty hint removes any currently set one. delete m_hintData; - m_hintData = NULL; + m_hintData = nullptr; } //else: Setting empty hint when we don't have any doesn't do anything. diff --git a/src/common/textmeasurecmn.cpp b/src/common/textmeasurecmn.cpp index 84ba1890f8..4ee0301f5e 100644 --- a/src/common/textmeasurecmn.cpp +++ b/src/common/textmeasurecmn.cpp @@ -31,7 +31,7 @@ wxTextMeasureBase::wxTextMeasureBase(const wxDC *dc, const wxFont *theFont) : m_dc(dc), - m_win(NULL), + m_win(nullptr), m_font(theFont) { wxASSERT_MSG( dc, wxS("wxTextMeasure needs a valid wxDC") ); @@ -42,7 +42,7 @@ wxTextMeasureBase::wxTextMeasureBase(const wxDC *dc, const wxFont *theFont) } wxTextMeasureBase::wxTextMeasureBase(const wxWindow *win, const wxFont *theFont) - : m_dc(NULL), + : m_dc(nullptr), m_win(win), m_font(theFont) { @@ -238,7 +238,7 @@ bool wxTextMeasureBase::GetPartialTextExtents(const wxString& text, class FontWidthCache { public: - FontWidthCache() : m_scaleX(1), m_widths(NULL) { } + FontWidthCache() : m_scaleX(1), m_widths(nullptr) { } ~FontWidthCache() { delete []m_widths; } void Reset() diff --git a/src/common/threadinfo.cpp b/src/common/threadinfo.cpp index f6d3e3b30f..17fc9d612a 100644 --- a/src/common/threadinfo.cpp +++ b/src/common/threadinfo.cpp @@ -83,7 +83,7 @@ void wxThreadSpecificInfo::ThreadCleanUp() if ( i->get() == wxTHIS_THREAD_INFO ) { GetAllThreadInfos().erase(i); - wxTHIS_THREAD_INFO = NULL; + wxTHIS_THREAD_INFO = nullptr; break; } } diff --git a/src/common/time.cpp b/src/common/time.cpp index 478bcf2c8e..2ad2d9ad6d 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -89,7 +89,7 @@ struct tm *wxLocaltime_r(const time_t* ticks, struct tm* temp) const tm * const t = localtime(ticks); if ( !t ) - return NULL; + return nullptr; memcpy(temp, t, sizeof(struct tm)); return temp; @@ -107,7 +107,7 @@ struct tm *wxGmtime_r(const time_t* ticks, struct tm* temp) const tm * const t = gmtime(ticks); if ( !t ) - return NULL; + return nullptr; memcpy(temp, gmtime(ticks), sizeof(struct tm)); return temp; @@ -128,7 +128,7 @@ int wxGetTimeZone() { // just call wxLocaltime_r() instead of figuring out whether this // system supports tzset(), _tzset() or something else - time_t t = time(NULL); + time_t t = time(nullptr); struct tm tm; wxLocaltime_r(&t, &tm); @@ -213,7 +213,7 @@ long wxGetLocalTime() // Get UTC time as seconds since 00:00:00, Jan 1st 1970 long wxGetUTCTime() { - return (long)time(NULL); + return (long)time(nullptr); } #if wxUSE_LONGLONG diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index 943ef10ec7..820a0b3b52 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -55,7 +55,7 @@ wxTimer::~wxTimer() void wxTimer::Init() { wxAppTraits * const traits = wxApp::GetTraitsIfExists(); - m_impl = traits ? traits->CreateTimerImpl(this) : NULL; + m_impl = traits ? traits->CreateTimerImpl(this) : nullptr; if ( !m_impl ) { wxFAIL_MSG( wxT("No timer implementation for this platform") ); @@ -76,7 +76,7 @@ void wxTimer::SetOwner(wxEvtHandler *owner, int timerid) wxEvtHandler *wxTimer::GetOwner() const { - wxCHECK_MSG( m_impl, NULL, wxT("uninitialized timer") ); + wxCHECK_MSG( m_impl, nullptr, wxT("uninitialized timer") ); return m_impl->GetOwner(); } diff --git a/src/common/timerimpl.cpp b/src/common/timerimpl.cpp index 055014d92f..e80cb6bfde 100644 --- a/src/common/timerimpl.cpp +++ b/src/common/timerimpl.cpp @@ -30,7 +30,7 @@ wxTimerImpl::wxTimerImpl(wxTimer *timer) { m_timer = timer; - m_owner = NULL; + m_owner = nullptr; m_idTimer = wxID_ANY; m_milli = 0; m_oneShot = false; diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index 9889abc8cd..17c951e1ca 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -59,7 +59,7 @@ wxTopLevelWindowBase::~wxTopLevelWindowBase() { // don't let wxTheApp keep any stale pointers to us if ( wxTheApp && wxTheApp->GetTopWindow() == this ) - wxTheApp->SetTopWindow(NULL); + wxTheApp->SetTopWindow(nullptr); wxTopLevelWindows.DeleteObject(this); @@ -218,14 +218,14 @@ wxSize wxTopLevelWindowBase::GetDefaultSize() // size with DPI on the large screens to avoid creating windows too small // to fit anything at all when using high DPI if ( size.x >= 1024 ) - size.x = FromDIP(400, NULL /* no window */); + size.x = FromDIP(400, nullptr /* no window */); else if ( size.x >= 800 ) size.x = 300; else if ( size.x >= 320 ) size.x = 240; if ( size.y >= 768 ) - size.y = FromDIP(250, NULL /* no window */); + size.y = FromDIP(250, nullptr /* no window */); else if ( size.y > 200 ) { size.y *= 2; @@ -433,7 +433,7 @@ bool wxTopLevelWindowBase::Layout() else { // do we have _exactly_ one child? - wxWindow *child = NULL; + wxWindow *child = nullptr; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) diff --git a/src/common/translation.cpp b/src/common/translation.cpp index f62b1a7008..a701338720 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -395,7 +395,7 @@ class wxPluralFormsNode; class wxPluralFormsNodePtr { public: - wxPluralFormsNodePtr(wxPluralFormsNode *p = NULL) : m_p(p) {} + wxPluralFormsNodePtr(wxPluralFormsNode *p = nullptr) : m_p(p) {} ~wxPluralFormsNodePtr(); wxPluralFormsNode& operator*() const { return *m_p; } wxPluralFormsNode* operator->() const { return m_p; } @@ -430,7 +430,7 @@ wxPluralFormsNodePtr::~wxPluralFormsNodePtr() wxPluralFormsNode* wxPluralFormsNodePtr::release() { wxPluralFormsNode *p = m_p; - m_p = NULL; + m_p = nullptr; return p; } void wxPluralFormsNodePtr::reset(wxPluralFormsNode *p) @@ -506,7 +506,7 @@ wxPluralFormsNode::evaluate(wxPluralFormsToken::Number n) const class wxPluralFormsCalculator { public: - wxPluralFormsCalculator() : m_nplurals(0), m_plural(0) {} + wxPluralFormsCalculator() : m_nplurals(0), m_plural(nullptr) {} // input: number, returns msgstr index int evaluate(int n) const; @@ -514,7 +514,7 @@ public: // input: text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"), // if s == 0, creates default handler // returns 0 if error - static wxPluralFormsCalculator* make(const char* s = 0); + static wxPluralFormsCalculator* make(const char* s = nullptr); ~wxPluralFormsCalculator() {} @@ -536,7 +536,7 @@ void wxPluralFormsCalculator::init(wxPluralFormsToken::Number nplurals, int wxPluralFormsCalculator::evaluate(int n) const { - if (m_plural.get() == 0) + if (m_plural.get() == nullptr) { return 0; } @@ -599,7 +599,7 @@ bool wxPluralFormsParser::parse(wxPluralFormsCalculator& rCalculator) if (!nextToken()) return false; wxPluralFormsNode* plural = parsePlural(); - if (plural == 0) + if (plural == nullptr) return false; if (token().type() != wxPluralFormsToken::T_SEMICOLON) return false; @@ -614,14 +614,14 @@ bool wxPluralFormsParser::parse(wxPluralFormsCalculator& rCalculator) wxPluralFormsNode* wxPluralFormsParser::parsePlural() { wxPluralFormsNode* p = expression(); - if (p == NULL) + if (p == nullptr) { - return NULL; + return nullptr; } wxPluralFormsNodePtr n(p); if (token().type() != wxPluralFormsToken::T_SEMICOLON) { - return NULL; + return nullptr; } return n.release(); } @@ -641,34 +641,34 @@ bool wxPluralFormsParser::nextToken() wxPluralFormsNode* wxPluralFormsParser::expression() { wxPluralFormsNode* p = logicalOrExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr n(p); if (token().type() == wxPluralFormsToken::T_QUESTION) { wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); if (!nextToken()) { - return 0; + return nullptr; } p = expression(); - if (p == 0) + if (p == nullptr) { - return 0; + return nullptr; } qn->setNode(1, p); if (token().type() != wxPluralFormsToken::T_COLON) { - return 0; + return nullptr; } if (!nextToken()) { - return 0; + return nullptr; } p = expression(); - if (p == 0) + if (p == nullptr) { - return 0; + return nullptr; } qn->setNode(2, p); qn->setNode(0, n.release()); @@ -680,20 +680,20 @@ wxPluralFormsNode* wxPluralFormsParser::expression() wxPluralFormsNode*wxPluralFormsParser::logicalOrExpression() { wxPluralFormsNode* p = logicalAndExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr ln(p); if (token().type() == wxPluralFormsToken::T_LOGICAL_OR) { wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); if (!nextToken()) { - return 0; + return nullptr; } p = logicalOrExpression(); - if (p == 0) + if (p == nullptr) { - return 0; + return nullptr; } wxPluralFormsNodePtr rn(p); // right if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_OR) @@ -716,20 +716,20 @@ wxPluralFormsNode*wxPluralFormsParser::logicalOrExpression() wxPluralFormsNode* wxPluralFormsParser::logicalAndExpression() { wxPluralFormsNode* p = equalityExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr ln(p); // left if (token().type() == wxPluralFormsToken::T_LOGICAL_AND) { wxPluralFormsNodePtr un(new wxPluralFormsNode(token())); // up if (!nextToken()) { - return NULL; + return nullptr; } p = logicalAndExpression(); - if (p == 0) + if (p == nullptr) { - return NULL; + return nullptr; } wxPluralFormsNodePtr rn(p); // right if (rn->token().type() == wxPluralFormsToken::T_LOGICAL_AND) @@ -754,8 +754,8 @@ wxPluralFormsNode* wxPluralFormsParser::logicalAndExpression() wxPluralFormsNode* wxPluralFormsParser::equalityExpression() { wxPluralFormsNode* p = relationalExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr n(p); if (token().type() == wxPluralFormsToken::T_EQUAL || token().type() == wxPluralFormsToken::T_NOT_EQUAL) @@ -763,12 +763,12 @@ wxPluralFormsNode* wxPluralFormsParser::equalityExpression() wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); if (!nextToken()) { - return NULL; + return nullptr; } p = relationalExpression(); - if (p == NULL) + if (p == nullptr) { - return NULL; + return nullptr; } qn->setNode(1, p); qn->setNode(0, n.release()); @@ -780,8 +780,8 @@ wxPluralFormsNode* wxPluralFormsParser::equalityExpression() wxPluralFormsNode* wxPluralFormsParser::relationalExpression() { wxPluralFormsNode* p = multiplicativeExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr n(p); if (token().type() == wxPluralFormsToken::T_GREATER || token().type() == wxPluralFormsToken::T_LESS @@ -791,12 +791,12 @@ wxPluralFormsNode* wxPluralFormsParser::relationalExpression() wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); if (!nextToken()) { - return NULL; + return nullptr; } p = multiplicativeExpression(); - if (p == NULL) + if (p == nullptr) { - return NULL; + return nullptr; } qn->setNode(1, p); qn->setNode(0, n.release()); @@ -808,20 +808,20 @@ wxPluralFormsNode* wxPluralFormsParser::relationalExpression() wxPluralFormsNode* wxPluralFormsParser::multiplicativeExpression() { wxPluralFormsNode* p = pmExpression(); - if (p == NULL) - return NULL; + if (p == nullptr) + return nullptr; wxPluralFormsNodePtr n(p); if (token().type() == wxPluralFormsToken::T_REMINDER) { wxPluralFormsNodePtr qn(new wxPluralFormsNode(token())); if (!nextToken()) { - return NULL; + return nullptr; } p = pmExpression(); - if (p == NULL) + if (p == nullptr) { - return NULL; + return nullptr; } qn->setNode(1, p); qn->setNode(0, n.release()); @@ -839,32 +839,32 @@ wxPluralFormsNode* wxPluralFormsParser::pmExpression() n.reset(new wxPluralFormsNode(token())); if (!nextToken()) { - return NULL; + return nullptr; } } else if (token().type() == wxPluralFormsToken::T_LEFT_BRACKET) { if (!nextToken()) { - return NULL; + return nullptr; } wxPluralFormsNode* p = expression(); - if (p == NULL) + if (p == nullptr) { - return NULL; + return nullptr; } n.reset(p); if (token().type() != wxPluralFormsToken::T_RIGHT_BRACKET) { - return NULL; + return nullptr; } if (!nextToken()) { - return NULL; + return nullptr; } } else { - return NULL; + return nullptr; } return n.release(); } @@ -872,13 +872,13 @@ wxPluralFormsNode* wxPluralFormsParser::pmExpression() wxPluralFormsCalculator* wxPluralFormsCalculator::make(const char* s) { wxPluralFormsCalculatorPtr calculator(new wxPluralFormsCalculator); - if (s != NULL) + if (s != nullptr) { wxPluralFormsScanner scanner(s); wxPluralFormsParser p(scanner); if (!p.parse(*calculator)) { - return NULL; + return nullptr; } } return calculator.release(); @@ -968,7 +968,7 @@ private: size_t32 ofsString = Swap(ent->ofsString); if ( ofsString + Swap(ent->nLen) > m_data.length()) { - return NULL; + return nullptr; } return m_data.data() + ofsString; @@ -1126,7 +1126,7 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash, wxUnusedVar(domain); // silence warning in Unicode build // conversion to use to convert catalog strings to the GUI encoding - wxMBConv *inputConv = NULL; + wxMBConv *inputConv = nullptr; wxScopedPtr inputConvPtr; // just to delete inputConv if needed @@ -1252,10 +1252,10 @@ wxMsgCatalog *wxMsgCatalog::CreateFromFile(const wxString& filename, wxMsgCatalogFile file; if ( !file.LoadFile(filename, cat->m_pluralFormsCalculator) ) - return NULL; + return nullptr; if ( !file.FillHash(cat->m_messages, domain) ) - return NULL; + return nullptr; return cat.release(); } @@ -1269,10 +1269,10 @@ wxMsgCatalog *wxMsgCatalog::CreateFromData(const wxScopedCharBuffer& data, wxMsgCatalogFile file; if ( !file.LoadData(data, cat->m_pluralFormsCalculator) ) - return NULL; + return nullptr; if ( !file.FillHash(cat->m_messages, domain) ) - return NULL; + return nullptr; return cat.release(); } @@ -1305,7 +1305,7 @@ const wxString *wxMsgCatalog::GetString(const wxString& str, unsigned n, const w return &i->second; } else - return NULL; + return nullptr; } @@ -1316,7 +1316,7 @@ const wxString *wxMsgCatalog::GetString(const wxString& str, unsigned n, const w namespace { -wxTranslations *gs_translations = NULL; +wxTranslations *gs_translations = nullptr; bool gs_translationsOwned = false; } // anonymous namespace @@ -1349,7 +1349,7 @@ void wxTranslations::SetNonOwned(wxTranslations *t) wxTranslations::wxTranslations() { - m_pMsgCat = NULL; + m_pMsgCat = nullptr; m_loader = new wxFileTranslationsLoader; } @@ -1359,7 +1359,7 @@ wxTranslations::~wxTranslations() delete m_loader; // free catalogs memory - while ( m_pMsgCat != NULL ) + while ( m_pMsgCat != nullptr ) { wxMsgCatalog* pTmpCat; pTmpCat = m_pMsgCat; @@ -1371,7 +1371,7 @@ wxTranslations::~wxTranslations() void wxTranslations::SetLoader(wxTranslationsLoader *loader) { - wxCHECK_RET( loader, "loader can't be NULL" ); + wxCHECK_RET( loader, "loader can't be null" ); delete m_loader; m_loader = loader; @@ -1394,7 +1394,7 @@ void wxTranslations::SetLanguage(const wxString& lang) wxArrayString wxTranslations::GetAvailableTranslations(const wxString& domain) const { - wxCHECK_MSG( m_loader, wxArrayString(), "loader can't be NULL" ); + wxCHECK_MSG( m_loader, wxArrayString(), "loader can't be null" ); return m_loader->GetAvailableTranslations(domain); } @@ -1449,9 +1449,9 @@ bool wxTranslations::AddCatalog(const wxString& domain, bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang, const wxString& msgIdLang) { - wxCHECK_MSG( m_loader, false, "loader can't be NULL" ); + wxCHECK_MSG( m_loader, false, "loader can't be null" ); - wxMsgCatalog *cat = NULL; + wxMsgCatalog *cat = nullptr; #if wxUSE_FONTMAP // first look for the catalog for this language and the current locale: @@ -1517,7 +1517,7 @@ bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang, c // check if the given catalog is loaded bool wxTranslations::IsLoaded(const wxString& domain) const { - return FindCatalog(domain) != NULL; + return FindCatalog(domain) != nullptr; } wxString wxTranslations::GetBestTranslation(const wxString& domain, @@ -1573,9 +1573,9 @@ const wxString *wxTranslations::GetTranslatedString(const wxString& origString, const wxString& context) const { if ( origString.empty() ) - return NULL; + return nullptr; - const wxString *trans = NULL; + const wxString *trans = nullptr; wxMsgCatalog *pMsgCat; if ( !domain.empty() ) @@ -1583,21 +1583,21 @@ const wxString *wxTranslations::GetTranslatedString(const wxString& origString, pMsgCat = FindCatalog(domain); // does the catalog exist? - if ( pMsgCat != NULL ) + if ( pMsgCat != nullptr ) trans = pMsgCat->GetString(origString, n, context); } else { // search in all domains - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) + for ( pMsgCat = m_pMsgCat; pMsgCat != nullptr; pMsgCat = pMsgCat->m_pNext ) { trans = pMsgCat->GetString(origString, n, context); - if ( trans != NULL ) // take the first found + if ( trans != nullptr ) // take the first found break; } } - if ( trans == NULL ) + if ( trans == nullptr ) { wxLogTrace ( @@ -1620,7 +1620,7 @@ wxString wxTranslations::GetHeaderValue(const wxString& header, if ( header.empty() ) return wxEmptyString; - const wxString *trans = NULL; + const wxString *trans = nullptr; wxMsgCatalog *pMsgCat; if ( !domain.empty() ) @@ -1628,7 +1628,7 @@ wxString wxTranslations::GetHeaderValue(const wxString& header, pMsgCat = FindCatalog(domain); // does the catalog exist? - if ( pMsgCat == NULL ) + if ( pMsgCat == nullptr ) return wxEmptyString; trans = pMsgCat->GetString(wxEmptyString, UINT_MAX); @@ -1636,10 +1636,10 @@ wxString wxTranslations::GetHeaderValue(const wxString& header, else { // search in all domains - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) + for ( pMsgCat = m_pMsgCat; pMsgCat != nullptr; pMsgCat = pMsgCat->m_pNext ) { trans = pMsgCat->GetString(wxEmptyString, UINT_MAX); - if ( trans != NULL ) // take the first found + if ( trans != nullptr ) // take the first found break; } } @@ -1668,7 +1668,7 @@ wxMsgCatalog *wxTranslations::FindCatalog(const wxString& domain) const { const wxMsgCatalogMap::const_iterator found = m_catalogMap.find(domain); - return found == m_catalogMap.end() ? NULL : found->second; + return found == m_catalogMap.end() ? nullptr : found->second; } // ---------------------------------------------------------------------------- @@ -1817,7 +1817,7 @@ wxMsgCatalog *wxFileTranslationsLoader::LoadCatalog(const wxString& domain, wxString strFullName; if ( !wxFindFileInPath(&strFullName, searchPath, fn.GetFullPath()) ) - return NULL; + return nullptr; // open file and read its data wxLogVerbose(_("using catalog '%s' from '%s'."), domain, strFullName); @@ -1883,7 +1883,7 @@ wxArrayString wxFileTranslationsLoader::GetAvailableTranslations(const wxString& wxMsgCatalog *wxResourceTranslationsLoader::LoadCatalog(const wxString& domain, const wxString& lang) { - const void *mo_data = NULL; + const void *mo_data = nullptr; size_t mo_size = 0; // Language may contain non-alphabetic characters that are not allowed in the @@ -1902,7 +1902,7 @@ wxMsgCatalog *wxResourceTranslationsLoader::LoadCatalog(const wxString& domain, resname, GetResourceType().t_str(), GetModule()) ) - return NULL; + return nullptr; wxLogTrace(TRACE_I18N, "Using catalog from Windows resource \"%s\".", resname); @@ -1991,7 +1991,7 @@ public: { if ( gs_translationsOwned ) delete gs_translations; - gs_translations = NULL; + gs_translations = nullptr; gs_translationsOwned = true; } }; diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index be0f188c3f..91feeaad67 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -141,7 +141,7 @@ wxTreeEvent::wxTreeEvent(wxEventType commandType, wxTreeEvent::wxTreeEvent(wxEventType commandType, int id) : wxNotifyEvent(commandType, id) { - m_itemOld = 0l; + m_itemOld = nullptr; m_editCancelled = false; } diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index 4bf9214cae..1aa666e6df 100644 --- a/src/common/txtstrm.cpp +++ b/src/common/txtstrm.cpp @@ -636,7 +636,7 @@ wxTextOutputStream& wxTextOutputStream::PutChar(wxChar c) void wxTextOutputStream::Flush() { #if wxUSE_UNICODE - const size_t len = m_conv->FromWChar(NULL, 0, L"", 1); + const size_t len = m_conv->FromWChar(nullptr, 0, L"", 1); if ( len > m_conv->GetMBNulLen() ) { wxCharBuffer buf(len); diff --git a/src/common/uiactioncmn.cpp b/src/common/uiactioncmn.cpp index e110af9142..8fb4ab27aa 100644 --- a/src/common/uiactioncmn.cpp +++ b/src/common/uiactioncmn.cpp @@ -189,7 +189,7 @@ bool wxUIActionSimulator::Select(const wxString& text) // We can only select something in controls inheriting from // wxItemContainer, so check that we have it. #ifdef wxNO_RTTI - wxItemContainer* container = NULL; + wxItemContainer* container = nullptr; if ( wxComboBox* combo = wxDynamicCast(focus, wxComboBox) ) container = combo; diff --git a/src/common/uilocale.cpp b/src/common/uilocale.cpp index 01d2e2ece3..69846c2274 100644 --- a/src/common/uilocale.cpp +++ b/src/common/uilocale.cpp @@ -474,7 +474,7 @@ bool wxUILocale::UseDefault() /* static */ bool wxUILocale::UseLocaleName(const wxString& localeName) { - wxUILocaleImpl* impl = NULL; + wxUILocaleImpl* impl = nullptr; if (IsDefaultCLocale(localeName)) { impl = wxUILocaleImpl::CreateStdC(); @@ -522,7 +522,7 @@ wxUILocale::wxUILocale(const wxLocaleIdent& localeId) if ( localeId.IsEmpty() ) { wxFAIL_MSG( "Locale identifier must be initialized" ); - m_impl = NULL; + m_impl = nullptr; return; } @@ -550,7 +550,7 @@ wxUILocale& wxUILocale::operator=(const wxUILocale& loc) bool wxUILocale::IsSupported() const { - return m_impl != NULL; + return m_impl != nullptr; } wxString wxUILocale::GetName() const @@ -702,7 +702,7 @@ const wxLanguageInfo* wxUILocale::GetLanguageInfo(int lang) lang = GetSystemLanguage(); if (lang == wxLANGUAGE_UNKNOWN) - return NULL; + return nullptr; const wxLanguageInfos& languagesDB = wxGetLanguageInfos(); const size_t count = languagesDB.size(); @@ -712,7 +712,7 @@ const wxLanguageInfo* wxUILocale::GetLanguageInfo(int lang) return &languagesDB[i]; } - return NULL; + return nullptr; } /* static */ @@ -749,7 +749,7 @@ wxString wxUILocale::GetLanguageCanonicalName(int lang) const wxLanguageInfo* wxUILocale::FindLanguageInfo(const wxString& localeOrig) { if (localeOrig.empty()) - return NULL; + return nullptr; CreateLanguagesDB(); @@ -771,7 +771,7 @@ const wxLanguageInfo* wxUILocale::FindLanguageInfo(const wxString& localeOrig) language << " (" << region << ")"; } - const wxLanguageInfo* infoRet = NULL; + const wxLanguageInfo* infoRet = nullptr; const wxLanguageInfos& languagesDB = wxGetLanguageInfos(); const size_t count = languagesDB.size(); @@ -808,11 +808,11 @@ const wxLanguageInfo* wxUILocale::FindLanguageInfo(const wxString& localeOrig) const wxLanguageInfo* wxUILocale::FindLanguageInfo(const wxLocaleIdent& locId) { if (locId.IsEmpty()) - return NULL; + return nullptr; CreateLanguagesDB(); - const wxLanguageInfo* infoRet = NULL; + const wxLanguageInfo* infoRet = nullptr; wxString localeTag = locId.GetTag(wxLOCALE_TAGTYPE_BCP47); if (IsDefaultCLocale(locId.GetLanguage())) { diff --git a/src/common/unictabl.inc b/src/common/unictabl.inc index 2993424abc..8a80f0c540 100644 --- a/src/common/unictabl.inc +++ b/src/common/unictabl.inc @@ -893,5 +893,5 @@ static const struct { { wxFONTENCODING_KOI8, encoding_table__KOI8}, { wxFONTENCODING_KOI8_U, encoding_table__KOI8_U}, { wxFONTENCODING_CP866, encoding_table__CP866}, - {wxFONTENCODING_MAX /*anything*/, NULL} + {wxFONTENCODING_MAX /*anything*/, nullptr} }; diff --git a/src/common/url.cpp b/src/common/url.cpp index 4d4ccff22d..89ff71840d 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -29,7 +29,7 @@ wxIMPLEMENT_CLASS(wxURL, wxURI); // Protocols list -wxProtoInfo *wxURL::ms_protocols = NULL; +wxProtoInfo *wxURL::ms_protocols = nullptr; // Enforce linking of protocol classes: USE_PROTOCOL(wxFileProto) @@ -37,7 +37,7 @@ USE_PROTOCOL(wxFileProto) #if wxUSE_PROTOCOL_HTTP USE_PROTOCOL(wxHTTP) - wxHTTP *wxURL::ms_proxyDefault = NULL; + wxHTTP *wxURL::ms_proxyDefault = nullptr; bool wxURL::ms_useDefaultProxy = false; #endif @@ -75,7 +75,7 @@ wxURL::wxURL(const wxURL& url) : wxURI(url) void wxURL::Init(const wxString& url) { - m_protocol = NULL; + m_protocol = nullptr; m_error = wxURL_NOERR; m_url = url; #if wxUSE_URL_NATIVE @@ -94,7 +94,7 @@ void wxURL::Init(const wxString& url) } } - m_useProxy = ms_proxyDefault != NULL; + m_useProxy = ms_proxyDefault != nullptr; m_proxy = ms_proxyDefault; #endif // wxUSE_PROTOCOL_HTTP @@ -148,7 +148,7 @@ wxURL& wxURL::operator = (const wxURL& url) bool wxURL::ParseURL() { - // If the URL was already parsed (m_protocol != NULL), pass this section. + // If the URL was already parsed (m_protocol != nullptr), pass this section. if (!m_protocol) { // Clean up @@ -213,7 +213,7 @@ void wxURL::CleanData() { // Need to safely delete the socket (pending events) m_protocol->Destroy(); - m_protocol = NULL; + m_protocol = nullptr; } } } @@ -267,7 +267,7 @@ wxInputStream *wxURL::GetInputStream() if (!m_protocol) { m_error = wxURL_NOPROTO; - return NULL; + return nullptr; } m_error = wxURL_NOERR; @@ -300,7 +300,7 @@ wxInputStream *wxURL::GetInputStream() #if wxUSE_SOCKETS wxIPV4address addr; - // m_protoinfo is NULL when we use a proxy + // m_protoinfo is null when we use a proxy if ( #if wxUSE_PROTOCOL_HTTP !m_useProxy && @@ -310,7 +310,7 @@ wxInputStream *wxURL::GetInputStream() if (!addr.Hostname(m_server)) { m_error = wxURL_NOHOST; - return NULL; + return nullptr; } addr.Service(m_port); @@ -318,7 +318,7 @@ wxInputStream *wxURL::GetInputStream() if (!m_protocol->Connect(addr)) { m_error = wxURL_CONNERR; - return NULL; + return nullptr; } } #endif // wxUSE_SOCKETS @@ -347,7 +347,7 @@ wxInputStream *wxURL::GetInputStream() if (!the_i_stream) { m_error = wxURL_PROTOERR; - return NULL; + return nullptr; } return the_i_stream; diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index ac43c067a8..bfd8158f14 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -164,7 +164,7 @@ wxString wxDecToHex(unsigned char dec) // Return the current date/time wxString wxNow() { - time_t now = time(NULL); + time_t now = time(nullptr); char *date = ctime(&now); date[24] = '\0'; return wxString::FromAscii(date); @@ -213,7 +213,7 @@ bool wxIsPlatformLittleEndian() * Class to make it easier to specify platform-dependent values */ -wxArrayInt* wxPlatform::sm_customPlatforms = NULL; +wxArrayInt* wxPlatform::sm_customPlatforms = nullptr; void wxPlatform::Copy(const wxPlatform& platform) { @@ -480,7 +480,7 @@ wxString wxGetCurrentDir() bool ok; do { - ok = getcwd(dir.GetWriteBuf(len + 1), len) != NULL; + ok = getcwd(dir.GetWriteBuf(len + 1), len) != nullptr; dir.UngetWriteBuf(); if ( !ok ) @@ -517,7 +517,7 @@ wxString wxGetCurrentDir() bool wxGetEnvMap(wxEnvVariableHashMap *map) { - wxCHECK_MSG( map, false, wxS("output pointer can't be NULL") ); + wxCHECK_MSG( map, false, wxS("output pointer can't be null") ); #if defined(__VISUALC__) // This variable only exists to force the CRT to fill the wide char array, @@ -529,7 +529,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) #elif defined(__VMS) // Now this routine wil give false for OpenVMS // TODO : should we do something with logicals? - char **env=NULL; + char **env=nullptr; #elif defined(__DARWIN__) #if wxOSX_USE_COCOA_OR_CARBON // Under Mac shared libraries don't have access to the global environ @@ -540,7 +540,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) return false; char **env = *penv; #else - char **env=NULL; + char **env=nullptr; // todo translate NSProcessInfo environment into map #endif #else // non-MSVC non-Mac @@ -590,7 +590,7 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map) // ---------------------------------------------------------------------------- // wxDoExecuteWithCapture() helper: reads an entire stream into one array if -// the stream is non-NULL (it doesn't do anything if it's NULL). +// the stream is non-null (it doesn't do anything if it's null). // // returns true if ok, false if error #if wxUSE_STREAMS @@ -668,7 +668,7 @@ static long wxDoExecuteWithCapture(const wxString& command, long wxExecute(const wxString& command, wxArrayString& output, int flags, const wxExecuteEnv *env) { - return wxDoExecuteWithCapture(command, output, NULL, flags, env); + return wxDoExecuteWithCapture(command, output, nullptr, flags, env); } long wxExecute(const wxString& command, @@ -807,7 +807,7 @@ void wxQsort(void* pbase, size_t total_elems, stack_node stack[STACK_SIZE]; stack_node *top = stack; - PUSH (NULL, NULL); + PUSH (nullptr, nullptr); while (STACK_NOT_EMPTY) { @@ -1217,8 +1217,8 @@ wxString wxStripMenuCodes(const wxString& in, int flags) // ---------------------------------------------------------------------------- /* - * If parent is non-NULL, look through children for a label or title - * matching the specified string. If NULL, look through all top-level windows. + * If parent is non-nullptr, look through children for a label or title + * matching the specified string. If null, look through all top-level windows. * */ @@ -1230,8 +1230,8 @@ wxFindWindowByLabel (const wxString& title, wxWindow * parent) /* - * If parent is non-NULL, look through children for a name - * matching the specified string. If NULL, look through all top-level windows. + * If parent is non-null, look through children for a name + * matching the specified string. If null, look through all top-level windows. * */ @@ -1268,7 +1268,7 @@ wxFindMenuItemId(wxFrame *frame, wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt) { if (!win->IsShown()) - return NULL; + return nullptr; // Hack for wxNotebook case: at least in wxGTK, all pages // claim to be shown, so we must only deal with the selected one. @@ -1308,7 +1308,7 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt) if (rect.Contains(pt)) return win; - return NULL; + return nullptr; } wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt) @@ -1325,7 +1325,7 @@ wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt) return found; node = node->GetPrevious(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1510,7 +1510,7 @@ wxWindowDisabler::wxWindowDisabler(bool disable) DoDisable(); #if defined(__WXOSX__) && wxOSX_USE_COCOA - AfterDisable(NULL); + AfterDisable(nullptr); #endif } } diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp index 00a5995a91..f34624da54 100644 --- a/src/common/valgen.cpp +++ b/src/common/valgen.cpp @@ -693,16 +693,16 @@ bool wxGenericValidator::TransferFromWindow() */ void wxGenericValidator::Initialize() { - m_pBool = NULL; - m_pInt = NULL; - m_pString = NULL; - m_pArrayInt = NULL; + m_pBool = nullptr; + m_pInt = nullptr; + m_pString = nullptr; + m_pArrayInt = nullptr; #if wxUSE_DATETIME - m_pDateTime = NULL; + m_pDateTime = nullptr; #endif // wxUSE_DATETIME - m_pFileName = NULL; - m_pFloat = NULL; - m_pDouble = NULL; + m_pFileName = nullptr; + m_pFloat = nullptr; + m_pDouble = nullptr; } #endif // wxUSE_VALIDATORS diff --git a/src/common/validate.cpp b/src/common/validate.cpp index dc91bc3226..0e1aac18be 100644 --- a/src/common/validate.cpp +++ b/src/common/validate.cpp @@ -30,7 +30,7 @@ bool wxValidator::ms_isSilent = false; wxValidator::wxValidator() { - m_validatorWindow = NULL; + m_validatorWindow = nullptr; } wxValidator::~wxValidator() diff --git a/src/common/valnum.cpp b/src/common/valnum.cpp index b2db43d95b..cc8744a5a5 100644 --- a/src/common/valnum.cpp +++ b/src/common/valnum.cpp @@ -80,7 +80,7 @@ wxTextEntry *wxNumValidatorBase::GetTextEntry() const return combo; #endif // wxUSE_COMBOBOX - return NULL; + return nullptr; } void diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 9fdcddddfd..e6bf1986c9 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -119,7 +119,7 @@ wxTextEntry *wxTextValidator::GetTextEntry() "or wxComboCtrl" ); - return NULL; + return nullptr; } // Called when the value in the window must be validated. diff --git a/src/common/variant.cpp b/src/common/variant.cpp index cb4f034396..5002af3c97 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -55,7 +55,7 @@ wxVariant::wxVariant() bool wxVariant::IsNull() const { - return (m_refData == NULL); + return (m_refData == nullptr); } void wxVariant::MakeNull() @@ -91,7 +91,7 @@ wxObjectRefData *wxVariant::CreateRefData() const { // We cannot create any particular wxVariantData. wxFAIL_MSG("wxVariant::CreateRefData() cannot be implemented"); - return NULL; + return nullptr; } wxObjectRefData *wxVariant::CloneRefData(const wxObjectRefData *data) const @@ -1081,7 +1081,7 @@ wxString wxVariantDataWxObjectPtr::GetType() const wxClassInfo* wxVariantDataWxObjectPtr::GetValueClassInfo() { - wxClassInfo* returnVal=NULL; + wxClassInfo* returnVal=nullptr; if (m_value) returnVal = m_value->GetClassInfo(); @@ -1253,7 +1253,7 @@ void* wxVariant::GetVoidPtr() const { // handling this specially is convenient when working with COM, see #9873 if ( IsNull() ) - return NULL; + return nullptr; wxASSERT( GetType() == wxT("void*") ); diff --git a/src/common/webrequest.cpp b/src/common/webrequest.cpp index 6f9c21fe62..ef54507f80 100644 --- a/src/common/webrequest.cpp +++ b/src/common/webrequest.cpp @@ -556,7 +556,7 @@ wxFileOffset wxWebRequest::GetBytesExpectedToReceive() const wxWebRequestHandle wxWebRequest::GetNativeHandle() const { - return m_impl ? m_impl->GetNativeHandle() : NULL; + return m_impl ? m_impl->GetNativeHandle() : nullptr; } void wxWebRequest::DisablePeerVerify(bool disable) @@ -641,7 +641,7 @@ void wxWebResponseImpl::Init() { // Check available disk space wxLongLong freeSpace; - if ( wxGetDiskSpace(tmpPrefix.GetFullPath(), NULL, &freeSpace) && + if ( wxGetDiskSpace(tmpPrefix.GetFullPath(), nullptr, &freeSpace) && GetContentLength() > freeSpace ) { m_request.SetState(wxWebRequest::State_Failed, _("Not enough free disk space for download.")); @@ -853,7 +853,7 @@ wxString wxWebResponse::GetStatusText() const wxInputStream* wxWebResponse::GetStream() const { - wxCHECK_IMPL( NULL ); + wxCHECK_IMPL( nullptr ); return m_impl->GetStream(); } @@ -985,7 +985,7 @@ wxWebSession::RegisterFactory(const wxString& backend, if ( !factory->Initialize() ) { delete factory; - factory = NULL; + factory = nullptr; return; } @@ -1058,17 +1058,17 @@ wxString wxWebSession::GetTempDir() const bool wxWebSession::IsOpened() const { - return m_impl.get() != NULL; + return m_impl.get() != nullptr; } void wxWebSession::Close() { - m_impl.reset(NULL); + m_impl.reset(nullptr); } wxWebSessionHandle wxWebSession::GetNativeHandle() const { - return m_impl ? m_impl->GetNativeHandle() : NULL; + return m_impl ? m_impl->GetNativeHandle() : nullptr; } // ---------------------------------------------------------------------------- diff --git a/src/common/webrequest_curl.cpp b/src/common/webrequest_curl.cpp index 7845afac76..8d149f0f84 100644 --- a/src/common/webrequest_curl.cpp +++ b/src/common/webrequest_curl.cpp @@ -181,7 +181,7 @@ wxFileOffset wxWebResponseCURL::GetContentLength() const wxString wxWebResponseCURL::GetURL() const { - char* urlp = NULL; + char* urlp = nullptr; curl_easy_getinfo(GetHandle(), CURLINFO_EFFECTIVE_URL, &urlp); // While URLs should contain ASCII characters only as per @@ -226,7 +226,7 @@ wxWebRequestCURL::wxWebRequestCURL(wxWebSession & session, wxWebRequestImpl(session, sessionImpl, handler, id), m_sessionImpl(sessionImpl) { - m_headerList = NULL; + m_headerList = nullptr; m_handle = curl_easy_init(); if ( !m_handle ) @@ -380,7 +380,7 @@ void wxWebRequestCURL::DestroyHeaderList() if ( m_headerList ) { curl_slist_free_all(m_headerList); - m_headerList = NULL; + m_headerList = nullptr; } } @@ -528,19 +528,19 @@ WinSock1SocketPoller::WinSock1SocketPoller(wxEvtHandler* hndlr) m_hwnd = CreateWindowEx( 0, //DWORD dwExStyle, TEXT("STATIC"), //LPCSTR lpClassName, - NULL, //LPCSTR lpWindowName, + nullptr, //LPCSTR lpWindowName, 0, //DWORD dwStyle, 0, //int X, 0, //int Y, 0, //int nWidth, 0, //int nHeight, HWND_MESSAGE, //HWND hWndParent, - NULL, //HMENU hMenu, - NULL, //HINSTANCE hInstance, - NULL //LPVOID lpParam + nullptr, //HMENU hMenu, + nullptr, //HINSTANCE hInstance, + nullptr //LPVOID lpParam ); - if ( m_hwnd == NULL ) + if ( m_hwnd == nullptr ) { wxLogError("Unable to create message window for WinSock1SocketPoller"); return; @@ -790,7 +790,7 @@ static int SocketPoller2EventSource(int pollAction) bool SourceSocketPoller::StartPolling(wxSOCKET_T sock, int pollAction) { SocketDataMap::iterator it = m_socketData.find(sock); - wxEventLoopSourceHandler* srcHandler = NULL; + wxEventLoopSourceHandler* srcHandler = nullptr; if ( it != m_socketData.end() ) { @@ -814,7 +814,7 @@ bool SourceSocketPoller::StartPolling(wxSOCKET_T sock, int pollAction) wxEventLoopSource* newSrc = wxEventLoopBase::AddSourceForFD(sock, srcHandler, eventSourceFlag); - if ( newSrc == NULL ) + if ( newSrc == nullptr ) { // We were not able to add a source for this socket. wxLogDebug(wxString::Format( @@ -874,7 +874,7 @@ int wxWebSessionCURL::ms_activeSessions = 0; unsigned int wxWebSessionCURL::ms_runtimeVersion = 0; wxWebSessionCURL::wxWebSessionCURL() : - m_handle(NULL) + m_handle(nullptr) { // Initialize CURL globally if no sessions are active if ( ms_activeSessions == 0 ) diff --git a/src/common/webview.cpp b/src/common/webview.cpp index 7b995a7abc..904746dbec 100644 --- a/src/common/webview.cpp +++ b/src/common/webview.cpp @@ -121,7 +121,7 @@ wxString wxWebViewHandler::GetVirtualHost() const wxFSFile* wxWebViewHandler::GetFile(const wxString& WXUNUSED(uri)) { - return NULL; + return nullptr; } void wxWebViewHandler::StartRequest(const wxWebViewHandlerRequest& request, @@ -364,7 +364,7 @@ wxWebView* wxWebView::New(const wxString& backend) wxStringWebViewFactoryMap::iterator iter = FindFactory(backend); if(iter == m_factoryMap.end()) - return NULL; + return nullptr; else return (*iter).second->Create(); } @@ -378,7 +378,7 @@ wxWebView* wxWebView::New(wxWindow* parent, wxWindowID id, const wxString& url, wxStringWebViewFactoryMap::iterator iter = FindFactory(backend); if(iter == m_factoryMap.end()) - return NULL; + return nullptr; else return (*iter).second->Create(parent, id, url, pos, size, style, name); diff --git a/src/common/webviewarchivehandler.cpp b/src/common/webviewarchivehandler.cpp index 697ee6337e..8c4323beeb 100644 --- a/src/common/webviewarchivehandler.cpp +++ b/src/common/webviewarchivehandler.cpp @@ -79,7 +79,7 @@ wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri) size_t doubleslash = path.find("//"); //The path is incorrectly formed without // after the scheme if(doubleslash == wxString::npos) - return NULL; + return nullptr; wxString fspath = "file:" + EscapeFileNameCharsInURL(path.substr(doubleslash + 2).utf8_str()); @@ -92,7 +92,7 @@ wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri) //For the path to be valid there must to a path after the protocol if(end == wxString::npos) { - return NULL; + return nullptr; } wxString mainpath = path.substr(0, start); wxString archivepath = path.substr(end); @@ -102,7 +102,7 @@ wxFSFile* wxWebViewArchiveHandler::GetFile(const wxString &uri) size_t doubleslash = path.find("//"); //The path is incorrectly formed without // after the first protocol if(doubleslash == wxString::npos) - return NULL; + return nullptr; wxString fspath = "file:" + EscapeFileNameCharsInURL(mainpath.substr(doubleslash + 2).utf8_str()) diff --git a/src/common/wfstream.cpp b/src/common/wfstream.cpp index 0e4c40e491..af8438eb5e 100644 --- a/src/common/wfstream.cpp +++ b/src/common/wfstream.cpp @@ -41,7 +41,7 @@ wxFileInputStream::wxFileInputStream() : wxInputStream() { m_file_destroy = false; - m_file = NULL; + m_file = nullptr; } wxFileInputStream::wxFileInputStream(wxFile& file) @@ -131,7 +131,7 @@ wxFileOutputStream::wxFileOutputStream() : wxOutputStream() { m_file_destroy = false; - m_file = NULL; + m_file = nullptr; } wxFileOutputStream::wxFileOutputStream(int fd) @@ -282,7 +282,7 @@ wxFFileInputStream::wxFFileInputStream(const wxString& fileName, wxFFileInputStream::wxFFileInputStream() : wxInputStream() { - m_file = NULL; + m_file = nullptr; m_file_destroy = false; } @@ -370,7 +370,7 @@ wxFFileOutputStream::wxFFileOutputStream(wxFFile& file) wxFFileOutputStream::wxFFileOutputStream() : wxOutputStream() { - m_file = NULL; + m_file = nullptr; m_file_destroy = false; } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index f29898b032..a00ffd6d7b 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -89,7 +89,7 @@ WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows; // globals #if wxUSE_MENUS -wxMenu *wxCurrentPopupMenu = NULL; +wxMenu *wxCurrentPopupMenu = nullptr; #endif // wxUSE_MENUS extern WXDLLEXPORT_DATA(const char) wxPanelNameStr[] = "panel"; @@ -271,7 +271,7 @@ wxWindowBase::wxWindowBase() , m_bestSizeCache(wxDefaultSize) { // no window yet, no parent nor children - m_parent = NULL; + m_parent = nullptr; m_windowId = wxID_ANY; // no constraints on the minimal window size @@ -289,7 +289,7 @@ wxWindowBase::wxWindowBase() #if wxUSE_VALIDATORS // no validator - m_windowValidator = NULL; + m_windowValidator = nullptr; #endif // wxUSE_VALIDATORS // the colours/fonts are default for now, so leave m_font, @@ -309,26 +309,26 @@ wxWindowBase::wxWindowBase() #if wxUSE_CONSTRAINTS // no constraints whatsoever - m_constraints = NULL; - m_constraintsInvolvedIn = NULL; + m_constraints = nullptr; + m_constraintsInvolvedIn = nullptr; #endif // wxUSE_CONSTRAINTS - m_windowSizer = NULL; - m_containingSizer = NULL; + m_windowSizer = nullptr; + m_containingSizer = nullptr; m_autoLayout = false; m_disableFocusFromKbd = false; #if wxUSE_DRAG_AND_DROP - m_dropTarget = NULL; + m_dropTarget = nullptr; #endif // wxUSE_DRAG_AND_DROP #if wxUSE_TOOLTIPS - m_tooltip = NULL; + m_tooltip = nullptr; #endif // wxUSE_TOOLTIPS #if wxUSE_CARET - m_caret = NULL; + m_caret = nullptr; #endif // wxUSE_CARET #if wxUSE_PALETTE @@ -336,10 +336,10 @@ wxWindowBase::wxWindowBase() #endif // wxUSE_PALETTE #if wxUSE_ACCESSIBILITY - m_accessible = NULL; + m_accessible = nullptr; #endif - m_scrollHelper = NULL; + m_scrollHelper = nullptr; m_windowVariant = wxWINDOW_VARIANT_NORMAL; #if wxUSE_SYSTEM_OPTIONS @@ -477,7 +477,7 @@ wxWindowBase::~wxWindowBase() // The associated popup menu can still be alive, disassociate from it in // this case if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetInvokingWindow() == this ) - wxCurrentPopupMenu->SetInvokingWindow(NULL); + wxCurrentPopupMenu->SetInvokingWindow(nullptr); #endif // wxUSE_MENUS wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") ); @@ -1231,7 +1231,7 @@ bool wxWindowBase::IsShownOnScreen() const // parents. But if a window is toplevel one, then its always visible on // screen if IsShown() returns true, even if it has a hidden parent. return IsShown() && - (IsTopLevel() || GetParent() == NULL || GetParent()->IsShownOnScreen()); + (IsTopLevel() || GetParent() == nullptr || GetParent()->IsShownOnScreen()); } // ---------------------------------------------------------------------------- @@ -1313,7 +1313,7 @@ bool wxWindowBase::IsDescendant(wxWindowBase* win) const void wxWindowBase::AddChild(wxWindowBase *child) { - wxCHECK_RET( child, wxT("can't add a NULL child") ); + wxCHECK_RET( child, wxT("can't add a null child") ); // this should never happen and it will lead to a crash later if it does // because RemoveChild() will remove only one node from the children list @@ -1331,7 +1331,7 @@ void wxWindowBase::AddChild(wxWindowBase *child) void wxWindowBase::RemoveChild(wxWindowBase *child) { - wxCHECK_RET( child, wxT("can't remove a NULL child") ); + wxCHECK_RET( child, wxT("can't remove a null child") ); // removing a child while frozen may result in permanently frozen window // if used e.g. from Reparent(), so thaw it @@ -1342,7 +1342,7 @@ void wxWindowBase::RemoveChild(wxWindowBase *child) child->Thaw(); GetChildren().DeleteObject((wxWindow *)child); - child->SetParent(NULL); + child->SetParent(nullptr); } void wxWindowBase::SetParent(wxWindowBase *parent) @@ -1407,7 +1407,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent) void wxWindowBase::SetEventHandler(wxEvtHandler *handler) { - wxCHECK_RET(handler != NULL, "SetEventHandler(NULL) called"); + wxCHECK_RET(handler != nullptr, "SetEventHandler(nullptr) called"); m_eventHandler = handler; } @@ -1430,7 +1430,7 @@ void wxWindowBase::SetPreviousHandler(wxEvtHandler *WXUNUSED(handler)) void wxWindowBase::PushEventHandler(wxEvtHandler *handlerToPush) { - wxCHECK_RET( handlerToPush != NULL, "PushEventHandler(NULL) called" ); + wxCHECK_RET( handlerToPush != nullptr, "PushEventHandler(nullptr) called" ); // the new handler is going to be part of the wxWindow stack of event handlers: // it can't be part also of an event handler double-linked chain: @@ -1439,7 +1439,7 @@ void wxWindowBase::PushEventHandler(wxEvtHandler *handlerToPush) "a wxEvtHandler chain; call Unlink() on it first"); wxEvtHandler *handlerOld = GetEventHandler(); - wxCHECK_RET( handlerOld, "an old event handler is NULL?" ); + wxCHECK_RET( handlerOld, "an old event handler is null?" ); // now use wxEvtHandler double-linked list to implement a stack: handlerToPush->SetNextHandler(handlerOld); @@ -1451,17 +1451,17 @@ void wxWindowBase::PushEventHandler(wxEvtHandler *handlerToPush) #if wxDEBUG_LEVEL // final checks of the operations done above: - wxASSERT_MSG( handlerToPush->GetPreviousHandler() == NULL, + wxASSERT_MSG( handlerToPush->GetPreviousHandler() == nullptr, "the first handler of the wxWindow stack should " "have no previous handlers set" ); - wxASSERT_MSG( handlerToPush->GetNextHandler() != NULL, + wxASSERT_MSG( handlerToPush->GetNextHandler() != nullptr, "the first handler of the wxWindow stack should " - "have non-NULL next handler" ); + "have non-null next handler" ); wxEvtHandler* pLast = handlerToPush; while ( pLast && pLast != this ) pLast = pLast->GetNextHandler(); - wxASSERT_MSG( pLast->GetNextHandler() == NULL, + wxASSERT_MSG( pLast->GetNextHandler() == nullptr, "the last handler of the wxWindow stack should " "have this window as next handler" ); #endif // wxDEBUG_LEVEL @@ -1472,21 +1472,21 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler) // we need to pop the wxWindow stack, i.e. we need to remove the first handler wxEvtHandler *firstHandler = GetEventHandler(); - wxCHECK_MSG( firstHandler != NULL, NULL, "wxWindow cannot have a NULL event handler" ); - wxCHECK_MSG( firstHandler != this, NULL, "cannot pop the wxWindow itself" ); - wxCHECK_MSG( firstHandler->GetPreviousHandler() == NULL, NULL, + wxCHECK_MSG( firstHandler != nullptr, nullptr, "wxWindow cannot have a null event handler" ); + wxCHECK_MSG( firstHandler != this, nullptr, "cannot pop the wxWindow itself" ); + wxCHECK_MSG( firstHandler->GetPreviousHandler() == nullptr, nullptr, "the first handler of the wxWindow stack should have no previous handlers set" ); wxEvtHandler *secondHandler = firstHandler->GetNextHandler(); - wxCHECK_MSG( secondHandler != NULL, NULL, - "the first handler of the wxWindow stack should have non-NULL next handler" ); + wxCHECK_MSG( secondHandler != nullptr, nullptr, + "the first handler of the wxWindow stack should have non-null next handler" ); - firstHandler->SetNextHandler(NULL); + firstHandler->SetNextHandler(nullptr); // It is harmless but useless to unset the previous handler of the window - // itself as it's always NULL anyhow, so don't do this. + // itself as it's always null anyhow, so don't do this. if ( secondHandler != this ) - secondHandler->SetPreviousHandler(NULL); + secondHandler->SetPreviousHandler(nullptr); // now firstHandler is completely unlinked; set secondHandler as the new window event handler SetEventHandler(secondHandler); @@ -1501,7 +1501,7 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler) bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handlerToRemove) { - wxCHECK_MSG( handlerToRemove != NULL, false, "RemoveEventHandler(NULL) called" ); + wxCHECK_MSG( handlerToRemove != nullptr, false, "RemoveEventHandler(nullptr) called" ); wxCHECK_MSG( handlerToRemove != this, false, "Cannot remove the window itself" ); if (handlerToRemove == GetEventHandler()) @@ -1840,7 +1840,7 @@ wxWindow *wxWindowBase::FindWindow(long id) const if ( id == m_windowId ) return const_cast(static_cast(this)); - wxWindowBase *res = NULL; + wxWindowBase *res = nullptr; wxWindowList::compatibility_iterator node; for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) { @@ -1862,7 +1862,7 @@ wxWindow *wxWindowBase::FindWindow(const wxString& name) const if ( name == m_windowName ) return const_cast(static_cast(this)); - wxWindowBase *res = NULL; + wxWindowBase *res = nullptr; wxWindowList::compatibility_iterator node; for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) { @@ -1879,8 +1879,8 @@ wxWindow *wxWindowBase::FindWindow(const wxString& name) const } -// find any window by id or name or label: If parent is non-NULL, look through -// children for a label or title matching the specified string. If NULL, look +// find any window by id or name or label: If parent is non-null, look through +// children for a label or title matching the specified string. If null, look // through all top-level windows. // // to avoid duplicating code we reuse the same helper function but with @@ -1934,7 +1934,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent, } // Not found - return NULL; + return nullptr; } // helper for FindWindowByXXX() @@ -1962,7 +1962,7 @@ wxWindow *wxFindWindowHelper(const wxWindow *parent, return retwin; } - return NULL; + return nullptr; } /* static */ @@ -2049,7 +2049,7 @@ public: virtual ~ValidationTraverserBase() { } protected: - // Called for each child, validator is guaranteed to be non-NULL. + // Called for each child, validator is guaranteed to be non-null. virtual bool OnDo(wxValidator* validator) = 0; // Called for each child if we need to recurse into its children. @@ -2263,7 +2263,7 @@ void wxWindowBase::DoSetToolTipText( const wxString &tip ) } // setting empty tooltip text does not remove the tooltip any more - use - // SetToolTip(NULL) for this + // SetToolTip(nullptr) for this } void wxWindowBase::DoSetToolTip(wxToolTip *tooltip) @@ -2277,9 +2277,9 @@ void wxWindowBase::DoSetToolTip(wxToolTip *tooltip) bool wxWindowBase::CopyToolTip(wxToolTip *tip) { - SetToolTip(tip ? new wxToolTip(tip->GetTip()) : NULL); + SetToolTip(tip ? new wxToolTip(tip->GetTip()) : nullptr); - return tip != NULL; + return tip != nullptr; } #endif // wxUSE_TOOLTIPS @@ -2404,7 +2404,7 @@ void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld) if ( m_windowSizer ) { - m_windowSizer->SetContainingWindow(NULL); + m_windowSizer->SetContainingWindow(nullptr); if ( deleteOld ) delete m_windowSizer; @@ -2416,7 +2416,7 @@ void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld) m_windowSizer->SetContainingWindow((wxWindow *)this); } - SetAutoLayout(m_windowSizer != NULL); + SetAutoLayout(m_windowSizer != nullptr); } void wxWindowBase::SetSizerAndFit(wxSizer *sizer, bool deleteOld) @@ -3020,14 +3020,14 @@ void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) ) bool wxWindowBase::PopupMenu(wxMenu *menu, int x, int y) { - wxCHECK_MSG( menu, false, "can't popup NULL menu" ); + wxCHECK_MSG( menu, false, "can't popup null menu" ); wxMenuInvokingWindowSetter setInvokingWin(*menu, static_cast(this)); wxCurrentPopupMenu = menu; const bool rc = DoPopupMenu(menu, x, y); - wxCurrentPopupMenu = NULL; + wxCurrentPopupMenu = nullptr; return rc; } @@ -3502,19 +3502,19 @@ bool wxWindowBase::TryAfter(wxEvent& event) wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const { - wxCHECK_MSG( GetParent(), NULL, + wxCHECK_MSG( GetParent(), nullptr, wxT("GetPrev/NextSibling() don't work for TLWs!") ); wxWindowList& siblings = GetParent()->GetChildren(); wxWindowList::compatibility_iterator i = siblings.Find(static_cast(this)); - wxCHECK_MSG( i, NULL, wxT("window not a child of its parent?") ); + wxCHECK_MSG( i, nullptr, wxT("window not a child of its parent?") ); if ( order == OrderBefore ) i = i->GetPrevious(); else // OrderAfter i = i->GetNext(); - return i ? i->GetData() : NULL; + return i ? i->GetData() : nullptr; } // ---------------------------------------------------------------------------- @@ -3599,7 +3599,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move) /*static*/ wxWindow* wxWindowBase::FindFocus() { wxWindowBase *win = DoFindFocus(); - return win ? win->GetMainWindowOfCompositeControl() : NULL; + return win ? win->GetMainWindowOfCompositeControl() : nullptr; } bool wxWindowBase::HasFocus() const @@ -3658,7 +3658,7 @@ void wxWindowBase::DragAcceptFiles(bool accept) } else { - SetDropTarget(NULL); + SetDropTarget(nullptr); } } @@ -3711,7 +3711,7 @@ wxString wxDumpWindow(const wxWindowBase* win) // representing the child element, starting from 1. wxAccStatus wxWindowAccessible::HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUSED(childId), wxAccessible** WXUNUSED(childObject)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -3719,9 +3719,9 @@ wxAccStatus wxWindowAccessible::HitTest(const wxPoint& WXUNUSED(pt), int* WXUNUS // Returns the rectangle for this object (id = 0) or a child element (id > 0). wxAccStatus wxWindowAccessible::GetLocation(wxRect& rect, int elementId) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); - wxWindow* win = NULL; + wxWindow* win = nullptr; if (elementId == wxACC_SELF) { win = GetWindow(); @@ -3750,7 +3750,7 @@ wxAccStatus wxWindowAccessible::GetLocation(wxRect& rect, int elementId) wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId, int* WXUNUSED(toId), wxAccessible** toObject) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); switch (navDir) { @@ -3840,7 +3840,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId, // Gets the name of the specified object. wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); wxString title; @@ -3871,19 +3871,19 @@ wxAccStatus wxWindowAccessible::GetName(int childId, wxString* name) // Gets the number of children. wxAccStatus wxWindowAccessible::GetChildCount(int* childId) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); *childId = (int) GetWindow()->GetChildren().GetCount(); return wxACC_OK; } // Gets the specified child (starting from 1). -// If *child is NULL and return value is wxACC_OK, +// If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. wxAccStatus wxWindowAccessible::GetChild(int childId, wxAccessible** child) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); if (childId == wxACC_SELF) { @@ -3902,15 +3902,15 @@ wxAccStatus wxWindowAccessible::GetChild(int childId, wxAccessible** child) return wxACC_FAIL; } -// Gets the parent, or NULL. +// Gets the parent, or nullptr. wxAccStatus wxWindowAccessible::GetParent(wxAccessible** parent) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); wxWindow* parentWindow = GetWindow()->GetParent(); if (!parentWindow) { - *parent = NULL; + *parent = nullptr; return wxACC_OK; } else @@ -3929,7 +3929,7 @@ wxAccStatus wxWindowAccessible::GetParent(wxAccessible** parent) // window (e.g. an edit control). wxAccStatus wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -3942,7 +3942,7 @@ wxAccStatus wxWindowAccessible::DoDefaultAction(int WXUNUSED(childId)) // a document has a default action of "Press" rather than "Prints the current document." wxAccStatus wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId), wxString* WXUNUSED(actionName)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -3950,7 +3950,7 @@ wxAccStatus wxWindowAccessible::GetDefaultAction(int WXUNUSED(childId), wxString // Returns the description for this object or a child. wxAccStatus wxWindowAccessible::GetDescription(int WXUNUSED(childId), wxString* description) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); (void)description; #if wxUSE_HELP @@ -3968,7 +3968,7 @@ wxAccStatus wxWindowAccessible::GetDescription(int WXUNUSED(childId), wxString* // Returns help text for this object or a child, similar to tooltip text. wxAccStatus wxWindowAccessible::GetHelpText(int WXUNUSED(childId), wxString* helpText) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); (void)helpText; #if wxUSE_HELP @@ -3987,7 +3987,7 @@ wxAccStatus wxWindowAccessible::GetHelpText(int WXUNUSED(childId), wxString* hel // Return e.g. ALT+K wxAccStatus wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId), wxString* WXUNUSED(shortcut)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -3995,7 +3995,7 @@ wxAccStatus wxWindowAccessible::GetKeyboardShortcut(int WXUNUSED(childId), wxStr // Returns a role constant. wxAccStatus wxWindowAccessible::GetRole(int childId, wxAccRole* role) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); // If a child, leave wxWidgets to call the function on the actual // child object. @@ -4025,7 +4025,7 @@ wxAccStatus wxWindowAccessible::GetRole(int childId, wxAccRole* role) // Returns a state constant. wxAccStatus wxWindowAccessible::GetState(int childId, long* state) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); // If a child, leave wxWidgets to call the function on the actual // child object. @@ -4056,7 +4056,7 @@ wxAccStatus wxWindowAccessible::GetState(int childId, long* state) // or child. wxAccStatus wxWindowAccessible::GetValue(int WXUNUSED(childId), wxString* WXUNUSED(strValue)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -4064,18 +4064,18 @@ wxAccStatus wxWindowAccessible::GetValue(int WXUNUSED(childId), wxString* WXUNUS // Selects the object or child. wxAccStatus wxWindowAccessible::Select(int WXUNUSED(childId), wxAccSelectionFlags WXUNUSED(selectFlags)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } // Gets the window with the keyboard focus. -// If childId is 0 and child is NULL, no object in +// If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** WXUNUSED(child)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } @@ -4091,7 +4091,7 @@ wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** // - a "void*" pointer to a wxAccessible child object wxAccStatus wxWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections)) { - wxCHECK( GetWindow() != NULL, wxACC_FAIL ); + wxCHECK( GetWindow() != nullptr, wxACC_FAIL ); return wxACC_NOT_IMPLEMENTED; } diff --git a/src/common/windowid.cpp b/src/common/windowid.cpp index 8f2fb80e0f..de0be789c8 100644 --- a/src/common/windowid.cpp +++ b/src/common/windowid.cpp @@ -46,7 +46,7 @@ wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1] = { 0 }; // freed. The cell storing the count for an ID is freed only when its count // gets to zero (not when it goes below ID_COUNTTOOLARGE, so as to avoid // degenerate cases) -wxLongToLongHashMap *gs_autoIdsLargeRefCount = NULL; +wxLongToLongHashMap *gs_autoIdsLargeRefCount = nullptr; // this is an optimization used until we wrap around wxID_AUTO_HIGHEST: if this // value is < wxID_AUTO_HIGHEST we know that we haven't wrapped yet and so can diff --git a/src/common/wrapsizer.cpp b/src/common/wrapsizer.cpp index 72789c215b..a02d37fd07 100644 --- a/src/common/wrapsizer.cpp +++ b/src/common/wrapsizer.cpp @@ -112,7 +112,7 @@ void wxWrapSizer::ClearRows() if ( propChanger ) { // this deletes propChanger and so restores the old proportion - item->SetUserData(NULL); + item->SetUserData(nullptr); } } } @@ -328,7 +328,7 @@ void wxWrapSizer::CalcMinFromMajor(int totMajor) // Helper struct for CalcMinFromMinor struct wxWrapLine { - wxWrapLine() : m_first(NULL), m_width(0) { } + wxWrapLine() : m_first(nullptr), m_width(0) { } wxSizerItem *m_first; int m_width; // Width of line }; @@ -507,8 +507,8 @@ void wxWrapSizer::RepositionChildren(const wxSize& WXUNUSED(minSize)) size_t nRow = 0; wxSizer *sizer = GetRowSizer(nRow); - wxSizerItem *itemLast = NULL, // last item processed in this row - *itemSpace = NULL; // spacer which we delayed adding + wxSizerItem *itemLast = nullptr, // last item processed in this row + *itemSpace = nullptr; // spacer which we delayed adding // Now put our child items into child sizers instead for ( wxSizerItemList::iterator i = m_children.begin(); @@ -546,7 +546,7 @@ void wxWrapSizer::RepositionChildren(const wxSize& WXUNUSED(minSize)) sizer = GetRowSizer(++nRow); itemLast = - itemSpace = NULL; + itemSpace = nullptr; } // Only remove first/last spaces if that flag is set @@ -571,7 +571,7 @@ void wxWrapSizer::RepositionChildren(const wxSize& WXUNUSED(minSize)) // to a conflict with the current containing sizer. wxWindow * const win = item->GetWindow(); if ( win ) - win->SetContainingSizer(NULL); + win->SetContainingSizer(nullptr); // Notice that we reuse a pointer to our own sizer item here, so we // must remember to remove it by calling ClearRows() to avoid @@ -582,12 +582,12 @@ void wxWrapSizer::RepositionChildren(const wxSize& WXUNUSED(minSize)) // which is wrong. Set it to point to us. if ( win ) { - win->SetContainingSizer(NULL); + win->SetContainingSizer(nullptr); win->SetContainingSizer(this); } itemLast = item; - itemSpace = NULL; + itemSpace = nullptr; } } diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index 8437ce6ff6..9177d245c8 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -84,15 +84,15 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n) } // Note that we rely on common (and required by Unix98 but unfortunately not - // C99) extension which allows to call mbs(r)towcs() with NULL output pointer + // C99) extension which allows to call mbs(r)towcs() with null output pointer // to just get the size of the needed buffer -- this is needed as otherwise // we have no idea about how much space we need. Currently all supported // compilers do provide it and if they don't, HAVE_WCSRTOMBS shouldn't be // defined at all. #ifdef HAVE_WCSRTOMBS - return mbsrtowcs(NULL, &psz, 0, &mbstate); + return mbsrtowcs(nullptr, &psz, 0, &mbstate); #else - return wxMbstowcs(NULL, psz, 0); + return wxMbstowcs(nullptr, psz, 0); #endif } @@ -117,19 +117,19 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *pwz, size_t n) } #ifdef HAVE_WCSRTOMBS - return wcsrtombs(NULL, &pwz, 0, &mbstate); + return wcsrtombs(nullptr, &pwz, 0, &mbstate); #else - return wxWcstombs(NULL, pwz, 0); + return wxWcstombs(nullptr, pwz, 0); #endif } char* wxSetlocale(int category, const char *locale) { #ifdef __WXMAC__ - char *rv = NULL ; - if ( locale != NULL && locale[0] == 0 ) + char *rv = nullptr ; + if ( locale != nullptr && locale[0] == 0 ) { - // the attempt to use newlocale(LC_ALL_MASK, "", NULL); + // the attempt to use newlocale(LC_ALL_MASK, "", nullptr); // here in order to deduce the language along the environment vars rules // lead to strange crashes later... @@ -146,7 +146,7 @@ char* wxSetlocale(int category, const char *locale) #else char *rv = setlocale(category, locale); #endif - if ( locale != NULL /* setting locale, not querying */ && + if ( locale != nullptr /* setting locale, not querying */ && rv /* call was successful */ ) { wxUpdateLocaleIsUtf8(); @@ -268,9 +268,9 @@ 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, L"%s") == NULL, -1, + wxCHECK_MSG( wxStrstr(format, L"%s") == nullptr, -1, wxT("incomplete vswscanf implementation doesn't allow %s") ); - wxCHECK_MSG( wxStrstr(format, L"%c") == NULL, -1, + wxCHECK_MSG( wxStrstr(format, L"%c") == nullptr, -1, wxT("incomplete vswscanf implementation doesn't allow %c") ); return wxCRT_VsscanfA(static_cast(wxConvLibc.cWC2MB(ws)), @@ -1035,21 +1035,21 @@ static T *wxCRT_DoStrtok(T *psz, const T *delim, T **save_ptr) { psz = *save_ptr; if ( !psz ) - return NULL; + return nullptr; } psz += wxStrspn(psz, delim); if (!*psz) { - *save_ptr = NULL; - return NULL; + *save_ptr = nullptr; + return nullptr; } T *ret = psz; psz = wxStrpbrk(psz, delim); if (!psz) { - *save_ptr = NULL; + *save_ptr = nullptr; } else { @@ -1118,7 +1118,7 @@ static bool wxIsLocaleUtf8() // check if we're running under the "C" locale: it is 7bit subset // of UTF-8, so it can be safely used with the UTF-8 build: - const char *lc_ctype = setlocale(LC_CTYPE, NULL); + const char *lc_ctype = setlocale(LC_CTYPE, nullptr); if ( lc_ctype && (strcmp(lc_ctype, "C") == 0 || strcmp(lc_ctype, "POSIX") == 0) ) { @@ -1199,17 +1199,17 @@ void wxPerror(const wxString& s) wchar_t *wxFgets(wchar_t *s, int size, FILE *stream) { - wxCHECK_MSG( s, NULL, "empty buffer passed to wxFgets()" ); + wxCHECK_MSG( s, nullptr, "empty buffer passed to wxFgets()" ); wxCharBuffer buf(size - 1); // FIXME: this reads too little data if wxConvLibc uses UTF-8 ('size' wide // characters may be encoded by up to 'size'*4 bytes), but what // else can we do? - if ( wxFgets(buf.data(), size, stream) == NULL ) - return NULL; + if ( wxFgets(buf.data(), size, stream) == nullptr ) + return nullptr; if ( wxConvLibc.ToWChar(s, size, buf, wxNO_LEN) == wxCONV_FAILED ) - return NULL; + return nullptr; return s; } @@ -1258,7 +1258,7 @@ int wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap) if(dstendp) \ *endptr = (wchar_t*)(nptr + (dstendp - dst)); \ else \ - *endptr = NULL; \ + *endptr = nullptr; \ } \ return d; diff --git a/src/common/wxprintf.cpp b/src/common/wxprintf.cpp index 06787963a2..2c1533c52d 100644 --- a/src/common/wxprintf.cpp +++ b/src/common/wxprintf.cpp @@ -193,7 +193,7 @@ static int wxDoVsnprintf(CharType *buf, size_t lenMax, // Don't do: // wxASSERT(lenCur == wxStrlen(buf)); - // in fact if we embedded NULLs in the output buffer (using %c with a '\0') + // in fact if we embedded NULs in the output buffer (using %c with a '\0') // such check would fail return lenCur; diff --git a/src/common/xlocale.cpp b/src/common/xlocale.cpp index 3d9a51828b..92c65a5d03 100644 --- a/src/common/xlocale.cpp +++ b/src/common/xlocale.cpp @@ -36,7 +36,7 @@ // ---------------------------------------------------------------------------- // This is the C locale object, it is created on demand -static wxXLocale *gs_cLocale = NULL; +static wxXLocale *gs_cLocale = nullptr; wxXLocale wxNullXLocale; @@ -74,9 +74,9 @@ wxXLocale& wxXLocale::GetCLocale() { if ( !gs_cLocale ) { - // Notice that we need a separate variable because clang 3.1 refuses to - // cast nullptr (which is how NULL is defined in it) to anything. - static wxXLocaleCTag* const tag = NULL; + // Notice that we need a separate variable because wxXLocale has + // overloaded ctors from two different pointer types. + static wxXLocaleCTag* const tag = nullptr; gs_cLocale = new wxXLocale(tag); } @@ -88,7 +88,7 @@ wxXLocale& wxXLocale::GetCLocale() #if wxUSE_INTL wxXLocale::wxXLocale(wxLanguage lang) { - m_locale = NULL; + m_locale = nullptr; const wxLanguageInfo * const info = wxUILocale::GetLanguageInfo(lang); if ( info ) @@ -129,7 +129,7 @@ void wxXLocale::Init(const char *loc) if (!loc || *loc == '\0') return; - m_locale = newlocale(LC_ALL_MASK, loc, NULL); + m_locale = newlocale(LC_ALL_MASK, loc, nullptr); if (!m_locale) { // NOTE: here we do something similar to what wxSetLocaleTryUTF8() does @@ -137,21 +137,21 @@ void wxXLocale::Init(const char *loc) wxString buf(loc); wxString buf2; buf2 = buf + wxS(".UTF-8"); - m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), NULL); + m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), nullptr); if ( !m_locale ) { buf2 = buf + wxS(".utf-8"); - m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), NULL); + m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), nullptr); } if ( !m_locale ) { buf2 = buf + wxS(".UTF8"); - m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), NULL); + m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), nullptr); } if ( !m_locale ) { buf2 = buf + wxS(".utf8"); - m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), NULL); + m_locale = newlocale(LC_ALL_MASK, buf2.c_str(), nullptr); } } @@ -286,7 +286,7 @@ class CNumericLocaleSetter { public: CNumericLocaleSetter() - : m_oldLocale(wxStrdupA(setlocale(LC_NUMERIC, NULL))) + : m_oldLocale(wxStrdupA(setlocale(LC_NUMERIC, nullptr))) { if ( !wxSetlocale(LC_NUMERIC, "C") ) { diff --git a/src/common/xpmdecod.cpp b/src/common/xpmdecod.cpp index 9d3f83e29d..313a111e81 100644 --- a/src/common/xpmdecod.cpp +++ b/src/common/xpmdecod.cpp @@ -223,7 +223,7 @@ wxImage wxXPMDecoder::ReadFile(wxInputStream& stream) } } - xpm_lines[lines_cnt] = NULL; + xpm_lines[lines_cnt] = nullptr; /* * Read the image: @@ -497,7 +497,7 @@ static const rgbRecord theRGBRecords[] = {"whitesmoke", myRGB(245, 245, 245)}, {"yellow", myRGB(255, 255, 0)}, {"yellowgreen", myRGB(50, 216, 56)}, - {NULL, myRGB(0, 0, 0)} + {nullptr, myRGB(0, 0, 0)} }; static const int numTheRGBRecords = 235; @@ -544,7 +544,7 @@ static bool GetRGBFromName(const char *inname, bool *isNone, // lot of gray... // so first extract ' ' - while ((p = strchr(name, ' ')) != NULL) + while ((p = strchr(name, ' ')) != nullptr) { while (*(p)) // till eof of string { @@ -562,7 +562,7 @@ static bool GetRGBFromName(const char *inname, bool *isNone, // substitute Grey with Gray, else rgbtab.h would have more than 100 // 'duplicate' entries - if ( (grey = strstr(name, "grey")) != NULL ) + if ( (grey = strstr(name, "grey")) != nullptr ) grey[2] = 'a'; // check for special 'none' colour: @@ -616,13 +616,13 @@ static bool GetRGBFromName(const char *inname, bool *isNone, static const char *ParseColor(const char *data) { static const char *const targets[] = - {"c ", "g ", "g4 ", "m ", "b ", "s ", NULL}; + {"c ", "g ", "g4 ", "m ", "b ", "s ", nullptr}; const char *p, *r; const char *q; int i; - for (i = 0; targets[i] != NULL; i++) + for (i = 0; targets[i] != nullptr; i++) { r = data; for (q = targets[i]; *r != '\0'; r++) @@ -642,7 +642,7 @@ static const char *ParseColor(const char *data) q = targets[i]; } } - return NULL; + return nullptr; } struct wxXPMColourMapData @@ -654,7 +654,7 @@ WX_DECLARE_STRING_HASH_MAP(wxXPMColourMapData, wxXPMColourMap); wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) { - wxCHECK_MSG(xpm_data, wxNullImage, wxT("NULL XPM data") ); + wxCHECK_MSG(xpm_data, wxNullImage, wxT("null XPM data") ); wxImage img; int count; @@ -709,7 +709,7 @@ wxImage wxXPMDecoder::ReadData(const char* const* xpm_data) const char *clr_def; clr_def = ParseColor(xmpColLine + chars_per_pixel); - if ( clr_def == NULL ) + if ( clr_def == nullptr ) { wxLogError(_("XPM: malformed colour definition '%s' at line %d!"), xmpColLine, (int)(1 + i)); diff --git a/src/common/xti.cpp b/src/common/xti.cpp index 07214a7b55..33c391fbc3 100644 --- a/src/common/xti.cpp +++ b/src/common/xti.cpp @@ -278,7 +278,7 @@ typedef unsigned char unsigned_char; typedef unsigned int unsigned_int; typedef unsigned long unsigned_long; -wxBuiltInTypeInfo s_typeInfovoid( wxT_VOID, NULL, NULL, typeid(void).name()); +wxBuiltInTypeInfo s_typeInfovoid( wxT_VOID, nullptr, nullptr, typeid(void).name()); wxBUILTIN_TYPE_INFO( wxT_BOOL, bool); wxBUILTIN_TYPE_INFO( wxT_CHAR, char); wxBUILTIN_TYPE_INFO( wxT_UCHAR, unsigned_char); @@ -331,14 +331,14 @@ template<> void wxCollectionToVariantArray( wxArrayString const &theArray, wxArrayCollectionToVariantArray( theArray, value ); } -wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL; +wxTypeInfoMap *wxTypeInfo::ms_typeTable = nullptr; wxTypeInfo *wxTypeInfo::FindType(const wxString& typeName) { wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName); if (iter == ms_typeTable->end()) - return NULL; + return nullptr; return (wxTypeInfo *)iter->second; } @@ -376,7 +376,7 @@ wxEventSourceTypeInfo::wxEventSourceTypeInfo( int eventType, int lastEventType, void wxTypeInfo::Register() { - if ( ms_typeTable == NULL ) + if ( ms_typeTable == nullptr ) ms_typeTable = new wxTypeInfoMap(); if( !m_name.empty() ) @@ -408,8 +408,8 @@ void wxSetStringToArray( const wxString &s, wxArrayString &array ) void wxPropertyInfo::Insert(wxPropertyInfo* &iter) { - m_next = NULL; - if ( iter == NULL ) + m_next = nullptr; + if ( iter == nullptr ) iter = this; else { @@ -450,8 +450,8 @@ void wxPropertyInfo::Remove() void wxHandlerInfo::Insert(wxHandlerInfo* &iter) { - m_next = NULL; - if ( iter == NULL ) + m_next = nullptr; + if ( iter == nullptr ) iter = this; else { @@ -506,14 +506,14 @@ wxObject *wxClassInfo::ConstructObject(int ParamCount, wxAny *Params) const { if ( ParamCount != m_constructorPropertiesCount ) { - // FIXME: shouldn't we just return NULL and let the caller handle this case? + // FIXME: shouldn't we just return nullptr and let the caller handle this case? wxLogError( _("Illegal Parameter Count for ConstructObject Method") ); - return NULL; + return nullptr; } - wxObject *object = NULL; + wxObject *object = nullptr; if (!m_constructor->Create( object, Params )) - return NULL; + return nullptr; return object; } @@ -540,7 +540,7 @@ const wxPropertyAccessor *wxClassInfo::FindAccessor(const wxChar *PropertyName) if ( info ) return info->GetAccessor(); - return NULL; + return nullptr; } wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const @@ -566,7 +566,7 @@ const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const wxChar *PropertyName) const wxClassInfo** parents = GetParents(); for ( int i = 0; parents[i]; ++ i ) { - if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != NULL ) + if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != nullptr ) return info; } @@ -597,7 +597,7 @@ const wxHandlerInfo *wxClassInfo::FindHandlerInfo (const wxChar *PropertyName) c const wxClassInfo** parents = GetParents(); for ( int i = 0; parents[i]; ++ i ) { - if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != NULL ) + if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != nullptr ) return info; } @@ -609,9 +609,9 @@ wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const if ( m_streamingCallback ) return m_streamingCallback; - wxObjectStreamingCallback retval = NULL; + wxObjectStreamingCallback retval = nullptr; const wxClassInfo** parents = GetParents(); - for ( int i = 0; parents[i] && retval == NULL; ++ i ) + for ( int i = 0; parents[i] && retval == nullptr; ++ i ) { retval = parents[i]->GetStreamingCallback(); } @@ -712,7 +712,7 @@ wxAny wxClassInfo::ObjectPtrToAny( wxObject* obj) const bool wxClassInfo::NeedsDirectConstruction() const { - return wx_dynamic_cast(wxObjectAllocator*, m_constructor) != NULL; + return wx_dynamic_cast(wxObjectAllocator*, m_constructor) != nullptr; } // ---------------------------------------------------------------------------- @@ -796,7 +796,7 @@ wxDynamicClassInfo::wxDynamicClassInfo( const wxChar *unitName, wxClassInfo( unitName, className, new const wxClassInfo*[2]) { GetParents()[0] = superClass; - GetParents()[1] = NULL; + GetParents()[1] = nullptr; m_data = new wxDynamicClassInfoInternal; } @@ -910,7 +910,7 @@ struct wxGenericPropertyAccessor::wxGenericPropertyAccessorInternal }; wxGenericPropertyAccessor::wxGenericPropertyAccessor( const wxString& propertyName ) -: wxPropertyAccessor( NULL, NULL, NULL, NULL ) +: wxPropertyAccessor( nullptr, nullptr, nullptr, nullptr ) { m_data = new wxGenericPropertyAccessorInternal; m_propertyName = propertyName; @@ -945,7 +945,7 @@ wxString wxAnyGetAsString( const wxAny& data) { wxString s; - if ( data.IsNull() || data.GetTypeInfo()==NULL ) + if ( data.IsNull() || data.GetTypeInfo()==nullptr ) return s; data.GetTypeInfo()->ConvertToString(data,s); @@ -960,7 +960,7 @@ const wxObject* wxAnyGetAsObjectPtr( const wxAny& data) if( ti ) return ti->GetClassInfo()->AnyToObjectPtr(data); } - return NULL; + return nullptr; } wxObjectFunctor::~wxObjectFunctor() diff --git a/src/common/xtistrm.cpp b/src/common/xtistrm.cpp index 12fab5fa34..d85d10a31f 100644 --- a/src/common/xtistrm.cpp +++ b/src/common/xtistrm.cpp @@ -86,7 +86,7 @@ void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *clas if ( writercallback->BeforeWriteObject( this, object, classInfo, metadata) ) { - if ( object == NULL ) + if ( object == nullptr ) DoWriteNullObject(); else if ( IsObjectKnown( object ) ) DoWriteRepeatedObject( GetObjectID(object) ); @@ -125,7 +125,7 @@ void wxObjectWriter::FindConnectEntry(const wxEvtHandler * evSource, if ( entry->m_fn && (dti->GetEventType() == entry->m_eventType) && (entry->m_id == -1 ) && - (entry->m_fn->GetEvtHandler() != NULL ) ) + (entry->m_fn->GetEvtHandler() != nullptr ) ) { sink = entry->m_fn->GetEvtHandler(); const wxClassInfo* sinkClassInfo = sink->GetClassInfo(); @@ -153,7 +153,7 @@ void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo { wxString name = ci->GetCreateParamName(i); wxPropertyInfoMap::const_iterator iter = map.find(name); - const wxPropertyInfo* prop = iter == map.end() ? NULL : iter->second; + const wxPropertyInfo* prop = iter == map.end() ? nullptr : iter->second; if ( prop ) { WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data ); @@ -217,7 +217,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c // make sure that we are picking the correct object for accessing the property const wxDynamicObject* dynobj = wx_dynamic_cast(const wxDynamicObject*, obj ); - if ( dynobj && (wx_dynamic_cast(const wxDynamicClassInfo*, ci) == NULL) ) + if ( dynobj && (wx_dynamic_cast(const wxDynamicClassInfo*, ci) == nullptr) ) obj = dynobj->GetSuperClassInstance(); if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION ) @@ -261,8 +261,8 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c wx_dynamic_cast( const wxEventSourceTypeInfo* , pi->GetTypeInfo() ); if ( dti ) { - const wxObject* sink = NULL; - const wxHandlerInfo *handler = NULL; + const wxObject* sink = nullptr; + const wxHandlerInfo *handler = nullptr; const wxEvtHandler * evSource = wx_dynamic_cast(const wxEvtHandler *, obj); if ( evSource ) @@ -270,7 +270,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c FindConnectEntry( evSource, dti, sink, handler ); if ( writercallback->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) ) { - if ( sink != NULL && handler != NULL ) + if ( sink != nullptr && handler != nullptr ) { DoBeginWriteProperty( pi ); if ( IsObjectKnown( sink ) ) @@ -328,7 +328,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c const wxClassTypeInfo* cti = wx_dynamic_cast( const wxClassTypeInfo* , pi->GetTypeInfo() ); - if ( cti && cti->GetKind() == wxT_OBJECT_PTR && wxAnyGetAsObjectPtr(value) == NULL ) + if ( cti && cti->GetKind() == wxT_OBJECT_PTR && wxAnyGetAsObjectPtr(value) == nullptr ) return; if ( writercallback->BeforeWriteProperty( this, obj, pi, value ) ) @@ -400,12 +400,12 @@ wxClassInfo* wxObjectReader::GetObjectClassInfo(int objectID) if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID ) { wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ); - return NULL; + return nullptr; } if ( m_data->m_classInfos.find(objectID) == m_data->m_classInfos.end() ) { wxLogError( _("Unknown Object passed to GetObjectClassInfo" ) ); - return NULL; + return nullptr; } return m_data->m_classInfos[objectID]; } @@ -467,11 +467,11 @@ struct wxObjectRuntimeReaderCallback::wxObjectRuntimeReaderCallbackInternal wxObject* GetObject( int objectID ) { if ( objectID == wxNullObjectID ) - return NULL; + return nullptr; if ( m_objects.find(objectID) == m_objects.end() ) { wxLogError( _("Passing an unknown object to GetObject") ); - return NULL; + return nullptr; } return m_objects[objectID]; @@ -515,7 +515,7 @@ void wxObjectRuntimeReaderCallback::CreateObject(int objectID, // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o2); - if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) + if ( dyno!=nullptr && (objectClassInfos[i] != dyno->GetClassInfo()) ) { o2 = dyno->GetSuperClassInstance(); } @@ -543,7 +543,7 @@ void wxObjectRuntimeReaderCallback::ConstructObject(int objectID, // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o2); - if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) ) + if ( dyno!=nullptr && (objectClassInfos[i] != dyno->GetClassInfo()) ) { o2 = dyno->GetSuperClassInstance(); } @@ -586,7 +586,7 @@ void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID, // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. wxDynamicObject *dynvalo = wx_dynamic_cast( wxDynamicObject *, valo); - if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) + if ( dynvalo!=nullptr && (valClassInfo != dynvalo->GetClassInfo()) ) { valo = dynvalo->GetSuperClassInstance(); } @@ -614,7 +614,7 @@ void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID, if( delegateTypeInfo && delegateTypeInfo->GetLastEventType() == -1 ) { ehsource->Connect( -1, delegateTypeInfo->GetEventType(), - handlerInfo->GetEventFunction(), NULL /*user data*/, + handlerInfo->GetEventFunction(), nullptr /*user data*/, ehsink ); } else @@ -623,7 +623,7 @@ void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID, iter <= delegateTypeInfo->GetLastEventType(); ++iter ) { ehsource->Connect( -1, iter, - handlerInfo->GetEventFunction(), NULL /*user data*/, + handlerInfo->GetEventFunction(), nullptr /*user data*/, ehsink ); } } @@ -661,7 +661,7 @@ void wxObjectRuntimeReaderCallback::AddToPropertyCollectionAsObject(int objectID // if this is a dynamic object and we are asked for another class // than wxDynamicObject we cast it down manually. wxDynamicObject *dynvalo = wx_dynamic_cast( wxDynamicObject *, valo); - if ( dynvalo!=NULL && (valClassInfo != dynvalo->GetClassInfo()) ) + if ( dynvalo!=nullptr && (valClassInfo != dynvalo->GetClassInfo()) ) { valo = dynvalo->GetSuperClassInstance(); } diff --git a/src/common/xtixml.cpp b/src/common/xtixml.cpp index bc9f828f54..c8b22b1d6d 100644 --- a/src/common/xtixml.cpp +++ b/src/common/xtixml.cpp @@ -184,7 +184,7 @@ void wxObjectXmlWriter::DoWriteDelegate( const wxObject *WXUNUSED(object), const wxClassInfo* WXUNUSED(eventSinkClassInfo), const wxHandlerInfo* handlerInfo ) { - if ( eventSink != NULL && handlerInfo != NULL ) + if ( eventSink != nullptr && handlerInfo != nullptr ) { wxXmlAddContentToNode( m_data->m_current, wxString::Format(wxT("%d.%s"), sinkObjectID, handlerInfo->GetName().c_str()) ); @@ -244,13 +244,13 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *ca } classInfo = wxClassInfo::FindClass(className); - if ( classInfo == NULL ) + if ( classInfo == nullptr ) { wxLogError( wxString::Format(_("unknown class %s"),className ) ); return wxInvalidObjectID; } - if ( children != NULL && children->GetType() == wxXML_TEXT_NODE ) + if ( children != nullptr && children->GetType() == wxXML_TEXT_NODE ) { wxLogError(_("objects cannot have XML Text Nodes") ); return wxInvalidObjectID; @@ -352,7 +352,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *ca wxLogError( _("Type must have enum - long conversion") ); } } - createClassInfos[i] = NULL; + createClassInfos[i] = nullptr; } for ( size_t j = 0; j < propertyNames.size(); ++j ) diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 853a0f365f..d60ddba639 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -180,10 +180,10 @@ wxZipClassFactory::wxZipClassFactory() const wxChar * const * wxZipClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *protocols[] = { wxT("zip"), NULL }; - static const wxChar *mimetypes[] = { wxT("application/zip"), NULL }; - static const wxChar *fileexts[] = { wxT(".zip"), wxT(".htb"), NULL }; - static const wxChar *empty[] = { NULL }; + static const wxChar *protocols[] = { wxT("zip"), nullptr }; + static const wxChar *mimetypes[] = { wxT("application/zip"), nullptr }; + static const wxChar *fileexts[] = { wxT(".zip"), wxT(".htb"), nullptr }; + static const wxChar *empty[] = { nullptr }; switch (type) { case wxSTREAM_PROTOCOL: return protocols; @@ -454,7 +454,7 @@ size_t wxTeeInputStream::GetData(char *buffer, size_t size) m_parent_i_stream->Reset(); m_parent_i_stream->Ungetch(m_wback, m_wbacksize); free(m_wback); - m_wback = NULL; + m_wback = nullptr; m_wbacksize = 0; m_wbackcur = 0; } @@ -519,7 +519,7 @@ wxInputStream *wxRawInputStream::Open(wxInputStream *decomp) m_tee->Open(); return this; } else { - return NULL; + return nullptr; } } @@ -609,7 +609,7 @@ bool wxZlibInputStream2::Open(wxInputStream& stream) class wxZipMemory { public: - wxZipMemory() : m_data(NULL), m_size(0), m_capacity(0), m_ref(1) { } + wxZipMemory() : m_data(nullptr), m_size(0), m_capacity(0), m_ref(1) { } wxZipMemory *AddRef() { m_ref++; return this; } void Release() { if (--m_ref == 0) delete this; } @@ -724,7 +724,7 @@ wxZipEntry *wxZipWeakLinks::GetEntry(wxFileOffset key) const { wxOffsetZipEntryMap_::const_iterator it = m_entries.find(wx_truncate_cast(key_type, key)); - return it != m_entries.end() ? it->second : NULL; + return it != m_entries.end() ? it->second : nullptr; } @@ -751,10 +751,10 @@ wxZipEntry::wxZipEntry( m_InternalAttributes(0), m_ExternalAttributes(0), m_z64infoOffset(0), - m_Extra(NULL), - m_LocalExtra(NULL), - m_zipnotifier(NULL), - m_backlink(NULL) + m_Extra(nullptr), + m_LocalExtra(nullptr), + m_zipnotifier(nullptr), + m_backlink(nullptr) { if (!name.empty()) SetName(name); @@ -789,8 +789,8 @@ wxZipEntry::wxZipEntry(const wxZipEntry& e) m_z64infoOffset(0), m_Extra(AddRef(e.m_Extra)), m_LocalExtra(AddRef(e.m_LocalExtra)), - m_zipnotifier(NULL), - m_backlink(NULL) + m_zipnotifier(nullptr), + m_backlink(nullptr) { } @@ -815,10 +815,10 @@ wxZipEntry& wxZipEntry::operator=(const wxZipEntry& e) m_ExternalAttributes = e.m_ExternalAttributes; Copy(m_Extra, e.m_Extra); Copy(m_LocalExtra, e.m_LocalExtra); - m_zipnotifier = NULL; + m_zipnotifier = nullptr; if (m_backlink) { m_backlink->Release(m_Key); - m_backlink = NULL; + m_backlink = nullptr; } } return *this; @@ -875,7 +875,7 @@ inline bool IsDOSPathSep(wxUniChar ch) // wxString wxZipEntry::GetInternalName(const wxString& name, wxPathFormat format /*=wxPATH_NATIVE*/, - bool *pIsDir /*=NULL*/) + bool *pIsDir /*=nullptr*/) { wxString internal; @@ -969,7 +969,7 @@ void wxZipEntry::SetMode(int mode) const char *wxZipEntry::GetExtra() const { - return m_Extra ? m_Extra->GetData() : NULL; + return m_Extra ? m_Extra->GetData() : nullptr; } size_t wxZipEntry::GetExtraLen() const @@ -986,7 +986,7 @@ void wxZipEntry::SetExtra(const char *extra, size_t len) const char *wxZipEntry::GetLocalExtra() const { - return m_LocalExtra ? m_LocalExtra->GetData() : NULL; + return m_LocalExtra ? m_LocalExtra->GetData() : nullptr; } size_t wxZipEntry::GetLocalExtraLen() const @@ -1019,7 +1019,7 @@ void wxZipEntry::Notify() void wxZipEntry::UnsetNotifier() { wxArchiveEntry::UnsetNotifier(); - m_zipnotifier = NULL; + m_zipnotifier = nullptr; } bool wxZipEntry::LoadExtraInfo(const char* extraData, wxUint16 extraLen, bool localInfo) @@ -1113,7 +1113,7 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) if (LoadExtraInfo(m_LocalExtra->GetData(), extraLen, true)) { Release(m_LocalExtra); - m_LocalExtra = NULL; + m_LocalExtra = nullptr; } } } @@ -1198,7 +1198,7 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) if (LoadExtraInfo(m_Extra->GetData(), extraLen, false)) { Release(m_Extra); - m_Extra = NULL; + m_Extra = nullptr; } } } @@ -1570,7 +1570,7 @@ public: void Release(class wxZipInputStream *WXUNUSED(s)) { if (--m_ref == 0) delete this; } void Release(class wxZipOutputStream *WXUNUSED(s)) - { m_stream = NULL; if (--m_ref == 0) delete this; } + { m_stream = nullptr; if (--m_ref == 0) delete this; } private: ~wxZipStreamLink() { } @@ -1608,14 +1608,14 @@ wxZipInputStream::wxZipInputStream(wxInputStream *stream, void wxZipInputStream::Init() { m_store = new wxStoredInputStream(*m_parent_i_stream); - m_inflate = NULL; - m_rawin = NULL; + m_inflate = nullptr; + m_rawin = nullptr; m_raw = false; m_headerSize = 0; - m_decomp = NULL; + m_decomp = nullptr; m_parentSeekable = false; m_weaklinks = new wxZipWeakLinks; - m_streamlink = NULL; + m_streamlink = nullptr; m_offsetAdjustment = 0; m_position = wxInvalidOffset; m_signature = 0; @@ -1660,7 +1660,7 @@ int wxZipInputStream::GetTotalEntries() wxZipStreamLink *wxZipInputStream::MakeLink(wxZipOutputStream *out) { - wxZipStreamLink *link = NULL; + wxZipStreamLink *link = nullptr; if (!m_parentSeekable && (IsOpened() || !Eof())) { link = new wxZipStreamLink(out); @@ -1813,11 +1813,11 @@ wxZipEntry *wxZipInputStream::GetNextEntry() { if (m_position == wxInvalidOffset) if (!LoadEndRecord()) - return NULL; + return nullptr; m_lasterror = m_parentSeekable ? ReadCentral() : ReadLocal(); if (!IsOk()) - return NULL; + return nullptr; wxZipEntryPtr_ entry(new wxZipEntry(m_entry)); entry->m_backlink = m_weaklinks->AddEntry(entry.get(), entry->GetKey()); @@ -1880,12 +1880,12 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/) m_signature == Z64_END_MAGIC) { if (m_streamlink && !m_streamlink->GetOutputStream()) { m_streamlink->Release(this); - m_streamlink = NULL; + m_streamlink = nullptr; } } while (m_signature == CENTRAL_MAGIC) { - if (m_weaklinks->IsEmpty() && m_streamlink == NULL) + if (m_weaklinks->IsEmpty() && m_streamlink == nullptr) return wxSTREAM_EOF; size_t size = m_entry.ReadCentral(*m_parent_i_stream, GetConv()); @@ -1919,7 +1919,7 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/) if (m_streamlink) { m_streamlink->GetOutputStream()->SetComment(endrec.GetComment()); m_streamlink->Release(this); - m_streamlink = NULL; + m_streamlink = nullptr; } } return wxSTREAM_EOF; @@ -2069,7 +2069,7 @@ wxInputStream *wxZipInputStream::OpenDecompressor(wxInputStream& stream) wxLogError(_("unsupported Zip compression method")); } - return NULL; + return nullptr; } bool wxZipInputStream::CloseDecompressor(wxInputStream *decomp) @@ -2107,7 +2107,7 @@ bool wxZipInputStream::CloseEntry() m_lasterror = wxSTREAM_NO_ERROR; CloseDecompressor(m_decomp); - m_decomp = NULL; + m_decomp = nullptr; m_entry = wxZipEntry(); m_headerSize = 0; m_raw = false; @@ -2190,16 +2190,16 @@ wxZipOutputStream::wxZipOutputStream(wxOutputStream *stream, void wxZipOutputStream::Init(int level) { m_store = new wxStoredOutputStream(*m_parent_o_stream); - m_deflate = NULL; - m_backlink = NULL; + m_deflate = nullptr; + m_backlink = nullptr; m_initialData = new char[OUTPUT_LATENCY]; m_initialSize = 0; - m_pending = NULL; + m_pending = nullptr; m_raw = false; m_headerOffset = 0; m_headerSize = 0; m_entrySize = 0; - m_comp = NULL; + m_comp = nullptr; m_level = level; m_offsetAdjustment = wxInvalidOffset; m_endrecWritten = false; @@ -2286,7 +2286,7 @@ void wxZipOutputStream::SetLevel(int level) if (level != m_level) { if (m_comp != m_deflate) delete m_deflate; - m_deflate = NULL; + m_deflate = nullptr; m_level = level; } } @@ -2390,7 +2390,7 @@ wxOutputStream *wxZipOutputStream::OpenCompressor( wxLogError(_("unsupported Zip compression method")); } - return NULL; + return nullptr; } bool wxZipOutputStream::CloseCompressor(wxOutputStream *comp) @@ -2409,12 +2409,12 @@ void wxZipOutputStream::CreatePendingEntry(const void *buffer, size_t size) { wxASSERT(IsOk() && m_pending && !m_comp); wxZipEntryPtr_ spPending(m_pending); - m_pending = NULL; + m_pending = nullptr; Buffer bufs[] = { { m_initialData, m_initialSize }, { (const char*)buffer, size }, - { NULL, 0 } + { nullptr, 0 } }; if (m_raw) @@ -2450,14 +2450,14 @@ void wxZipOutputStream::CreatePendingEntry() { wxASSERT(IsOk() && m_pending && !m_comp); wxZipEntryPtr_ spPending(m_pending); - m_pending = NULL; + m_pending = nullptr; m_lasterror = wxSTREAM_WRITE_ERROR; if (!m_raw) { // Initially compresses the data to memory, then fall back to 'store' // if the compressor makes the data larger rather than smaller. wxMemoryOutputStream mem; - Buffer bufs[] = { { m_initialData, m_initialSize }, { NULL, 0 } }; + Buffer bufs[] = { { m_initialData, m_initialSize }, { nullptr, 0 } }; wxOutputStream *comp = OpenCompressor(mem, *spPending, bufs); if (!comp) @@ -2550,7 +2550,7 @@ bool wxZipOutputStream::CloseEntry() return true; CloseCompressor(m_comp); - m_comp = NULL; + m_comp = nullptr; wxFileOffset compressedSize = m_store->TellO(); @@ -2620,7 +2620,7 @@ bool wxZipOutputStream::CloseEntry() void wxZipOutputStream::Sync() { if (IsOk() && m_pending) - CreatePendingEntry(NULL, 0); + CreatePendingEntry(nullptr, 0); if (!m_comp) m_lasterror = wxSTREAM_WRITE_ERROR; if (IsOk()) { diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 194ebeb624..5c5e722c58 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -73,9 +73,9 @@ wxZlibClassFactory::wxZlibClassFactory() const wxChar * const * wxZlibClassFactory::GetProtocols(wxStreamProtocolType type) const { - static const wxChar *mimes[] = { wxT("application/x-deflate"), NULL }; - static const wxChar *encs[] = { wxT("deflate"), NULL }; - static const wxChar *empty[] = { NULL }; + static const wxChar *mimes[] = { wxT("application/x-deflate"), nullptr }; + static const wxChar *encs[] = { wxT("deflate"), nullptr }; + static const wxChar *empty[] = { nullptr }; switch (type) { case wxSTREAM_MIMETYPE: return mimes; @@ -102,15 +102,15 @@ const wxChar * const * wxGzipClassFactory::GetProtocols(wxStreamProtocolType type) const { static const wxChar *protos[] = - { wxT("gzip"), NULL }; + { wxT("gzip"), nullptr }; static const wxChar *mimes[] = - { wxT("application/gzip"), wxT("application/x-gzip"), NULL }; + { wxT("application/gzip"), wxT("application/x-gzip"), nullptr }; static const wxChar *encs[] = - { wxT("gzip"), NULL }; + { wxT("gzip"), nullptr }; static const wxChar *exts[] = - { wxT(".gz"), wxT(".gzip"), NULL }; + { wxT(".gz"), wxT(".gzip"), nullptr }; static const wxChar *empty[] = - { NULL }; + { nullptr }; switch (type) { case wxSTREAM_PROTOCOL: return protos; @@ -140,7 +140,7 @@ wxZlibInputStream::wxZlibInputStream(wxInputStream *stream, int flags) void wxZlibInputStream::Init(int flags) { - m_inflate = NULL; + m_inflate = nullptr; m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE]; m_z_size = ZSTREAM_BUFFER_SIZE; m_pos = 0; @@ -296,7 +296,7 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream *stream, void wxZlibOutputStream::Init(int level, int flags) { - m_deflate = NULL; + m_deflate = nullptr; m_z_buffer = new unsigned char[ZSTREAM_BUFFER_SIZE]; m_z_size = ZSTREAM_BUFFER_SIZE; m_pos = 0; diff --git a/src/dfb/app.cpp b/src/dfb/app.cpp index 612e9f1636..d711257d98 100644 --- a/src/dfb/app.cpp +++ b/src/dfb/app.cpp @@ -50,7 +50,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) argvDFB[i] = strdup(wxConvUTF8.cWX2MB(argv[i])); } - argvDFB[argc] = NULL; + argvDFB[argc] = nullptr; int argcDFB = argc; diff --git a/src/dfb/bitmap.cpp b/src/dfb/bitmap.cpp index 47ed640950..67ccc1745f 100644 --- a/src/dfb/bitmap.cpp +++ b/src/dfb/bitmap.cpp @@ -189,10 +189,10 @@ CreateSurfaceWithFormat(int w, int h, DFBSurfacePixelFormat format) // Creates a surface that will use wxImage's pixel data (RGB only) wxIDirectFBSurfacePtr CreateSurfaceForImage(const wxImage& image) { - wxCHECK_MSG( image.IsOk(), NULL, "invalid image" ); + wxCHECK_MSG( image.IsOk(), nullptr, "invalid image" ); // FIXME_DFB: implement alpha handling by merging alpha buffer with RGB // into a temporary RGBA surface - wxCHECK_MSG( !image.HasAlpha(), NULL, "alpha channel not supported" ); + wxCHECK_MSG( !image.HasAlpha(), nullptr, "alpha channel not supported" ); // NB: wxImage uses RGB order of bytes while DirectFB uses BGR, so we // cannot use preallocated surface that shares data with wxImage, we @@ -215,7 +215,7 @@ bool ConvertSurfaceToFormat(wxIDirectFBSurfacePtr& surface, if ( !s->SetBlittingFlags(DSBLIT_NOFX) ) return false; - if ( !s->Blit(surface->GetRaw(), NULL, 0, 0) ) + if ( !s->Blit(surface->GetRaw(), nullptr, 0, 0) ) return false; surface = s; @@ -349,19 +349,19 @@ class wxBitmapRefData: public wxGDIRefData public: wxBitmapRefData() { - m_mask = NULL; + m_mask = nullptr; #if wxUSE_PALETTE - m_palette = NULL; + m_palette = nullptr; #endif } wxBitmapRefData(const wxBitmapRefData& data) { - m_surface = data.m_surface ? data.m_surface->Clone() : NULL; + m_surface = data.m_surface ? data.m_surface->Clone() : nullptr; - m_mask = data.m_mask ? new wxMask(*data.m_mask) : NULL; + m_mask = data.m_mask ? new wxMask(*data.m_mask) : nullptr; #if wxUSE_PALETTE - m_palette = data.m_palette ? new wxPalette(*data.m_palette) : NULL; + m_palette = data.m_palette ? new wxPalette(*data.m_palette) : nullptr; #endif } @@ -457,7 +457,7 @@ void wxBitmap::InitFromImage(const wxImage& imageOrig, int depth, double WXUNUSE if ( !dst->SetBlittingFlags(DSBLIT_NOFX) ) return; - if ( !dst->Blit(src->GetRaw(), NULL, 0, 0) ) + if ( !dst->Blit(src->GetRaw(), nullptr, 0, 0) ) return; } } @@ -485,7 +485,7 @@ wxImage wxBitmap::ConvertToImage() const if ( !dst->SetBlittingFlags(DSBLIT_NOFX) ) return wxNullImage; - if ( !dst->Blit(src->GetRaw(), NULL, 0, 0) ) + if ( !dst->Blit(src->GetRaw(), nullptr, 0, 0) ) return wxNullImage; CopySurfaceToImage(dst, img); @@ -493,7 +493,7 @@ wxImage wxBitmap::ConvertToImage() const } // FIXME: implement mask setting in the image - wxASSERT_MSG( GetMask() == NULL, "bitmap masks are ignored for now" ); + wxASSERT_MSG( GetMask() == nullptr, "bitmap masks are ignored for now" ); return img; } @@ -501,7 +501,7 @@ wxImage wxBitmap::ConvertToImage() const void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { - wxCHECK_MSG( IsOk(), NULL, "invalid bitmap" ); + wxCHECK_MSG( IsOk(), nullptr, "invalid bitmap" ); AllocExclusive(); @@ -516,16 +516,16 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) // as unpacked formats (RGB24, RGB32) are the common case and converting // between them while blitting is fast enough (FIXME?) if ( !ConvertSurfaceToFormat(M_BITMAP->m_surface, format) ) - return NULL; + return nullptr; - void *bits = NULL; + void *bits = nullptr; if ( !M_BITMAP->m_surface->Lock ( (DFBSurfaceLockFlags)(DSLF_READ | DSLF_WRITE), &bits, &data.m_stride ) ) - return NULL; + return nullptr; M_BITMAP->m_surface->GetSize(&data.m_width, &data.m_height); @@ -567,7 +567,7 @@ int wxBitmap::GetHeight() const wxCHECK_MSG( IsOk(), -1, wxT("invalid bitmap") ); int h = -1; - M_BITMAP->m_surface->GetSize(NULL, &h); + M_BITMAP->m_surface->GetSize(nullptr, &h); return h; } @@ -576,7 +576,7 @@ int wxBitmap::GetWidth() const wxCHECK_MSG( IsOk(), -1, wxT("invalid bitmap") ); int w = -1; - M_BITMAP->m_surface->GetSize(&w, NULL); + M_BITMAP->m_surface->GetSize(&w, nullptr); return w; } @@ -589,7 +589,7 @@ int wxBitmap::GetDepth() const wxMask *wxBitmap::GetMask() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BITMAP->m_mask; } @@ -625,7 +625,7 @@ bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type) wxBitmapHandler *handler = FindHandler(type); - if ( handler == NULL ) + if ( handler == nullptr ) { wxImage image; if ( !image.LoadFile(name, type) || !image.IsOk() ) @@ -652,7 +652,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, const wxPal wxBitmapHandler *handler = FindHandler(type); - if ( handler == NULL ) + if ( handler == nullptr ) { wxImage image = ConvertToImage(); #if wxUSE_PALETTE @@ -675,7 +675,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, const wxPal #if wxUSE_PALETTE wxPalette *wxBitmap::GetPalette() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BITMAP->m_palette; } @@ -724,7 +724,7 @@ void wxBitmap::SetDepth(int depth) return; if ( !s->SetBlittingFlags(DSBLIT_NOFX) ) return; - if ( !s->Blit(M_BITMAP->m_surface->GetRaw(), NULL, 0, 0) ) + if ( !s->Blit(M_BITMAP->m_surface->GetRaw(), nullptr, 0, 0) ) return; M_BITMAP->m_surface = s; @@ -733,7 +733,7 @@ void wxBitmap::SetDepth(int depth) wxIDirectFBSurfacePtr wxBitmap::GetDirectFBSurface() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BITMAP->m_surface; } diff --git a/src/dfb/dc.cpp b/src/dfb/dc.cpp index c0a1c2c0e5..0d5b7cc217 100644 --- a/src/dfb/dc.cpp +++ b/src/dfb/dc.cpp @@ -46,7 +46,7 @@ void wxDFBDCImpl::DFBInit(const wxIDirectFBSurfacePtr& surface) { m_surface = surface; - wxCHECK_RET( surface != NULL, "invalid surface" ); + wxCHECK_RET( surface != nullptr, "invalid surface" ); SetFont(DEFAULT_FONT); SetPen(DEFAULT_PEN); @@ -105,7 +105,7 @@ void wxDFBDCImpl::DestroyClippingRegion() { wxCHECK_RET( IsOk(), wxT("invalid dc") ); - m_surface->SetClip(NULL); + m_surface->SetClip(nullptr); wxDCImpl::DestroyClippingRegion(); } @@ -148,7 +148,7 @@ bool wxDFBDCImpl::DoFloodFill(wxCoord x, wxCoord y, bool wxDFBDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const { - wxCHECK_MSG( col, false, "NULL colour parameter in wxDFBDCImpl::GetPixel"); + wxCHECK_MSG( col, false, "null colour parameter in wxDFBDCImpl::GetPixel"); wxFAIL_MSG( "GetPixel not implemented" ); @@ -493,7 +493,7 @@ void wxDFBDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y wxCHECK_RET( !theFont || theFont->IsOk(), wxT("invalid font") ); wxFont oldFont; - if ( theFont != NULL ) + if ( theFont != nullptr ) { oldFont = m_font; wxConstCast(this, wxDFBDCImpl)->SetFont(*theFont); @@ -503,7 +503,7 @@ void wxDFBDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y DFBRectangle rect; wxIDirectFBFontPtr f = GetCurrentFont(); - if ( f->GetStringExtents(string.utf8_str(), -1, &rect, NULL) ) + if ( f->GetStringExtents(string.utf8_str(), -1, &rect, nullptr) ) { // VS: YDEV is corrent, it should *not* be XDEV, because font's are // only scaled according to m_scaleY @@ -524,7 +524,7 @@ void wxDFBDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y if ( y ) *y = yy; if ( externalLeading ) *externalLeading = 0; - if ( theFont != NULL ) + if ( theFont != nullptr ) wxConstCast(this, wxDFBDCImpl)->SetFont(oldFont); } diff --git a/src/dfb/dcclient.cpp b/src/dfb/dcclient.cpp index 64a67e0e98..ef3ad2ee68 100644 --- a/src/dfb/dcclient.cpp +++ b/src/dfb/dcclient.cpp @@ -96,7 +96,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxDFBDCImpl); wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *win) : wxDFBDCImpl(owner) { - InitForWin(win, NULL); + InitForWin(win, nullptr); } void wxWindowDCImpl::InitForWin(wxWindow *win, const wxRect *rect) diff --git a/src/dfb/dcmemory.cpp b/src/dfb/dcmemory.cpp index 546549e693..2c8389507f 100644 --- a/src/dfb/dcmemory.cpp +++ b/src/dfb/dcmemory.cpp @@ -67,7 +67,7 @@ void wxMemoryDCImpl::DoSelect(const wxBitmap& bitmap) if ( !bitmap.IsOk() ) { // select the bitmap out of the DC - m_surface = NULL; + m_surface = nullptr; return; } diff --git a/src/dfb/font.cpp b/src/dfb/font.cpp index de17a510ab..016886c40e 100644 --- a/src/dfb/font.cpp +++ b/src/dfb/font.cpp @@ -84,7 +84,7 @@ wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const wxIDirectFBFontPtr wxFont::GetDirectFBFont(bool antialiased) const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid font") ); // we don't support DC scaling yet, so use scale=1 wxFontInstance *i = M_FONTDATA->GetFontInstance(1.0, antialiased); @@ -148,7 +148,7 @@ bool wxFont::IsFixedWidth() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid font") ); return M_FONTDATA->GetNativeFontInfo(); } diff --git a/src/dfb/fontmgr.cpp b/src/dfb/fontmgr.cpp index d2a48f8e9d..5ea0d53fa6 100644 --- a/src/dfb/fontmgr.cpp +++ b/src/dfb/fontmgr.cpp @@ -55,7 +55,7 @@ wxFontInstance::wxFontInstance(float ptSize, bool aa, desc.fract_height = pixSize; if ( filename == BUILTIN_DFB_FONT_FILENAME ) - m_font = wxIDirectFB::Get()->CreateFont(NULL, &desc); + m_font = wxIDirectFB::Get()->CreateFont(nullptr, &desc); else m_font = wxIDirectFB::Get()->CreateFont(filename.fn_str(), &desc); diff --git a/src/dfb/nonownedwnd.cpp b/src/dfb/nonownedwnd.cpp index 5133a19a63..984b945448 100644 --- a/src/dfb/nonownedwnd.cpp +++ b/src/dfb/nonownedwnd.cpp @@ -132,7 +132,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, if ( !m_dfbwin->SetOpacity(wxALPHA_TRANSPARENT) ) return false; - if ( !wxWindow::Create(NULL, id, pos, size, style, name) ) + if ( !wxWindow::Create(nullptr, id, pos, size, style, name) ) return false; SetParent(parent); @@ -346,7 +346,7 @@ void wxNonOwnedWindow::HandleQueuedPaintRequests() DFBRegion r = {paintedRect.GetLeft(), paintedRect.GetTop(), paintedRect.GetRight(), paintedRect.GetBottom()}; - DFBRegion *rptr = (winRect == paintedRect) ? NULL : &r; + DFBRegion *rptr = (winRect == paintedRect) ? nullptr : &r; GetDfbSurface()->FlipToFront(rptr); @@ -387,18 +387,18 @@ void wxNonOwnedWindow::Update() namespace { -static wxNonOwnedWindow *gs_insideDFBFocusHandlerOf = NULL; +static wxNonOwnedWindow *gs_insideDFBFocusHandlerOf = nullptr; struct InsideDFBFocusHandlerSetter { InsideDFBFocusHandlerSetter(wxNonOwnedWindow *win) { - wxASSERT( gs_insideDFBFocusHandlerOf == NULL ); + wxASSERT( gs_insideDFBFocusHandlerOf == nullptr ); gs_insideDFBFocusHandlerOf = win; } ~InsideDFBFocusHandlerSetter() { - gs_insideDFBFocusHandlerOf = NULL; + gs_insideDFBFocusHandlerOf = nullptr; } }; diff --git a/src/dfb/overlay.cpp b/src/dfb/overlay.cpp index fb484a2215..d98e67ac56 100644 --- a/src/dfb/overlay.cpp +++ b/src/dfb/overlay.cpp @@ -43,7 +43,7 @@ wxOverlay::Impl* wxOverlay::Create() wxOverlayImpl::wxOverlayImpl() { - m_window = NULL; + m_window = nullptr; m_isEmpty = true; } @@ -54,12 +54,12 @@ wxOverlayImpl::~wxOverlayImpl() bool wxOverlayImpl::IsOk() { - return m_window != NULL; + return m_window != nullptr; } void wxOverlayImpl::Init(wxDC *dc, int x, int y, int width, int height) { - wxCHECK_RET( dc, "NULL dc pointer" ); + wxCHECK_RET( dc, "null dc pointer" ); wxASSERT_MSG( !IsOk() , "You cannot Init an overlay twice" ); wxDFBDCImpl * const dcimpl = wxDynamicCast(dc->GetImpl(), wxDFBDCImpl); @@ -83,7 +83,7 @@ void wxOverlayImpl::Init(wxDC *dc, int x, int y, int width, int height) void wxOverlayImpl::BeginDrawing(wxDC *dc) { - wxCHECK_RET( dc, "NULL dc pointer" ); + wxCHECK_RET( dc, "null dc pointer" ); wxWindowDCImpl * const dcimpl = static_cast(dc->GetImpl()); @@ -121,7 +121,7 @@ void wxOverlayImpl::Reset() if ( m_window ) { m_window->RemoveOverlay(this); - m_window = NULL; + m_window = nullptr; m_surface.Reset(); } } diff --git a/src/dfb/pen.cpp b/src/dfb/pen.cpp index f082f4b7d1..15ef4d1485 100644 --- a/src/dfb/pen.cpp +++ b/src/dfb/pen.cpp @@ -134,7 +134,7 @@ int wxPen::GetDashes(wxDash **ptr) const { wxFAIL_MSG( "GetDashes not implemented" ); - *ptr = NULL; + *ptr = nullptr; return 0; } @@ -149,7 +149,7 @@ wxDash* wxPen::GetDash() const { wxFAIL_MSG( "GetDash not implemented" ); - return NULL; + return nullptr; } wxPenCap wxPen::GetCap() const @@ -191,10 +191,10 @@ wxColour wxPen::GetColour() const wxBitmap *wxPen::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid pen") ); wxFAIL_MSG( "GetStipple not implemented" ); - return NULL; + return nullptr; } wxGDIRefData *wxPen::CreateGDIRefData() const diff --git a/src/dfb/region.cpp b/src/dfb/region.cpp index 59b4196758..e2210b5961 100644 --- a/src/dfb/region.cpp +++ b/src/dfb/region.cpp @@ -53,7 +53,7 @@ wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const wxRegion::wxRegion() { - m_refData = NULL; + m_refData = nullptr; } wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) @@ -74,7 +74,7 @@ wxRegion::wxRegion(const wxRect& r) wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle) { #warning "implement this" - m_refData = NULL; + m_refData = nullptr; } wxRegion::~wxRegion() diff --git a/src/dfb/settings.cpp b/src/dfb/settings.cpp index f9fbe01bf4..4754d693fe 100644 --- a/src/dfb/settings.cpp +++ b/src/dfb/settings.cpp @@ -67,10 +67,10 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, switch (index) { case wxSYS_SCREEN_X: - wxDisplaySize(&val, NULL); + wxDisplaySize(&val, nullptr); return val; case wxSYS_SCREEN_Y: - wxDisplaySize(NULL, &val); + wxDisplaySize(nullptr, &val); return val; default: diff --git a/src/dfb/window.cpp b/src/dfb/window.cpp index fe70ee80f4..6dceeb0028 100644 --- a/src/dfb/window.cpp +++ b/src/dfb/window.cpp @@ -45,12 +45,12 @@ // --------------------------------------------------------------------------- // the window that has keyboard focus: -static wxWindowDFB *gs_focusedWindow = NULL; +static wxWindowDFB *gs_focusedWindow = nullptr; // the window that is about to be focused after currently focused // one looses focus: -static wxWindow *gs_toBeFocusedWindow = NULL; +static wxWindow *gs_toBeFocusedWindow = nullptr; // the window that has mouse capture -static wxWindowDFB *gs_mouseCapture = NULL; +static wxWindowDFB *gs_mouseCapture = nullptr; // --------------------------------------------------------------------------- // overlays support @@ -84,8 +84,8 @@ wxWindow *wxGetActiveWindow() void wxWindowDFB::Init() { m_isShown = true; - m_tlw = NULL; - m_overlays = NULL; + m_tlw = nullptr; + m_overlays = nullptr; } // Destructor @@ -140,10 +140,10 @@ bool wxWindowDFB::Create(wxWindow *parent, wxIDirectFBSurfacePtr wxWindowDFB::ObtainDfbSurface() const { - wxCHECK_MSG( m_parent, NULL, "parentless window?" ); + wxCHECK_MSG( m_parent, nullptr, "parentless window?" ); wxIDirectFBSurfacePtr parentSurface(m_parent->GetDfbSurface()); - wxCHECK_MSG( parentSurface, NULL, "invalid parent surface" ); + wxCHECK_MSG( parentSurface, nullptr, "invalid parent surface" ); wxRect r(GetRect()); AdjustForParentClientOrigin(r.x, r.y, 0); @@ -165,7 +165,7 @@ wxIDirectFBSurfacePtr wxWindowDFB::GetDfbSurface() void wxWindowDFB::InvalidateDfbSurface() { - m_surface = NULL; + m_surface = nullptr; // surfaces of the children are subsurfaces of this window's surface, // so they must be invalidated as well: @@ -191,7 +191,7 @@ void wxWindowDFB::SetFocus() { gs_toBeFocusedWindow = (wxWindow*)this; gs_focusedWindow->DFBKillFocus(); - gs_toBeFocusedWindow = NULL; + gs_toBeFocusedWindow = nullptr; } gs_focusedWindow = this; @@ -228,7 +228,7 @@ void wxWindowDFB::DFBKillFocus() wxCHECK_RET( gs_focusedWindow == this, "killing focus on window that doesn't have it" ); - gs_focusedWindow = NULL; + gs_focusedWindow = nullptr; if ( m_isBeingDeleted ) return; // don't send any events from dtor @@ -301,7 +301,7 @@ void wxWindowDFB::DoReleaseMouse() #if 0 DFB_wmUncaptureEvents(m_wnd, wxDFB_CAPTURE_MOUSE); #endif - gs_mouseCapture = NULL; + gs_mouseCapture = nullptr; } /* static */ wxWindow *wxWindowBase::GetCapture() @@ -969,7 +969,7 @@ static long GetUntraslatedKeyCode(DFBInputDeviceKeyIdentifier key_id, else { wchar_t chr = key_symbol; - wxCharBuffer buf(wxConvUI->cWC2MB(&chr, 1, NULL)); + wxCharBuffer buf(wxConvUI->cWC2MB(&chr, 1, nullptr)); if ( buf ) return *buf; // may be 0 if failed else @@ -1065,5 +1065,5 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt) wxWindow* wxFindWindowAtPoint(const wxPoint& WXUNUSED(pt)) { wxFAIL_MSG( "wxFindWindowAtPoint not implemented" ); - return NULL; + return nullptr; } diff --git a/src/dfb/wrapdfb.cpp b/src/dfb/wrapdfb.cpp index 7e62a81099..24e13b6419 100644 --- a/src/dfb/wrapdfb.cpp +++ b/src/dfb/wrapdfb.cpp @@ -139,10 +139,10 @@ wxIDirectFBSurface::CreateCompatible(const wxSize& sz, int flags) if ( size == wxDefaultSize ) { if ( !GetSize(&size.x, &size.y) ) - return NULL; + return nullptr; } - wxCHECK_MSG( size.x > 0 && size.y > 0, NULL, "invalid size" ); + wxCHECK_MSG( size.x > 0 && size.y > 0, nullptr, "invalid size" ); DFBSurfaceDescription desc; desc.flags = (DFBSurfaceDescriptionFlags)( @@ -165,7 +165,7 @@ wxIDirectFBSurface::CreateCompatible(const wxSize& sz, int flags) wxIDirectFBSurfacePtr snew(wxIDirectFB::Get()->CreateSurface(&desc)); if ( !snew ) - return NULL; + return nullptr; if ( desc.pixelformat == DSPF_LUT8 ) { @@ -173,7 +173,7 @@ wxIDirectFBSurface::CreateCompatible(const wxSize& sz, int flags) if ( pal ) { if ( !snew->SetPalette(pal) ) - return NULL; + return nullptr; } } @@ -184,13 +184,13 @@ wxIDirectFBSurfacePtr wxIDirectFBSurface::Clone() { wxIDirectFBSurfacePtr snew(CreateCompatible()); if ( !snew ) - return NULL; + return nullptr; if ( !snew->SetBlittingFlags(DSBLIT_NOFX) ) - return NULL; + return nullptr; - if ( !snew->Blit(GetRaw(), NULL, 0, 0) ) - return NULL; + if ( !snew->Blit(GetRaw(), nullptr, 0, 0) ) + return nullptr; return snew; } diff --git a/src/generic/aboutdlgg.cpp b/src/generic/aboutdlgg.cpp index 846da14150..bb0cd240a6 100644 --- a/src/generic/aboutdlgg.cpp +++ b/src/generic/aboutdlgg.cpp @@ -227,7 +227,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren void wxGenericAboutDialog::AddControl(wxWindow *win, const wxSizerFlags& flags) { wxCHECK_RET( m_sizerText, wxT("can only be called after Create()") ); - wxASSERT_MSG( win, wxT("can't add NULL window to about dialog") ); + wxASSERT_MSG( win, wxT("can't add null window to about dialog") ); m_sizerText->Add(win, flags); } diff --git a/src/generic/accel.cpp b/src/generic/accel.cpp index 1e5ebf2e87..aa2844a3c9 100644 --- a/src/generic/accel.cpp +++ b/src/generic/accel.cpp @@ -105,7 +105,7 @@ wxAcceleratorTable::~wxAcceleratorTable() bool wxAcceleratorTable::IsOk() const { - return m_refData != NULL; + return m_refData != nullptr; } // ---------------------------------------------------------------------------- @@ -161,7 +161,7 @@ wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const if ( !IsOk() ) { // not an error, the accel table is just empty - return NULL; + return nullptr; } wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst(); @@ -186,14 +186,14 @@ wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const node = node->GetNext(); } - return NULL; + return nullptr; } wxMenuItem *wxAcceleratorTable::GetMenuItem(const wxKeyEvent& event) const { const wxAcceleratorEntry *entry = GetEntry(event); - return entry ? entry->GetMenuItem() : NULL; + return entry ? entry->GetMenuItem() : nullptr; } int wxAcceleratorTable::GetCommand(const wxKeyEvent& event) const diff --git a/src/generic/animateg.cpp b/src/generic/animateg.cpp index 0262abfa5b..9eb7b2d866 100644 --- a/src/generic/animateg.cpp +++ b/src/generic/animateg.cpp @@ -128,7 +128,7 @@ bool wxAnimationGenericImpl::Load(wxInputStream &stream, wxAnimationType type) handler = wxAnimation::FindHandler(type); - if (handler == NULL) + if (handler == nullptr) { wxLogWarning( _("No animation handler for type %ld defined."), type ); @@ -154,7 +154,7 @@ void wxAnimationGenericImpl::UnRef() if ( m_decoder ) { m_decoder->DecRef(); - m_decoder = NULL; + m_decoder = nullptr; } } @@ -272,7 +272,7 @@ void wxGenericAnimationCtrl::SetInactiveBitmap(const wxBitmapBundle &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.IsOk() && bmp.GetBitmapFor(this).GetMask() != NULL && GetParent() != NULL ) + if ( bmp.IsOk() && bmp.GetBitmapFor(this).GetMask() != nullptr && GetParent() != nullptr ) SetBackgroundColour(GetParent()->GetBackgroundColour()); wxAnimationCtrlBase::SetInactiveBitmap(bmp); diff --git a/src/generic/bmpcboxg.cpp b/src/generic/bmpcboxg.cpp index cd05be6c85..3681049d73 100644 --- a/src/generic/bmpcboxg.cpp +++ b/src/generic/bmpcboxg.cpp @@ -350,7 +350,7 @@ wxCoord wxBitmapComboBox::OnMeasureItem(size_t item) const wxCoord wxBitmapComboBox::OnMeasureItemWidth(size_t item) const { wxCoord x, y; - GetTextExtent(GetString(item), &x, &y, 0, 0); + GetTextExtent(GetString(item), &x, &y, nullptr, nullptr); x += m_imgAreaWidth; return x; } diff --git a/src/generic/busyinfo.cpp b/src/generic/busyinfo.cpp index c80172f31d..6b00a4f8b9 100644 --- a/src/generic/busyinfo.cpp +++ b/src/generic/busyinfo.cpp @@ -69,7 +69,7 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) } else { - title = NULL; + title = nullptr; } // Vertically center the text in the window. diff --git a/src/generic/buttonbar.cpp b/src/generic/buttonbar.cpp index c904e738c3..a4bf6386bc 100644 --- a/src/generic/buttonbar.cpp +++ b/src/generic/buttonbar.cpp @@ -59,7 +59,7 @@ public: m_width = m_height = 0; - m_button = NULL; + m_button = nullptr; } wxButtonToolBarTool(wxButtonToolBar *tbar, @@ -70,7 +70,7 @@ public: m_x = m_y = wxDefaultCoord; m_width = m_height = 0; - m_button = NULL; + m_button = nullptr; } wxBitmapButton* GetButton() const { return m_button; } @@ -169,7 +169,7 @@ wxToolBarToolBase *wxButtonToolBar::FindToolForPosition(wxCoord x, wxCoord y) co if ( IsVertical() ) { if ( x < 0 || x > m_maxWidth ) - return NULL; + return nullptr; // we always use x, even for a vertical toolbar, this makes the code // below simpler @@ -178,7 +178,7 @@ wxToolBarToolBase *wxButtonToolBar::FindToolForPosition(wxCoord x, wxCoord y) co else // horizontal { if ( y < 0 || y > m_maxHeight ) - return NULL; + return nullptr; } for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); @@ -195,18 +195,18 @@ wxToolBarToolBase *wxButtonToolBar::FindToolForPosition(wxCoord x, wxCoord y) co { // don't return the separators from here, they don't accept any // input anyhow - return tool->IsSeparator() ? NULL : tool; + return tool->IsSeparator() ? nullptr : tool; } } - return NULL; + return nullptr; } void wxButtonToolBar::GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const { - wxCHECK_RET( start && end, wxT("NULL pointer in GetRectLimits") ); + wxCHECK_RET( start && end, wxT("null pointer in GetRectLimits") ); if ( IsVertical() ) { @@ -288,7 +288,7 @@ wxRect wxButtonToolBar::GetToolRect(wxToolBarToolBase *toolBase) const wxRect rect; - wxCHECK_MSG( tool, rect, wxT("GetToolRect: NULL tool") ); + wxCHECK_MSG( tool, rect, wxT("GetToolRect: null tool") ); // ensure that we always have the valid tool position if ( m_needsLayout ) diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index c405d31e98..e06a95ec81 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -127,10 +127,10 @@ wxGenericCalendarCtrl::wxGenericCalendarCtrl(wxWindow *parent, void wxGenericCalendarCtrl::Init() { - m_choiceMonth = NULL; - m_spinYear = NULL; - m_staticYear = NULL; - m_staticMonth = NULL; + m_choiceMonth = nullptr; + m_spinYear = nullptr; + m_staticYear = nullptr; + m_staticMonth = nullptr; m_userChangedYear = false; @@ -146,7 +146,7 @@ void wxGenericCalendarCtrl::Init() for ( size_t n = 0; n < WXSIZEOF(m_attrs); n++ ) { - m_attrs[n] = NULL; + m_attrs[n] = nullptr; } InitColours(); @@ -258,7 +258,7 @@ void wxGenericCalendarCtrl::CreateMonthChoice() m_choiceMonth = new wxChoice(GetParent(), wxID_ANY, wxDefaultPosition, wxDefaultSize, - 0, NULL); + 0, nullptr); wxDateTime::Month m; for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) @@ -304,10 +304,10 @@ bool wxGenericCalendarCtrl::Destroy() if ( m_staticMonth ) m_staticMonth->Destroy(); - m_staticYear = NULL; - m_spinYear = NULL; - m_choiceMonth = NULL; - m_staticMonth = NULL; + m_staticYear = nullptr; + m_spinYear = nullptr; + m_choiceMonth = nullptr; + m_staticMonth = nullptr; return wxControl::Destroy(); } @@ -956,13 +956,13 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) unsigned int day = date.GetDay(); wxString dayStr = wxString::Format(wxT("%u"), day); wxCoord width; - dc.GetTextExtent(dayStr, &width, NULL); + dc.GetTextExtent(dayStr, &width, nullptr); bool changedColours = false, changedFont = false; bool isSel = false; - wxCalendarDateAttr *attr = NULL; + wxCalendarDateAttr *attr = nullptr; if ( date.GetMonth() != m_date.GetMonth() || !IsDateInRange(date) ) { diff --git a/src/generic/caret.cpp b/src/generic/caret.cpp index 2011fc1cf9..476f5a3165 100644 --- a/src/generic/caret.cpp +++ b/src/generic/caret.cpp @@ -80,12 +80,12 @@ void wxCaretBase::SetBlinkTime(int milliseconds) GtkSettings *settings = gtk_settings_get_default(); if (millseconds == 0) { - gtk_settings_set_long_property(settings, "gtk-cursor-blink", gtk_false, NULL); + gtk_settings_set_long_property(settings, "gtk-cursor-blink", gtk_false, nullptr); } else { - gtk_settings_set_long_property(settings, "gtk-cursor-blink", gtk_true, NULL); - gtk_settings_set_long_property(settings, "gtk-cursor-time", milliseconds, NULL); + gtk_settings_set_long_property(settings, "gtk-cursor-blink", gtk_true, nullptr); + gtk_settings_set_long_property(settings, "gtk-cursor-time", milliseconds, nullptr); } #endif } @@ -311,7 +311,7 @@ void wxCaret::DoDraw(wxDC *dc, wxWindow* win) } #if wxUSE_GRAPHICS_CONTEXT - if (gc == NULL) + if (gc == nullptr) #endif { dc->SetLogicalFunction(wxINVERT); diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 4a1e8ec40f..b5dba69a1d 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -181,7 +181,7 @@ void *wxGetSingleChoiceData( const wxString& message, client_data); dialog.SetSelection(initialSelection); - return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : NULL; + return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : nullptr; } void *wxGetSingleChoiceData( const wxString& message, @@ -197,7 +197,7 @@ void *wxGetSingleChoiceData( const wxString& message, wxSingleChoiceDialog dialog(parent, message, caption, choices, client_data); dialog.SetSelection(initialSelection); - return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : NULL; + return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : nullptr; } void* wxGetSingleChoiceData( const wxString& message, diff --git a/src/generic/collpaneg.cpp b/src/generic/collpaneg.cpp index 22cc8983d1..85f8c9acd4 100644 --- a/src/generic/collpaneg.cpp +++ b/src/generic/collpaneg.cpp @@ -56,9 +56,9 @@ wxEND_EVENT_TABLE() void wxGenericCollapsiblePane::Init() { - m_pButton = NULL; - m_pPane = NULL; - m_sz = NULL; + m_pButton = nullptr; + m_pPane = nullptr; + m_sz = nullptr; } bool wxGenericCollapsiblePane::Create(wxWindow *parent, @@ -102,7 +102,7 @@ bool wxGenericCollapsiblePane::Create(wxWindow *parent, wxGenericCollapsiblePane::~wxGenericCollapsiblePane() { if (m_pButton) - m_pButton->SetContainingSizer(NULL); + m_pButton->SetContainingSizer(nullptr); // our sizer is not deleted automatically since we didn't use SetSizer()! wxDELETE(m_sz); diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 3da6fc4433..754c2734fb 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -159,9 +159,9 @@ bool wxGenericColourDialog::Create(wxWindow *parent, const wxColourData *data) m_colourData = *data; #if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA - m_customColourBmp = NULL; + m_customColourBmp = nullptr; for ( unsigned i = 0; i < WXSIZEOF(m_customColoursBmp); i++ ) - m_customColoursBmp[i] = NULL; + m_customColoursBmp[i] = nullptr; #endif InitializeColours(); @@ -342,7 +342,7 @@ void wxGenericColourDialog::CreateWidgets() } else { - m_alphaSlider = NULL; + m_alphaSlider = nullptr; } wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index 625293e32e..a1ef858ef1 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -450,7 +450,7 @@ bool wxGenericComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const #if defined(__WXOSX__) wxTextWidgetImpl * wxGenericComboCtrl::GetTextPeer() const { - return m_text ? m_text->GetTextPeer() : NULL; + return m_text ? m_text->GetTextPeer() : nullptr; } #endif diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 4c6757d765..a7a0050653 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -489,7 +489,7 @@ public: wxDataViewTreeNode(wxDataViewTreeNode *parent, const wxDataViewItem& item) : m_parent(parent), m_item(item), - m_branchData(NULL) + m_branchData(nullptr) { } @@ -511,7 +511,7 @@ public: static wxDataViewTreeNode* CreateRootNode() { - wxDataViewTreeNode *n = new wxDataViewTreeNode(NULL, wxDataViewItem()); + wxDataViewTreeNode *n = new wxDataViewTreeNode(nullptr, wxDataViewItem()); n->m_branchData = new BranchNodeData; n->m_branchData->open = true; return n; @@ -529,7 +529,7 @@ public: void RemoveChild(unsigned index) { - wxCHECK_RET( m_branchData != NULL, "leaf node doesn't have children" ); + wxCHECK_RET( m_branchData != nullptr, "leaf node doesn't have children" ); m_branchData->RemoveChild(index); } @@ -556,7 +556,7 @@ public: { int ret = 0; const wxDataViewTreeNode * node = this; - while( node->GetParent()->GetParent() != NULL ) + while( node->GetParent()->GetParent() != nullptr ) { node = node->GetParent(); ret ++; @@ -576,7 +576,7 @@ public: if ( !m_parent ) return; - wxCHECK_RET( m_branchData != NULL, "can't open leaf node" ); + wxCHECK_RET( m_branchData != nullptr, "can't open leaf node" ); int sum = 0; @@ -603,7 +603,7 @@ public: // even if GetChildNodes() is empty; see below. bool HasChildren() const { - return m_branchData != NULL; + return m_branchData != nullptr; } void SetHasChildren(bool has) @@ -617,7 +617,7 @@ public: { wxDELETE(m_branchData); } - else if ( m_branchData == NULL ) + else if ( m_branchData == nullptr ) { m_branchData = new BranchNodeData; } @@ -630,7 +630,7 @@ public: void ChangeSubTreeCount( int num ) { - wxASSERT( m_branchData != NULL ); + wxASSERT( m_branchData != nullptr ); if( !m_branchData->open ) return; @@ -723,7 +723,7 @@ public: virtual ~wxDataViewMainWindow(); bool IsList() const { return GetModel()->IsListModel(); } - bool IsVirtualList() const { return m_root == NULL; } + bool IsVirtualList() const { return m_root == nullptr; } // notifications from wxDataViewModel bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); @@ -806,7 +806,7 @@ public: void OnRenameTimer(); - void ScrollWindow( int dx, int dy, const wxRect *rect = NULL ) override; + void ScrollWindow( int dx, int dy, const wxRect *rect = nullptr ) override; void ScrollTo( int rows, int column ); unsigned GetCurrentRow() const { return m_currentRow; } @@ -815,7 +815,7 @@ public: bool TryAdvanceCurrentColumn(wxDataViewTreeNode *node, wxKeyEvent& event, bool forward); wxDataViewColumn *GetCurrentColumn() const { return m_currentCol; } - void ClearCurrentColumn() { m_currentCol = NULL; } + void ClearCurrentColumn() { m_currentCol = nullptr; } bool IsSingleSel() const { return !GetParent()->HasFlag(wxDV_MULTIPLE); } bool IsEmpty() { return GetRowCount() == 0; } @@ -914,7 +914,7 @@ public: DropItemInfo() : m_row(static_cast(-1)) , m_hint(DropHint_None) - , m_item(NULL) + , m_item(nullptr) , m_proposedDropIndex(-1) , m_indentLevel(-1) { @@ -943,7 +943,7 @@ public: void FinishEditing(); bool HasEditableColumn(const wxDataViewItem& item) const { - return FindColumnForEditing(item, wxDATAVIEW_CELL_EDITABLE) != NULL; + return FindColumnForEditing(item, wxDATAVIEW_CELL_EDITABLE) != nullptr; } private: @@ -1007,7 +1007,7 @@ private: return GetOwner()->GetColumnAt(i); } - return NULL; + return nullptr; } // Helper of public Expand(), must be called with a valid node. @@ -1055,10 +1055,10 @@ private: // This is the tree node under the cursor wxDataViewTreeNode * m_underMouse; - // The control used for editing or NULL. + // The control used for editing or nullptr. wxWeakRef m_editorCtrl; - // Id m_editorCtrl is non-NULL, pointer to the associated renderer. + // Id m_editorCtrl is non-null, pointer to the associated renderer. wxDataViewRenderer* m_editorRenderer; private: @@ -1106,7 +1106,7 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, m_align = align; m_mode = mode; m_ellipsizeMode = wxELLIPSIZE_MIDDLE; - m_dc = NULL; + m_dc = nullptr; m_state = 0; } @@ -1117,12 +1117,12 @@ wxDataViewRenderer::~wxDataViewRenderer() wxDC *wxDataViewRenderer::GetDC() { - if (m_dc == NULL) + if (m_dc == nullptr) { - if (GetOwner() == NULL) - return NULL; - if (GetOwner()->GetOwner() == NULL) - return NULL; + if (GetOwner() == nullptr) + return nullptr; + if (GetOwner()->GetOwner() == nullptr) + return nullptr; m_dc = new wxClientDC( GetOwner()->GetOwner() ); } @@ -1185,7 +1185,7 @@ wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype, wxDataViewRenderer( varianttype, mode, align ) { #if wxUSE_MARKUP - m_markupText = NULL; + m_markupText = nullptr; #endif // wxUSE_MARKUP } @@ -1211,7 +1211,7 @@ void wxDataViewTextRenderer::EnableMarkup(bool enable) if ( m_markupText ) { delete m_markupText; - m_markupText = NULL; + m_markupText = nullptr; } } } @@ -1678,7 +1678,7 @@ public: { m_win = win; m_row = row; - m_hint = NULL; + m_hint = nullptr; } ~wxDataViewDropSource() @@ -1694,7 +1694,7 @@ public: { int liney = m_win->GetLineStart( m_row ); int linex = 0; - m_win->GetOwner()->CalcUnscrolledPosition( 0, liney, NULL, &liney ); + m_win->GetOwner()->CalcUnscrolledPosition( 0, liney, nullptr, &liney ); m_win->ClientToScreen( &linex, &liney ); m_dist_x = pos.x - linex; m_dist_y = pos.y - liney; @@ -2084,13 +2084,13 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i SetOwner( parent ); - m_editorRenderer = NULL; + m_editorRenderer = nullptr; m_lastOnSame = false; m_renameTimer = new wxDataViewRenameTimer( this ); // TODO: user better initial values/nothing selected - m_currentCol = NULL; + m_currentCol = nullptr; m_currentColSetByKeyboard = false; m_useCellFocus = false; m_currentRow = (unsigned)-1; @@ -2101,7 +2101,7 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i } else { - m_rowHeightCache = NULL; + m_rowHeightCache = nullptr; } #if wxUSE_DRAG_AND_DROP @@ -2128,7 +2128,7 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i // Make m_count = -1 will cause the class recaculate the real displaying number of rows. m_count = -1; - m_underMouse = NULL; + m_underMouse = nullptr; UpdateDisplay(); } @@ -2287,7 +2287,7 @@ wxDataViewMainWindow::DropItemInfo wxDataViewMainWindow::GetDropItemInfo(const w wxDataViewTreeNode* prevAscendNode = node; wxDataViewTreeNode* ascendNode = node; - while (ascendNode != NULL) + while (ascendNode != nullptr) { dropItemInfo.m_indentLevel = level + 1; @@ -2536,7 +2536,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) unsigned int item_last = item_start + item_count; // Send the event to wxDataViewCtrl itself. - wxDataViewEvent cache_event(wxEVT_DATAVIEW_CACHE_HINT, m_owner, NULL); + wxDataViewEvent cache_event(wxEVT_DATAVIEW_CACHE_HINT, m_owner, nullptr); cache_event.SetCache(item_start, item_last - 1); m_owner->ProcessWindowEvent(cache_event); @@ -2824,7 +2824,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) for (unsigned int item = item_start; item < item_last; item++) { // get the cell value and set it into the renderer - wxDataViewTreeNode *node = NULL; + wxDataViewTreeNode *node = nullptr; wxDataViewItem dataitem; const int line_height = GetLineHeight(item); bool hasValue = true; @@ -2832,7 +2832,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) if (!IsVirtualList()) { node = GetTreeNodeByRow(item); - if (node == NULL) + if (node == nullptr) { cell_rect.y += line_height; continue; @@ -2997,7 +2997,7 @@ void wxDataViewMainWindow::OnRenameTimer() // been made and no screen update taken place. if ( m_dirty ) { - // TODO: use wxTheApp->SafeYieldFor(NULL, wxEVT_CATEGORY_UI) instead + // TODO: use wxTheApp->SafeYieldFor(nullptr, wxEVT_CATEGORY_UI) instead // (needs to be tested!) wxSafeYield(); } @@ -3068,7 +3068,7 @@ public: bool Walker(wxDataViewTreeNode * node, DoJob & func, WalkFlags flags = Walk_All) { - wxCHECK_MSG( node, false, "can't walk NULL node" ); + wxCHECK_MSG( node, false, "can't walk null node" ); switch( func( node ) ) { @@ -3249,7 +3249,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, // have to do it manually. We keep track of its position as well for // later use. int itemPosInNode = 0; - wxDataViewTreeNode *itemNode = NULL; + wxDataViewTreeNode *itemNode = nullptr; for ( wxDataViewTreeNodes::const_iterator i = parentsChildren.begin(); i != parentsChildren.end(); ++i, ++itemPosInNode ) @@ -3362,7 +3362,7 @@ bool wxDataViewMainWindow::DoItemChanged(const wxDataViewItem & item, int view_c wxDataViewColumn* column; if ( view_column == wxNOT_FOUND ) { - column = NULL; + column = nullptr; GetOwner()->InvalidateColBestWidths(); } else @@ -3416,7 +3416,7 @@ bool wxDataViewMainWindow::Cleared() void wxDataViewMainWindow::UpdateDisplay() { m_dirty = true; - m_underMouse = NULL; + m_underMouse = nullptr; } void wxDataViewMainWindow::OnInternalIdle() @@ -3451,7 +3451,7 @@ void wxDataViewMainWindow::RecalculateDisplay() void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect ) { - m_underMouse = NULL; + m_underMouse = nullptr; wxWindow::ScrollWindow( dx, dy, rect ); @@ -3461,7 +3461,7 @@ void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect ) void wxDataViewMainWindow::ScrollTo( int rows, int column ) { - m_underMouse = NULL; + m_underMouse = nullptr; int x, y; m_owner->GetScrollPixelsPerUnit( &x, &y ); @@ -3510,13 +3510,13 @@ int wxDataViewMainWindow::GetCountPerPage() const wxDataViewItem wxDataViewMainWindow::GetTopItem() const { unsigned int item = GetFirstVisibleRow(); - wxDataViewTreeNode *node = NULL; + wxDataViewTreeNode *node = nullptr; wxDataViewItem dataitem; if ( !IsVirtualList() ) { node = GetTreeNodeByRow(item); - if( node == NULL ) return wxDataViewItem(0); + if( node == nullptr ) return wxDataViewItem(nullptr); dataitem = node->GetItem(); } @@ -3568,7 +3568,7 @@ unsigned int wxDataViewMainWindow::GetLastFullyVisibleRow() unsigned int row = GetLastVisibleRow(); int bottom = GetLineStart(row) + GetLineHeight(row); - m_owner->CalcScrolledPosition(-1, bottom, NULL, &bottom); + m_owner->CalcScrolledPosition(-1, bottom, nullptr, &bottom); if ( bottom > GetClientSize().y ) return wxMax(0, row - 1); @@ -3699,7 +3699,7 @@ void wxDataViewMainWindow::RefreshRowsAfter( unsigned int firstRow ) { wxSize client_size = GetClientSize(); int start = GetLineStart( firstRow ); - m_owner->CalcScrolledPosition( start, 0, &start, NULL ); + m_owner->CalcScrolledPosition( start, 0, &start, nullptr ); if (start > client_size.y) return; wxRect rect( 0, start, client_size.x, client_size.y - start ); @@ -3864,7 +3864,7 @@ public: // our operator() will be the root node, which doesn't appear in the window // and so doesn't count as a real row. explicit RowToTreeNodeJob(int row) - : m_row(row), m_current(-1), m_ret(NULL) + : m_row(row), m_current(-1), m_ret(nullptr) { } @@ -3916,7 +3916,7 @@ wxDataViewTreeNode * wxDataViewMainWindow::GetTreeNodeByRow(unsigned int row) co wxASSERT( !IsVirtualList() ); if ( row == (unsigned)-1 ) - return NULL; + return nullptr; RowToTreeNodeJob job(static_cast(row)); Walker( m_root , job ); @@ -4131,11 +4131,11 @@ wxDataViewMainWindow::FindNodeResult wxDataViewMainWindow::FindNode( const wxDataViewItem & item ) { FindNodeResult result; - result.m_node = NULL; + result.m_node = nullptr; result.m_subtreeRealized = true; const wxDataViewModel * model = GetModel(); - if( model == NULL ) + if( model == nullptr ) return result; if (!item.IsOk()) @@ -4202,7 +4202,7 @@ wxDataViewMainWindow::FindNode( const wxDataViewItem & item ) void wxDataViewMainWindow::HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) { - wxDataViewColumn *col = NULL; + wxDataViewColumn *col = nullptr; unsigned int cols = GetOwner()->GetColumnCount(); unsigned int colnum = 0; int x, y; @@ -4247,7 +4247,7 @@ wxRect wxDataViewMainWindow::GetItemRect( const wxDataViewItem & item, width += col->GetWidth(); } - if(column != 0) + if(column != nullptr) { // If we have a column, we need can get its width directly. if(column->IsHidden()) @@ -4273,7 +4273,7 @@ wxRect wxDataViewMainWindow::GetItemRect( const wxDataViewItem & item, // to get the correct x position where the actual text is int indent = 0; if (!IsList() && - (column == 0 || GetExpanderColumnOrFirstOne(GetOwner()) == column) ) + (column == nullptr || GetExpanderColumnOrFirstOne(GetOwner()) == column) ) { wxDataViewTreeNode* node = GetTreeNodeByRow(row); indent = GetOwner()->GetIndent() * node->GetIndentLevel(); @@ -4373,7 +4373,7 @@ wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item, WalkFlags flags) const { const wxDataViewModel * model = GetModel(); - if( model == NULL ) + if( model == nullptr ) return -1; if (IsVirtualList()) @@ -4476,7 +4476,7 @@ wxDataViewMainWindow::FindColumnForEditing(const wxDataViewItem& item, wxDataVie // 'mode') and the user pressed Space/F2 then do not edit anything // because focus is visually on that column and editing // something else would be surprising. - return NULL; + return nullptr; } else { @@ -4485,7 +4485,7 @@ wxDataViewMainWindow::FindColumnForEditing(const wxDataViewItem& item, wxDataVie // situation as if there was whole-row focus, because that's what is // visually indicated and the mouse click could very well be targeted // on the row rather than on an individual cell. - candidate = NULL; + candidate = nullptr; } } @@ -4511,10 +4511,10 @@ wxDataViewMainWindow::FindColumnForEditing(const wxDataViewItem& item, wxDataVie candidate = FindFirstColumnWithValue(item); if ( !candidate ) - return NULL; + return nullptr; if ( !IsCellEditableInMode(item, candidate, mode) ) - return NULL; + return nullptr; return candidate; } @@ -4649,7 +4649,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) wxDataViewRenderer *cell = activatableCol->GetRenderer(); cell->PrepareForItem(GetModel(), item, colIdx); - cell->WXActivateCell(cell_rect, GetModel(), item, colIdx, NULL); + cell->WXActivateCell(cell_rect, GetModel(), item, colIdx, nullptr); break; } @@ -4828,7 +4828,7 @@ void wxDataViewMainWindow::OnLeftKey(wxKeyEvent& event) { if ( IsList() ) { - TryAdvanceCurrentColumn(NULL, event, /*forward=*/false); + TryAdvanceCurrentColumn(nullptr, event, /*forward=*/false); } else { @@ -4842,7 +4842,7 @@ void wxDataViewMainWindow::OnLeftKey(wxKeyEvent& event) const bool dontCollapseNodes = event.GetKeyCode() == WXK_TAB; if ( dontCollapseNodes ) { - m_currentCol = NULL; + m_currentCol = nullptr; // allow focus change event.Skip(); return; @@ -4876,7 +4876,7 @@ void wxDataViewMainWindow::OnRightKey(wxKeyEvent& event) { if ( IsList() ) { - TryAdvanceCurrentColumn(NULL, event, /*forward=*/true); + TryAdvanceCurrentColumn(nullptr, event, /*forward=*/true); } else { @@ -4917,7 +4917,7 @@ bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, wxK if ( node && IsItemSingleValued(node->GetItem()) ) return false; - if ( m_currentCol == NULL || !m_currentColSetByKeyboard ) + if ( m_currentCol == nullptr || !m_currentColSetByKeyboard ) { if ( forward ) { @@ -4995,7 +4995,7 @@ bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, wxK { // We are going to the left of the second column. Reset to whole-row // focus (which means first column would be edited). - m_currentCol = NULL; + m_currentCol = nullptr; RefreshRow(m_currentRow); return true; } @@ -5018,7 +5018,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) int x = event.GetX(); int y = event.GetY(); m_owner->CalcUnscrolledPosition( x, y, &x, &y ); - wxDataViewColumn *col = NULL; + wxDataViewColumn *col = nullptr; int xpos = 0; unsigned int cols = GetOwner()->GetColumnCount(); @@ -5189,11 +5189,11 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) } if (!hoverOverExpander) { - if (m_underMouse != NULL) + if (m_underMouse != nullptr) { // wxLogMessage("Undo the row: %d", GetRowByItem(m_underMouse->GetItem())); RefreshRow(GetRowByItem(m_underMouse->GetItem())); - m_underMouse = NULL; + m_underMouse = nullptr; } } @@ -5518,7 +5518,7 @@ void wxDataViewMainWindow::UpdateColumnSizes() // Find the last shown column: we shouldn't bother to resize the columns // that are hidden anyhow. int lastColIndex = -1; - wxDataViewColumn *lastCol wxDUMMY_INITIALIZE(NULL); + wxDataViewColumn *lastCol wxDUMMY_INITIALIZE(nullptr); for ( int colIndex = colsCount - 1; colIndex >= 0; --colIndex ) { lastCol = owner->GetColumnAt(colIndex); @@ -5594,17 +5594,17 @@ wxDataViewCtrl::~wxDataViewCtrl() DoClearColumns(); #if wxUSE_ACCESSIBILITY - SetAccessible(NULL); + SetAccessible(nullptr); wxAccessible::NotifyEvent(wxACC_EVENT_OBJECT_DESTROY, this, wxOBJID_CLIENT, wxACC_SELF); #endif // wxUSE_ACCESSIBILITY } void wxDataViewCtrl::Init() { - m_notifier = NULL; + m_notifier = nullptr; - m_headerArea = NULL; - m_clientArea = NULL; + m_headerArea = nullptr; + m_clientArea = nullptr; m_colsDirty = false; @@ -5642,7 +5642,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, DisableKeyboardScrolling(); if (HasFlag(wxDV_NO_HEADER)) - m_headerArea = NULL; + m_headerArea = nullptr; else m_headerArea = new wxDataViewHeaderWindow(this); @@ -5876,7 +5876,7 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model ) // 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; + m_notifier = nullptr; } m_clientArea->DestroyTree(); @@ -5900,7 +5900,7 @@ bool wxDataViewCtrl::EnableDragSource( const wxDataFormat &format ) bool wxDataViewCtrl::DoEnableDropTarget( const wxVector &formats ) { - wxDataViewDropTarget* dt = NULL; + wxDataViewDropTarget* dt = nullptr; if (wxDataObjectComposite* dataObject = CreateDataObject(formats)) { dt = new wxDataViewDropTarget(dataObject, m_clientArea); @@ -6063,10 +6063,10 @@ public: m_expanderSize(expanderSize) { int index = dvc->GetModelColumnIndex( model_column ); - wxDataViewColumn* column = index == wxNOT_FOUND ? NULL : dvc->GetColumn(index); + wxDataViewColumn* column = index == wxNOT_FOUND ? nullptr : dvc->GetColumn(index); m_isExpanderCol = !clientArea->IsList() && - (column == 0 || + (column == nullptr || GetExpanderColumnOrFirstOne(const_cast(dvc)) == column ); } @@ -6175,7 +6175,7 @@ void wxDataViewCtrl::DoClearColumns() bool wxDataViewCtrl::ClearColumns() { - SetExpanderColumn(NULL); + SetExpanderColumn(nullptr); DoClearColumns(); @@ -6255,7 +6255,7 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const { if ( m_sortingColumnIdxs.empty() ) - return NULL; + return nullptr; return GetColumn(m_sortingColumnIdxs.front()); } @@ -6461,7 +6461,7 @@ void wxDataViewCtrl::EnsureVisible( const wxDataViewItem & item, const wxDataVie int row = m_clientArea->GetRowByItem(item); if( row >= 0 ) { - if( column == NULL ) + if( column == nullptr ) EnsureVisibleRowCol(row, -1); else EnsureVisibleRowCol( row, GetColumnIndex(column) ); @@ -6649,7 +6649,7 @@ wxAccStatus wxDataViewCtrlAccessible::HitTest(const wxPoint& pt, if ( item.IsOk() ) { *childId = dvCtrl->GetRowByItem(item)+1; - *childObject = NULL; + *childObject = nullptr; } else { @@ -6675,7 +6675,7 @@ wxAccStatus wxDataViewCtrlAccessible::HitTest(const wxPoint& pt, else { *childId = wxACC_SELF; - *childObject = NULL; + *childObject = nullptr; } } @@ -6704,7 +6704,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetLocation(wxRect& rect, int elementId) return wxACC_NOT_IMPLEMENTED; } - rect = dvWnd->GetItemRect(item, NULL); + rect = dvWnd->GetItemRect(item, nullptr); // Indentation and expander column should be included here and therefore // reported row width should by the same as the width of the client area. rect.width += rect.x; @@ -6734,7 +6734,7 @@ wxAccStatus wxDataViewCtrlAccessible::Navigate(wxNavDir navDir, int fromId, if ( numRows > 0 ) { *toId = 1; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } return wxACC_FALSE; @@ -6742,7 +6742,7 @@ wxAccStatus wxDataViewCtrlAccessible::Navigate(wxNavDir navDir, int fromId, if ( numRows > 0 ) { *toId = numRows; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } return wxACC_FALSE; @@ -6779,7 +6779,7 @@ wxAccStatus wxDataViewCtrlAccessible::Navigate(wxNavDir navDir, int fromId, if ( fromId < numRows ) { *toId = fromId + 1; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } return wxACC_FALSE; @@ -6789,7 +6789,7 @@ wxAccStatus wxDataViewCtrlAccessible::Navigate(wxNavDir navDir, int fromId, if ( fromId > 1 ) { *toId = fromId - 1; - *toObject = NULL; + *toObject = nullptr; return wxACC_OK; } return wxACC_FALSE; @@ -6875,12 +6875,12 @@ wxAccStatus wxDataViewCtrlAccessible::GetChildCount(int* childCount) } // Gets the specified child (starting from 1). -// If *child is NULL and return value is wxACC_OK, +// If *child is null and return value is wxACC_OK, // this means that the child is a simple element and // not an accessible object. wxAccStatus wxDataViewCtrlAccessible::GetChild(int childId, wxAccessible** child) { - *child = (childId == wxACC_SELF) ? this : NULL; + *child = (childId == wxACC_SELF) ? this : nullptr; return wxACC_OK; } @@ -7049,7 +7049,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetHelpText(int childId, wxString* helpTex if ( item.IsOk() ) { wxDataViewMainWindow* dvWnd = wxDynamicCast(dvCtrl->GetMainWindow(), wxDataViewMainWindow); - wxRect rect = dvWnd->GetItemRect(item, NULL); + wxRect rect = dvWnd->GetItemRect(item, nullptr); *helpText = dvWnd->GetHelpTextAtPoint(rect.GetPosition(), wxHelpEvent::Origin_Keyboard); } else @@ -7338,7 +7338,7 @@ wxAccStatus wxDataViewCtrlAccessible::Select(int childId, wxAccSelectionFlags se } // Gets the window with the keyboard focus. -// If childId is 0 and child is NULL, no object in +// If childId is 0 and child is null, no object in // this subhierarchy has the focus. // If this object has the focus, child should be 'this'. wxAccStatus wxDataViewCtrlAccessible::GetFocus(int* childId, wxAccessible** child) @@ -7351,7 +7351,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetFocus(int* childId, wxAccessible** chil if ( row != (unsigned int)*childId-1 ) { *childId = row+1; - *child = NULL; + *child = nullptr; } else { @@ -7376,7 +7376,7 @@ wxAccStatus wxDataViewCtrlAccessible::GetFocus(int* childId, wxAccessible** chil else { *childId = 0; - *child = NULL; + *child = nullptr; } } diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 0a3bf42207..7f41559e43 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -385,8 +385,8 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, void wxDatePickerCtrlGeneric::Init() { - m_combo = NULL; - m_popup = NULL; + m_combo = nullptr; + m_popup = nullptr; } wxDatePickerCtrlGeneric::~wxDatePickerCtrlGeneric() @@ -398,8 +398,8 @@ bool wxDatePickerCtrlGeneric::Destroy() if ( m_combo ) m_combo->Destroy(); - m_combo = NULL; - m_popup = NULL; + m_combo = nullptr; + m_popup = nullptr; return wxControl::Destroy(); } @@ -414,7 +414,7 @@ wxSize wxDatePickerCtrlGeneric::DoGetBestSize() const wxTextCtrl* const text = m_combo->GetTextCtrl(); int w; - text->GetTextExtent(text->GetValue(), &w, NULL); + text->GetTextExtent(text->GetValue(), &w, nullptr); size.x += text->GetSizeFromTextSize(w + 1).x; return size; diff --git a/src/generic/dbgrptg.cpp b/src/generic/dbgrptg.cpp index 47daf79edf..04393c5ff1 100644 --- a/src/generic/dbgrptg.cpp +++ b/src/generic/dbgrptg.cpp @@ -297,7 +297,7 @@ wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- wxDebugReportDialog::wxDebugReportDialog(wxDebugReport& dbgrpt) - : wxDialog(NULL, wxID_ANY, + : wxDialog(nullptr, wxID_ANY, wxString::Format(_("Debug report \"%s\""), dbgrpt.GetReportName().c_str()), wxDefaultPosition, @@ -535,8 +535,7 @@ bool wxDebugReportPreviewStd::Show(wxDebugReport& dbgrpt) const // handling for all other windows as this could result in more crashes wxEventLoop::SetCriticalWindow(&dlg); - wxON_BLOCK_EXIT1( wxEventLoop::SetCriticalWindow, - static_cast(NULL) ); + wxON_BLOCK_EXIT1( wxEventLoop::SetCriticalWindow, nullptr ); #endif // __WXMSW__ return dlg.ShowModal() == wxID_OK && dbgrpt.GetFilesCount() != 0; diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 9e47ad6a4b..6a5ac8fb31 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -290,7 +290,7 @@ wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& d void wxPostScriptDCImpl::Init() { - m_pstream = NULL; + m_pstream = nullptr; m_currentRed = 0; m_currentGreen = 0; @@ -311,7 +311,7 @@ wxPostScriptDCImpl::~wxPostScriptDCImpl () if (m_pstream) { fclose( m_pstream ); - m_pstream = NULL; + m_pstream = nullptr; } } @@ -1210,7 +1210,7 @@ void wxPostScriptDCImpl::SetPen( const wxPen& pen ) PsPrint( buffer ); } PsPrint ("] 0 setdash\n"); - psdash = 0; + psdash = nullptr; } break; case wxPENSTYLE_SOLID: @@ -1350,7 +1350,7 @@ void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y SetPSFont(); wxCoord text_descent; - GetOwner()->GetTextExtent(text, NULL, NULL, &text_descent); + GetOwner()->GetTextExtent(text, nullptr, nullptr, &text_descent); int size = m_font.GetPointSize(); // wxCoord by = y + (wxCoord)floor( double(size) * 2.0 / 3.0 ); // approximate baseline @@ -1386,7 +1386,7 @@ void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxC // Calculate bottom-left coordinates of the rotated text wxCoord text_descent; - GetOwner()->GetTextExtent(text, NULL, NULL, &text_descent); + GetOwner()->GetTextExtent(text, nullptr, nullptr, &text_descent); int size = m_font.GetPointSize(); double rad = wxDegToRad(angle); wxCoord bx = wxRound(x + (size - text_descent) * sin(rad)); @@ -1431,7 +1431,7 @@ void wxPostScriptDCImpl::SetLogicalFunction(wxRasterOperationMode WXUNUSED(funct void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points ) { wxCHECK_RET( m_ok, wxT("invalid postscript dc") ); - wxCHECK_RET(points, "NULL pointer to spline points?"); + wxCHECK_RET(points, "null pointer to spline points?"); wxCHECK_RET(points->size() >= 2, "incomplete list of spline points?"); SetPen( m_pen ); @@ -1709,7 +1709,7 @@ void wxPostScriptDCImpl::EndDoc () if ( m_pstream ) { fclose( m_pstream ); - m_pstream = NULL; + m_pstream = nullptr; } // Reset the list of fonts for which PS font registration code was generated. @@ -1974,7 +1974,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, / / example: / - / wxPostScriptDC dc(NULL, true); + / wxPostScriptDC dc(nullptr, true); / if (dc.IsOk()){ / wxSetAFMPath("d:\\wxw161\\afm\\"); / dc.StartDoc("Test"); @@ -2053,7 +2053,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, } } - FILE *afmFile = NULL; + FILE *afmFile = nullptr; // Get the directory of the AFM files wxString afmName; @@ -2107,7 +2107,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, / / when the font has changed, we read in the right AFM file and store the / character widths in an array, which is processed below (see point 3.). */ - if (afmFile==NULL) + if (afmFile==nullptr) { wxLogDebug( wxT("GetTextExtent: can't open AFM file '%s'"), afmName ); wxLogDebug( wxT(" using approximate values")); @@ -2126,7 +2126,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, char line[256]; int ascii,cWidth; /* read in the file and parse it */ - while(fgets(line,sizeof(line),afmFile)!=NULL) + while(fgets(line,sizeof(line),afmFile)!=nullptr) { /* A.) check for descender definition */ if (strncmp(line,"Descender",9)==0) diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index c1734de72e..cae0d5aeb9 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -430,8 +430,8 @@ void wxGenericDirCtrl::Init() m_showHidden = false; m_currentFilter = 0; m_currentFilterStr.clear(); // Default: any file - m_treeCtrl = NULL; - m_filterListCtrl = NULL; + m_treeCtrl = nullptr; + m_filterListCtrl = nullptr; } wxTreeCtrl* wxGenericDirCtrl::CreateTreeCtrl(wxWindow *parent, wxWindowID treeid, const wxPoint& pos, const wxSize& size, long treeStyle) @@ -1148,7 +1148,7 @@ void wxGenericDirCtrl::SetFilter(const wxString& filter) else if (filter.empty() && m_filterListCtrl) { m_filterListCtrl->Destroy(); - m_filterListCtrl = NULL; + m_filterListCtrl = nullptr; } wxString f, d; @@ -1247,12 +1247,12 @@ bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, long style) { m_dirCtrl = parent; - return wxChoice::Create(parent, treeid, pos, size, 0, NULL, style); + return wxChoice::Create(parent, treeid, pos, size, 0, nullptr, style); } void wxDirFilterListCtrl::Init() { - m_dirCtrl = NULL; + m_dirCtrl = nullptr; } void wxDirFilterListCtrl::OnSelFilter(wxCommandEvent& WXUNUSED(event)) @@ -1310,7 +1310,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt // ---------------------------------------------------------------------------- // global instance of a wxFileIconsTable -wxFileIconsTable* wxTheFileIconsTable = NULL; +wxFileIconsTable* wxTheFileIconsTable = nullptr; // A module to allow icons table cleanup @@ -1339,8 +1339,8 @@ public: wxFileIconsTable::wxFileIconsTable() : m_size(16, 16) { - m_HashTable = NULL; - m_smallImageList = NULL; + m_HashTable = nullptr; + m_smallImageList = nullptr; } wxFileIconsTable::~wxFileIconsTable() diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index c00c18635c..0323caa438 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -116,7 +116,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent, topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 ); // 1) dir ctrl - m_dirCtrl = NULL; // this is necessary, event handler called from + m_dirCtrl = nullptr; // this is necessary, event handler called from // wxGenericDirCtrl would crash otherwise! long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER; @@ -246,7 +246,7 @@ void wxGenericDirDialog::OnTreeSelected( wxTreeEvent &event ) wxTreeItemId item = event.GetItem(); - wxDirItemData *data = NULL; + wxDirItemData *data = nullptr; if(item.IsOk()) data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(item); diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp index e6efaec8fc..4be520cb65 100644 --- a/src/generic/dragimgg.cpp +++ b/src/generic/dragimgg.cpp @@ -62,10 +62,10 @@ void wxGenericDragImage::Init() { m_isDirty = false; m_isShown = false; - m_windowDC = NULL; - m_window = NULL; + m_windowDC = nullptr; + m_window = nullptr; m_fullScreen = false; - m_pBackingBitmap = NULL; + m_pBackingBitmap = nullptr; } // Attributes @@ -306,10 +306,10 @@ bool wxGenericDragImage::EndDrag() } // Move the image: call from OnMouseMove. Pt is in window client coordinates if window -// is non-NULL, or in screen coordinates if NULL. +// is non-null, or in screen coordinates if null. bool wxGenericDragImage::Move(const wxPoint& pt) { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Move()") ); + wxASSERT_MSG( (m_windowDC != nullptr), wxT("No window DC in wxGenericDragImage::Move()") ); wxPoint pt2(pt); if (m_fullScreen) @@ -333,7 +333,7 @@ bool wxGenericDragImage::Move(const wxPoint& pt) bool wxGenericDragImage::Show() { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Show()") ); + wxASSERT_MSG( (m_windowDC != nullptr), wxT("No window DC in wxGenericDragImage::Show()") ); // Show at the current position @@ -372,7 +372,7 @@ bool wxGenericDragImage::UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& des bool wxGenericDragImage::Hide() { - wxASSERT_MSG( (m_windowDC != NULL), wxT("No window DC in wxGenericDragImage::Hide()") ); + wxASSERT_MSG( (m_windowDC != nullptr), wxT("No window DC in wxGenericDragImage::Hide()") ); // Repair the old position @@ -480,7 +480,7 @@ bool wxGenericDragImage::DoDrawImage(wxDC& dc, const wxPoint& pos) const { if (m_bitmap.IsOk()) { - dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != 0)); + dc.DrawBitmap(m_bitmap, pos.x, pos.y, (m_bitmap.GetMask() != nullptr)); return true; } else if (m_icon.IsOk()) diff --git a/src/generic/fdrepdlg.cpp b/src/generic/fdrepdlg.cpp index 9dc2d763f0..06f092a1f4 100644 --- a/src/generic/fdrepdlg.cpp +++ b/src/generic/fdrepdlg.cpp @@ -67,15 +67,15 @@ wxEND_EVENT_TABLE() void wxGenericFindReplaceDialog::Init() { - m_FindReplaceData = NULL; + m_FindReplaceData = nullptr; m_chkWord = - m_chkCase = NULL; + m_chkCase = nullptr; - m_radioDir = NULL; + m_radioDir = nullptr; m_textFind = - m_textRepl = NULL; + m_textRepl = nullptr; } bool wxGenericFindReplaceDialog::Create(wxWindow *parent, diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp index 702017afd4..5bed7e07cb 100644 --- a/src/generic/filectrlg.cpp +++ b/src/generic/filectrlg.cpp @@ -893,7 +893,7 @@ bool wxGenericFileCtrl::Create( wxWindow *parent, this->m_style = style; m_inSelected = false; m_noSelChgEvent = false; - m_check = NULL; + m_check = nullptr; // check that the styles are not contradictory wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_OPEN ) ), diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 56c9bfe66b..a6abc5b7ef 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -112,9 +112,9 @@ void wxGenericFileDialog::Init() { m_bypassGenericImpl = false; - m_filectrl = NULL; - m_upDirButton = NULL; - m_newDirButton = NULL; + m_filectrl = nullptr; + m_upDirButton = nullptr; + m_newDirButton = nullptr; } wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent, @@ -308,7 +308,7 @@ int wxGenericFileDialog::ShowModal() if (m_extraControl) { m_extraControl->Destroy(); - m_extraControl = NULL; + m_extraControl = nullptr; } return rc; diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index 0b3b060a52..f9d0bfc068 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -261,7 +261,7 @@ static wxString wxColourDialogNames[NUM_COLS]={wxT("ORANGE"), void wxGenericFontDialog::Init() { m_useEvents = false; - m_previewer = NULL; + m_previewer = nullptr; Create( m_parent ) ; } @@ -396,7 +396,7 @@ void wxGenericFontDialog::CreateWidgets() wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); itemGridSizer4->Add(itemBoxSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxGROW, 5); - m_colourChoice = NULL; + m_colourChoice = nullptr; if (m_fontData.GetEnableEffects()) { wxStaticText* itemStaticText15 = new wxStaticText( this, wxID_STATIC, _("C&olour:"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -432,7 +432,7 @@ void wxGenericFontDialog::CreateWidgets() itemBoxSizer17->Add(m_pointSizeChoice, 0, wxALIGN_LEFT|wxALL, 5); #endif - m_underLineCheckBox = NULL; + m_underLineCheckBox = nullptr; if (m_fontData.GetEnableEffects()) { wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL); diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index da1b0569ef..9a9abba78a 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -120,7 +120,7 @@ namespace class WXDLLIMPEXP_CORE wxCairoPathData : public wxGraphicsPathData { public : - wxCairoPathData(wxGraphicsRenderer* renderer, cairo_t* path = NULL); + wxCairoPathData(wxGraphicsRenderer* renderer, cairo_t* path = nullptr); ~wxCairoPathData(); virtual wxGraphicsObjectRefData *Clone() const override; @@ -191,7 +191,7 @@ private : class WXDLLIMPEXP_CORE wxCairoMatrixData : public wxGraphicsMatrixData { public : - wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_matrix_t* matrix = NULL ) ; + wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_matrix_t* matrix = nullptr ) ; virtual ~wxCairoMatrixData() ; virtual wxGraphicsObjectRefData *Clone() const override ; @@ -204,8 +204,8 @@ public : wxDouble tx=0.0, wxDouble ty=0.0) override; // 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 override; + virtual void Get(wxDouble* a=nullptr, wxDouble* b=nullptr, wxDouble* c=nullptr, + wxDouble* d=nullptr, wxDouble* tx=nullptr, wxDouble* ty=nullptr) const override; // makes this the inverse matrix virtual void Invert() override; @@ -628,13 +628,13 @@ class wxCairoMeasuringContext : public wxCairoContext { public: wxCairoMeasuringContext(wxGraphicsRenderer* renderer) - : wxCairoContext(renderer, m_hdc = ::GetDC(NULL)) + : wxCairoContext(renderer, m_hdc = ::GetDC(nullptr)) { } virtual ~wxCairoMeasuringContext() { - ::ReleaseDC(NULL, m_hdc); + ::ReleaseDC(nullptr, m_hdc); } private: @@ -652,8 +652,8 @@ wxCairoPenBrushBaseData::wxCairoPenBrushBaseData(wxGraphicsRenderer* renderer, : wxGraphicsObjectRefData(renderer) { m_hatchStyle = wxHATCHSTYLE_INVALID; - m_pattern = NULL; - m_bmpdata = NULL; + m_pattern = nullptr; + m_bmpdata = nullptr; if ( isTransparent || !col.IsOk() ) { @@ -676,9 +676,9 @@ wxCairoPenBrushBaseData::~wxCairoPenBrushBaseData() if (m_bmpdata) { // Deleting the bitmap data also deletes the pattern referenced by - // m_pattern, so set it to NULL to avoid deleting it twice. + // m_pattern, so set it to nullptr to avoid deleting it twice. delete m_bmpdata; - m_pattern = NULL; + m_pattern = nullptr; } if (m_pattern) cairo_pattern_destroy(m_pattern); @@ -846,9 +846,9 @@ wxCairoPenData::~wxCairoPenData() void wxCairoPenData::Init() { - m_pattern = NULL; - m_lengths = NULL; - m_userLengths = NULL; + m_pattern = nullptr; + m_lengths = nullptr; + m_userLengths = nullptr; m_width = 0; m_count = 0; } @@ -965,7 +965,7 @@ wxCairoPenData::wxCairoPenData( wxGraphicsRenderer* renderer, const wxGraphicsPe { wxDash *wxdashes ; m_count = info.GetDashes( &wxdashes ) ; - if ((wxdashes != NULL) && (m_count > 0)) + if ((wxdashes != nullptr) && (m_count > 0)) { m_userLengths = new double[m_count] ; for ( int i = 0 ; i < m_count ; ++i ) @@ -1100,8 +1100,8 @@ wxCairoBrushData::wxCairoBrushData( wxGraphicsRenderer* renderer, void wxCairoBrushData::Init() { - m_pattern = NULL; - m_bmpdata = NULL; + m_pattern = nullptr; + m_bmpdata = nullptr; } //----------------------------------------------------------------------------- @@ -1182,11 +1182,11 @@ wxCairoFontData::wxCairoFontData(wxGraphicsRenderer* renderer, m_size = sizeInPixels; #if defined(__WXMAC__) - m_font = NULL; + m_font = nullptr; #endif // There is no need to set m_underlined under wxGTK in this case, it can - // only be used if m_font != NULL. + // only be used if m_font != nullptr. InitFontComponents ( @@ -1592,15 +1592,15 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surfac m_width = cairo_image_surface_get_width(m_surface); m_height = cairo_image_surface_get_height(m_surface); - m_buffer = NULL; + m_buffer = nullptr; } wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsBitmapData(renderer) { - m_surface = NULL; - m_pattern = NULL; - m_buffer = NULL; + m_surface = nullptr; + m_pattern = nullptr; + m_buffer = nullptr; wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap")); #ifdef wxHAS_RAW_BITMAP @@ -1617,9 +1617,9 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm cairo_format_t bufferFormat = // Under MSW and OSX we can have 32 bpp xRGB bitmaps (without alpha). #if defined(__WXMSW__) || defined(__WXOSX__) - (isSrcBpp32 && hasAlpha) || bmp.GetMask() != NULL + (isSrcBpp32 && hasAlpha) || bmp.GetMask() != nullptr #else - isSrcBpp32 || bmp.GetMask() != NULL + isSrcBpp32 || bmp.GetMask() != nullptr #endif ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24; @@ -1708,7 +1708,7 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm // if there is a mask, set the alpha bytes in the target buffer to // fully transparent or retain original value - if (bmp.GetMask() != NULL) + if (bmp.GetMask() != nullptr) { wxBitmap bmpMask = bmp.GetMask()->GetBitmap(); data = (wxUint32*)m_buffer; @@ -1991,7 +1991,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& #elif defined(__WXGTK__) const wxDCImpl *impl = dc.GetImpl(); cairo_t* cr = static_cast(impl->GetCairoContext()); - Init(cr ? cairo_reference(cr) : NULL); + Init(cr ? cairo_reference(cr) : nullptr); wxSize sz = dc.GetSize(); m_width = sz.x; @@ -2025,7 +2025,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& #ifdef __WXGTK3__ cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); - Init(cr ? cairo_reference(cr) : NULL); + Init(cr ? cairo_reference(cr) : nullptr); #elif defined __WXGTK__ const wxGTKDCImpl* impldc = static_cast(dc.GetImpl()); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); @@ -2167,7 +2167,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& else { cairo_surface_destroy(m_mswSurface); - m_mswSurface = NULL; + m_mswSurface = nullptr; } } else @@ -2198,10 +2198,10 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc.GetDeviceOrigin(&orgX, &orgY); if ( orgX > 0 || orgY > 0 ) { - ::SetViewportOrgEx(hdc, 0, 0, NULL); - ::SetViewportExtEx(hdc, 1, 1, NULL); - ::SetWindowOrgEx(hdc, 0, 0, NULL); - ::SetWindowExtEx(hdc, 1, 1, NULL); + ::SetViewportOrgEx(hdc, 0, 0, nullptr); + ::SetViewportExtEx(hdc, 1, 1, nullptr); + ::SetWindowOrgEx(hdc, 0, 0, nullptr); + ::SetWindowExtEx(hdc, 1, 1, nullptr); adjustTransformFromDC = true; } } @@ -2238,7 +2238,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& #ifdef __WXGTK3__ cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); - Init(cr ? cairo_reference(cr) : NULL); + Init(cr ? cairo_reference(cr) : nullptr); #elif defined __WXGTK__ const wxGTKDCImpl* impldc = static_cast(dc.GetImpl()); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); @@ -2353,10 +2353,10 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, HDC handle ) cairo_matrix_scale(&dcTransform, sx, sy); cairo_matrix_translate(&dcTransform, -logOrg.x, -logOrg.y); - ::SetViewportOrgEx(handle, 0, 0, NULL); - ::SetViewportExtEx(handle, 1, 1, NULL); - ::SetWindowOrgEx(handle, 0, 0, NULL); - ::SetWindowExtEx(handle, 1, 1, NULL); + ::SetViewportOrgEx(handle, 0, 0, nullptr); + ::SetViewportExtEx(handle, 1, 1, nullptr); + ::SetWindowOrgEx(handle, 0, 0, nullptr); + ::SetWindowExtEx(handle, 1, 1, nullptr); adjustTransformFromDC = true; } @@ -2412,12 +2412,12 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, cairo_t *context ) : wxGraphicsContext(renderer) { #ifdef __WXQT__ - m_qtPainter = NULL; - m_qtImage = NULL; - m_qtSurface = NULL; + m_qtPainter = nullptr; + m_qtImage = nullptr; + m_qtSurface = nullptr; #endif #ifdef __WXMSW__ - m_mswSurface = NULL; + m_mswSurface = nullptr; m_mswStateSavedDC = 0; #endif // __WXMSW__ Init( cairo_reference(context) ); @@ -2438,7 +2438,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) // Some controls don't have m_wxwindow - like wxStaticBox, but the user // code should still be able to create wxClientDCs for them, so we will // use the parent window here then. - if (window->m_wxwindow == NULL) + if (window->m_wxwindow == nullptr) { window = window->GetParent(); } @@ -2471,15 +2471,15 @@ wxCairoContext::wxCairoContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer) { #ifdef __WXQT__ - m_qtPainter = NULL; - m_qtImage = NULL; - m_qtSurface = NULL; + m_qtPainter = nullptr; + m_qtImage = nullptr; + m_qtSurface = nullptr; #endif #ifdef __WXMSW__ - m_mswSurface = NULL; + m_mswSurface = nullptr; m_mswStateSavedDC = 0; #endif // __WXMSW__ - Init(NULL); + Init(nullptr); m_width = 0; m_height = 0; } @@ -2504,7 +2504,7 @@ wxCairoContext::~wxCairoContext() } #endif #ifdef __WXQT__ - if ( m_qtPainter != NULL ) + if ( m_qtPainter != nullptr ) { // draw the internal buffered image to the widget cairo_surface_flush(m_qtSurface); @@ -2974,7 +2974,7 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& PangoLayoutIter* iter = pango_layout_get_iter(layout); PangoRectangle rect; do { - pango_layout_iter_get_cluster_extents(iter, NULL, &rect); + pango_layout_iter_get_cluster_extents(iter, nullptr, &rect); w += rect.width; widths.Add(PANGO_PIXELS(w)); } while (pango_layout_iter_next_cluster(iter)); @@ -3119,7 +3119,7 @@ void wxCairoContext::EndLayer() #ifdef __WXMSW__ WXHDC wxCairoContext::GetNativeHDC() { - wxCHECK_MSG(m_mswSurface, NULL, "Can't get HDC from Cairo context"); + wxCHECK_MSG(m_mswSurface, nullptr, "Can't get HDC from Cairo context"); cairo_surface_flush(m_mswSurface); return cairo_win32_surface_get_dc(m_mswSurface); }; @@ -3244,20 +3244,20 @@ static wxCairoRenderer gs_cairoGraphicsRenderer; wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this,dc); } wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this,dc); } #if wxUSE_PRINTING_ARCHITECTURE wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this, dc); } #endif @@ -3265,14 +3265,14 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) #if defined(__WXMSW__) && wxUSE_ENH_METAFILE wxGraphicsContext * wxCairoRenderer::CreateContext(const wxEnhMetaFileDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this, dc); } #endif // __WXMSW__ && wxUSE_ENH_METAFILE wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext(void * context) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); #ifdef __WXMSW__ DWORD objType = ::GetObjectType((HGDIOBJ)context); if (objType == 0) @@ -3281,7 +3281,7 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext(void * conte if (objType == OBJ_DC || objType == OBJ_MEMDC) return new wxCairoContext(this, (HDC)context); - return NULL; + return nullptr; #else return new wxCairoContext(this,(cairo_t*)context); #endif @@ -3290,21 +3290,21 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext(void * conte wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeWindow( void * window ) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); #ifdef __WXGTK__ return new wxCairoContext(this, static_cast(window)); #elif defined(__WXMSW__) return new wxCairoContext(this, static_cast(window)); #else wxUnusedVar(window); - return NULL; + return nullptr; #endif } #ifdef __WXMSW__ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeHDC(WXHDC dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this, (HDC)dc); } #endif @@ -3312,7 +3312,7 @@ wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeHDC(WXHDC dc) #if wxUSE_IMAGE wxGraphicsContext * wxCairoRenderer::CreateContextFromImage(wxImage& image) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoImageContext(this, image); } #endif // wxUSE_IMAGE @@ -3322,17 +3322,17 @@ wxGraphicsContext * wxCairoRenderer::CreateMeasuringContext() #ifdef __WXGTK__ return CreateContextFromNativeWindow(gdk_get_default_root_window()); #elif defined(__WXMSW__) - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoMeasuringContext(this); #else - return NULL; + return nullptr; // TODO #endif } wxGraphicsContext * wxCairoRenderer::CreateContext( wxWindow* window ) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxCairoContext(this, window ); } @@ -3490,7 +3490,7 @@ wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap ) { wxGraphicsBitmap p; ENSURE_LOADED_OR_RETURN(p); - if ( bitmap != NULL ) + if ( bitmap != nullptr ) { p.SetRefData(new wxCairoBitmapData( this , (cairo_surface_t*) bitmap )); } @@ -3572,7 +3572,7 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() { - return NULL; + return nullptr; } #endif // wxUSE_CAIRO/!wxUSE_CAIRO diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index d19996764c..57723448bd 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -434,8 +434,8 @@ void wxGridCellAttr::Init(wxGridCellAttr *attrDefault) { m_isReadOnly = Unset; - m_renderer = NULL; - m_editor = NULL; + m_renderer = nullptr; + m_editor = nullptr; m_attrkind = wxGridCellAttr::Cell; @@ -689,7 +689,7 @@ bool wxGridCellAttr::CanOverflow() const // centered cells because it's not really clear how it should work for // them. int hAlign = wxALIGN_LEFT; - GetNonDefaultAlignment(&hAlign, NULL); + GetNonDefaultAlignment(&hAlign, nullptr); return hAlign == wxALIGN_LEFT; } @@ -698,12 +698,12 @@ bool wxGridCellAttr::CanOverflow() const // which attribute to use. If a non-default attr object has one then it is // used, otherwise the default editor or renderer is fetched from the grid and // used. It should be the default for the data type of the cell. If it is -// NULL (because the table has a type that the grid does not have in its +// null (because the table has a type that the grid does not have in its // registry), then the grid's default editor or renderer is used. wxGridCellRenderer* wxGridCellAttr::GetRenderer(const wxGrid* grid, int row, int col) const { - wxGridCellRenderer *renderer = NULL; + wxGridCellRenderer *renderer = nullptr; if ( m_renderer && this != m_defGridAttr ) { @@ -720,13 +720,13 @@ wxGridCellRenderer* wxGridCellAttr::GetRenderer(const wxGrid* grid, int row, int renderer = grid->GetDefaultRendererForCell(row, col); } - if ( renderer == NULL ) + if ( renderer == nullptr ) { - if ( (m_defGridAttr != NULL) && (m_defGridAttr != this) ) + if ( (m_defGridAttr != nullptr) && (m_defGridAttr != this) ) { // if we still don't have one then use the grid default // (no need for IncRef() here either) - renderer = m_defGridAttr->GetRenderer(NULL, 0, 0); + renderer = m_defGridAttr->GetRenderer(nullptr, 0, 0); } else // default grid attr { @@ -747,7 +747,7 @@ wxGridCellRenderer* wxGridCellAttr::GetRenderer(const wxGrid* grid, int row, int // same as above, except for s/renderer/editor/g wxGridCellEditor* wxGridCellAttr::GetEditor(const wxGrid* grid, int row, int col) const { - wxGridCellEditor *editor = NULL; + wxGridCellEditor *editor = nullptr; if ( m_editor && this != m_defGridAttr ) { @@ -764,13 +764,13 @@ wxGridCellEditor* wxGridCellAttr::GetEditor(const wxGrid* grid, int row, int col editor = grid->GetDefaultEditorForCell(row, col); } - if ( editor == NULL ) + if ( editor == nullptr ) { - if ( (m_defGridAttr != NULL) && (m_defGridAttr != this) ) + if ( (m_defGridAttr != nullptr) && (m_defGridAttr != this) ) { // if we still don't have one then use the grid default // (no need for IncRef() here either) - editor = m_defGridAttr->GetEditor(NULL, 0, 0); + editor = m_defGridAttr->GetEditor(nullptr, 0, 0); } else // default grid attr { @@ -853,7 +853,7 @@ void wxGridCellAttrData::SetAttr(wxGridCellAttr *attr, int row, int col) wxGridCellAttr *wxGridCellAttrData::GetAttr(int row, int col) const { - wxGridCellAttr *attr = NULL; + wxGridCellAttr *attr = nullptr; wxGridCoordsToAttrMap::iterator it = FindIndex(row, col); if ( it != m_attrs.end() ) @@ -1081,7 +1081,7 @@ wxGridRowOrColAttrData::~wxGridRowOrColAttrData() wxGridCellAttr *wxGridRowOrColAttrData::GetAttr(int rowOrCol) const { - wxGridCellAttr *attr = NULL; + wxGridCellAttr *attr = nullptr; int n = m_rowsOrCols.Index(rowOrCol); if ( n != wxNOT_FOUND ) @@ -1167,7 +1167,7 @@ void wxGridRowOrColAttrData::UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols wxGridCellAttrProvider::wxGridCellAttrProvider() { - m_data = NULL; + m_data = nullptr; } wxGridCellAttrProvider::~wxGridCellAttrProvider() @@ -1183,7 +1183,7 @@ void wxGridCellAttrProvider::InitData() wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind ) const { - wxGridCellAttr *attr = NULL; + wxGridCellAttr *attr = nullptr; if ( m_data ) { switch (kind) @@ -1202,7 +1202,7 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col, if ((attrcell != attrrow) && (attrrow != attrcol) && (attrcell != attrcol)) { - // Two or more are non NULL + // Two or more are non null attr = new wxGridCellAttr; attr->SetKind(wxGridCellAttr::Merged); @@ -1540,8 +1540,8 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxGridTableBase, wxObject); wxGridTableBase::wxGridTableBase() { - m_view = NULL; - m_attrProvider = NULL; + m_view = nullptr; + m_attrProvider = nullptr; } wxGridTableBase::~wxGridTableBase() @@ -1571,7 +1571,7 @@ wxGridCellAttr *wxGridTableBase::GetAttr(int row, int col, wxGridCellAttr::wxAtt if ( m_attrProvider ) return m_attrProvider->GetAttr(row, col, kind); else - return NULL; + return nullptr; } void wxGridTableBase::SetAttr(wxGridCellAttr* attr, int row, int col) @@ -1760,7 +1760,7 @@ void wxGridTableBase::SetValueAsBool( int WXUNUSED(row), int WXUNUSED(col), void* wxGridTableBase::GetValueAsCustom( int WXUNUSED(row), int WXUNUSED(col), const wxString& WXUNUSED(typeName) ) { - return NULL; + return nullptr; } void wxGridTableBase::SetValueAsCustom( int WXUNUSED(row), int WXUNUSED(col), @@ -1777,7 +1777,7 @@ void wxGridTableBase::SetValueAsCustom( int WXUNUSED(row), int WXUNUSED(col), wxGridTableMessage::wxGridTableMessage() { - m_table = NULL; + m_table = nullptr; m_id = -1; m_comInt1 = -1; m_comInt2 = -1; @@ -2320,12 +2320,12 @@ void wxGrid::Render( wxDC& dc, // remove grid selection, don't paint selection colour // unless we have wxGRID_DRAW_SELECTION - wxGridSelection* selectionOrig = NULL; + wxGridSelection* selectionOrig = nullptr; if ( m_selection && !( style & wxGRID_DRAW_SELECTION ) ) { // remove the selection temporarily, it will be restored below selectionOrig = m_selection; - m_selection = NULL; + m_selection = nullptr; } // store user device origin @@ -2740,7 +2740,7 @@ wxGrid::~wxGrid() if ( m_ownTable ) delete m_table; else if ( m_table && m_table->GetView() == this ) - m_table->SetView(NULL); + m_table->SetView(nullptr); delete m_typeRegistry; delete m_selection; @@ -2917,10 +2917,10 @@ wxGrid::SetTable(wxGridTableBase *table, HideCellEditControl(); m_cellEditCtrlEnabled = false; - m_table->SetView(0); + m_table->SetView(nullptr); if( m_ownTable ) delete m_table; - m_table = NULL; + m_table = nullptr; } wxDELETE(m_selection); @@ -2975,30 +2975,30 @@ void wxGrid::Init() { m_created = false; - m_cornerLabelWin = NULL; - m_rowLabelWin = NULL; - m_rowFrozenLabelWin = NULL; - m_colLabelWin = NULL; - m_colFrozenLabelWin = NULL; - m_gridWin = NULL; - m_frozenColGridWin = NULL; - m_frozenRowGridWin = NULL; - m_frozenCornerGridWin = NULL; + m_cornerLabelWin = nullptr; + m_rowLabelWin = nullptr; + m_rowFrozenLabelWin = nullptr; + m_colLabelWin = nullptr; + m_colFrozenLabelWin = nullptr; + m_gridWin = nullptr; + m_frozenColGridWin = nullptr; + m_frozenRowGridWin = nullptr; + m_frozenCornerGridWin = nullptr; - m_table = NULL; + m_table = nullptr; m_ownTable = false; - m_selection = NULL; - m_defaultCellAttr = NULL; - m_typeRegistry = NULL; + m_selection = nullptr; + m_defaultCellAttr = nullptr; + m_typeRegistry = nullptr; m_setFixedRows = - m_setFixedCols = NULL; + m_setFixedCols = nullptr; // init attr cache m_attrCache.row = -1; m_attrCache.col = -1; - m_attrCache.attr = NULL; + m_attrCache.attr = nullptr; m_labelFont = GetFont(); m_labelFont.SetWeight( wxFONTWEIGHT_BOLD ); @@ -3043,14 +3043,14 @@ void wxGrid::Init() m_canHideColumns = true; m_cursorMode = WXGRID_CURSOR_SELECT_CELL; - m_winCapture = NULL; + m_winCapture = nullptr; m_canDragRowSize = true; m_canDragColSize = true; m_canDragGridSize = true; m_canDragCell = false; m_dragMoveRowOrCol = -1; m_dragLastPos = -1; - m_dragLastColour = NULL; + m_dragLastColour = nullptr; m_dragRowOrCol = -1; m_dragRowOrColOldSize = -1; m_isDragging = false; @@ -3243,7 +3243,7 @@ void wxGrid::CalcWindowSizes() { // escape if the window is has not been fully created yet - if ( m_cornerLabelWin == NULL ) + if ( m_cornerLabelWin == nullptr ) return; int cw, ch; @@ -4012,7 +4012,7 @@ void wxGrid::ProcessRowColLabelMouseEvent( const wxGridOperations &oper, wxMouse // find y or x mouse coordinate for row / col label window int coord = dual.Select(unscrolledPos); // index into data rows/cols; wxNOT_FOUND if outside label window - int line = oper.PosToLine(this, coord, NULL); + int line = oper.PosToLine(this, coord, nullptr); // wxNOT_FOUND if not near a line edge; otherwise index into data rows/cols int lineEdge = PosToEdgeOfLine(coord, oper); @@ -4020,7 +4020,7 @@ void wxGrid::ProcessRowColLabelMouseEvent( const wxGridOperations &oper, wxMouse // these are always valid, even if the mouse is outside the row/col range: // index into displayed rows/cols - int posAt = PosToLinePos(coord, true /* clip */, oper, NULL); + int posAt = PosToLinePos(coord, true /* clip */, oper, nullptr); // index into data rows/cols int lineAt = oper.GetLineAt(this, posAt); @@ -4092,7 +4092,7 @@ void wxGrid::ProcessRowColLabelMouseEvent( const wxGridOperations &oper, wxMouse oper.DrawParallelLine(dc, 0, markerLength, m_dragLastPos + 1); dc.SetPen(wxNullPen); - int lastLine = oper.PosToLine(this, m_dragLastPos, NULL, false); + int lastLine = oper.PosToLine(this, m_dragLastPos, nullptr, false); if ( lastLine != -1 ) oper.DrawLineLabel(this, dc, lastLine); @@ -4512,11 +4512,11 @@ void wxGrid::DoAfterDraggingEnd() // from drag moving row/col m_dragMoveRowOrCol = -1; m_dragLastPos = -1; - m_dragLastColour = NULL; + m_dragLastColour = nullptr; m_cursorMode = WXGRID_CURSOR_SELECT_CELL; m_winCapture->SetCursor( *wxSTANDARD_CURSOR ); - m_winCapture = NULL; + m_winCapture = nullptr; } void wxGrid::EndDraggingIfNecessary() @@ -4555,7 +4555,7 @@ void wxGrid::ChangeCursorMode(CursorMode mode, if ( mode == m_cursorMode && win == m_winCapture && - captureMouse == (m_winCapture != NULL)) + captureMouse == (m_winCapture != nullptr)) return; if ( !win ) @@ -5061,7 +5061,7 @@ wxPoint wxGrid::GetPositionForResizeEvent(int width) const // This would need to be changed if they're allowed to be used together. int x; CalcGridWindowScrolledPosition(GetColLeft(m_dragRowOrCol) + width, 0, - &x, NULL, + &x, nullptr, m_gridWin); return wxPoint(x, 0); @@ -5365,8 +5365,8 @@ void wxGrid::InitializeFrozenWindows() { delete m_frozenRowGridWin; delete m_rowFrozenLabelWin; - m_frozenRowGridWin = NULL; - m_rowFrozenLabelWin = NULL; + m_frozenRowGridWin = nullptr; + m_rowFrozenLabelWin = nullptr; } // frozen column windows @@ -5384,8 +5384,8 @@ void wxGrid::InitializeFrozenWindows() { delete m_frozenColGridWin; delete m_colFrozenLabelWin; - m_frozenColGridWin = NULL; - m_colFrozenLabelWin = NULL; + m_frozenColGridWin = nullptr; + m_colFrozenLabelWin = nullptr; } // frozen corner window @@ -5399,7 +5399,7 @@ void wxGrid::InitializeFrozenWindows() else if ((m_numFrozenRows == 0 || m_numFrozenCols == 0) && m_frozenCornerGridWin) { delete m_frozenCornerGridWin; - m_frozenCornerGridWin = NULL; + m_frozenCornerGridWin = nullptr; } } @@ -5737,23 +5737,23 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect) } else { - m_cornerLabelWin->Refresh(eraseb, NULL); - m_colLabelWin->Refresh(eraseb, NULL); - m_rowLabelWin->Refresh(eraseb, NULL); - m_gridWin->Refresh(eraseb, NULL); + m_cornerLabelWin->Refresh(eraseb, nullptr); + m_colLabelWin->Refresh(eraseb, nullptr); + m_rowLabelWin->Refresh(eraseb, nullptr); + m_gridWin->Refresh(eraseb, nullptr); if ( m_frozenColGridWin ) { - m_frozenColGridWin->Refresh(eraseb, NULL); - m_colFrozenLabelWin->Refresh(eraseb, NULL); + m_frozenColGridWin->Refresh(eraseb, nullptr); + m_colFrozenLabelWin->Refresh(eraseb, nullptr); } if ( m_frozenRowGridWin ) { - m_frozenRowGridWin->Refresh(eraseb, NULL); - m_rowFrozenLabelWin->Refresh(eraseb, NULL); + m_frozenRowGridWin->Refresh(eraseb, nullptr); + m_rowFrozenLabelWin->Refresh(eraseb, nullptr); } if ( m_frozenCornerGridWin ) - m_frozenCornerGridWin->Refresh(eraseb, NULL); + m_frozenCornerGridWin->Refresh(eraseb, nullptr); } } } @@ -5886,7 +5886,7 @@ void wxGrid::OnDPIChanged(wxDPIChangedEvent& event) // control even if none of the widths had been changed, as it's not going // to do it on its own when redisplayed. wxHeaderCtrl* const - colHeader = m_useNativeHeader ? GetGridColHeader() : NULL; + colHeader = m_useNativeHeader ? GetGridColHeader() : nullptr; if ( !m_colWidths.empty() ) { int total = 0; @@ -6003,7 +6003,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) // end row/column moving m_winCapture->Refresh(); m_dragLastPos = -1; - m_dragLastColour = NULL; + m_dragLastColour = nullptr; break; case WXGRID_CURSOR_RESIZE_ROW: @@ -7026,7 +7026,7 @@ void wxGrid::DrawRowLabel( wxDC& dc, int row ) return; wxGridCellAttrProvider * const - attrProvider = m_table ? m_table->GetAttrProvider() : NULL; + attrProvider = m_table ? m_table->GetAttrProvider() : nullptr; // notice that an explicit static_cast is needed to avoid a compilation // error with VC7.1 which, for some reason, tries to instantiate (abstract) @@ -7129,7 +7129,7 @@ void wxGrid::DrawCornerLabel(wxDC& dc) wxRect rect(wxSize(m_rowLabelWidth, m_colLabelHeight)); wxGridCellAttrProvider * const - attrProvider = m_table ? m_table->GetAttrProvider() : NULL; + attrProvider = m_table ? m_table->GetAttrProvider() : nullptr; const wxGridCornerHeaderRenderer& rend = attrProvider ? attrProvider->GetCornerRenderer() : static_cast @@ -7169,7 +7169,7 @@ void wxGrid::DrawColLabel(wxDC& dc, int col) wxRect rect(colLeft, 0, GetColWidth(col), m_colLabelHeight); wxGridCellAttrProvider * const - attrProvider = m_table ? m_table->GetAttrProvider() : NULL; + attrProvider = m_table ? m_table->GetAttrProvider() : nullptr; const wxGridColumnHeaderRenderer& rend = attrProvider ? attrProvider->GetColumnHeaderRenderer(col) : static_cast @@ -7689,7 +7689,7 @@ bool wxGrid::DoShowCellEditControl(const wxGridActivationSource& actSource) if ( !value.empty() && attr->GetOverflow() ) { int y; - GetTextExtent(value, &maxWidth, &y, NULL, NULL, &attr->GetFont()); + GetTextExtent(value, &maxWidth, &y, nullptr, nullptr, &attr->GetFont()); if (maxWidth < rect.width) maxWidth = rect.width; } @@ -7748,7 +7748,7 @@ bool wxGrid::DoShowCellEditControl(const wxGridActivationSource& actSource) CalcDimensions(); editor->BeginEdit(row, col, this); - editor->SetCellAttr(NULL); + editor->SetCellAttr(nullptr); return true; } @@ -7794,7 +7794,7 @@ void wxGrid::DoHideCellEditControl() gridWindow->Refresh( false, &rect ); // refresh also the grid to the right - wxGridWindow *rightGridWindow = NULL; + wxGridWindow *rightGridWindow = nullptr; if ( gridWindow->GetType() == wxGridWindow::wxGridWindowFrozenCorner ) rightGridWindow = m_frozenRowGridWin; else if ( gridWindow->GetType() == wxGridWindow::wxGridWindowFrozenCol ) @@ -8003,7 +8003,7 @@ int wxGrid::XToPos(int x, wxGridWindow *gridWindow) const int wxGrid::PosToEdgeOfLine(int pos, const wxGridOperations& oper) const { // Get the bottom or rightmost line that could match. - int line = oper.PosToLine(this, pos, NULL, true); + int line = oper.PosToLine(this, pos, nullptr, true); if ( line == wxNOT_FOUND ) return -1; @@ -8143,7 +8143,7 @@ wxGridWindow* wxGrid::DevicePosToGridWindow(int x, int y) const else if ( m_frozenColGridWin && m_frozenColGridWin->GetRect().Contains(x, y) ) return m_frozenColGridWin; - return NULL; + return nullptr; } void wxGrid::CalcGridWindowUnscrolledPosition(int x, int y, int *xx, int *yy, @@ -8275,11 +8275,11 @@ void wxGrid::MakeCellVisible( int row, int col ) { // Convert to device coords. int top, bottom; - CalcGridWindowScrolledPosition(0, r.GetTop(), NULL, &top, gridWindow); - CalcGridWindowScrolledPosition(0, r.GetBottom(), NULL, &bottom, gridWindow); + CalcGridWindowScrolledPosition(0, r.GetTop(), nullptr, &top, gridWindow); + CalcGridWindowScrolledPosition(0, r.GetBottom(), nullptr, &bottom, gridWindow); int ch; - gridWindow->GetClientSize(NULL, &ch); + gridWindow->GetClientSize(nullptr, &ch); if ( top < gridOffset.y ) { @@ -8316,11 +8316,11 @@ void wxGrid::MakeCellVisible( int row, int col ) { // Convert to device coords. int left, right; - CalcGridWindowScrolledPosition(r.GetLeft(), 0, &left, NULL, gridWindow); - CalcGridWindowScrolledPosition(r.GetRight(), 0, &right, NULL, gridWindow); + CalcGridWindowScrolledPosition(r.GetLeft(), 0, &left, nullptr, gridWindow); + CalcGridWindowScrolledPosition(r.GetRight(), 0, &right, nullptr, gridWindow); int cw; - gridWindow->GetClientSize(&cw, NULL); + gridWindow->GetClientSize(&cw, nullptr); // special handling for wide cells - show always left part of the cell! // Otherwise, e.g. when stepping from row to row, it would jump between @@ -8367,7 +8367,7 @@ int wxGrid::GetFirstFullyVisibleRow() const { int y; CalcGridWindowUnscrolledPosition(0, 0, - NULL, &y, + nullptr, &y, m_gridWin); row = internalYToRow(y, m_gridWin); @@ -8406,7 +8406,7 @@ int wxGrid::GetFirstFullyVisibleColumn() const { int x; CalcGridWindowUnscrolledPosition(0, 0, - &x, NULL, + &x, nullptr, m_gridWin); col = internalXToCol(x, m_gridWin); @@ -9370,12 +9370,12 @@ wxGridFitMode wxGrid::GetDefaultCellFitMode() const wxGridCellRenderer *wxGrid::GetDefaultRenderer() const { - return m_defaultCellAttr->GetRenderer(NULL, 0, 0); + return m_defaultCellAttr->GetRenderer(nullptr, 0, 0); } wxGridCellEditor *wxGrid::GetDefaultEditor() const { - return m_defaultCellAttr->GetEditor(NULL, 0, 0); + return m_defaultCellAttr->GetEditor(nullptr, 0, 0); } // ---------------------------------------------------------------------------- @@ -9449,7 +9449,7 @@ void wxGrid::ClearAttrCache() if ( m_attrCache.row != -1 ) { wxGridCellAttr *oldAttr = m_attrCache.attr; - m_attrCache.attr = NULL; + m_attrCache.attr = nullptr; m_attrCache.row = -1; // wxSafeDecRec(...) might cause event processing that accesses // the cached attribute, if one exists (e.g. by deleting the @@ -9468,7 +9468,7 @@ void wxGrid::RefreshAttr(int row, int col) void wxGrid::CacheAttr(int row, int col, wxGridCellAttr *attr) const { - if ( attr != NULL ) + if ( attr != nullptr ) { wxGrid * const self = const_cast(this); @@ -9505,7 +9505,7 @@ bool wxGrid::LookupAttr(int row, int col, wxGridCellAttr **attr) const wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const { - wxGridCellAttr *attr = NULL; + wxGridCellAttr *attr = nullptr; // Additional test to avoid looking at the cache e.g. for // wxNoCellCoords, as this will confuse memory management. if ( row >= 0 ) @@ -9513,7 +9513,7 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const if ( !LookupAttr(row, col, &attr) ) { attr = m_table ? m_table->GetAttr(row, col, wxGridCellAttr::Any) - : NULL; + : nullptr; CacheAttr(row, col, attr); } } @@ -9533,7 +9533,7 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const { - wxGridCellAttr *attr = NULL; + wxGridCellAttr *attr = nullptr; const bool canHave = CanHaveAttributes(); wxCHECK_MSG( canHave, attr, wxT("Cell attributes not allowed")); @@ -9777,7 +9777,7 @@ void wxGrid::RegisterDataType(const wxString& typeName, wxGridCellEditor * wxGrid::GetDefaultEditorForCell(int row, int col) const { if ( !m_table ) - return NULL; + return nullptr; wxString typeName = m_table->GetTypeName(row, col); return GetDefaultEditorForType(typeName); @@ -9786,7 +9786,7 @@ wxGridCellEditor * wxGrid::GetDefaultEditorForCell(int row, int col) const wxGridCellRenderer * wxGrid::GetDefaultRendererForCell(int row, int col) const { if ( !m_table ) - return NULL; + return nullptr; wxString typeName = m_table->GetTypeName(row, col); return GetDefaultRendererForType(typeName); @@ -9799,7 +9799,7 @@ wxGridCellEditor * wxGrid::GetDefaultEditorForType(const wxString& typeName) con { wxFAIL_MSG(wxString::Format(wxT("Unknown data type name [%s]"), typeName.c_str())); - return NULL; + return nullptr; } return m_typeRegistry->GetEditor(index); @@ -9812,7 +9812,7 @@ wxGridCellRenderer * wxGrid::GetDefaultRendererForType(const wxString& typeName) { wxFAIL_MSG(wxString::Format(wxT("Unknown data type name [%s]"), typeName.c_str())); - return NULL; + return nullptr; } return m_typeRegistry->GetRenderer(index); @@ -9997,8 +9997,8 @@ void wxGrid::DoSetRowSize( int row, int height ) // they can't have multiple rows currently. const wxRect rect = m_gridWin->GetRect(); int left, right; - CalcUnscrolledPosition(rect.GetLeft(), 0, &left, NULL); - CalcUnscrolledPosition(rect.GetRight(), 0, &right, NULL); + CalcUnscrolledPosition(rect.GetLeft(), 0, &left, nullptr); + CalcUnscrolledPosition(rect.GetRight(), 0, &right, nullptr); const int posLeft = XToPos(left, m_gridWin); const int posRight = XToPos(right, m_gridWin); @@ -10041,7 +10041,7 @@ void wxGrid::DoSetRowSize( int row, int height ) }; int y; - CalcScrolledPosition(0, GetRowTop(topRow), NULL, &y); + CalcScrolledPosition(0, GetRowTop(topRow), nullptr, &y); if ( topRow < m_numFrozenRows ) { @@ -10185,8 +10185,8 @@ void wxGrid::DoSetColSize( int col, int width ) const wxRect rect = m_gridWin->GetRect(); int top, bottom; - CalcUnscrolledPosition(0, rect.GetTop(), NULL, &top); - CalcUnscrolledPosition(0, rect.GetBottom(), NULL, &bottom); + CalcUnscrolledPosition(0, rect.GetTop(), nullptr, &top); + CalcUnscrolledPosition(0, rect.GetBottom(), nullptr, &bottom); const int posTop = YToPos(top, m_gridWin); const int posBottom = YToPos(bottom, m_gridWin); @@ -10229,7 +10229,7 @@ void wxGrid::DoSetColSize( int col, int width ) }; int x; - CalcScrolledPosition(GetColLeft(leftCol), 0, &x, NULL); + CalcScrolledPosition(GetColLeft(leftCol), 0, &x, nullptr); if ( leftCol < m_numFrozenCols ) { @@ -11206,7 +11206,7 @@ void wxGrid::DoSetSizes(const wxGridSizesInfo& sizeInfo, { BeginBatch(); oper.SetDefaultLineSize(this, sizeInfo.m_sizeDefault, true); - const int numLines = oper.GetNumberOfLines(this, NULL); + const int numLines = oper.GetNumberOfLines(this, nullptr); for ( int i = 0; i < numLines; i++ ) { int size = sizeInfo.GetSize(i); diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index d77c98109b..8148bcab84 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -179,7 +179,7 @@ void wxGridCellEditorEvtHandler::OnChar(wxKeyEvent& event) // get width of cell CONTENTS (text) int y; wxFont font = m_grid->GetCellFont(row, col); - m_grid->GetTextExtent(value, &textWidth, &y, NULL, NULL, &font); + m_grid->GetTextExtent(value, &textWidth, &y, nullptr, nullptr, &font); // try to RIGHT align the text by scrolling int client_right = m_grid->GetGridWindow()->GetClientSize().GetWidth(); @@ -229,7 +229,7 @@ wxGridCellEditor::wxGridCellEditor(const wxGridCellEditor& other) m_colBgOld(other.m_colBgOld), m_fontOld(other.m_fontOld) { - m_attr = other.m_attr ? other.m_attr->Clone() : NULL; + m_attr = other.m_attr ? other.m_attr->Clone() : nullptr; } wxGridCellEditor::~wxGridCellEditor() @@ -262,7 +262,7 @@ void wxGridCellEditor::Destroy() m_control->PopEventHandler( true /* delete it*/ ); m_control->Destroy(); - m_control = NULL; + m_control = nullptr; } } @@ -1508,7 +1508,7 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid) wxASSERT_MSG(m_control, wxT("The wxGridCellEditor must be created first!")); - wxGridCellEditorEvtHandler* evtHandler = NULL; + wxGridCellEditorEvtHandler* evtHandler = nullptr; if (m_control) { // This event handler is needed to properly dismiss the editor when the popup is closed @@ -1651,7 +1651,7 @@ void wxGridCellEnumEditor::BeginEdit(int row, int col, wxGrid* grid) wxASSERT_MSG(m_control, wxT("The wxGridCellEnumEditor must be Created first!")); - wxGridCellEditorEvtHandler* evtHandler = NULL; + wxGridCellEditorEvtHandler* evtHandler = nullptr; if (m_control) evtHandler = wxDynamicCast(m_control->GetEventHandler(), wxGridCellEditorEvtHandler); @@ -1787,7 +1787,7 @@ struct wxGridCellDateEditorKeyHandler // see the comment before WX_DECLARE_TYPEINFO_INLINE() in wx/typeinfo.h) // and this, in turn, requires a default ctor of this class -- which will // never be actually used, but must nevertheless exist. - wxGridCellDateEditorKeyHandler() : m_handler(NULL) { } + wxGridCellDateEditorKeyHandler() : m_handler(nullptr) { } #endif // wxNO_RTTI }; #endif // __WXGTK__ diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 618cfff471..299ec06151 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -65,7 +65,7 @@ wxIMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase); wxExtHelpController::wxExtHelpController(wxWindow* parentWindow) : wxHelpControllerBase(parentWindow) { - m_MapList = NULL; + m_MapList = nullptr; m_NumOfEntries = 0; m_BrowserIsNetscape = false; diff --git a/src/generic/htmllbox.cpp b/src/generic/htmllbox.cpp index 53ac233874..28e9b65291 100644 --- a/src/generic/htmllbox.cpp +++ b/src/generic/htmllbox.cpp @@ -71,7 +71,7 @@ public: for ( size_t n = 0; n < SIZE; n++ ) { m_items[n] = (size_t)-1; - m_cells[n] = NULL; + m_cells[n] = nullptr; } m_next = 0; @@ -94,7 +94,7 @@ public: } } - // return the cached cell for this index or NULL if none + // return the cached cell for this index or nullptr if none wxHtmlCell *Get(size_t item) const { for ( size_t n = 0; n < SIZE; n++ ) @@ -103,11 +103,11 @@ public: return m_cells[n]; } - return NULL; + return nullptr; } // returns true if we already have this item cached - bool Has(size_t item) const { return Get(item) != NULL; } + bool Has(size_t item) const { return Get(item) != nullptr; } // ensure that the item is cached void Store(size_t item, wxHtmlCell *cell) @@ -140,10 +140,10 @@ private: // the index of the LRU (oldest) cell size_t m_next; - // the parsed representation of the cached item or NULL + // the parsed representation of the cached item or nullptr wxHtmlCell *m_cells[SIZE]; - // the index of the currently cached item (only valid if m_cells != NULL) + // the index of the currently cached item (only valid if m_cells != nullptr) size_t m_items[SIZE]; }; @@ -234,7 +234,7 @@ wxHtmlListBox::wxHtmlListBox(wxWindow *parent, void wxHtmlListBox::Init() { - m_htmlParser = NULL; + m_htmlParser = nullptr; m_htmlRendStyle = new wxHtmlListBoxStyle(*this); m_cache = new wxHtmlListBoxCache; } @@ -313,7 +313,7 @@ wxHtmlCell* wxHtmlListBox::CreateCellForItem(size_t n) const wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser-> Parse(OnGetItemMarkup(n)); - wxCHECK_MSG( cell, NULL, wxT("wxHtmlParser::Parse() returned NULL?") ); + wxCHECK_MSG( cell, nullptr, wxT("wxHtmlParser::Parse() returned nullptr?") ); // set the cell's ID to item's index so that CellCoordsToPhysical() // can quickly find the item: @@ -698,7 +698,7 @@ int wxSimpleHtmlListBox::DoInsertItems(const wxArrayStringsAdapter& items, const unsigned int count = items.GetCount(); m_items.Insert(wxEmptyString, pos, count); - m_HTMLclientData.Insert(NULL, pos, count); + m_HTMLclientData.Insert(nullptr, pos, count); for ( unsigned int i = 0; i < count; ++i, ++pos ) { diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 18897a100d..20dc318daa 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -161,7 +161,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour const wxBitmap *wxGenericImageList::DoGetPtr( int index ) const { if ( index < 0 || (size_t)index >= m_images.size() ) - return NULL; + return nullptr; return &m_images[index]; } diff --git a/src/generic/infobar.cpp b/src/generic/infobar.cpp index 7705319626..1255d8961e 100644 --- a/src/generic/infobar.cpp +++ b/src/generic/infobar.cpp @@ -46,9 +46,9 @@ wxEND_EVENT_TABLE() void wxInfoBarGeneric::Init() { - m_icon = NULL; - m_text = NULL; - m_button = NULL; + m_icon = nullptr; + m_text = nullptr; + m_button = nullptr; m_showEffect = m_hideEffect = wxSHOW_EFFECT_MAX; diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index 720c8cee9c..af0ce074e7 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -263,7 +263,7 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) // Find the last layout-aware window, so we can make it fill all remaining // space. - wxWindow *lastAwareWindow = NULL; + wxWindow *lastAwareWindow = nullptr; wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); while (node) @@ -289,9 +289,9 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) { wxWindow* win = node->GetData(); - // If mainWindow is NULL and we're at the last window, + // If mainWindow is null and we're at the last window, // skip this, because we'll simply make it fit the remaining space. - if (win->IsShown() && (win != mainWindow) && (mainWindow != NULL || win != lastAwareWindow)) + if (win->IsShown() && (win != mainWindow) && (mainWindow != nullptr || win != lastAwareWindow)) { event.SetId(win->GetId()); event.SetEventObject(win); @@ -313,9 +313,9 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) { wxWindow* win = node->GetData(); - // If mainWindow is NULL and we're at the last window, + // If mainWindow is null and we're at the last window, // skip this, because we'll simply make it fit the remaining space. - if (win->IsShown() && (win != mainWindow) && (mainWindow != NULL || win != lastAwareWindow)) + if (win->IsShown() && (win != mainWindow) && (mainWindow != nullptr || win != lastAwareWindow)) { event.SetId(win->GetId()); event.SetEventObject(win); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 80e1ea392e..3da7620e68 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -136,7 +136,7 @@ void wxListItemData::Init() m_image = -1; m_data = 0; - m_attr = NULL; + m_attr = nullptr; } wxListItemData::wxListItemData(wxListMainWindow *owner) @@ -146,7 +146,7 @@ wxListItemData::wxListItemData(wxListMainWindow *owner) m_owner = owner; if ( owner->InReportView() ) - m_rect = NULL; + m_rect = nullptr; else m_rect = new wxRect; } @@ -426,7 +426,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner ) m_owner = owner; if ( InReportView() ) - m_gi = NULL; + m_gi = nullptr; else // !report m_gi = new GeometryInfo; @@ -675,7 +675,7 @@ int wxListLineData::GetImage( int index ) const wxItemAttr *wxListLineData::GetAttr() const { wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); - wxCHECK_MSG( node, NULL, wxT("invalid column index in GetAttr()") ); + wxCHECK_MSG( node, nullptr, wxT("invalid column index in GetAttr()") ); wxListItemData *item = node->GetData(); return item->GetAttr(); @@ -969,7 +969,7 @@ wxEND_EVENT_TABLE() void wxListHeaderWindow::Init() { - m_currentCursor = NULL; + m_currentCursor = nullptr; m_isDragging = false; m_dirty = false; m_sendSetColumnWidth = false; @@ -979,8 +979,8 @@ wxListHeaderWindow::wxListHeaderWindow() { Init(); - m_owner = NULL; - m_resizeCursor = NULL; + m_owner = nullptr; + m_resizeCursor = nullptr; m_sortAsc = true; m_sortCol = -1; @@ -1035,10 +1035,10 @@ void wxListHeaderWindow::AdjustDC(wxDC& dc) wxGenericListCtrl *parent = m_owner->GetListCtrl(); int xpix; - parent->GetScrollPixelsPerUnit( &xpix, NULL ); + parent->GetScrollPixelsPerUnit( &xpix, nullptr ); int view_start; - parent->GetViewStart( &view_start, NULL ); + parent->GetViewStart( &view_start, nullptr ); int org_x = 0; @@ -1072,7 +1072,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // width and height of the entire header window int w, h; GetClientSize( &w, &h ); - parent->CalcUnscrolledPosition(w, 0, &w, NULL); + parent->CalcUnscrolledPosition(w, 0, &w, nullptr); dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); dc.SetTextForeground(GetForegroundColour()); @@ -1146,7 +1146,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } else { - imageList = NULL; + imageList = nullptr; } // ignore alignment if there is not enough space anyhow @@ -1231,7 +1231,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) // we want to work with logical coords int x; - parent->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL); + parent->CalcUnscrolledPosition(event.GetX(), 0, &x, nullptr); if (m_isDragging) { @@ -1240,8 +1240,8 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event ) // we don't draw the line beyond our window, but we allow dragging it // there int w = 0; - GetClientSize( &w, NULL ); - parent->CalcUnscrolledPosition(w, 0, &w, NULL); + GetClientSize( &w, nullptr ); + parent->CalcUnscrolledPosition(w, 0, &w, nullptr); w -= 6; // erase the line if it was drawn @@ -1592,8 +1592,8 @@ void wxListMainWindow::Init() m_headerWidth = m_lineHeight = 0; - m_small_image_list = NULL; - m_normal_image_list = NULL; + m_small_image_list = nullptr; + m_normal_image_list = nullptr; m_small_spacing = 30; m_normal_spacing = 40; @@ -1604,9 +1604,9 @@ void wxListMainWindow::Init() m_lastOnSame = false; m_renameTimer = new wxListRenameTimer( this ); - m_findTimer = NULL; + m_findTimer = nullptr; m_findBell = 0; // default is to not ring bell at all - m_textctrlWrapper = NULL; + m_textctrlWrapper = nullptr; m_current = m_lineLastClicked = @@ -1623,7 +1623,7 @@ wxListMainWindow::wxListMainWindow() Init(); m_highlightBrush = - m_highlightUnfocusedBrush = NULL; + m_highlightUnfocusedBrush = nullptr; } wxListMainWindow::wxListMainWindow( wxWindow *parent, @@ -1749,7 +1749,7 @@ wxCoord wxListMainWindow::GetLineHeight() const dc.SetFont( GetFont() ); wxCoord y; - dc.GetTextExtent(wxT("H"), NULL, &y); + dc.GetTextExtent(wxT("H"), nullptr, &y); if ( m_small_image_list && m_small_image_list->GetImageCount() ) { @@ -2079,7 +2079,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) RecalculatePositions(); // ... but schedule it for later. - CallAfter(&wxWindow::Refresh, true, (const wxRect*)NULL); + CallAfter(&wxWindow::Refresh, true, (const wxRect*)nullptr); // Don't bother redoing the relayout again the next time nor redrawing // now, as we'll be refresh soon anyhow. @@ -2384,7 +2384,7 @@ void wxListMainWindow::ChangeCurrent(size_t current) wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass) { - wxCHECK_MSG( (item >= 0) && ((size_t)item < GetItemCount()), NULL, + wxCHECK_MSG( (item >= 0) && ((size_t)item < GetItemCount()), nullptr, wxT("wrong index in wxGenericListCtrl::EditLabel()") ); wxASSERT_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)), @@ -2397,13 +2397,13 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass le.m_item.m_itemId = le.m_itemIndex = item; wxListLineData *data = GetLine(itemEdit); - wxCHECK_MSG( data, NULL, wxT("invalid index in EditLabel()") ); + wxCHECK_MSG( data, nullptr, wxT("invalid index in EditLabel()") ); data->GetItem( 0, le.m_item ); if ( GetParent()->GetEventHandler()->ProcessEvent( le ) && !le.IsAllowed() ) { // vetoed by user code - return NULL; + return nullptr; } if ( m_dirty ) @@ -4538,7 +4538,7 @@ long wxListMainWindow::FindItem(long start, wxUIntPtr data) long wxListMainWindow::FindItem( const wxPoint& pt ) { size_t topItem; - GetVisibleLinesRange( &topItem, NULL ); + GetVisibleLinesRange( &topItem, nullptr ); wxPoint p; GetItemPosition( GetItemCount() - 1, p ); @@ -4717,7 +4717,7 @@ int wxListMainWindow::GetItemWidthWithImage(wxListItem * item) if (!item->GetText().empty()) { wxCoord w; - dc.GetTextExtent( item->GetText(), &w, NULL ); + dc.GetTextExtent( item->GetText(), &w, nullptr ); width += w; } @@ -4778,7 +4778,7 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event) wxGenericListCtrl* lc = GetListCtrl(); wxCHECK_RET( lc, wxT("no listctrl window?") ); - if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==NULL + if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==nullptr { lc->m_headerWin->Refresh(); lc->m_headerWin->Update(); @@ -4903,8 +4903,8 @@ wxEND_EVENT_TABLE() void wxGenericListCtrl::Init() { - m_mainWin = NULL; - m_headerWin = NULL; + m_mainWin = nullptr; + m_headerWin = nullptr; } wxGenericListCtrl::~wxGenericListCtrl() @@ -4918,7 +4918,7 @@ wxGenericListCtrl::~wxGenericListCtrl() void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() { bool needs_header = HasHeader(); - bool has_header = (m_headerWin != NULL); + bool has_header = (m_headerWin != nullptr); if (needs_header == has_header) return; @@ -5445,7 +5445,7 @@ void wxGenericListCtrl::SetTextColour(const wxColour& col) long wxGenericListCtrl::GetTopItem() const { size_t top; - m_mainWin->GetVisibleLinesRange(&top, NULL); + m_mainWin->GetVisibleLinesRange(&top, nullptr); return (long)top; } @@ -5593,7 +5593,7 @@ long wxGenericListCtrl::DoInsertColumn( long col, const wxListItem &item ) long idx = m_mainWin->InsertColumn( col, item ); // NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but - // still have m_headerWin==NULL + // still have m_headerWin==nullptr if (m_headerWin) m_headerWin->Refresh(); diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index c380b1801e..e6d89233d8 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -175,7 +175,7 @@ wxEND_EVENT_TABLE() // filename and try to open it, returns true on success (file was opened), // false if file couldn't be opened/created and -1 if the file selection // dialog was cancelled -static int OpenLogFile(wxFile& file, wxString *filename = NULL, wxWindow *parent = NULL); +static int OpenLogFile(wxFile& file, wxString *filename = nullptr, wxWindow *parent = nullptr); #endif // CAN_SAVE_FILES @@ -252,7 +252,7 @@ wxLogGui::DoShowMultipleLogMessages(const wxArrayString& messages, int style) { #if wxUSE_LOG_DIALOG - wxLogDialog dlg(NULL, + wxLogDialog dlg(nullptr, messages, severities, times, title, style); @@ -350,7 +350,7 @@ void wxLogGui::DoLogRecord(wxLogLevel level, case wxLOG_Status: #if wxUSE_STATUSBAR { - wxFrame *pFrame = NULL; + wxFrame *pFrame = nullptr; // check if the frame was passed to us explicitly wxUIntPtr ptr = 0; @@ -360,7 +360,7 @@ void wxLogGui::DoLogRecord(wxLogLevel level, } // find the top window and set it's status text if it has any - if ( pFrame == NULL ) { + if ( pFrame == nullptr ) { wxWindow *pWin = wxTheApp->GetTopWindow(); if ( wxDynamicCast(pWin, wxFrame) ) { pFrame = (wxFrame *)pWin; @@ -596,10 +596,10 @@ wxLogWindow::wxLogWindow(wxWindow *pParent, bool bShow, bool bDoPass) { - // Initialize it to NULL to ensure that we don't crash if any log messages + // Initialize it to nullptr to ensure that we don't crash if any log messages // are generated before the frame is fully created (while this doesn't // happen normally, it might, in principle). - m_pLogFrame = NULL; + m_pLogFrame = nullptr; PassMessages(bDoPass); @@ -643,12 +643,12 @@ bool wxLogWindow::OnFrameClose(wxFrame * WXUNUSED(frame)) void wxLogWindow::OnFrameDelete(wxFrame * WXUNUSED(frame)) { - m_pLogFrame = NULL; + m_pLogFrame = nullptr; } wxLogWindow::~wxLogWindow() { - // may be NULL if log frame already auto destroyed itself + // may be null if log frame already auto destroyed itself delete m_pLogFrame; } @@ -700,7 +700,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent, m_times.Add(times[n]); } - m_listctrl = NULL; + m_listctrl = nullptr; bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); @@ -964,7 +964,7 @@ void wxLogDialog::OnCopy(wxCommandEvent& WXUNUSED(event)) void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) { wxFile file; - int rc = OpenLogFile(file, NULL, this); + int rc = OpenLogFile(file, nullptr, this); if ( rc == -1 ) { // cancelled diff --git a/src/generic/markuptext.cpp b/src/generic/markuptext.cpp index 646ded6ce3..394564b4aa 100644 --- a/src/generic/markuptext.cpp +++ b/src/generic/markuptext.cpp @@ -96,7 +96,7 @@ private: // The values that we compute. wxSize m_size; - int * const m_visibleHeight; // may be NULL + int * const m_visibleHeight; // may be null wxDECLARE_NO_COPY_CLASS(wxMarkupParserMeasureOutput); }; diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index d7fb45a7ee..8be2b96aeb 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -60,7 +60,7 @@ wxEND_EVENT_TABLE() void wxGenericMDIParentFrame::Init() { #if wxUSE_MENUS - m_pMyMenuBar = NULL; + m_pMyMenuBar = nullptr; #endif // wxUSE_MENUS } @@ -175,21 +175,21 @@ void wxGenericMDIParentFrame::SetMenuBar(wxMenuBar *pMenuBar) void wxGenericMDIParentFrame::WXSetChildMenuBar(wxGenericMDIChildFrame *pChild) { #if wxUSE_MENUS - if (pChild == NULL) + if (pChild == nullptr) { // No Child, set Our menu bar back. SetMenuBar(m_pMyMenuBar); // Make sure we know our menu bar is in use - m_pMyMenuBar = NULL; + m_pMyMenuBar = nullptr; } else { - if (pChild->GetMenuBar() == NULL) + if (pChild->GetMenuBar() == nullptr) return; // Do we need to save the current bar? - if (m_pMyMenuBar == NULL) + if (m_pMyMenuBar == nullptr) m_pMyMenuBar = GetMenuBar(); SetMenuBar(pChild->GetMenuBar()); @@ -206,7 +206,7 @@ wxGenericMDIParentFrame::GetGenericClientWindow() const wxBookCtrlBase *wxGenericMDIParentFrame::GetBookCtrl() const { wxGenericMDIClientWindow * const client = GetGenericClientWindow(); - return client ? client->GetBookCtrl() : NULL; + return client ? client->GetBookCtrl() : nullptr; } void wxGenericMDIParentFrame::AdvanceActive(bool forward) @@ -243,8 +243,8 @@ void wxGenericMDIParentFrame::WXRemoveChild(wxGenericMDIChildFrame *child) const bool removingActive = WXIsActiveChild(child); if ( removingActive ) { - SetActiveChild(NULL); - WXSetChildMenuBar(NULL); + SetActiveChild(nullptr); + WXSetChildMenuBar(nullptr); } wxGenericMDIClientWindow * const client = GetGenericClientWindow(); @@ -389,11 +389,11 @@ wxEND_EVENT_TABLE() void wxGenericMDIChildFrame::Init() { #if wxUSE_MENUS - m_pMenuBar = NULL; + m_pMenuBar = nullptr; #endif // wxUSE_MENUS #if !wxUSE_GENERIC_MDI_AS_NATIVE - m_mdiParentGeneric = NULL; + m_mdiParentGeneric = nullptr; #endif } @@ -432,7 +432,7 @@ bool wxGenericMDIChildFrame::Create(wxGenericMDIParentFrame *parent, #if wxUSE_GENERIC_MDI_AS_NATIVE m_mdiParent = parent; #else // generic != native - // leave m_mdiParent NULL, we don't have it + // leave m_mdiParent null, we don't have it m_mdiParentGeneric = parent; #endif @@ -469,7 +469,7 @@ void wxGenericMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { // Replace current menu bars if (pOldMenuBar) - parent->WXSetChildMenuBar(NULL); + parent->WXSetChildMenuBar(nullptr); parent->WXSetChildMenuBar(this); } } diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 3bda158786..c235cb5b8a 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -96,7 +96,7 @@ wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() { wxStdDialogButtonSizer * const sizerStd = new wxStdDialogButtonSizer; - wxButton *btnDef = NULL; + wxButton *btnDef = nullptr; if ( m_dialogStyle & wxOK ) { diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp index 913adb9e25..1d611e7039 100644 --- a/src/generic/notebook.cpp +++ b/src/generic/notebook.cpp @@ -106,7 +106,7 @@ static int GetPageId(wxTabView *tabview, wxNotebookPage *page) // common part of all ctors void wxNotebook::Init() { - m_tabView = NULL; + m_tabView = nullptr; m_selection = -1; } @@ -312,13 +312,13 @@ bool wxNotebook::DeletePage(wxNotebookPage* page) bool wxNotebook::RemovePage(size_t nPage) { - return DoRemovePage(nPage) != NULL; + return DoRemovePage(nPage) != nullptr; } // remove one page from the notebook wxWindow* wxNotebook::DoRemovePage(size_t nPage) { - wxCHECK( IS_VALID_PAGE(nPage), NULL ); + wxCHECK( IS_VALID_PAGE(nPage), nullptr ); m_pages[nPage]->Show(false); // m_pages[nPage]->Lower(); @@ -401,7 +401,7 @@ bool wxNotebook::InsertPage(size_t nPage, bool bSelect, int WXUNUSED(imageId)) { - wxASSERT( pPage != NULL ); + wxASSERT( pPage != nullptr ); wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false ); m_tabView->AddTab(GetPageId(m_tabView, pPage), strText); diff --git a/src/generic/notifmsgg.cpp b/src/generic/notifmsgg.cpp index 50d63c86c0..b0ef90c3c1 100644 --- a/src/generic/notifmsgg.cpp +++ b/src/generic/notifmsgg.cpp @@ -126,14 +126,14 @@ wxEND_EVENT_TABLE() wxVector wxNotificationMessageWindow::ms_visibleNotifications; wxNotificationMessageWindow::wxNotificationMessageWindow(wxGenericNotificationMessageImpl* notificationImpl) - : wxFrame(NULL, wxID_ANY, _("Notice"), + : wxFrame(nullptr, wxID_ANY, _("Notice"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP /* no caption, no border styles */), m_timer(this), m_mouseActiveCount(0), m_notificationImpl(notificationImpl) { - m_buttonSizer = NULL; + m_buttonSizer = nullptr; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); @@ -215,7 +215,7 @@ void wxNotificationMessageWindow::SetMessageIcon(const wxIcon& icon) bool wxNotificationMessageWindow::AddAction(wxWindowID actionid, const wxString &label) { wxSizer* msgSizer = m_messagePanel->GetSizer(); - if ( m_buttonSizer == NULL ) + if ( m_buttonSizer == nullptr ) { msgSizer->Detach(m_closeBtn); m_closeBtn->Hide(); diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 4651b7ebf8..b7549cc739 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -538,7 +538,7 @@ void wxVListBoxComboPopup::Insert( const wxString& item, int pos ) m_strings.Insert(item,pos); if ( (int)m_clientDatas.size() >= pos ) - m_clientDatas.insert(m_clientDatas.begin()+pos, NULL); + m_clientDatas.insert(m_clientDatas.begin()+pos, nullptr); m_widths.insert(m_widths.begin()+pos, -1); m_widthsDirty = true; @@ -615,7 +615,7 @@ void wxVListBoxComboPopup::SetItemClientData( unsigned int n, void* wxVListBoxComboPopup::GetItemClientData(unsigned int n) const { - return n < m_clientDatas.size() ? m_clientDatas[n] : NULL; + return n < m_clientDatas.size() ? m_clientDatas[n] : nullptr; } void wxVListBoxComboPopup::Delete( unsigned int item ) @@ -657,7 +657,7 @@ bool wxVListBoxComboPopup::FindItem(const wxString& item, wxString* trueItem) int idx = m_strings.Index(item, false); if ( idx == wxNOT_FOUND ) return false; - if ( trueItem != NULL ) + if ( trueItem != nullptr ) *trueItem = m_strings[idx]; return true; } @@ -762,7 +762,7 @@ void wxVListBoxComboPopup::CalcWidths() if ( dirtyHandled < 1024 ) { wxCoord y; - dc.GetTextExtent(text, &x, &y, 0, 0); + dc.GetTextExtent(text, &x, &y, nullptr, nullptr); x += 4; } else @@ -942,7 +942,7 @@ bool wxOwnerDrawnComboBox::Create(wxWindow *parent, //return Create(parent, id, value, pos, size, chs.GetCount(), // chs.GetStrings(), style, validator, name); return Create(parent, id, value, pos, size, 0, - NULL, style, validator, name); + nullptr, style, validator, name); } bool wxOwnerDrawnComboBox::Create(wxWindow *parent, @@ -1138,7 +1138,7 @@ void wxOwnerDrawnComboBox::DoSetItemClientData(unsigned int n, void* clientData) void* wxOwnerDrawnComboBox::DoGetItemClientData(unsigned int n) const { if ( !m_popupInterface ) - return NULL; + return nullptr; return GetVListBoxComboPopup()->GetItemClientData(n); } diff --git a/src/generic/paletteg.cpp b/src/generic/paletteg.cpp index 6b3530e864..9515d29a07 100644 --- a/src/generic/paletteg.cpp +++ b/src/generic/paletteg.cpp @@ -38,7 +38,7 @@ public: wxPaletteRefData::wxPaletteRefData() { m_count = 0; - m_entries = NULL; + m_entries = nullptr; } wxPaletteRefData::wxPaletteRefData(const wxPaletteRefData& palette) @@ -62,7 +62,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject); wxPalette::wxPalette() { - m_refData = NULL; + m_refData = nullptr; } wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) diff --git a/src/generic/preferencesg.cpp b/src/generic/preferencesg.cpp index 32cdd6ae11..bcfe9011f7 100644 --- a/src/generic/preferencesg.cpp +++ b/src/generic/preferencesg.cpp @@ -178,7 +178,7 @@ public: if ( m_win ) { m_win->Close(/*force=*/true); - m_win = NULL; + m_win = nullptr; } } @@ -199,7 +199,7 @@ class wxModalPreferencesEditorImpl : public wxGenericPreferencesEditorImplBase public: wxModalPreferencesEditorImpl() { - m_dlg = NULL; + m_dlg = nullptr; m_currentPage = -1; } @@ -207,7 +207,7 @@ public: { wxScopedPtr dlg(CreateDialog(parent)); - // Store it for Dismiss() but ensure that the pointer is reset to NULL + // Store it for Dismiss() but ensure that the pointer is reset to nullptr // when the dialog is destroyed on leaving this function. m_dlg = dlg.get(); wxON_BLOCK_EXIT_NULL(m_dlg); @@ -226,7 +226,7 @@ public: if ( m_dlg ) { m_dlg->EndModal(wxID_CANCEL); - m_dlg = NULL; + m_dlg = nullptr; } } diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index e9a230e90d..dab2279d51 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -69,7 +69,7 @@ wxPostScriptPrinter::~wxPostScriptPrinter() bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; - sm_abortWindow = NULL; + sm_abortWindow = nullptr; if (!printout) { @@ -211,7 +211,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) { - wxDC* dc = NULL; + wxDC* dc = nullptr; wxGenericPrintDialog dialog( parent, &m_printDialogData ); if (dialog.ShowModal() == wxID_OK) @@ -219,7 +219,7 @@ wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) dc = dialog.GetPrintDC(); m_printDialogData = dialog.GetPrintDialogData(); - if (dc == NULL) + if (dc == nullptr) sm_lastError = wxPRINTER_ERROR; else sm_lastError = wxPRINTER_NO_ERROR; diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index ad1612e3bc..2792f55d55 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -208,9 +208,9 @@ void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent)) choices[0] = _("All"); choices[1] = _("Pages"); - m_fromText = NULL; - m_toText = NULL; - m_rangeRadioBox = NULL; + m_fromText = nullptr; + m_toText = nullptr; + m_rangeRadioBox = nullptr; if (m_printDialogData.GetFromPage() != 0) { @@ -760,7 +760,7 @@ bool wxGenericPrintSetupDialog::TransferDataFromWindow() if (selectedItem != -1) { wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem); - if (paper != NULL) + if (paper != nullptr) m_printData.SetPaperId( paper->GetId()); } } @@ -911,7 +911,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, } else { - m_printerButton = NULL; + m_printerButton = nullptr; } // if (m_printData.GetEnableHelp()) diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index 9ceef84922..18f9a92028 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -78,13 +78,13 @@ void wxGenericProgressDialog::Init() // create a valid window in this class). m_pdStyle = 0; - m_parentTop = NULL; + m_parentTop = nullptr; - m_gauge = NULL; - m_msg = NULL; + m_gauge = nullptr; + m_msg = nullptr; m_elapsed = m_estimated = - m_remaining = NULL; + m_remaining = nullptr; m_state = Uncancelable; m_maximum = 0; @@ -96,7 +96,7 @@ void wxGenericProgressDialog::Init() m_skip = false; m_btnAbort = - m_btnSkip = NULL; + m_btnSkip = nullptr; m_display_estimated = m_last_timeupdate = @@ -104,8 +104,8 @@ void wxGenericProgressDialog::Init() m_delay = 3; - m_winDisabler = NULL; - m_tempEventLoop = NULL; + m_winDisabler = nullptr; + m_tempEventLoop = nullptr; SetWindowStyle(wxDEFAULT_DIALOG_STYLE); } @@ -208,7 +208,7 @@ bool wxGenericProgressDialog::Create( const wxString& title, // create the estimated/remaining/total time zones if requested m_elapsed = m_estimated = - m_remaining = NULL; + m_remaining = nullptr; // also count how many labels we really have size_t nTimeLabels = 0; @@ -717,7 +717,7 @@ wxGenericProgressDialog::~wxGenericProgressDialog() "wxGenericProgressDialog lifetime" ); - wxEventLoopBase::SetActive(NULL); + wxEventLoopBase::SetActive(nullptr); delete m_tempEventLoop; } } @@ -732,7 +732,7 @@ void wxGenericProgressDialog::DisableOtherWindows() { if ( m_parentTop ) m_parentTop->Disable(); - m_winDisabler = NULL; + m_winDisabler = nullptr; } } diff --git a/src/generic/propdlg.cpp b/src/generic/propdlg.cpp index dca22468d2..3b90049754 100644 --- a/src/generic/propdlg.cpp +++ b/src/generic/propdlg.cpp @@ -79,8 +79,8 @@ bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxStri void wxPropertySheetDialog::Init() { m_sheetStyle = wxPROPSHEET_DEFAULT; - m_innerSizer = NULL; - m_bookCtrl = NULL; + m_innerSizer = nullptr; + m_bookCtrl = nullptr; m_sheetOuterBorder = 2; m_sheetInnerBorder = 5; } @@ -109,7 +109,7 @@ wxBookCtrlBase* wxPropertySheetDialog::CreateBookCtrl() { int style = wxCLIP_CHILDREN | wxBK_DEFAULT; - wxBookCtrlBase* bookCtrl = NULL; + wxBookCtrlBase* bookCtrl = nullptr; #if wxUSE_NOTEBOOK if (GetSheetStyle() & wxPROPSHEET_NOTEBOOK) diff --git a/src/generic/regiong.cpp b/src/generic/regiong.cpp index 0f6c94e4ff..ee5aea5614 100644 --- a/src/generic/regiong.cpp +++ b/src/generic/regiong.cpp @@ -49,7 +49,7 @@ public: BoxPtr GetBox(int i) { - return i < numRects ? rects + i : NULL; + return i < numRects ? rects + i : nullptr; } // X.org methods @@ -607,14 +607,14 @@ Region REGION::XCreateRegion(void) Region temp = new REGION; if (!temp) - return (Region) NULL; + return nullptr; temp->rects = ( BOX * )malloc( (unsigned) sizeof( BOX )); if (!temp->rects) { delete temp; - return (Region) NULL; + return nullptr; } temp->numRects = 0; temp->extents.x1 = 0; @@ -829,7 +829,7 @@ XIntersectRegion( newReg->numRects = 0; else miRegionOp (newReg, reg1, reg2, - miIntersectO, NULL, NULL); + miIntersectO, nullptr, nullptr); /* * Can't alter newReg's extents before we call miRegionOp because @@ -1199,7 +1199,7 @@ miRegionOp( top = wxMax(r1->y1,ybot); bot = wxMin(r1->y2,r2->y1); - if ((top != bot) && (nonOverlap1Func != NULL)) + if ((top != bot) && (nonOverlap1Func != nullptr)) { (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot); } @@ -1211,7 +1211,7 @@ miRegionOp( top = wxMax(r2->y1,ybot); bot = wxMin(r2->y2,r1->y1); - if ((top != bot) && (nonOverlap2Func != NULL)) + if ((top != bot) && (nonOverlap2Func != nullptr)) { (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot); } @@ -1271,7 +1271,7 @@ miRegionOp( curBand = newReg->numRects; if (r1 != r1End) { - if (nonOverlap1Func != NULL) + if (nonOverlap1Func != nullptr) { do { @@ -1286,7 +1286,7 @@ miRegionOp( } while (r1 != r1End); } } - else if ((r2 != r2End) && (nonOverlap2Func != NULL)) + else if ((r2 != r2End) && (nonOverlap2Func != nullptr)) { do { @@ -1769,7 +1769,7 @@ bool REGION::XSubtractRegion(Region regM, Region regS, Region regD) } miRegionOp (regD, regM, regS, miSubtractO, - miSubtractNonO1, NULL); + miSubtractNonO1, nullptr); /* * Can't alter newReg's extents before we call miRegionOp because diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index d561e9d9f5..012154ddcc 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -58,14 +58,14 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override; + wxHeaderButtonParams* params = nullptr) override; virtual int DrawHeaderButtonContents(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override; + wxHeaderButtonParams* params = nullptr) override; virtual int GetHeaderButtonHeight(wxWindow *win) override; @@ -256,7 +256,7 @@ void wxRendererGeneric::Cleanup() wxDELETE(sm_rendererGeneric); } -wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL; +wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = nullptr; wxRendererGeneric::wxRendererGeneric() : m_penBlack(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)), diff --git a/src/generic/richtooltipg.cpp b/src/generic/richtooltipg.cpp index fe3cf03a86..2621c1caba 100644 --- a/src/generic/richtooltipg.cpp +++ b/src/generic/richtooltipg.cpp @@ -274,7 +274,7 @@ protected: private: #ifdef HAVE_MSW_THEME - // Returns non-NULL theme only if we're using Win7-style tooltips. + // Returns non-null theme only if we're using Win7-style tooltips. static bool UseTooltipTheme() { // Even themed applications under XP still use "classic" tooltips. diff --git a/src/generic/rowheightcache.cpp b/src/generic/rowheightcache.cpp index 62e25acfaa..04a9261220 100644 --- a/src/generic/rowheightcache.cpp +++ b/src/generic/rowheightcache.cpp @@ -293,7 +293,7 @@ bool HeightCache::GetLineAt(int y, unsigned int &row) void HeightCache::Put(unsigned int row, int height) { RowRanges *rowRanges = m_heightToRowRange[height]; - if (rowRanges == NULL) + if (rowRanges == nullptr) { rowRanges = new RowRanges(); m_heightToRowRange[height] = rowRanges; diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 85f0b3936f..3993348a6e 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -75,7 +75,7 @@ void wxSashWindow::Init() m_sashCursorWE = new wxCursor(wxCURSOR_SIZEWE); m_sashCursorNS = new wxCursor(wxCURSOR_SIZENS); m_mouseCaptured = false; - m_currentCursor = NULL; + m_currentCursor = nullptr; // Eventually, we'll respond to colour change messages InitColours(); @@ -310,7 +310,7 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) else { SetCursor(wxNullCursor); - m_currentCursor = NULL; + m_currentCursor = nullptr; } } else if ( event.Dragging() && diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index 1e0c95e073..f1e700193d 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -302,10 +302,10 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) wxAnyScrollHelperBase::wxAnyScrollHelperBase(wxWindow* win) { - wxASSERT_MSG( win, wxT("associated window can't be NULL in wxScrollHelper") ); + wxASSERT_MSG( win, wxT("associated window can't be null in wxScrollHelper") ); m_win = win; - m_targetWindow = NULL; + m_targetWindow = nullptr; m_kbdScrollingEnabled = true; } @@ -335,9 +335,9 @@ wxScrollHelperBase::wxScrollHelperBase(wxWindow *win) m_wheelRotation = 0; #endif - m_timerAutoScroll = NULL; + m_timerAutoScroll = nullptr; - m_handler = NULL; + m_handler = nullptr; m_win->SetScrollHelper(static_cast(this)); @@ -436,7 +436,7 @@ void wxScrollHelperBase::DeleteEvtHandler() //else: something is very wrong, so better [maybe] leak memory than // risk a crash because of double deletion - m_handler = NULL; + m_handler = nullptr; } } @@ -462,7 +462,7 @@ void wxScrollHelperBase::DoSetTargetWindow(wxWindow *target) void wxScrollHelperBase::SetTargetWindow(wxWindow *target) { - wxCHECK_RET( target, wxT("target window must not be NULL") ); + wxCHECK_RET( target, wxT("target window must not be null") ); if ( target == m_targetWindow ) return; @@ -1088,7 +1088,7 @@ void wxScrollHelperBase::HandleOnChildFocus(wxChildFocusEvent& event) for ( wxWindow* w = win; w; w = w->GetParent() ) { if ( w != actual_focus && - wxDynamicCast(w, wxPanel) != NULL && + wxDynamicCast(w, wxPanel) != nullptr && w->GetParent() == m_targetWindow ) { // if it is a wxPanel and receives the focus, it should not be diff --git a/src/generic/selstore.cpp b/src/generic/selstore.cpp index b1b6bb50af..7914cca3f7 100644 --- a/src/generic/selstore.cpp +++ b/src/generic/selstore.cpp @@ -114,7 +114,7 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, } // many items (> half) changed state - itemsChanged = NULL; + itemsChanged = nullptr; } else // select == m_defaultState { @@ -143,7 +143,7 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, if ( itemsChanged->GetCount() > MANY_ITEMS ) { // stop counting (see comment below) - itemsChanged = NULL; + itemsChanged = nullptr; } else { @@ -175,14 +175,14 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, // stop counting them, we'll just eat gobs of memory // for nothing at all - faster to refresh everything in // this case - itemsChanged = NULL; + itemsChanged = nullptr; } } } } - // we set it to NULL if there are many items changing state - return itemsChanged != NULL; + // we set it to nullptr if there are many items changing state + return itemsChanged != nullptr; } // ---------------------------------------------------------------------------- diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 8a3636caa6..577add8ddc 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -87,9 +87,9 @@ public: { // MSW sends extra kill focus event on destroy if (m_spin) - m_spin->m_textCtrl = NULL; + m_spin->m_textCtrl = nullptr; - m_spin = NULL; + m_spin = nullptr; } void OnChar( wxKeyEvent &event ) @@ -200,8 +200,8 @@ void wxSpinCtrlGenericBase::Init() m_spin_value = 0; - m_textCtrl = NULL; - m_spinButton = NULL; + m_textCtrl = nullptr; + m_spinButton = nullptr; } bool wxSpinCtrlGenericBase::Create(wxWindow *parent, @@ -269,10 +269,10 @@ wxSpinCtrlGenericBase::~wxSpinCtrlGenericBase() if (m_textCtrl) { // null this since MSW sends KILL_FOCUS on deletion, see ~wxSpinCtrlTextGeneric - wxDynamicCast(m_textCtrl, wxSpinCtrlTextGeneric)->m_spin = NULL; + wxDynamicCast(m_textCtrl, wxSpinCtrlTextGeneric)->m_spin = nullptr; wxSpinCtrlTextGeneric *text = (wxSpinCtrlTextGeneric*)m_textCtrl; - m_textCtrl = NULL; + m_textCtrl = nullptr; delete text; } diff --git a/src/generic/splash.cpp b/src/generic/splash.cpp index 605f97d518..b8b2e9f52b 100644 --- a/src/generic/splash.cpp +++ b/src/generic/splash.cpp @@ -40,7 +40,7 @@ wxEND_EVENT_TABLE() void wxSplashScreen::Init() { - m_window = NULL; + m_window = nullptr; wxEvtHandler::AddFilter(this); } diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index fd6bace0d9..d956233257 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -134,8 +134,8 @@ void wxSplitterWindow::Init() { m_splitMode = wxSPLIT_VERTICAL; m_permitUnsplitAlways = true; - m_windowOne = NULL; - m_windowTwo = NULL; + m_windowOne = nullptr; + m_windowTwo = nullptr; m_dragMode = wxSPLIT_DRAG_NONE; m_oldX = 0; m_oldY = 0; @@ -318,7 +318,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) // We remove the first window from the view wxWindow *removedWindow = m_windowOne; m_windowOne = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = nullptr; OnUnsplit(removedWindow); wxSplitterEvent eventUnsplit(wxEVT_SPLITTER_UNSPLIT, this); eventUnsplit.m_data.win = removedWindow; @@ -329,7 +329,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) { // We remove the second window from the view wxWindow *removedWindow = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = nullptr; OnUnsplit(removedWindow); wxSplitterEvent eventUnsplit(wxEVT_SPLITTER_UNSPLIT, this); eventUnsplit.m_data.win = removedWindow; @@ -549,7 +549,7 @@ void wxSplitterWindow::SetSashGravity(double gravity) bool wxSplitterWindow::SashHitTest(int x, int y) { - if ( m_windowTwo == NULL || m_sashPosition == 0) + if ( m_windowTwo == nullptr || m_sashPosition == 0) return false; // No sash int z = m_splitMode == wxSPLIT_VERTICAL ? x : y; @@ -818,7 +818,7 @@ void wxSplitterWindow::Initialize(wxWindow *window) window->Show(); m_windowOne = window; - m_windowTwo = NULL; + m_windowTwo = nullptr; DoSetSashPosition(0); } @@ -833,7 +833,7 @@ bool wxSplitterWindow::DoSplit(wxSplitMode mode, return false; wxCHECK_MSG( window1 && window2, false, - wxT("cannot split with NULL window(s)") ); + wxT("cannot split with null window(s)") ); wxCHECK_MSG( window1->GetParent() == this && window2->GetParent() == this, false, wxT("windows in the splitter should have it as parent!") ); @@ -878,16 +878,16 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove) return false; wxWindow *win; - if ( toRemove == NULL || toRemove == m_windowTwo) + if ( toRemove == nullptr || toRemove == m_windowTwo) { win = m_windowTwo ; - m_windowTwo = NULL; + m_windowTwo = nullptr; } else if ( toRemove == m_windowOne ) { win = m_windowOne ; m_windowOne = m_windowTwo; - m_windowTwo = NULL; + m_windowTwo = nullptr; } else { diff --git a/src/generic/srchctlg.cpp b/src/generic/srchctlg.cpp index 37b1f23abf..19cf47d5be 100644 --- a/src/generic/srchctlg.cpp +++ b/src/generic/srchctlg.cpp @@ -282,11 +282,11 @@ wxSearchCtrl::wxSearchCtrl(wxWindow *parent, wxWindowID id, void wxSearchCtrl::Init() { - m_text = NULL; - m_searchButton = NULL; - m_cancelButton = NULL; + m_text = nullptr; + m_searchButton = nullptr; + m_cancelButton = nullptr; #if wxUSE_MENUS - m_menu = NULL; + m_menu = nullptr; #endif // wxUSE_MENUS m_searchBitmapUser = false; @@ -347,7 +347,7 @@ void wxSearchCtrl::SetMenu( wxMenu* menu ) // no change return; } - bool hadMenu = (m_menu != NULL); + bool hadMenu = (m_menu != nullptr); delete m_menu; m_menu = menu; diff --git a/src/generic/statline.cpp b/src/generic/statline.cpp index 0b7edbfd7d..62835eab56 100644 --- a/src/generic/statline.cpp +++ b/src/generic/statline.cpp @@ -43,7 +43,7 @@ bool wxStaticLine::Create( wxWindow *parent, long style, const wxString &name) { - m_statbox = NULL; + m_statbox = nullptr; if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; diff --git a/src/generic/stattextg.cpp b/src/generic/stattextg.cpp index 022dcbfb66..5c4df293d1 100644 --- a/src/generic/stattextg.cpp +++ b/src/generic/stattextg.cpp @@ -105,7 +105,7 @@ void wxGenericStaticText::SetLabel(const wxString& label) if ( m_markupText ) { delete m_markupText; - m_markupText = NULL; + m_markupText = nullptr; } #endif // wxUSE_MARKUP diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index 7a8d497c9a..adbc7d498b 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -127,7 +127,7 @@ bool wxStatusBarGeneric::Create(wxWindow *parent, #if GTK_CHECK_VERSION(2,12,0) if (HasFlag(wxSTB_SHOW_TIPS) && wx_is_at_least_gtk2(12)) { - g_object_set(m_widget, "has-tooltip", TRUE, NULL); + g_object_set(m_widget, "has-tooltip", TRUE, nullptr); g_signal_connect(m_widget, "query-tooltip", G_CALLBACK(statusbar_query_tooltip), this); } @@ -143,7 +143,7 @@ wxSize wxStatusBarGeneric::DoGetBestSize() const // best width is the width of the parent if (GetParent()) - GetParent()->GetClientSize(&width, NULL); + GetParent()->GetClientSize(&width, nullptr); else width = 80; // a dummy value @@ -433,7 +433,7 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) gtk_paint_resize_grip(gtk_widget_get_style(m_widget), GTKGetDrawingWindow(), gtk_widget_get_state(m_widget), - NULL, + nullptr, m_widget, "statusbar", edge, @@ -475,7 +475,7 @@ void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) rect.width && rect.height) wxGCC_WARNING_RESTORE() { - ancestor = NULL; + ancestor = nullptr; } #endif @@ -525,7 +525,7 @@ void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) rect.width && rect.height) wxGCC_WARNING_RESTORE() { - ancestor = NULL; + ancestor = nullptr; } #endif diff --git a/src/generic/tabg.cpp b/src/generic/tabg.cpp index 445dae83cb..a42898990e 100644 --- a/src/generic/tabg.cpp +++ b/src/generic/tabg.cpp @@ -90,7 +90,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow) // Calculate the top of the tab beneath. It's the height of the tab, MINUS // a bit if the tab below happens to be selected. Check. - wxTabControl *tabBeneath = NULL; + wxTabControl *tabBeneath = nullptr; int subtractThis = 0; if (GetColPosition() > 0) tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition()); @@ -159,7 +159,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow) { // Calculate the top of the tab beneath. It's the height of the tab, MINUS // a bit if the tab below (and next col along) happens to be selected. Check. - wxTabControl *tabBeneath = NULL; + wxTabControl *tabBeneath = nullptr; int subtractThis = 0; if (GetColPosition() > 0) tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition() + 1); @@ -512,7 +512,7 @@ wxTabView::wxTabView(long style) // SetBackgroundColour(m_backgroundColour); m_tabFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); m_tabSelectedFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - m_window = NULL; + m_window = nullptr; } wxTabView::~wxTabView() @@ -562,7 +562,7 @@ wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *exi tabControl->SetRowPosition(tabLayer->GetCount()); tabControl->SetColPosition(layer); - wxTabControl *lastTab = NULL; + wxTabControl *lastTab = nullptr; if (lastTabNode) lastTab = (wxTabControl *)lastTabNode->GetData(); @@ -712,7 +712,7 @@ void wxTabView::LayoutTabs(void) layerNode = nextLayerNode; } - wxTabControl *lastTab = NULL; + wxTabControl *lastTab = nullptr; wxTabLayer *currentLayer = new wxTabLayer; m_layers.Append(currentLayer); @@ -734,7 +734,7 @@ void wxTabView::LayoutTabs(void) { currentLayer = new wxTabLayer; m_layers.Append(currentLayer); - lastTab = NULL; + lastTab = nullptr; } } @@ -859,7 +859,7 @@ bool wxTabView::OnEvent(wxMouseEvent& event) wxCoord x, y; event.GetPosition(&x, &y); - wxTabControl *hitControl = NULL; + wxTabControl *hitControl = nullptr; wxTabLayerList::compatibility_iterator node = m_layers.GetFirst(); while (node) @@ -1059,7 +1059,7 @@ wxTabControl *wxTabView::FindTabControlForId(int id) const } node1 = node1->GetNext(); } - return NULL; + return nullptr; } // Find tab control for layer, position (starting from zero) @@ -1067,11 +1067,11 @@ wxTabControl *wxTabView::FindTabControlForPosition(int layer, int position) cons { wxTabLayerList::compatibility_iterator node1 = m_layers.Item(layer); if (!node1) - return NULL; + return nullptr; wxTabLayer *tabLayer = (wxTabLayer *)node1->GetData(); wxList::compatibility_iterator node2 = tabLayer->Item(position); if (!node2) - return NULL; + return nullptr; return (wxTabControl *)node2->GetData(); } @@ -1128,7 +1128,7 @@ wxTabbedDialog::wxTabbedDialog(wxWindow *parent, wxWindowID id, long windowStyle, const wxString& name): wxDialog(parent, id, title, pos, size, windowStyle, name) { - m_tabView = NULL; + m_tabView = nullptr; } wxTabbedDialog::~wxTabbedDialog(void) @@ -1170,7 +1170,7 @@ wxTabbedPanel::wxTabbedPanel(wxWindow *parent, wxWindowID id, const wxPoint& pos const wxSize& size, long windowStyle, const wxString& name): wxPanel(parent, id, pos, size, windowStyle, name) { - m_tabView = NULL; + m_tabView = nullptr; } wxTabbedPanel::~wxTabbedPanel(void) @@ -1201,7 +1201,7 @@ wxPanelTabView::wxPanelTabView(wxPanel *pan, long style) : wxTabView(style) { m_panel = pan; - m_currentWindow = NULL; + m_currentWindow = nullptr; if (m_panel->IsKindOf(wxCLASSINFO(wxTabbedDialog))) ((wxTabbedDialog *)m_panel)->SetTabView(this); @@ -1244,7 +1244,7 @@ void wxPanelTabView::AddTabWindow(int id, wxWindow *window) wxWindow *wxPanelTabView::GetTabWindow(int id) const { wxIntToWindowHashMap::const_iterator it = m_tabWindows.find(id); - return it == m_tabWindows.end() ? NULL : it->second; + return it == m_tabWindows.end() ? nullptr : it->second; } void wxPanelTabView::ClearWindows(bool deleteWindows) diff --git a/src/generic/timectrlg.cpp b/src/generic/timectrlg.cpp index 55fb91119a..03bc097e48 100644 --- a/src/generic/timectrlg.cpp +++ b/src/generic/timectrlg.cpp @@ -579,7 +579,7 @@ private: void wxTimePickerCtrlGeneric::Init() { - m_impl = NULL; + m_impl = nullptr; } bool @@ -668,7 +668,7 @@ wxSize wxTimePickerCtrlGeneric::DoGetBestSize() const wxTextCtrl* const text = m_impl->m_text; int w; - text->GetTextExtent(text->GetValue(), &w, NULL); + text->GetTextExtent(text->GetValue(), &w, nullptr); wxSize size(text->GetSizeFromTextSize(w + 1)); const wxSize sizeBtn(m_impl->m_btn->GetBestSize()); diff --git a/src/generic/timer.cpp b/src/generic/timer.cpp index d1bfd9b10c..c44eb00c26 100644 --- a/src/generic/timer.cpp +++ b/src/generic/timer.cpp @@ -55,8 +55,8 @@ class wxTimerDesc { public: wxTimerDesc(wxGenericTimerImpl *t) : - timer(t), running(false), next(NULL), prev(NULL), - shotTime(0), deleteFlag(NULL) {} + timer(t), running(false), next(nullptr), prev(nullptr), + shotTime(0), deleteFlag(nullptr) {} wxGenericTimerImpl *timer; bool running; @@ -68,7 +68,7 @@ public: class wxTimerScheduler { public: - wxTimerScheduler() : m_timers(NULL) {} + wxTimerScheduler() : m_timers(nullptr) {} void QueueTimer(wxTimerDesc *desc, wxTimerTick_t when = 0); void RemoveTimer(wxTimerDesc *desc); @@ -105,7 +105,7 @@ void wxTimerScheduler::QueueTimer(wxTimerDesc *desc, wxTimerTick_t when) else { m_timers = desc; - desc->prev = desc->next = NULL; + desc->prev = desc->next = nullptr; } } @@ -118,7 +118,7 @@ void wxTimerScheduler::RemoveTimer(wxTimerDesc *desc) desc->prev->next = desc->next; if ( desc->next ) desc->next->prev = desc->prev; - desc->prev = desc->next = NULL; + desc->prev = desc->next = nullptr; } void wxTimerScheduler::NotifyTimers() @@ -148,7 +148,7 @@ void wxTimerScheduler::NotifyTimers() desc->timer, wxTimerTickPrintfArg(desc->shotTime) ); - desc->deleteFlag = NULL; + desc->deleteFlag = nullptr; if ( !oneShot ) QueueTimer(desc, now + desc->timer->GetInterval()); } @@ -168,7 +168,7 @@ void wxTimerScheduler::NotifyTimers() // wxTimer // ---------------------------------------------------------------------------- -wxTimerScheduler *gs_scheduler = NULL; +wxTimerScheduler *gs_scheduler = nullptr; void wxGenericTimerImpl::Init() { @@ -187,7 +187,7 @@ wxGenericTimerImpl::~wxGenericTimerImpl() // that wxTimer object was deleted under its hands -- this may // happen if somebody is really nasty and deletes the timer // from wxTimer::Notify() - if ( m_desc->deleteFlag != NULL ) + if ( m_desc->deleteFlag != nullptr ) *m_desc->deleteFlag = true; delete m_desc; diff --git a/src/generic/tipwin.cpp b/src/generic/tipwin.cpp index f8ac37f5f7..1fa0f18376 100644 --- a/src/generic/tipwin.cpp +++ b/src/generic/tipwin.cpp @@ -165,7 +165,7 @@ wxTipWindow::~wxTipWindow() { if ( m_windowPtr ) { - *m_windowPtr = NULL; + *m_windowPtr = nullptr; } #ifdef __WXGTK__ if ( m_view->HasCapture() ) @@ -192,8 +192,8 @@ void wxTipWindow::Close() { if ( m_windowPtr ) { - *m_windowPtr = NULL; - m_windowPtr = NULL; + *m_windowPtr = nullptr; + m_windowPtr = nullptr; } Show(false); diff --git a/src/generic/treebkg.cpp b/src/generic/treebkg.cpp index 876341e455..285838b591 100644 --- a/src/generic/treebkg.cpp +++ b/src/generic/treebkg.cpp @@ -268,7 +268,7 @@ bool wxTreebook::DeletePage(size_t pagePos) wxTreebookPage *wxTreebook::DoRemovePage(size_t pagePos) { wxTreeItemId pageId = DoInternalGetPage(pagePos); - wxCHECK_MSG( pageId.IsOk(), NULL, wxT("Invalid tree index") ); + wxCHECK_MSG( pageId.IsOk(), nullptr, wxT("Invalid tree index") ); wxTreebookPage * oldPage = GetPage(pagePos); wxTreeCtrl *tree = GetTreeCtrl(); @@ -546,7 +546,7 @@ wxWindow *wxTreebook::TryGetNonNullPage(size_t n) if ( !page ) { // Find the next suitable page, i.e. the first (grand)child - // of this one with a non-NULL associated page + // of this one with a non-null associated page wxTreeCtrl* const tree = GetTreeCtrl(); for ( wxTreeItemId childId = m_treeIds[n]; childId.IsOk(); ) { diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 406ff51d1d..76741110c3 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -139,7 +139,7 @@ public: // ctors & dtor wxGenericTreeItem() { - m_data = NULL; + m_data = nullptr; m_widthText = m_heightText = -1; } @@ -258,7 +258,7 @@ public: void RecursiveResetSize(); void RecursiveResetTextSize(); - // return the item at given position (or NULL if no item), onButton is + // return the item at given position (or nullptr if no item), onButton is // true if the point belongs to the item's button, otherwise it lies // on the item's label wxGenericTreeItem *HitTest( const wxPoint& point, @@ -279,9 +279,9 @@ public: bool IsBold() const { return m_isBold != 0; } // attributes - // get them - may be NULL + // get them - may be null wxItemAttr *GetAttributes() const { return m_attr; } - // get them ensuring that the pointer is not NULL + // get them ensuring that the pointer is not null wxItemAttr& Attr() { if ( !m_attr ) @@ -596,7 +596,7 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent, m_parent = parent; - m_attr = NULL; + m_attr = nullptr; m_ownsAttr = false; // We don't know the height here yet. @@ -627,7 +627,7 @@ void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) child->DeleteChildren(tree); if ( child == tree->m_select_me ) - tree->m_select_me = NULL; + tree->m_select_me = nullptr; delete child; } @@ -752,7 +752,7 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, } // if children are expanded, fall through to evaluate them - if (m_isCollapsed) return NULL; + if (m_isCollapsed) return nullptr; } // evaluate children @@ -763,11 +763,11 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point, theCtrl, flags, level + 1 ); - if ( res != NULL ) + if ( res != nullptr ) return res; } - return NULL; + return nullptr; } int wxGenericTreeItem::GetCurrentImage() const @@ -926,7 +926,7 @@ void wxGenericTreeCtrl::Init() m_current = m_key_current = m_anchor = - m_select_me = NULL; + m_select_me = nullptr; m_hasFocus = false; m_dirty = false; @@ -936,19 +936,19 @@ void wxGenericTreeCtrl::Init() m_dragCount = 0; m_isDragging = false; - m_dropTarget = m_oldSelection = NULL; - m_underMouse = NULL; - m_textCtrl = NULL; + m_dropTarget = m_oldSelection = nullptr; + m_underMouse = nullptr; + m_textCtrl = nullptr; - m_renameTimer = NULL; + m_renameTimer = nullptr; - m_findTimer = NULL; + m_findTimer = nullptr; m_findBell = 0; // default is to not ring bell at all m_dropEffectAboveItem = false; m_dndEffect = NoEffect; - m_dndEffectItem = NULL; + m_dndEffectItem = nullptr; m_lastOnSame = false; } @@ -1117,7 +1117,7 @@ int wxGenericTreeCtrl::GetItemImage(const wxTreeItemId& item, wxTreeItemData *wxGenericTreeCtrl::GetItemData(const wxTreeItemId& item) const { - wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") ); + wxCHECK_MSG( item.IsOk(), nullptr, wxT("invalid tree item") ); return ((wxGenericTreeItem*) item.m_pItem)->GetData(); } @@ -1382,7 +1382,7 @@ wxTreeItemId wxGenericTreeCtrl::GetFirstChild(const wxTreeItemId& item, { wxCHECK_MSG( item.IsOk(), wxTreeItemId(), wxT("invalid tree item") ); - cookie = 0; + cookie = nullptr; return GetNextChild(item, cookie); } @@ -1423,7 +1423,7 @@ wxTreeItemId wxGenericTreeCtrl::GetNextSibling(const wxTreeItemId& item) const wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; wxGenericTreeItem *parent = i->GetParent(); - if ( parent == NULL ) + if ( parent == nullptr ) { // root item doesn't have any siblings return wxTreeItemId(); @@ -1444,7 +1444,7 @@ wxTreeItemId wxGenericTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; wxGenericTreeItem *parent = i->GetParent(); - if ( parent == NULL ) + if ( parent == nullptr ) { // root item doesn't have any siblings return wxTreeItemId(); @@ -1557,7 +1557,7 @@ wxTreeItemId wxGenericTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const // called by wxTextTreeCtrl when it marks itself for deletion void wxGenericTreeCtrl::ResetTextControl() { - m_textCtrl = NULL; + m_textCtrl = nullptr; } void wxGenericTreeCtrl::ResetFindState() @@ -1643,7 +1643,7 @@ wxTreeItemId wxGenericTreeCtrl::DoInsertItem(const wxTreeItemId& parentId, wxGenericTreeItem *item = new wxGenericTreeItem( parent, text, image, selImage, data ); - if ( data != NULL ) + if ( data != nullptr ) { data->m_pItem = item; } @@ -1664,9 +1664,9 @@ wxTreeItemId wxGenericTreeCtrl::AddRoot(const wxString& text, m_dirty = true; // do this first so stuff below doesn't cause flicker - m_anchor = new wxGenericTreeItem(NULL, text, + m_anchor = new wxGenericTreeItem(nullptr, text, image, selImage, data); - if ( data != NULL ) + if ( data != nullptr ) { data->m_pItem = m_anchor; } @@ -1734,7 +1734,7 @@ void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item) if ( item != m_key_current && IsDescendantOf(item, m_key_current) ) { - m_key_current = NULL; + m_key_current = nullptr; } if ( IsDescendantOf(item, m_select_me) ) @@ -1748,7 +1748,7 @@ void wxGenericTreeCtrl::ChildrenClosing(wxGenericTreeItem* item) // items selected if we can have many of them. if ( !HasFlag(wxTR_MULTIPLE) ) m_current->SetHilight( false ); - m_current = NULL; + m_current = nullptr; m_select_me = item; } } @@ -1769,7 +1769,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; - if (m_textCtrl != NULL && IsDescendantOf(item, m_textCtrl->item())) + if (m_textCtrl != nullptr && IsDescendantOf(item, m_textCtrl->item())) { // can't delete the item being edited, cancel editing it first m_textCtrl->EndEdit( true ); @@ -1795,7 +1795,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) // handlers get called. // m_key_current = parent; - m_key_current = NULL; + m_key_current = nullptr; } // m_select_me records whether we need to select @@ -1812,7 +1812,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) // handlers get called. // m_current = parent; - m_current = NULL; + m_current = nullptr; m_select_me = to_be_selected; } @@ -1824,7 +1824,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) else // deleting the root { // nothing will be left in the tree - m_anchor = NULL; + m_anchor = nullptr; } // and delete all of its children and the item itself now @@ -1832,7 +1832,7 @@ void wxGenericTreeCtrl::Delete(const wxTreeItemId& itemId) SendDeleteEvent(item); if (item == m_select_me) - m_select_me = NULL; + m_select_me = nullptr; delete item; @@ -1953,8 +1953,8 @@ void wxGenericTreeCtrl::Unselect() m_current->SetHilight( false ); RefreshLine( m_current ); - m_current = NULL; - m_select_me = NULL; + m_current = nullptr; + m_select_me = nullptr; } } @@ -1964,7 +1964,7 @@ void wxGenericTreeCtrl::ClearFocusedItem() if ( item.IsOk() ) SelectItem(item, false); - m_current = NULL; + m_current = nullptr; } void wxGenericTreeCtrl::SetFocusedItem(const wxTreeItemId& item) @@ -2053,7 +2053,7 @@ wxGenericTreeCtrl::TagNextChildren(wxGenericTreeItem *crt_item, { wxGenericTreeItem *parent = crt_item->GetParent(); - if (parent == NULL) // This is root item + if (parent == nullptr) // This is root item return TagAllChildrenUntilLast(crt_item, last_item, select); wxArrayGenericTreeItems& children = parent->GetChildren(); @@ -2100,7 +2100,7 @@ void wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2) { - m_select_me = NULL; + m_select_me = nullptr; // item2 is not necessary after item1 // choice first' and 'last' between item1 and item2 @@ -2121,7 +2121,7 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId, { wxCHECK_RET( itemId.IsOk(), wxT("invalid tree item") ); - m_select_me = NULL; + m_select_me = nullptr; bool is_single=!(GetWindowStyleFlag() & wxTR_MULTIPLE); wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem; @@ -2339,7 +2339,7 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item) } // FIXME: tree sorting functions are not reentrant and not MT-safe! -static wxGenericTreeCtrl *s_treeBeingSorted = NULL; +static wxGenericTreeCtrl *s_treeBeingSorted = nullptr; static int LINKAGEMODE tree_ctrl_compare_func(wxGenericTreeItem **item1, wxGenericTreeItem **item2) @@ -2366,7 +2366,7 @@ void wxGenericTreeCtrl::SortChildren(const wxTreeItemId& itemId) s_treeBeingSorted = this; children.Sort(tree_ctrl_compare_func); - s_treeBeingSorted = NULL; + s_treeBeingSorted = nullptr; } //else: don't make the tree dirty as nothing changed } @@ -2442,7 +2442,7 @@ void wxGenericTreeCtrl::UpdateAfterImageListChange() if (m_anchor) m_anchor->RecursiveResetSize(); - // Don't do any drawing if we're setting the list to NULL, + // Don't do any drawing if we're setting the list to nullptr, // since we may be in the process of deleting the tree control. if (GetImageList()) CalculateLineHeight(); @@ -2951,7 +2951,7 @@ void wxGenericTreeCtrl::DrawBorder(const wxTreeItemId &item) else { m_dndEffect = NoEffect; - m_dndEffectItem = NULL; + m_dndEffectItem = nullptr; } wxRect rect( i->GetX()-1, i->GetY()-1, i->GetWidth()+2, GetLineHeight(i)+2 ); @@ -2976,7 +2976,7 @@ void wxGenericTreeCtrl::DrawLine(const wxTreeItemId &item, bool below) else { m_dndEffect = NoEffect; - m_dndEffectItem = NULL; + m_dndEffectItem = nullptr; } wxRect rect( i->GetX()-1, i->GetY()-1, i->GetWidth()+2, GetLineHeight(i)+2 ); @@ -3008,7 +3008,7 @@ void wxGenericTreeCtrl::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetPen( m_dottedPen ); // this is now done dynamically - //if(GetImageList() == NULL) + //if(GetImageList() == nullptr) // m_lineHeight = (int)(dc.GetCharHeight() + 4); int y = 2; @@ -3046,7 +3046,7 @@ void wxGenericTreeCtrl::OnKeyDown( wxKeyEvent &event ) void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) { - if ( (m_current == 0) || (m_key_current == 0) ) + if ( (m_current == nullptr) || (m_key_current == nullptr) ) { event.Skip(); return; @@ -3414,7 +3414,7 @@ wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const if (point.y>h) flags |= wxTREE_HITTEST_BELOW; if (flags) return wxTreeItemId(); - if (m_anchor == NULL) + if (m_anchor == nullptr) { flags = wxTREE_HITTEST_NOWHERE; return wxTreeItemId(); @@ -3422,7 +3422,7 @@ wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const wxGenericTreeItem *hit = m_anchor->HitTest(CalcUnscrolledPosition(point), this, flags, 0); - if (hit == NULL) + if (hit == nullptr) { flags = wxTREE_HITTEST_NOWHERE; return wxTreeItemId(); @@ -3485,7 +3485,7 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, wxClassInfo * WXUNUSED(textCtrlClass)) { - wxCHECK_MSG( item.IsOk(), NULL, wxT("can't edit an invalid item") ); + wxCHECK_MSG( item.IsOk(), nullptr, wxT("can't edit an invalid item") ); wxGenericTreeItem *itemEdit = (wxGenericTreeItem *)item.m_pItem; @@ -3493,7 +3493,7 @@ wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, if ( GetEventHandler()->ProcessEvent( te ) && !te.IsAllowed() ) { // vetoed by user - return NULL; + return nullptr; } // We have to call this here because the label in @@ -3511,7 +3511,7 @@ wxTextCtrl *wxGenericTreeCtrl::EditLabel(const wxTreeItemId& item, } // returns a pointer to the text edit control if the item is being -// edited, NULL otherwise (it's assumed that no more than one item may +// edited, nullptr otherwise (it's assumed that no more than one item may // be edited simultaneously) wxTextCtrl* wxGenericTreeCtrl::GetEditControl() const { @@ -3574,7 +3574,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) } else { - underMouse = NULL; + underMouse = nullptr; } if (underMouse != m_underMouse) @@ -3583,7 +3583,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { // unhighlight old item wxGenericTreeItem *tmp = m_underMouse; - m_underMouse = NULL; + m_underMouse = nullptr; RefreshLine( tmp ); } @@ -3611,7 +3611,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) // on the neighbouring view ... #ifdef __WXOSX__ if ( event.Leaving() ) - SetToolTip(NULL); + SetToolTip(nullptr); else #endif if ( GetEventHandler()->ProcessEvent(hevent) ) @@ -3621,7 +3621,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) if ( hevent.IsAllowed() ) SetToolTip(hevent.m_label); else - SetToolTip(NULL); + SetToolTip(nullptr); } } #endif @@ -3726,7 +3726,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) { m_oldSelection->SetHilight(true); RefreshLine(m_oldSelection); - m_oldSelection = NULL; + m_oldSelection = nullptr; } // generate the drag end event @@ -3737,7 +3737,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) (void)GetEventHandler()->ProcessEvent(eventEndDrag); m_isDragging = false; - m_dropTarget = NULL; + m_dropTarget = nullptr; SetCursor(m_oldCursor); @@ -3767,7 +3767,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_dragCount = 0; - if ( item == NULL ) + if ( item == nullptr ) { event.Skip(); return; @@ -3997,7 +3997,7 @@ void wxGenericTreeCtrl::CalculatePositions() dc.SetFont( m_normalFont ); dc.SetPen( m_dottedPen ); - //if(GetImageList() == NULL) + //if(GetImageList() == nullptr) // m_lineHeight = (int)(dc.GetCharHeight() + 4); int y = 2; @@ -4018,7 +4018,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) wxSize client = GetClientSize(); wxRect rect; - CalcScrolledPosition(0, item->GetY(), NULL, &rect.y); + CalcScrolledPosition(0, item->GetY(), nullptr, &rect.y); rect.width = client.x; rect.height = client.y; @@ -4033,7 +4033,7 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) return; wxRect rect; - CalcScrolledPosition(0, item->GetY(), NULL, &rect.y); + CalcScrolledPosition(0, item->GetY(), nullptr, &rect.y); rect.width = GetClientSize().x; rect.height = GetLineHeight(item); //dc.GetCharHeight() + 6; diff --git a/src/generic/treelist.cpp b/src/generic/treelist.cpp index e167ee7b8e..2d885ccad5 100644 --- a/src/generic/treelist.cpp +++ b/src/generic/treelist.cpp @@ -52,12 +52,12 @@ public: const wxString& text = wxString(), int imageClosed = wxWithImages::NO_IMAGE, int imageOpened = wxWithImages::NO_IMAGE, - wxClientData* data = NULL) + wxClientData* data = nullptr) : m_text(text), m_parent(parent) { m_child = - m_next = NULL; + m_next = nullptr; m_imageClosed = imageClosed; m_imageOpened = imageOpened; @@ -66,7 +66,7 @@ public: m_data = data; - m_columnsTexts = NULL; + m_columnsTexts = nullptr; } // Destroying the node also (recursively) destroys its children. @@ -115,7 +115,7 @@ public: // the text for the first column is always stored in m_text and so we don't // store it in m_columnsTexts. - bool HasColumnsTexts() const { return m_columnsTexts != NULL; } + bool HasColumnsTexts() const { return m_columnsTexts != nullptr; } const wxString& GetColumnText(unsigned col) const { return m_columnsTexts[col - 1]; @@ -190,7 +190,7 @@ public: if ( m_columnsTexts ) { delete [] m_columnsTexts; - m_columnsTexts = NULL; + m_columnsTexts = nullptr; } } @@ -236,9 +236,9 @@ public: } - // Functions for tree traversal. All of them can return NULL. + // Functions for tree traversal. All of them can return nullptr. - // Only returns NULL when called on the root item. + // Only returns nullptr when called on the root item. wxTreeListModelNode* GetParent() const { return m_parent; } // Returns the first child of this item. @@ -265,22 +265,22 @@ public: return node->m_next; } - return NULL; + return nullptr; } private: // The (never changing after creation) parent of this node and the possibly - // NULL pointers to its first child and next sibling. + // null pointers to its first child and next sibling. wxTreeListModelNode* const m_parent; wxTreeListModelNode* m_child; wxTreeListModelNode* m_next; - // Client data pointer owned by the control. May be NULL. + // Client data pointer owned by the control. May be null. wxClientData* m_data; // Array of column values for all the columns except the first one. May be - // NULL if no values had been set for them. + // nullptr if no values had been set for them. wxString* m_columnsTexts; }; @@ -329,7 +329,7 @@ public: wxDataViewItem ToDVI(Node* node) const { - // Our root item must be represented as NULL at wxDVC level to map to + // Our root item must be represented as nullptr at wxDVC level to map to // its own invisible root. if ( !node->GetParent() ) return wxDataViewItem(); @@ -407,7 +407,7 @@ private: wxTreeListModel::wxTreeListModel(wxTreeListCtrl* treelist) : m_treelist(treelist), - m_root(new Node(NULL)) + m_root(new Node(nullptr)) { m_numColumns = 0; m_isFlat = true; @@ -467,10 +467,10 @@ wxTreeListModel::InsertItem(Node* parent, int imageOpened, wxClientData* data) { - wxCHECK_MSG( parent, NULL, + wxCHECK_MSG( parent, nullptr, "Must have a valid parent (maybe GetRootItem()?)" ); - wxCHECK_MSG( previous, NULL, + wxCHECK_MSG( previous, nullptr, "Must have a valid previous item (maybe wxTLI_FIRST/LAST?)" ); if ( m_isFlat && parent != m_root ) @@ -515,7 +515,7 @@ wxTreeListModel::InsertItem(Node* parent, else // We already have the previous item. { // Just check it's under the correct parent. - wxCHECK_MSG( previous->GetParent() == parent, NULL, + wxCHECK_MSG( previous->GetParent() == parent, nullptr, "Previous item is not under the right parent" ); } @@ -613,7 +613,7 @@ void wxTreeListModel::SetItemImage(Node* item, int closed, int opened) wxClientData* wxTreeListModel::GetItemData(Node* item) const { - wxCHECK_MSG( item, NULL, "Invalid item" ); + wxCHECK_MSG( item, nullptr, "Invalid item" ); return item->GetClientData(); } @@ -718,7 +718,7 @@ bool wxTreeListModel::IsContainer(const wxDataViewItem& item) const #else Node* const node = FromDVI(item); - return node->GetChild() != NULL; + return node->GetChild() != nullptr; #endif } @@ -802,9 +802,9 @@ wxEND_EVENT_TABLE() void wxTreeListCtrl::Init() { - m_view = NULL; - m_model = NULL; - m_comparator = NULL; + m_view = nullptr; + m_model = nullptr; + m_comparator = nullptr; } bool wxTreeListCtrl::Create(wxWindow* parent, @@ -839,7 +839,7 @@ bool wxTreeListCtrl::Create(wxWindow* parent, styleDataView) ) { delete m_view; - m_view = NULL; + m_view = nullptr; return false; } @@ -1115,7 +1115,7 @@ void wxTreeListCtrl::SetItemImage(wxTreeListItem item, int closed, int opened) wxClientData* wxTreeListCtrl::GetItemData(wxTreeListItem item) const { - wxCHECK_MSG( m_model, NULL, "Must create first" ); + wxCHECK_MSG( m_model, nullptr, "Must create first" ); return m_model->GetItemData(item); } diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index 860203fc85..bd31cb9c69 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -66,7 +66,7 @@ void wxVListBox::Init() { m_current = m_anchor = wxNOT_FOUND; - m_selStore = NULL; + m_selStore = nullptr; } bool wxVListBox::Create(wxWindow *parent, diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index f6ce056c55..66db08c8eb 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -192,7 +192,7 @@ wxVarScrollHelperBase::wxVarScrollHelperBase(wxWindow *win) m_unitFirst = 0; m_physicalScrolling = true; - m_handler = NULL; + m_handler = nullptr; // by default, the associated window is also the target window DoSetTargetWindow(win); @@ -427,7 +427,7 @@ void wxVarScrollHelperBase::DeleteEvtHandler() //else: something is very wrong, so better [maybe] leak memory than // risk a crash because of double deletion - m_handler = NULL; + m_handler = nullptr; } } @@ -457,7 +457,7 @@ void wxVarScrollHelperBase::DoSetTargetWindow(wxWindow *target) void wxVarScrollHelperBase::SetTargetWindow(wxWindow *target) { - wxCHECK_RET( target, wxT("target window must not be NULL") ); + wxCHECK_RET( target, wxT("target window must not be null") ); if ( target == m_targetWindow ) return; diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index bf87101979..bb0978936b 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -267,12 +267,12 @@ wxSize wxWizardSizer::SiblingSize(wxSizerItem *child) void wxWizard::Init() { m_posWizard = wxDefaultPosition; - m_page = NULL; - m_firstpage = NULL; - m_btnPrev = m_btnNext = NULL; - m_statbmp = NULL; - m_sizerBmpAndPage = NULL; - m_sizerPage = NULL; + m_page = nullptr; + m_firstpage = nullptr; + m_btnPrev = m_btnNext = nullptr; + m_statbmp = nullptr; + m_sizerBmpAndPage = nullptr; + m_sizerPage = nullptr; m_border = 5; m_started = false; m_wasModal = false; @@ -422,7 +422,7 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) // Desired TAB order is 'next', 'cancel', 'help', 'back'. This makes the 'back' button the last control on the page. // Create the buttons in the right order... - wxButton *btnHelp=0; + wxButton *btnHelp=nullptr; #ifdef __WXMAC__ if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON) btnHelp=new wxButton(this, wxID_HELP, wxEmptyString, wxDefaultPosition, wxDefaultSize, buttonStyle); @@ -609,7 +609,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, m_page); (void)GetEventHandler()->ProcessEvent(event); - m_page = NULL; + m_page = nullptr; return true; } @@ -855,7 +855,7 @@ void wxWizard::OnHelp(wxCommandEvent& WXUNUSED(event)) { // this function probably can never be called when we don't have an active // page, but a small extra check won't hurt - if(m_page != NULL) + if(m_page != nullptr) { // Create and send the help event to the specific page handler // event data contains the active page so that context-sensitive diff --git a/src/gtk/aboutdlg.cpp b/src/gtk/aboutdlg.cpp index 6bc9a010bc..03d56d7d80 100644 --- a/src/gtk/aboutdlg.cpp +++ b/src/gtk/aboutdlg.cpp @@ -39,7 +39,7 @@ class GtkArray { public: // Create empty GtkArray - GtkArray() : m_strings(0), m_count(0) + GtkArray() : m_strings(nullptr), m_count(0) { } @@ -67,8 +67,8 @@ public: #endif // wxUSE_UNICODE/!wxUSE_UNICODE } - // array must be NULL-terminated - m_strings[m_count] = NULL; + // array must be null-terminated + m_strings[m_count] = nullptr; } operator const gchar **() const { return m_strings; } @@ -97,14 +97,14 @@ private: // ============================================================================ // GTK+ about dialog is modeless, keep track of it in this variable -static GtkAboutDialog *gs_aboutDialog = NULL; +static GtkAboutDialog *gs_aboutDialog = nullptr; extern "C" { static void wxGtkAboutDialogOnClose(GtkAboutDialog *about) { gtk_widget_destroy(GTK_WIDGET(about)); if ( about == gs_aboutDialog ) - gs_aboutDialog = NULL; + gs_aboutDialog = nullptr; } } @@ -140,19 +140,19 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) if ( info.HasVersion() ) gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion())); else - gtk_about_dialog_set_version(dlg, NULL); + gtk_about_dialog_set_version(dlg, nullptr); if ( info.HasCopyright() ) gtk_about_dialog_set_copyright(dlg, wxGTK_CONV_SYS(info.GetCopyrightToDisplay())); else - gtk_about_dialog_set_copyright(dlg, NULL); + gtk_about_dialog_set_copyright(dlg, nullptr); if ( info.HasDescription() ) gtk_about_dialog_set_comments(dlg, wxGTK_CONV_SYS(info.GetDescription())); else - gtk_about_dialog_set_comments(dlg, NULL); + gtk_about_dialog_set_comments(dlg, nullptr); if ( info.HasLicence() ) gtk_about_dialog_set_license(dlg, wxGTK_CONV_SYS(info.GetLicence())); else - gtk_about_dialog_set_license(dlg, NULL); + gtk_about_dialog_set_license(dlg, nullptr); wxIcon icon = info.GetIcon(); if ( icon.IsOk() ) @@ -166,7 +166,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) // NB: must be called before gtk_about_dialog_set_website() as // otherwise it has no effect (although GTK+ docs don't mention // this...) - gtk_about_dialog_set_url_hook(wxGtkAboutDialogOnLink, NULL, NULL); + gtk_about_dialog_set_url_hook(wxGtkAboutDialogOnLink, nullptr, nullptr); #endif gtk_about_dialog_set_website(dlg, wxGTK_CONV_SYS(info.GetWebSiteURL())); @@ -178,12 +178,12 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) } else { - gtk_about_dialog_set_website(dlg, NULL); - gtk_about_dialog_set_website_label(dlg, NULL); + gtk_about_dialog_set_website(dlg, nullptr); + gtk_about_dialog_set_website_label(dlg, nullptr); #ifdef __WXGTK3__ - g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), NULL); + g_signal_connect(dlg, "activate-link", G_CALLBACK(activate_link), nullptr); #else - gtk_about_dialog_set_url_hook(NULL, NULL, NULL); + gtk_about_dialog_set_url_hook(nullptr, nullptr, nullptr); #endif } @@ -228,12 +228,12 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) if ( !transCredits.empty() ) gtk_about_dialog_set_translator_credits(dlg, wxGTK_CONV_SYS(transCredits)); else - gtk_about_dialog_set_translator_credits(dlg, NULL); + gtk_about_dialog_set_translator_credits(dlg, nullptr); g_signal_connect(dlg, "response", - G_CALLBACK(wxGtkAboutDialogOnClose), NULL); + G_CALLBACK(wxGtkAboutDialogOnClose), nullptr); - GtkWindow* gtkParent = NULL; + GtkWindow* gtkParent = nullptr; 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); diff --git a/src/gtk/activityindicator.cpp b/src/gtk/activityindicator.cpp index 15d5469164..eae98d9e1f 100644 --- a/src/gtk/activityindicator.cpp +++ b/src/gtk/activityindicator.cpp @@ -95,7 +95,7 @@ bool wxActivityIndicator::IsRunning() const return false; gboolean b; - g_object_get(m_widget, "active", &b, NULL); + g_object_get(m_widget, "active", &b, nullptr); return b != 0; } @@ -116,7 +116,7 @@ wxSize wxActivityIndicator::DoGetBestClientSize() const 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. + // 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); diff --git a/src/gtk/animate.cpp b/src/gtk/animate.cpp index bb52a72a54..df118eca40 100644 --- a/src/gtk/animate.cpp +++ b/src/gtk/animate.cpp @@ -40,7 +40,7 @@ void gdk_pixbuf_area_updated(GdkPixbufLoader *loader, gint WXUNUSED(height), wxAnimationGTKImpl *anim) { - if (anim && anim->GetPixbuf() == NULL) + if (anim && anim->GetPixbuf() == nullptr) { // we need to set the pixbuf only if this is the first time this signal // has been called! @@ -71,7 +71,7 @@ bool wxAnimationGTKImpl::IsCompatibleWith(wxClassInfo* ci) const bool wxAnimationGTKImpl::LoadFile(const wxString &name, wxAnimationType WXUNUSED(type)) { UnRef(); - m_pixbuf = gdk_pixbuf_animation_new_from_file(wxGTK_CONV_FN(name), NULL); + m_pixbuf = gdk_pixbuf_animation_new_from_file(wxGTK_CONV_FN(name), nullptr); return IsOk(); } @@ -96,7 +96,7 @@ bool wxAnimationGTKImpl::Load(wxInputStream &stream, wxAnimationType type) } // create a GdkPixbufLoader - GError *error = NULL; + GError *error = nullptr; GdkPixbufLoader *loader; if (type != wxANIMATION_TYPE_INVALID && type != wxANIMATION_TYPE_ANY) loader = gdk_pixbuf_loader_new_with_type(anim_type, &error); @@ -106,7 +106,7 @@ bool wxAnimationGTKImpl::Load(wxInputStream &stream, wxAnimationType type) wxGtkObject ensureUnrefLoader(loader); if (!loader || - error != NULL) // even if the loader was allocated, an error could have happened + error != nullptr) // even if the loader was allocated, an error could have happened { wxLogDebug(wxT("Could not create the loader for '%s' animation type: %s"), anim_type, error->message); @@ -124,8 +124,8 @@ bool wxAnimationGTKImpl::Load(wxInputStream &stream, wxAnimationType type) if (!stream.Read(buf, sizeof(buf)) && stream.GetLastError() != wxSTREAM_EOF) // EOF is OK for now { - // gdk_pixbuf_loader_close wants the GError == NULL - gdk_pixbuf_loader_close(loader, NULL); + // gdk_pixbuf_loader_close wants the GError == nullptr + gdk_pixbuf_loader_close(loader, nullptr); return false; } @@ -134,8 +134,8 @@ bool wxAnimationGTKImpl::Load(wxInputStream &stream, wxAnimationType type) { wxLogDebug(wxT("Could not write to the loader: %s"), error->message); - // gdk_pixbuf_loader_close wants the GError == NULL - gdk_pixbuf_loader_close(loader, NULL); + // gdk_pixbuf_loader_close wants the GError == nullptr + gdk_pixbuf_loader_close(loader, nullptr); return false; } @@ -145,7 +145,7 @@ bool wxAnimationGTKImpl::Load(wxInputStream &stream, wxAnimationType type) if (!data_written) { wxLogDebug("Could not read data from the stream..."); - gdk_pixbuf_loader_close(loader, NULL); + gdk_pixbuf_loader_close(loader, nullptr); return false; } @@ -177,7 +177,7 @@ void wxAnimationGTKImpl::UnRef() { if (m_pixbuf) g_object_unref(m_pixbuf); - m_pixbuf = NULL; + m_pixbuf = nullptr; } void wxAnimationGTKImpl::SetPixbuf(GdkPixbufAnimation* p) @@ -200,8 +200,8 @@ wxEND_EVENT_TABLE() void wxAnimationCtrl::Init() { - m_anim = NULL; - m_iter = NULL; + m_anim = nullptr; + m_iter = nullptr; m_bPlaying = false; } @@ -286,7 +286,7 @@ void wxAnimationCtrl::SetAnimation(const wxAnimation &anim) m_animation = anim; if (!m_animation.IsOk()) { - m_anim = NULL; + m_anim = nullptr; DisplayStaticImage(); return; } @@ -326,24 +326,24 @@ void wxAnimationCtrl::ResetAnim() { if (m_anim) g_object_unref(m_anim); - m_anim = NULL; + m_anim = nullptr; } void wxAnimationCtrl::ResetIter() { if (m_iter) g_object_unref(m_iter); - m_iter = NULL; + m_iter = nullptr; } bool wxAnimationCtrl::Play() { - if (m_anim == NULL) + if (m_anim == nullptr) return false; // init the iterator and start a one-shot timer ResetIter(); - m_iter = gdk_pixbuf_animation_get_iter (m_anim, NULL); + m_iter = gdk_pixbuf_animation_get_iter (m_anim, nullptr); m_bPlaying = true; // gdk_pixbuf_animation_iter_get_delay_time() may return -1 which means @@ -455,11 +455,11 @@ bool wxAnimationCtrl::SetBackgroundColour( const wxColour &colour ) void wxAnimationCtrl::OnTimer(wxTimerEvent& WXUNUSED(ev)) { - wxASSERT(m_iter != NULL); + wxASSERT(m_iter != nullptr); // gdk_pixbuf_animation_iter_advance() will automatically restart // the animation, if necessary and we have no way to know !! - if (gdk_pixbuf_animation_iter_advance(m_iter, NULL)) + if (gdk_pixbuf_animation_iter_advance(m_iter, nullptr)) { // start a new one-shot timer int n = gdk_pixbuf_animation_iter_get_delay_time(m_iter); @@ -482,7 +482,7 @@ void wxAnimationCtrl::OnTimer(wxTimerEvent& WXUNUSED(ev)) GdkPixbufAnimation* wxAnimationCtrl::AnimationImplGetPixbuf() const { - wxCHECK_MSG( m_animation.IsOk(), NULL, wxT("invalid animation") ); + wxCHECK_MSG( m_animation.IsOk(), nullptr, wxT("invalid animation") ); return ANIMATION->GetPixbuf(); } diff --git a/src/gtk/anybutton.cpp b/src/gtk/anybutton.cpp index 69943f0311..990e32390d 100644 --- a/src/gtk/anybutton.cpp +++ b/src/gtk/anybutton.cpp @@ -187,7 +187,7 @@ void wxAnyButton::GTKDoShowBitmap(const wxBitmapBundle& bitmap) wxCHECK_RET(bitmap.IsOk(), "invalid bitmap"); GtkWidget* image = gtk_button_get_image(GTK_BUTTON(m_widget)); - if (image == NULL) + if (image == nullptr) image = gtk_bin_get_child(GTK_BIN(m_widget)); wxCHECK_RET(WX_GTK_IS_IMAGE(image), "must have image widget"); @@ -222,7 +222,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmapBundle& bitmap, State which) // This must be the GtkImage created for stock buttons, we // want to replace it with our own wxGtkImage as only it // handles showing appropriately-sized bitmaps in high DPI. - image = NULL; + image = nullptr; } if ( image && !bitmap.IsOk() ) @@ -378,7 +378,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmapBundle& bitmap, State which) #if GTK_CHECK_VERSION(3,6,0) && !defined(__WXGTK4__) // Allow explicitly set bitmaps to be shown regardless of theme setting - if (gtk_check_version(3,6,0) == NULL && bitmap.IsOk()) + if (gtk_check_version(3,6,0) == nullptr && bitmap.IsOk()) gtk_button_set_always_show_image(GTK_BUTTON(m_widget), true); #endif diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index f7ceec7c86..550cf35242 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -49,7 +49,7 @@ static gboolean wx_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer data) { wxApp* app = wxTheApp; - if (app != NULL) + if (app != nullptr) app->WakeUpIdle(); bool* hook_installed = (bool*)data; // record that hook is not installed @@ -72,7 +72,7 @@ static void wx_add_idle_hooks() sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET); hook_installed = true; g_signal_add_emission_hook( - sig_id, 0, wx_emission_hook, &hook_installed, NULL); + sig_id, 0, wx_emission_hook, &hook_installed, nullptr); } } // "size_allocate" hook @@ -87,7 +87,7 @@ static void wx_add_idle_hooks() sig_id = g_signal_lookup("size_allocate", GTK_TYPE_WIDGET); hook_installed = true; g_signal_add_emission_hook( - sig_id, 0, wx_emission_hook, &hook_installed, NULL); + sig_id, 0, wx_emission_hook, &hook_installed, nullptr); } } } @@ -139,7 +139,7 @@ bool wxApp::DoIdle() gdk_threads_enter(); if (gs_focusChange) { - SetActive(gs_focusChange == 1, NULL); + SetActive(gs_focusChange == 1, nullptr); gs_focusChange = 0; } @@ -183,7 +183,7 @@ namespace wxGTKImpl bool LogFilter::ms_allowed = false; bool LogFilter::ms_installed = false; -LogFilter* LogFilter::ms_first = NULL; +LogFilter* LogFilter::ms_first = nullptr; /* static */ GLogWriterOutput @@ -198,7 +198,7 @@ LogFilter::wx_log_writer(GLogLevelFlags log_level, return G_LOG_WRITER_HANDLED; } - return g_log_writer_default(log_level, fields, n_fields, NULL); + return g_log_writer_default(log_level, fields, n_fields, nullptr); } bool LogFilter::Install() @@ -208,13 +208,13 @@ bool LogFilter::Install() if ( !ms_installed ) { - if ( glib_check_version(2, 50, 0) != 0 ) + if ( glib_check_version(2, 50, 0) != nullptr ) { // No runtime support for log callback, we can't do anything. return false; } - g_log_set_writer_func(LogFilter::wx_log_writer, NULL, NULL); + g_log_set_writer_func(LogFilter::wx_log_writer, nullptr, nullptr); ms_installed = true; } @@ -407,7 +407,7 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) // 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). - g_thread_init(NULL); + g_thread_init(nullptr); gdk_threads_init(); } #endif // wxUSE_THREADS @@ -484,7 +484,7 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv_[i])); } - argvGTK[argc_] = NULL; + argvGTK[argc_] = nullptr; int argcGTK = argc_; @@ -519,7 +519,7 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) } argc_ = argcGTK; - argv_[argc_] = NULL; + argv_[argc_] = nullptr; } //else: gtk_init() didn't modify our parameters @@ -568,10 +568,10 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) // 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); + 0, wx_focus_event_hook, GINT_TO_POINTER(1), nullptr); g_signal_add_emission_hook( g_signal_lookup("focus_out_event", widgetType), - 0, wx_focus_event_hook, GINT_TO_POINTER(2), NULL); + 0, wx_focus_event_hook, GINT_TO_POINTER(2), nullptr); WakeUpIdle(); @@ -585,7 +585,7 @@ void wxApp::CleanUp() // release reference acquired by Initialize() gpointer gt = g_type_class_peek(GTK_TYPE_WIDGET); - if (gt != NULL) + if (gt != nullptr) g_type_class_unref(gt); gdk_threads_leave(); @@ -599,7 +599,7 @@ void wxApp::WakeUpIdle() wxMutexLocker lock(m_idleMutex); #endif if (m_idleSourceId == 0) - m_idleSourceId = g_idle_add_full(G_PRIORITY_LOW, wxapp_idle_callback, NULL, NULL); + m_idleSourceId = g_idle_add_full(G_PRIORITY_LOW, wxapp_idle_callback, nullptr, nullptr); } // Checking for pending events requires first removing our idle source, diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp index 33fd4591b1..998952c5ec 100644 --- a/src/gtk/artgtk.cpp +++ b/src/gtk/artgtk.cpp @@ -221,7 +221,7 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size) wxGCC_WARNING_SUPPRESS(deprecated-declarations) GtkStyleContext* sc = gtk_widget_get_style_context(widget); GtkIconSet* iconset = gtk_style_context_lookup_icon_set(sc, stockid); - GdkPixbuf* pixbuf = NULL; + GdkPixbuf* pixbuf = nullptr; if (iconset) pixbuf = gtk_icon_set_render_icon_pixbuf(iconset, sc, size); return pixbuf; @@ -231,11 +231,11 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size) GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid); if (!iconset) - return NULL; + return nullptr; return gtk_icon_set_render_icon(iconset, style, gtk_widget_get_default_direction(), - GTK_STATE_NORMAL, size, NULL, NULL); + GTK_STATE_NORMAL, size, nullptr, nullptr); #endif } #endif // !__WXGTK4__ @@ -248,7 +248,7 @@ GdkPixbuf *CreateThemeIcon(const char *iconname, int size) iconname, size, (GtkIconLookupFlags)0, - NULL + nullptr ); } diff --git a/src/gtk/assertdlg_gtk.cpp b/src/gtk/assertdlg_gtk.cpp index 6992da3681..60220dc92a 100644 --- a/src/gtk/assertdlg_gtk.cpp +++ b/src/gtk/assertdlg_gtk.cpp @@ -71,7 +71,7 @@ GtkWidget *gtk_assert_dialog_add_button (GtkAssertDialog *dlg, const gchar *labe const gchar *stock, gint response_id) { /* create the button */ - GtkWidget* button = gtk_assert_dialog_add_button_to(NULL, label, stock); + GtkWidget* button = gtk_assert_dialog_add_button_to(nullptr, label, stock); /* add the button to the dialog's action area */ gtk_dialog_add_action_widget (GTK_DIALOG (dlg), button, response_id); @@ -90,7 +90,7 @@ void gtk_assert_dialog_append_text_column (GtkWidget *treeview, const gchar *nam renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (name, renderer, - "text", index, NULL); + "text", index, nullptr); gtk_tree_view_insert_column (GTK_TREE_VIEW (treeview), column, index); gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_reorderable (column, TRUE); @@ -141,7 +141,7 @@ void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg) (*dlg->callback)(dlg->userdata); /* toggle busy cursor */ - gdk_window_set_cursor (parent, NULL); + gdk_window_set_cursor (parent, nullptr); #ifdef __WXGTK3__ g_object_unref(cur); #else @@ -160,13 +160,13 @@ static void gtk_assert_dialog_expander_callback(GtkWidget*, GtkAssertDialog* dlg gboolean expanded = !gtk_expander_get_expanded (GTK_EXPANDER(dlg->expander)); gtk_window_set_resizable (GTK_WINDOW (dlg), expanded); - if (dlg->callback == NULL) /* was the backtrace already processed? */ + if (dlg->callback == nullptr) /* was the backtrace already processed? */ return; gtk_assert_dialog_process_backtrace (dlg); /* mark the work as done (so that next activate we won't call the callback again) */ - dlg->callback = NULL; + dlg->callback = nullptr; } static void gtk_assert_dialog_save_backtrace_callback(GtkWidget*, GtkAssertDialog* dlg) @@ -177,7 +177,7 @@ static void gtk_assert_dialog_save_backtrace_callback(GtkWidget*, GtkAssertDialo GTK_FILE_CHOOSER_ACTION_SAVE, static_cast(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)).utf8_str()), GTK_RESPONSE_CANCEL, static_cast(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_SAVE)).utf8_str()), GTK_RESPONSE_ACCEPT, - NULL); + nullptr); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { @@ -267,19 +267,19 @@ GType gtk_assert_dialog_get_type() const GTypeInfo assert_dialog_info = { sizeof (GtkAssertDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ + nullptr, /* base_init */ + nullptr, /* base_finalize */ #if GTK_CHECK_VERSION(3,10,0) gtk_assert_dialog_class_init, /* class init */ #else - NULL, + nullptr, #endif // GTK+ >= 3.10 / < 3.10 - NULL, /* class_finalize */ - NULL, /* class_data */ + nullptr, /* class_finalize */ + nullptr, /* class_data */ sizeof (GtkAssertDialog), 16, /* n_preallocs */ gtk_assert_dialog_init, - NULL + nullptr }; assert_dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "GtkAssertDialog", &assert_dialog_info, (GTypeFlags)0); } @@ -292,7 +292,7 @@ extern "C" { #if GTK_CHECK_VERSION(3,10,0) static void gtk_assert_dialog_class_init(gpointer g_class, void*) { - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) { // GtkBuilder XML to be bound to the dialog class data static const char dlgTempl[] = @@ -678,13 +678,13 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) // For GTK+ >= 3.10 create and initialize the dialog from the already assigned template // or create the dialog "manually" otherwise. #if GTK_CHECK_VERSION(3,10,0) - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) { GtkAssertDialog* dlg = GTK_ASSERT_DIALOG(instance); gtk_widget_init_template(GTK_WIDGET(dlg)); /* complete creation */ - dlg->callback = NULL; - dlg->userdata = NULL; + dlg->callback = nullptr; + dlg->userdata = nullptr; } else #endif // GTK+ >= 3.10 @@ -725,7 +725,7 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) gtk_box_pack_start (GTK_BOX(vbox2), info, TRUE, TRUE, 8); /* assert message */ - dlg->message = gtk_label_new (NULL); + dlg->message = gtk_label_new (nullptr); gtk_label_set_selectable (GTK_LABEL (dlg->message), TRUE); gtk_label_set_line_wrap (GTK_LABEL (dlg->message), TRUE); gtk_label_set_justify (GTK_LABEL (dlg->message), GTK_JUSTIFY_LEFT); @@ -751,7 +751,7 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) gtk_container_add (GTK_CONTAINER (dlg->expander), vbox); /* add a scrollable window under the expander */ - sw = gtk_scrolled_window_new (NULL, NULL); + sw = gtk_scrolled_window_new (nullptr, nullptr); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_ETCHED_IN); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -793,8 +793,8 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog_continue_callback), dlg); /* complete creation */ - dlg->callback = NULL; - dlg->userdata = NULL; + dlg->callback = nullptr; + dlg->userdata = nullptr; /* the resizable property of this window is modified by the expander: when it's collapsed, the window must be non-resizable! */ @@ -831,12 +831,12 @@ gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg) GtkTreeIter iter; GString *string; - g_return_val_if_fail (GTK_IS_ASSERT_DIALOG (dlg), NULL); + g_return_val_if_fail (GTK_IS_ASSERT_DIALOG (dlg), nullptr); model = gtk_tree_view_get_model (GTK_TREE_VIEW(dlg->treeview)); /* iterate over the list */ if (!gtk_tree_model_get_iter_first (model, &iter)) - return NULL; + return nullptr; string = g_string_new(""); do @@ -908,7 +908,7 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, model = gtk_tree_view_get_model (GTK_TREE_VIEW(dlg->treeview)); /* how many items are in the list up to now ? */ - count = gtk_tree_model_iter_n_children (model, NULL); + count = gtk_tree_model_iter_n_children (model, nullptr); linenum = g_string_new(""); if ( line_number != 0 ) @@ -930,7 +930,7 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, GtkWidget *gtk_assert_dialog_new(void) { - void* dialog = g_object_new(GTK_TYPE_ASSERT_DIALOG, NULL); + void* dialog = g_object_new(GTK_TYPE_ASSERT_DIALOG, nullptr); return GTK_WIDGET (dialog); } diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index e1969f73db..224f952ec3 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -30,7 +30,7 @@ GdkWindow* wxGetTopLevelGDK(); #ifndef __WXGTK3__ static void PixmapToPixbuf(GdkPixmap* pixmap, GdkPixbuf* pixbuf, int w, int h) { - gdk_pixbuf_get_from_drawable(pixbuf, pixmap, NULL, 0, 0, 0, 0, w, h); + gdk_pixbuf_get_from_drawable(pixbuf, pixmap, nullptr, 0, 0, 0, 0, w, h); if (gdk_drawable_get_depth(pixmap) == 1) { // invert to match XBM convention @@ -51,7 +51,7 @@ static void PixmapToPixbuf(GdkPixmap* pixmap, GdkPixbuf* pixbuf, int w, int h) static void MaskToAlpha(GdkPixmap* mask, GdkPixbuf* pixbuf, int w, int h) { GdkPixbuf* mask_pixbuf = gdk_pixbuf_get_from_drawable( - NULL, mask, NULL, 0, 0, 0, 0, w, h); + nullptr, mask, nullptr, 0, 0, 0, 0, w, h); guchar* p = gdk_pixbuf_get_pixels(pixbuf) + 3; const guchar* mask_data = gdk_pixbuf_get_pixels(mask_pixbuf); const int rowpad = gdk_pixbuf_get_rowstride(pixbuf) - w * 4; @@ -78,13 +78,13 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxMaskBase); wxMask::wxMask() { - m_bitmap = NULL; + m_bitmap = nullptr; } wxMask::wxMask(const wxMask& mask) { #ifdef __WXGTK3__ - m_bitmap = NULL; + m_bitmap = nullptr; if (mask.m_bitmap) { const int w = cairo_image_surface_get_width(mask.m_bitmap); @@ -100,7 +100,7 @@ wxMask::wxMask(const wxMask& mask) #else if ( !mask.m_bitmap ) { - m_bitmap = NULL; + m_bitmap = nullptr; return; } @@ -116,21 +116,21 @@ wxMask::wxMask(const wxMask& mask) wxMask::wxMask( const wxBitmap& bitmap, const wxColour& colour ) { - m_bitmap = NULL; + m_bitmap = nullptr; InitFromColour(bitmap, colour); } #if wxUSE_PALETTE wxMask::wxMask( const wxBitmap& bitmap, int paletteIndex ) { - m_bitmap = NULL; + m_bitmap = nullptr; Create( bitmap, paletteIndex ); } #endif // wxUSE_PALETTE wxMask::wxMask( const wxBitmap& bitmap ) { - m_bitmap = NULL; + m_bitmap = nullptr; InitFromMonoBitmap(bitmap); } @@ -164,7 +164,7 @@ void wxMask::FreeData() #else g_object_unref (m_bitmap); #endif - m_bitmap = NULL; + m_bitmap = nullptr; } } @@ -227,7 +227,7 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) GdkImage* image = gdk_drawable_get_image(bitmap.GetPixmap(), 0, 0, w, h); GdkColormap* colormap = gdk_image_get_colormap(image); guint32 mask_pixel; - if (colormap == NULL) + if (colormap == nullptr) // mono bitmap, white is pixel value 0 mask_pixel = guint32(colour.Red() != 255 || colour.Green() != 255 || colour.Blue() != 255); else @@ -360,15 +360,15 @@ public: wxBitmapRefData::wxBitmapRefData(int width, int height, int depth) { #ifdef __WXGTK3__ - m_pixbufNoMask = NULL; - m_surface = NULL; + m_pixbufNoMask = nullptr; + m_surface = nullptr; m_scaleFactor = 1; #else - m_pixmap = NULL; - m_pixbuf = NULL; + m_pixmap = nullptr; + m_pixbuf = nullptr; #endif - m_pixbufMask = NULL; - m_mask = NULL; + m_pixbufMask = nullptr; + m_mask = nullptr; m_width = width; m_height = height; m_bpp = depth; @@ -453,7 +453,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) wxBitmap::wxBitmap(const char* const* bits) { - wxCHECK2_MSG(bits != NULL, return, wxT("invalid bitmap data")); + wxCHECK2_MSG(bits != nullptr, return, wxT("invalid bitmap data")); #if wxUSE_IMAGE *this = wxBitmap(wxImage(bits)); @@ -468,9 +468,9 @@ wxBitmap::wxBitmap(const char* const* bits) wxASSERT(M_BMPDATA->m_bpp == 32 || !gdk_pixbuf_get_has_alpha(M_BMPDATA->m_pixbufNoMask)); } #else - GdkBitmap* mask = NULL; + GdkBitmap* mask = nullptr; GdkPixmap* pixmap = gdk_pixmap_create_from_xpm_d( - wxGetTopLevelGDK(), &mask, NULL, const_cast(bits)); + wxGetTopLevelGDK(), &mask, nullptr, const_cast(bits)); if (pixmap) { int width, height; @@ -691,7 +691,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth) } const wxByte* alpha = image.GetAlpha(); - if (alpha != NULL || image.HasMask()) + if (alpha != nullptr || image.HasMask()) { // create mask as XBM format bitmap @@ -699,7 +699,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth) wxByte* out = new wxByte[out_size]; memset(out, 0xff, out_size); unsigned bit_index = 0; - if (alpha != NULL) + if (alpha != nullptr) { for (int y = 0; y < h; y++) { @@ -803,7 +803,7 @@ wxImage wxBitmap::ConvertToImage() const const int h = bmpData->m_height; image.Create(w, h, false); guchar* dst = image.GetData(); - GdkPixbuf* pixbuf_src = NULL; + GdkPixbuf* pixbuf_src = nullptr; if (bmpData->m_pixbufNoMask) pixbuf_src = bmpData->m_pixbufNoMask; else if (bmpData->m_surface) @@ -831,7 +831,7 @@ wxImage wxBitmap::ConvertToImage() const } } } - cairo_surface_t* maskSurf = NULL; + cairo_surface_t* maskSurf = nullptr; if (bmpData->m_mask) maskSurf = *bmpData->m_mask; if (maskSurf) @@ -864,13 +864,13 @@ wxImage wxBitmap::ConvertToImage() const wxImage image(w, h, false); unsigned char *data = image.GetData(); - wxCHECK_MSG(data != NULL, wxNullImage, wxT("couldn't create image") ); + wxCHECK_MSG(data != nullptr, wxNullImage, wxT("couldn't create image") ); // prefer pixbuf if available, it will preserve alpha and should be quicker if (HasPixbuf()) { GdkPixbuf *pixbuf = GetPixbufNoMask(); - unsigned char* alpha = NULL; + unsigned char* alpha = nullptr; if (gdk_pixbuf_get_has_alpha(pixbuf)) { image.SetAlpha(); @@ -878,7 +878,7 @@ wxImage wxBitmap::ConvertToImage() const } const unsigned char* in = gdk_pixbuf_get_pixels(pixbuf); unsigned char *out = data; - const int inc = 3 + int(alpha != NULL); + const int inc = 3 + int(alpha != nullptr); const int rowpad = gdk_pixbuf_get_rowstride(pixbuf) - inc * w; for (int y = 0; y < h; y++, in += rowpad) @@ -888,7 +888,7 @@ wxImage wxBitmap::ConvertToImage() const out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; - if (alpha != NULL) + if (alpha != nullptr) *alpha++ = in[3]; } } @@ -896,7 +896,7 @@ wxImage wxBitmap::ConvertToImage() const else { GdkPixmap* pixmap = GetPixmap(); - GdkPixmap* pixmap_invert = NULL; + GdkPixmap* pixmap_invert = nullptr; if (GetDepth() == 1) { // mono bitmaps are inverted, i.e. 0 is white @@ -908,12 +908,12 @@ wxImage wxBitmap::ConvertToImage() const } // create a pixbuf which shares data with the wxImage GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data( - data, GDK_COLORSPACE_RGB, false, 8, w, h, 3 * w, NULL, NULL); + data, GDK_COLORSPACE_RGB, false, 8, w, h, 3 * w, nullptr, nullptr); - gdk_pixbuf_get_from_drawable(pixbuf, pixmap, NULL, 0, 0, 0, 0, w, h); + gdk_pixbuf_get_from_drawable(pixbuf, pixmap, nullptr, 0, 0, 0, 0, w, h); g_object_unref(pixbuf); - if (pixmap_invert != NULL) + if (pixmap_invert != nullptr) g_object_unref(pixmap_invert); } // convert mask, even there is already alpha. Image can have both. @@ -981,7 +981,7 @@ int wxBitmap::GetDepth() const wxMask *wxBitmap::GetMask() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BMPDATA->m_mask; } @@ -996,7 +996,7 @@ void wxBitmap::SetMask( wxMask *mask ) if (M_BMPDATA->m_pixbufMask) { g_object_unref(M_BMPDATA->m_pixbufMask); - M_BMPDATA->m_pixbufMask = NULL; + M_BMPDATA->m_pixbufMask = nullptr; } } @@ -1090,7 +1090,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect& r) const else if (bmpData->m_surface) newRef->m_surface = GetSubSurface(bmpData->m_surface, rect); - cairo_surface_t* maskSurf = NULL; + cairo_surface_t* maskSurf = nullptr; if (bmpData->m_mask) maskSurf = *bmpData->m_mask; if (maskSurf) @@ -1113,7 +1113,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect& r) const newRef->m_pixmap, gc, bmpData->m_pixmap, rect.x, rect.y, 0, 0, w, h); g_object_unref(gc); } - GdkPixmap* mask = NULL; + GdkPixmap* mask = nullptr; if (bmpData->m_mask) mask = *bmpData->m_mask; if (mask) @@ -1134,7 +1134,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett { wxCHECK_MSG( IsOk(), false, wxT("invalid bitmap") ); - const char* type_name = NULL; + const char* type_name = nullptr; switch (type) { case wxBITMAP_TYPE_ANI: type_name = "ani"; break; @@ -1152,7 +1152,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett default: break; } if (type_name && - gdk_pixbuf_save(GetPixbuf(), wxGTK_CONV_FN(name), type_name, NULL, NULL)) + gdk_pixbuf_save(GetPixbuf(), wxGTK_CONV_FN(name), type_name, nullptr, nullptr)) { return true; } @@ -1165,7 +1165,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, const wxPalett bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) { - GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(wxGTK_CONV_FN(name), NULL); + GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(wxGTK_CONV_FN(name), nullptr); if (pixbuf) { *this = wxBitmap(pixbuf); @@ -1187,7 +1187,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) #if wxUSE_PALETTE wxPalette *wxBitmap::GetPalette() const { - return NULL; + return nullptr; } void wxBitmap::SetPalette(const wxPalette& WXUNUSED(palette)) @@ -1234,7 +1234,7 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap ) GdkPixmap *wxBitmap::GetPixmap() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); wxBitmapRefData* bmpData = M_BMPDATA; if (bmpData->m_pixmap) @@ -1242,8 +1242,8 @@ GdkPixmap *wxBitmap::GetPixmap() const if (bmpData->m_pixbuf) { - GdkPixmap* pixmap = NULL; - GdkPixmap** mask_pixmap = NULL; + GdkPixmap* pixmap = nullptr; + GdkPixmap** mask_pixmap = nullptr; if (gdk_pixbuf_get_has_alpha(bmpData->m_pixbuf)) { // make new mask from alpha @@ -1269,14 +1269,14 @@ bool wxBitmap::HasPixmap() const { wxCHECK_MSG( IsOk(), false, wxT("invalid bitmap") ); - return M_BMPDATA->m_pixmap != NULL; + return M_BMPDATA->m_pixmap != nullptr; } #endif #ifdef __WXGTK3__ GdkPixbuf* wxBitmap::GetPixbufNoMask() const { - wxCHECK_MSG(IsOk(), NULL, "invalid bitmap"); + wxCHECK_MSG(IsOk(), nullptr, "invalid bitmap"); wxBitmapRefData* bmpData = M_BMPDATA; GdkPixbuf* pixbuf = bmpData->m_pixbufNoMask; @@ -1350,7 +1350,7 @@ void wxBitmap::SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg, c // Silently ignore attempts to draw uninitialized bitmap, // because other platforms don't complain about it - if (bmpData->m_pixbufNoMask == NULL) + if (bmpData->m_pixbufNoMask == nullptr) return; if (bmpData->m_bpp == 1) @@ -1365,7 +1365,7 @@ void wxBitmap::SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg, c cairo_t* wxBitmap::CairoCreate() const { - wxCHECK_MSG(IsOk(), NULL, "invalid bitmap"); + wxCHECK_MSG(IsOk(), nullptr, "invalid bitmap"); wxBitmapRefData* bmpData = M_BMPDATA; cairo_t* cr; @@ -1389,12 +1389,12 @@ cairo_t* wxBitmap::CairoCreate() const if (bmpData->m_pixbufNoMask) { g_object_unref(bmpData->m_pixbufNoMask); - bmpData->m_pixbufNoMask = NULL; + bmpData->m_pixbufNoMask = nullptr; } if (bmpData->m_pixbufMask) { g_object_unref(bmpData->m_pixbufMask); - bmpData->m_pixbufMask = NULL; + bmpData->m_pixbufMask = nullptr; } wxASSERT(cr && cairo_status(cr) == 0); if (!wxIsSameDouble(bmpData->m_scaleFactor, 1)) @@ -1417,7 +1417,7 @@ void wxBitmap::Draw(cairo_t* cr, int x, int y, bool useMask, const wxColour* fg, } SetSourceSurface(cr, x, y, fg, bg); cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_NEAREST); - cairo_surface_t* mask = NULL; + cairo_surface_t* mask = nullptr; if (useMask && bmpData->m_mask) mask = *bmpData->m_mask; if (mask) @@ -1440,7 +1440,7 @@ void wxBitmap::Draw(cairo_t* cr, int x, int y, bool useMask, const wxColour* fg, wxBitmap wxBitmap::CreateDisabled() const { wxBitmap disabled; - if (m_refData == NULL) + if (m_refData == nullptr) return disabled; const wxBitmapRefData* bmpData = M_BMPDATA; @@ -1465,7 +1465,7 @@ wxBitmap wxBitmap::CreateDisabled() const #else GdkPixbuf* wxBitmap::GetPixbufNoMask() const { - wxCHECK_MSG(IsOk(), NULL, "invalid bitmap"); + wxCHECK_MSG(IsOk(), nullptr, "invalid bitmap"); wxBitmapRefData* bmpData = M_BMPDATA; GdkPixbuf* pixbuf = bmpData->m_pixbuf; @@ -1486,19 +1486,19 @@ GdkPixbuf* wxBitmap::GetPixbufNoMask() const GdkPixbuf *wxBitmap::GetPixbuf() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); wxBitmapRefData* bmpData = M_BMPDATA; #ifdef __WXGTK3__ if (bmpData->m_pixbufMask) return bmpData->m_pixbufMask; - if (bmpData->m_pixbufNoMask == NULL) + if (bmpData->m_pixbufNoMask == nullptr) GetPixbufNoMask(); - cairo_surface_t* mask = NULL; + cairo_surface_t* mask = nullptr; if (bmpData->m_mask) mask = *bmpData->m_mask; - if (mask == NULL) + if (mask == nullptr) return bmpData->m_pixbufNoMask; const int w = bmpData->m_width; @@ -1530,7 +1530,7 @@ GdkPixbuf *wxBitmap::GetPixbuf() const if ( !bmpData->m_pixbuf ) GetPixbufNoMask(); - GdkPixmap* mask = NULL; + GdkPixmap* mask = nullptr; if (bmpData->m_mask) mask = *bmpData->m_mask; @@ -1555,7 +1555,7 @@ bool wxBitmap::HasPixbuf() const { wxCHECK_MSG( IsOk(), false, wxT("invalid bitmap") ); - return M_BMPDATA->m_pixbuf != NULL; + return M_BMPDATA->m_pixbuf != nullptr; } void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) @@ -1563,12 +1563,12 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) if (keep == Pixmap && HasPixbuf()) { g_object_unref (M_BMPDATA->m_pixbuf); - M_BMPDATA->m_pixbuf = NULL; + M_BMPDATA->m_pixbuf = nullptr; } if (keep == Pixbuf && HasPixmap()) { g_object_unref (M_BMPDATA->m_pixmap); - M_BMPDATA->m_pixmap = NULL; + M_BMPDATA->m_pixmap = nullptr; } } #endif @@ -1576,7 +1576,7 @@ void wxBitmap::PurgeOtherRepresentations(wxBitmap::Representation keep) #ifdef wxHAS_RAW_BITMAP void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { - void* bits = NULL; + void* bits = nullptr; #ifdef __WXGTK3__ GdkPixbuf* pixbuf = GetPixbufNoMask(); if ((bpp == 32) == (gdk_pixbuf_get_has_alpha(pixbuf) != 0)) @@ -1589,12 +1589,12 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) if (bmpData->m_pixbufMask) { g_object_unref(bmpData->m_pixbufMask); - bmpData->m_pixbufMask = NULL; + bmpData->m_pixbufMask = nullptr; } if (bmpData->m_surface) { cairo_surface_destroy(bmpData->m_surface); - bmpData->m_surface = NULL; + bmpData->m_surface = nullptr; } } #else @@ -1607,7 +1607,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) if ( M_BMPDATA->m_pixbufMask ) { g_object_unref(M_BMPDATA->m_pixbufMask); - M_BMPDATA->m_pixbufMask = NULL; + M_BMPDATA->m_pixbufMask = nullptr; } const bool hasAlpha = HasAlpha(); @@ -1671,7 +1671,7 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const cairo_surface_mark_dirty(surface); } #else - if (oldRef->m_pixmap != NULL) + if (oldRef->m_pixmap != nullptr) { newRef->m_pixmap = gdk_pixmap_new( oldRef->m_pixmap, oldRef->m_width, oldRef->m_height, @@ -1681,12 +1681,12 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const gdk_draw_drawable( newRef->m_pixmap, gc, oldRef->m_pixmap, 0, 0, 0, 0, -1, -1); } - if (oldRef->m_pixbuf != NULL) + if (oldRef->m_pixbuf != nullptr) { newRef->m_pixbuf = gdk_pixbuf_copy(oldRef->m_pixbuf); } #endif - if (oldRef->m_mask != NULL) + if (oldRef->m_mask != nullptr) { newRef->m_mask = new wxMask(*oldRef->m_mask); } diff --git a/src/gtk/bmpcbox.cpp b/src/gtk/bmpcbox.cpp index 0d382ecf1c..d355d4a96a 100644 --- a/src/gtk/bmpcbox.cpp +++ b/src/gtk/bmpcbox.cpp @@ -197,7 +197,7 @@ void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmapBundle& bitma GtkTreeModel *model = gtk_combo_box_get_model( combobox ); GtkTreeIter iter; - if ( gtk_tree_model_iter_nth_child( model, &iter, NULL, n ) ) + if ( gtk_tree_model_iter_nth_child( model, &iter, nullptr, n ) ) { wxGtkValue value0( G_TYPE_OBJECT ); g_value_set_object( value0, bmp.GetPixbuf() ); @@ -215,7 +215,7 @@ wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const GtkTreeModel *model = gtk_combo_box_get_model( combobox ); GtkTreeIter iter; - if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n)) + if (gtk_tree_model_iter_nth_child (model, &iter, nullptr, n)) { wxGtkValue value; gtk_tree_model_get_value( model, &iter, diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index d4fe907597..968ace8b14 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -115,7 +115,7 @@ wxColour wxBrush::GetColour() const wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") ); return &M_BRUSHDATA->m_stipple; } diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 194c205ef4..a52f9cbd6f 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -50,8 +50,8 @@ wxgtk_button_style_set_callback(GtkWidget* widget, GtkStyle*, wxButton* win) wxWindow* parent = win->GetParent(); if (parent && parent->m_wxwindow && gtk_widget_get_can_default(widget)) { - GtkBorder* border = NULL; - gtk_widget_style_get(widget, "default_border", &border, NULL); + GtkBorder* border = nullptr; + gtk_widget_style_get(widget, "default_border", &border, nullptr); if (border) { win->MoveWindow( @@ -126,7 +126,7 @@ bool wxButton::Create(wxWindow *parent, if (useLabel) { g_object_set(gtk_bin_get_child(GTK_BIN(m_widget)), - "xalign", x_alignment, "yalign", y_alignment, NULL); + "xalign", x_alignment, "yalign", y_alignment, nullptr); } #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) @@ -186,7 +186,7 @@ wxWindow *wxButton::SetDefault() gtk_widget_grab_default( m_widget ); // resize for default border - wxgtk_button_style_set_callback( m_widget, NULL, this ); + wxgtk_button_style_set_callback( m_widget, nullptr, this ); return oldDefault; } @@ -217,13 +217,13 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win)) gtk_container_add(GTK_CONTAINER(box), btn); gtk_container_add(GTK_CONTAINER(wnd), box); GtkRequisition req; - gtk_widget_get_preferred_size(btn, NULL, &req); + gtk_widget_get_preferred_size(btn, nullptr, &req); gint minwidth, minheight; gtk_widget_style_get(box, "child-min-width", &minwidth, "child-min-height", &minheight, - NULL); + nullptr); size.x = wxMax(minwidth, req.width); size.y = wxMax(minheight, req.height); @@ -235,7 +235,7 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win)) void wxButton::SetLabel( const wxString &lbl ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid button") ); wxString label(lbl); @@ -281,7 +281,7 @@ void wxButton::SetLabel( const wxString &lbl ) #if wxUSE_MARKUP bool wxButton::DoSetLabelMarkup(const wxString& markup) { - wxCHECK_MSG( m_widget != NULL, false, "invalid button" ); + wxCHECK_MSG( m_widget != nullptr, false, "invalid button" ); const wxString stripped = RemoveMarkup(markup); if ( stripped.empty() && !markup.empty() ) @@ -304,13 +304,13 @@ GtkLabel *wxButton::GTKGetLabel() const if (GTK_IS_LABEL(child)) return GTK_LABEL(child); - return NULL; + return nullptr; #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) if ( GTK_IS_ALIGNMENT(child) ) { GtkWidget* box = gtk_bin_get_child(GTK_BIN(child)); - GtkLabel* label = NULL; + GtkLabel* label = nullptr; wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box))); for (GList* item = list; item; item = item->next) { diff --git a/src/gtk/calctrl.cpp b/src/gtk/calctrl.cpp index aecf32e27d..a61bb2cdfa 100644 --- a/src/gtk/calctrl.cpp +++ b/src/gtk/calctrl.cpp @@ -79,9 +79,9 @@ bool wxGtkCalendarCtrl::Create(wxWindow *parent, SetDate(date.IsValid() ? date : wxDateTime::Today()); if (style & wxCAL_NO_MONTH_CHANGE) - g_object_set (G_OBJECT (m_widget), "no-month-change", true, NULL); + g_object_set (G_OBJECT (m_widget), "no-month-change", true, nullptr); if (style & wxCAL_SHOW_WEEK_NUMBERS) - g_object_set (G_OBJECT (m_widget), "show-week-numbers", true, NULL); + g_object_set (G_OBJECT (m_widget), "show-week-numbers", true, nullptr); g_signal_connect_after(m_widget, "day-selected", G_CALLBACK (gtk_day_selected_callback), @@ -187,7 +187,7 @@ bool wxGtkCalendarCtrl::EnableMonthChange(bool enable) if ( !wxCalendarCtrlBase::EnableMonthChange(enable) ) return false; - g_object_set (G_OBJECT (m_widget), "no-month-change", !enable, NULL); + g_object_set (G_OBJECT (m_widget), "no-month-change", !enable, nullptr); return true; } diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 0579417ebc..7f5c81f0e8 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -88,7 +88,7 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) wxCheckBox::wxCheckBox() { - m_widgetCheckbox = NULL; + m_widgetCheckbox = nullptr; } wxCheckBox::~wxCheckBox() @@ -123,7 +123,7 @@ bool wxCheckBox::Create(wxWindow *parent, m_widgetLabel = gtk_label_new(""); #ifdef __WXGTK4__ - g_object_set(m_widgetLabel, "xalign", 0.0f, NULL); + g_object_set(m_widgetLabel, "xalign", 0.0f, nullptr); #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) gtk_misc_set_alignment(GTK_MISC(m_widgetLabel), 0.0, 0.5); @@ -189,7 +189,7 @@ void wxCheckBox::GTKEnableEvents() void wxCheckBox::SetValue( bool state ) { - wxCHECK_RET( m_widgetCheckbox != NULL, wxT("invalid checkbox") ); + wxCHECK_RET( m_widgetCheckbox != nullptr, wxT("invalid checkbox") ); if (state == GetValue()) return; @@ -200,7 +200,7 @@ void wxCheckBox::SetValue( bool state ) bool wxCheckBox::GetValue() const { - wxCHECK_MSG( m_widgetCheckbox != NULL, false, wxT("invalid checkbox") ); + wxCHECK_MSG( m_widgetCheckbox != nullptr, false, wxT("invalid checkbox") ); return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widgetCheckbox)) != 0; } @@ -226,7 +226,7 @@ wxCheckBoxState wxCheckBox::DoGet3StateValue() const void wxCheckBox::SetLabel( const wxString& label ) { - wxCHECK_RET( m_widgetLabel != NULL, wxT("invalid checkbox") ); + wxCHECK_RET( m_widgetLabel != nullptr, wxT("invalid checkbox") ); // If we don't hide the empty label, in some themes a focus rectangle is // still drawn around it and this looks out of place. diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 74d3ebdf46..c4fdecf44d 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -25,7 +25,7 @@ static void gtk_checklist_toggled(GtkCellRendererToggle * WXUNUSED(renderer), gchar *stringpath, wxCheckListBox *listbox) { - wxCHECK_RET( listbox->m_treeview != NULL, wxT("invalid listbox") ); + wxCHECK_RET( listbox->m_treeview != nullptr, wxT("invalid listbox") ); wxGtkTreePath path(stringpath); wxCommandEvent new_event( wxEVT_CHECKLISTBOX, @@ -81,7 +81,7 @@ void wxCheckListBox::DoCreateCheckList() GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "active", 0, - NULL ); + nullptr ); gtk_tree_view_column_set_fixed_width(column, 22); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); @@ -96,12 +96,12 @@ void wxCheckListBox::DoCreateCheckList() bool wxCheckListBox::IsChecked(unsigned int index) const { - wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid checklistbox") ); + wxCHECK_MSG( m_treeview != nullptr, false, wxT("invalid checklistbox") ); GtkTreeIter iter; gboolean res = gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(m_liststore), - &iter, NULL, //NULL = parent = get first + &iter, nullptr, //nullptr = parent = get first index ); if(!res) @@ -118,12 +118,12 @@ bool wxCheckListBox::IsChecked(unsigned int index) const void wxCheckListBox::Check(unsigned int index, bool check) { - wxCHECK_RET( m_treeview != NULL, wxT("invalid checklistbox") ); + wxCHECK_RET( m_treeview != nullptr, wxT("invalid checklistbox") ); GtkTreeIter iter; gboolean res = gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(m_liststore), - &iter, NULL, //NULL = parent = get first + &iter, nullptr, //nullptr = parent = get first index ); if(!res) @@ -137,12 +137,12 @@ void wxCheckListBox::Check(unsigned int index, bool check) int wxCheckListBox::GetItemHeight() const { - wxCHECK_MSG( m_treeview != NULL, 0, wxT("invalid listbox")); + wxCHECK_MSG( m_treeview != nullptr, 0, wxT("invalid listbox")); gint height; gtk_tree_view_column_cell_get_size( gtk_tree_view_get_column(m_treeview, 0), - NULL, NULL, NULL, NULL, + nullptr, nullptr, nullptr, nullptr, &height); return height; } diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 9b06753cb9..c91acbafb0 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -41,7 +41,7 @@ gtk_choice_changed_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) void wxChoice::Init() { - m_strings = NULL; + m_strings = nullptr; m_stringCellIndex = 0; } @@ -72,7 +72,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, if ( IsSorted() ) { - // if our m_strings != NULL, Append() will check for it and insert + // if our m_strings != nullptr, Append() will check for it and insert // items in the correct order m_strings = new wxGtkCollatedArrayString; } @@ -89,7 +89,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, // any ill effects from having it on if everything does fit. const wxGtkList cells(gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_widget))); if (GTK_IS_CELL_RENDERER_TEXT(cells->data)) - g_object_set(G_OBJECT(cells->data), "ellipsize", PANGO_ELLIPSIZE_END, NULL); + g_object_set(G_OBJECT(cells->data), "ellipsize", PANGO_ELLIPSIZE_END, nullptr); #else m_widget = gtk_combo_box_new_text(); #endif @@ -127,7 +127,7 @@ bool wxChoice::GTKHandleFocusOut() if ( wx_is_at_least_gtk2(10) ) { gboolean isShown; - g_object_get( m_widget, "popup-shown", &isShown, NULL ); + g_object_get( m_widget, "popup-shown", &isShown, nullptr ); // Don't send "focus lost" events if the focus is grabbed by our own // popup, it counts as part of this window, even though wx doesn't know @@ -152,7 +152,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, unsigned int pos, void **clientData, wxClientDataType type) { - wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid control") ); + wxCHECK_MSG( m_widget != nullptr, -1, wxT("invalid control") ); wxASSERT_MSG( !IsSorted() || (pos == GetCount()), wxT("In a sorted choice data could only be appended")); @@ -171,7 +171,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, GTKInsertComboBoxTextItem( n, items[i] ); - m_clientData.Insert( NULL, n ); + m_clientData.Insert( nullptr, n ); AssignNewItemClientData(n, clientData, i, type); } @@ -192,7 +192,7 @@ void* wxChoice::DoGetItemClientData(unsigned int n) const void wxChoice::DoClear() { - wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid control") ); wxGtkEventsDisabler noEvents(this); @@ -211,14 +211,14 @@ void wxChoice::DoClear() void wxChoice::DoDeleteOneItem(unsigned int n) { - wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid control") ); wxCHECK_RET( IsValid(n), wxT("invalid index in wxChoice::Delete") ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); GtkTreeModel* model = gtk_combo_box_get_model( combobox ); GtkListStore* store = GTK_LIST_STORE(model); GtkTreeIter iter; - if ( !gtk_tree_model_iter_nth_child(model, &iter, NULL, n) ) + if ( !gtk_tree_model_iter_nth_child(model, &iter, nullptr, n) ) { // This is really not supposed to happen for a valid index. wxFAIL_MSG(wxS("Item unexpectedly not found.")); @@ -235,7 +235,7 @@ void wxChoice::DoDeleteOneItem(unsigned int n) int wxChoice::FindString( const wxString &item, bool bCase ) const { - wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid control") ); + wxCHECK_MSG( m_widget != nullptr, wxNOT_FOUND, wxT("invalid control") ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); GtkTreeModel* model = gtk_combo_box_get_model( combobox ); @@ -267,14 +267,14 @@ int wxChoice::GetSelection() const void wxChoice::SetString(unsigned int n, const wxString &text) { - wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid control") ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); wxCHECK_RET( IsValid(n), wxT("invalid index") ); GtkTreeModel *model = gtk_combo_box_get_model( combobox ); GtkTreeIter iter; - if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n)) + if (gtk_tree_model_iter_nth_child (model, &iter, nullptr, n)) { wxGtkValue value(G_TYPE_STRING); g_value_set_string( value, wxGTK_CONV( text ) ); @@ -286,12 +286,12 @@ void wxChoice::SetString(unsigned int n, const wxString &text) wxString wxChoice::GetString(unsigned int n) const { - wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid control") ); + wxCHECK_MSG( m_widget != nullptr, wxEmptyString, wxT("invalid control") ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); GtkTreeModel *model = gtk_combo_box_get_model( combobox ); GtkTreeIter iter; - if (!gtk_tree_model_iter_nth_child (model, &iter, NULL, n)) + if (!gtk_tree_model_iter_nth_child (model, &iter, nullptr, n)) { wxFAIL_MSG( "invalid index" ); return wxString(); @@ -304,7 +304,7 @@ wxString wxChoice::GetString(unsigned int n) const unsigned int wxChoice::GetCount() const { - wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid control") ); + wxCHECK_MSG( m_widget != nullptr, 0, wxT("invalid control") ); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); GtkTreeModel* model = gtk_combo_box_get_model( combobox ); @@ -320,7 +320,7 @@ unsigned int wxChoice::GetCount() const void wxChoice::SetSelection( int n ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid control") ); wxGtkEventsDisabler noEvents(this); @@ -373,7 +373,7 @@ wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const // We are interested in the difference of sizes between the whole contol // and its child part. I.e. arrow, separators, etc. GtkRequisition req; - gtk_widget_get_preferred_size(childPart, NULL, &req); + gtk_widget_get_preferred_size(childPart, nullptr, &req); wxSize totalS = GTKGetPreferredSize(m_widget); wxSize tsize(xlen + totalS.x - req.width, totalS.y); diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 9c3b069b52..a848627874 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -41,8 +41,8 @@ typedef wxScopedArray wxDataFormatArray; // data // ---------------------------------------------------------------------------- -static GdkAtom g_targetsAtom = 0; -static GdkAtom g_timestampAtom = 0; +static GdkAtom g_targetsAtom = nullptr; +static GdkAtom g_timestampAtom = nullptr; #if wxUSE_UNICODE extern GdkAtom g_altTextAtom; @@ -89,7 +89,7 @@ public: wxASSERT_MSG( clipboard == ms_clipboard, wxT("got notification for alien clipboard") ); - ms_clipboard = NULL; + ms_clipboard = nullptr; } // this method should be called if it's possible that no async clipboard @@ -109,7 +109,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxClipboardSync); }; -wxClipboard *wxClipboardSync::ms_clipboard = NULL; +wxClipboard *wxClipboardSync::ms_clipboard = nullptr; // ============================================================================ // clipboard callbacks implementation @@ -441,10 +441,10 @@ wxClipboard::wxClipboard() m_dataPrimary = m_dataClipboard = - m_receivedData = NULL; + m_receivedData = nullptr; m_formatSupported = false; - m_targetRequested = 0; + m_targetRequested = nullptr; // we use m_targetsWidget to query what formats are available m_targetsWidget = gtk_window_new( GTK_WINDOW_POPUP ); @@ -468,7 +468,7 @@ wxClipboard::wxClipboard() G_CALLBACK (selection_received), this); g_signal_connect (m_clipboardWidget, "selection_clear_event", - G_CALLBACK (selection_clear_clip), NULL); + G_CALLBACK (selection_clear_clip), nullptr); // initialize atoms we use if not done yet if ( !g_targetsAtom ) @@ -505,7 +505,7 @@ bool wxClipboard::SetSelectionOwner(bool set) { bool rc = gtk_selection_owner_set ( - set ? m_clipboardWidget : NULL, + set ? m_clipboardWidget : nullptr, GTKGetClipboardAtom(), (guint32)GDK_CURRENT_TIME ) != 0; @@ -589,7 +589,7 @@ void wxClipboard::Clear() SetSelectionOwner(false); } - m_targetRequested = 0; + m_targetRequested = nullptr; m_formatSupported = false; } @@ -601,7 +601,7 @@ bool wxClipboard::Flush() { GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_can_store(clipboard, NULL, 0); + gtk_clipboard_set_can_store(clipboard, nullptr, 0); gtk_clipboard_store(clipboard); return true; @@ -781,7 +781,7 @@ wxDataObject* wxClipboard::GTKGetDataObject( GdkAtom atom ) } else // some other selection, we're not concerned { - return (wxDataObject*)NULL; + return (wxDataObject*)nullptr; } } diff --git a/src/gtk/clrpicker.cpp b/src/gtk/clrpicker.cpp index 54f01a4d09..36864b32b8 100644 --- a/src/gtk/clrpicker.cpp +++ b/src/gtk/clrpicker.cpp @@ -88,7 +88,7 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id, // Display opacity slider g_object_set(G_OBJECT(m_widget), "use-alpha", - static_cast(style & wxCLRP_SHOW_ALPHA), NULL); + static_cast(style & wxCLRP_SHOW_ALPHA), nullptr); // GtkColourButton signals g_signal_connect(m_widget, "color-set", G_CALLBACK(gtk_clrbutton_setcolor_callback), this); diff --git a/src/gtk/collpane.cpp b/src/gtk/collpane.cpp index 4c8d1d38f8..ae98507af7 100644 --- a/src/gtk/collpane.cpp +++ b/src/gtk/collpane.cpp @@ -245,7 +245,7 @@ GdkWindow *wxCollapsiblePane::GTKGetWindow(wxArrayGdkWindows& windows) const windows.Add(gtk_widget_get_window(label)); windows.Add(gtk_widget_get_window(m_widget)); - return NULL; + return nullptr; } #endif // wxUSE_COLLPANE && !defined(__WXUNIVERSAL__) diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index 1be0c26698..2ee2cd2f92 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -44,7 +44,7 @@ bool wxColourDialog::Create(wxWindow *parent, const wxColourData *data) m_parent = GetParentForModalDialog(parent, 0); GtkWindow * const parentGTK = m_parent ? GTK_WINDOW(m_parent->m_widget) - : NULL; + : nullptr; wxString title(_("Choose colour")); #ifdef __WXGTK4__ @@ -127,7 +127,7 @@ void wxColourDialog::ColourDataToDialog() wxGtkString pal(gtk_color_selection_palette_to_string(colors, n_colors)); GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel)); - g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL); + g_object_set(settings, "gtk-color-palette", pal.c_str(), nullptr); wxGCC_WARNING_RESTORE() #endif // !__WXGTK4__ } @@ -163,7 +163,7 @@ void wxColourDialog::DialogToColourData() GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel)); gchar *pal; - g_object_get(settings, "gtk-color-palette", &pal, NULL); + g_object_get(settings, "gtk-color-palette", &pal, nullptr); GdkColor *colors; gint n_colors; diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 22185e027d..bb5aedfc8d 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -64,7 +64,7 @@ public: m_blue = blue; m_alpha = alpha; m_color.pixel = 0; - m_colormap = NULL; + m_colormap = nullptr; } virtual ~wxColourRefData() @@ -93,7 +93,7 @@ void wxColourRefData::FreeColour() if (m_colormap) { gdk_colormap_free_colors(m_colormap, &m_color, 1); - m_colormap = NULL; + m_colormap = nullptr; m_color.pixel = 0; } } @@ -239,7 +239,7 @@ int wxColour::GetPixel() const const GdkColor *wxColour::GetColor() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid colour") ); #ifdef __WXGTK3__ return &M_COLDATA->m_gdkColor; @@ -251,7 +251,7 @@ const GdkColor *wxColour::GetColor() const #ifdef __WXGTK3__ wxColour::operator const GdkRGBA*() const { - const GdkRGBA* c = NULL; + const GdkRGBA* c = nullptr; if (IsOk()) c = &M_COLDATA->m_gdkRGBA; return c; diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index c7be724e90..2d7eae421c 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -40,7 +40,7 @@ gtkcombobox_popupshown_callback(GObject *WXUNUSED(gobject), wxComboBox *combo) { gboolean isShown; - g_object_get( combo->m_widget, "popup-shown", &isShown, NULL ); + g_object_get( combo->m_widget, "popup-shown", &isShown, nullptr ); wxCommandEvent event( isShown ? wxEVT_COMBOBOX_DROPDOWN : wxEVT_COMBOBOX_CLOSEUP, combo->GetId() ); @@ -97,7 +97,7 @@ wxComboBox::~wxComboBox() void wxComboBox::Init() { - m_entry = NULL; + m_entry = nullptr; } bool wxComboBox::Create( wxWindow *parent, wxWindowID id, @@ -134,7 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, if (HasFlag(wxBORDER_NONE)) { // Doesn't seem to work - // g_object_set (m_widget, "has-frame", FALSE, NULL); + // g_object_set (m_widget, "has-frame", FALSE, nullptr); } GtkEntry * const entry = GetEntry(); diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index f4a25ea146..a2b9945dae 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -171,7 +171,7 @@ GtkWidget* wxControl::GTKCreateFrame(const wxString& label) GtkWidget* labelwidget = gtk_label_new_with_mnemonic(wxGTK_CONV(labelGTK)); gtk_widget_show(labelwidget); // without this it won't show... - GtkWidget* framewidget = gtk_frame_new(NULL); + GtkWidget* framewidget = gtk_frame_new(nullptr); gtk_frame_set_label_widget(GTK_FRAME(framewidget), labelwidget); return framewidget; // note that the label is already set so you'll @@ -239,8 +239,8 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, { wxVisualAttributes attr; - GtkWidget* tlw = NULL; - if (gtk_widget_get_parent(widget) == NULL) + GtkWidget* tlw = nullptr; + if (gtk_widget_get_parent(widget) == nullptr) { tlw = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_container_add(GTK_CONTAINER(tlw), widget); @@ -260,7 +260,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, 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); + GTK_STYLE_PROPERTY_FONT, &info.description, nullptr); gtk_style_context_restore(sc); attr.colFg = wxColour(*fc); attr.colBg = wxColour(*bc); @@ -274,7 +274,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, sc = gtk_widget_get_style_context(widget); gtk_style_context_save(sc); gtk_style_context_set_state(sc, stateFlag); - gtk_style_context_get(sc, stateFlag, "background-color", &bc, NULL); + gtk_style_context_get(sc, stateFlag, "background-color", &bc, nullptr); gtk_style_context_restore(sc); attr.colBg = wxColour(*bc); gdk_rgba_free(bc); @@ -303,7 +303,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, wxNativeFontInfo info; info.description = style->font_desc; attr.font = wxFont(info); - info.description = NULL; + info.description = nullptr; } } else @@ -313,11 +313,11 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if (!attr.font.IsOk()) { GtkSettings *settings = gtk_settings_get_default(); - gchar *font_name = NULL; + gchar *font_name = nullptr; g_object_get ( settings, "gtk-font-name", &font_name, - NULL); + nullptr); if (!font_name) attr.font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); else @@ -351,7 +351,7 @@ wxSize wxControl::GTKGetPreferredSize(GtkWidget* widget) const gtk_widget_show(widget); gtk_widget_set_size_request(widget, -1, -1); - gtk_widget_get_preferred_size(widget, NULL, &req); + gtk_widget_get_preferred_size(widget, nullptr, &req); gtk_widget_set_size_request(widget, w, h); if ( wasHidden ) @@ -386,7 +386,7 @@ wxSize wxControl::GTKGetEntryMargins(GtkEntry* entry) const else { GtkBorder* innerBorder2; - gtk_widget_style_get(GTK_WIDGET(entry), "inner-border", &innerBorder2, NULL); + gtk_widget_style_get(GTK_WIDGET(entry), "inner-border", &innerBorder2, nullptr); if (innerBorder2) { border = *innerBorder2; diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 6c1544c806..382dc82840 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -34,7 +34,7 @@ public: wxCursorRefData(); virtual ~wxCursorRefData(); - virtual bool IsOk() const override { return m_cursor != NULL; } + virtual bool IsOk() const override { return m_cursor != nullptr; } GdkCursor *m_cursor; @@ -46,7 +46,7 @@ private: wxCursorRefData::wxCursorRefData() { - m_cursor = NULL; + m_cursor = nullptr; } wxCursorRefData::~wxCursorRefData() @@ -221,7 +221,7 @@ void wxCursor::InitFromStock( wxStockCursor cursorId ) const char bits[] = { 0 }; const GdkColor color = { 0, 0, 0, 0 }; - GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bits, 1, 1); + GdkPixmap *pixmap = gdk_bitmap_create_from_data(nullptr, bits, 1, 1); M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap(pixmap, pixmap, &color, @@ -296,7 +296,7 @@ void wxCursor::InitFromImage( const wxImage & image ) int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y); if (hotSpotX < 0 || hotSpotX > w) hotSpotX = 0; if (hotSpotY < 0 || hotSpotY > h) hotSpotY = 0; - GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image.GetData(), GDK_COLORSPACE_RGB, false, 8, w, h, w * 3, NULL, NULL); + GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data(image.GetData(), GDK_COLORSPACE_RGB, false, 8, w, h, w * 3, nullptr, nullptr); if (alpha || hasMask) { guchar r = 0, g = 0, b = 0; @@ -329,7 +329,7 @@ void wxCursor::InitFromImage( const wxImage & image ) GdkCursor *wxCursor::GetCursor() const { - GdkCursor* cursor = NULL; + GdkCursor* cursor = nullptr; if (m_refData) cursor = M_CURSORDATA->m_cursor; return cursor; @@ -384,7 +384,7 @@ static void UpdateCursors(wxWindow* win, bool isBusyOrGlobalCursor) static void SetGlobalCursor(const wxCursor& cursor) { GdkCursor* gdk_cursor = cursor.GetCursor(); - GdkDisplay* display = NULL; + GdkDisplay* display = nullptr; wxWindowList::const_iterator i = wxTopLevelWindows.begin(); for (size_t n = wxTopLevelWindows.size(); n--; ++i) { @@ -393,8 +393,8 @@ static void SetGlobalCursor(const wxCursor& cursor) 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) + UpdateCursors(win, gdk_cursor != nullptr); + if (display == nullptr) display = gdk_window_get_display(window); } } diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp index bc5e3031b9..dea9b68866 100644 --- a/src/gtk/dataobj.cpp +++ b/src/gtk/dataobj.cpp @@ -28,11 +28,11 @@ // global data //------------------------------------------------------------------------- -GdkAtom g_textAtom = 0; -GdkAtom g_altTextAtom = 0; -GdkAtom g_pngAtom = 0; -GdkAtom g_fileAtom = 0; -GdkAtom g_htmlAtom = 0; +GdkAtom g_textAtom = nullptr; +GdkAtom g_altTextAtom = nullptr; +GdkAtom g_pngAtom = nullptr; +GdkAtom g_fileAtom = nullptr; +GdkAtom g_htmlAtom = nullptr; //------------------------------------------------------------------------- // wxDataFormat @@ -49,7 +49,7 @@ wxDataFormat::wxDataFormat() // calling PrepareFormats (and thus gdk_atom_intern) before GDK is // initialised will result in a crash m_type = wxDF_INVALID; - m_format = (GdkAtom) 0; + m_format = (GdkAtom) nullptr; } wxDataFormat::wxDataFormat( wxDataFormatId type ) @@ -239,7 +239,7 @@ bool wxFileDataObject::GetDataHere(void *buf) const for (size_t i = 0; i < m_filenames.GetCount(); i++) { - char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0); + char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), nullptr, nullptr); if (uri) { size_t const len = strlen(uri); @@ -261,7 +261,7 @@ size_t wxFileDataObject::GetDataSize() const for (size_t i = 0; i < m_filenames.GetCount(); i++) { - char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0); + char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), nullptr, nullptr); if (uri) { res += strlen(uri) + 2; // Including "\r\n" g_free(uri); @@ -315,7 +315,7 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *buf) // required to give it a trailing zero gchar *uri = g_strndup( temp, len ); - gchar *fn = g_filename_from_uri( uri, NULL, NULL ); + gchar *fn = g_filename_from_uri( uri, nullptr, nullptr ); g_free( uri ); @@ -383,7 +383,7 @@ bool wxBitmapDataObject::SetData(size_t size, const void *buf) { Clear(); - wxCHECK_MSG( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL, + wxCHECK_MSG( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != nullptr, false, wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") ); m_pngSize = size; @@ -408,7 +408,7 @@ void wxBitmapDataObject::DoConvertToPng() if ( !m_bitmap.IsOk() ) return; - wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != NULL, + wxCHECK_RET( wxImage::FindHandler(wxBITMAP_TYPE_PNG) != nullptr, wxT("You must call wxImage::AddHandler(new wxPNGHandler); to be able to use clipboard with bitmaps!") ); wxImage image = m_bitmap.ConvertToImage(); diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index e73bff0fa7..cbab81d73b 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -53,7 +53,7 @@ class wxGtkDataViewModelNotifier; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static wxDataViewCtrlInternal *gs_internal = NULL; +static wxDataViewCtrlInternal *gs_internal = nullptr; class wxGtkTreeModelNode; @@ -90,7 +90,7 @@ 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 in GTK+2 gtk_tree_selection_get_select_function() -// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276 +// can't be passed nullptr (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 @@ -110,7 +110,7 @@ gboolean wxdataview_selection_func(GtkTreeSelection * WXUNUSED(selection), gboolean WXUNUSED(path_currently_selected), gpointer data) { - return data == NULL; + return data == nullptr; } } @@ -127,19 +127,19 @@ public: if ( !alreadySet ) { alreadySet = true; - CheckCurrentSelectionFunc(NULL); + CheckCurrentSelectionFunc(nullptr); } 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. + // Pass some non-null pointer as "data" for the callback, it doesn't + // matter what it is as long as it's non-null. gtk_tree_selection_set_select_function(selection, wxdataview_selection_func, this, - NULL); + nullptr); } ~wxGtkTreeSelectionLock() @@ -148,10 +148,10 @@ public: gtk_tree_selection_set_select_function(m_selection, wxdataview_selection_func, - NULL, - NULL); + nullptr, + nullptr); - ms_instance = NULL; + ms_instance = nullptr; } private: @@ -183,7 +183,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxGtkTreeSelectionLock); }; -wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = NULL; +wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = nullptr; //----------------------------------------------------------------------------- // wxDataViewCtrlInternal @@ -278,7 +278,7 @@ public: enum wxFindNodeMode { - // return NULL from FindNode() of a subtree was not realized + // return nullptr from FindNode() of a subtree was not realized wxFIND_NODE_RETURN_IF_SUBTREE_NOT_REALIZED, // call BuildBranch() from FindNode() to realize a subtree @@ -591,43 +591,43 @@ gtk_wx_tree_model_get_type (void) const GTypeInfo tree_model_info = { sizeof (GObjectClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ + nullptr, /* base_init */ + nullptr, /* base_finalize */ + nullptr, + nullptr, /* class_finalize */ + nullptr, /* class_data */ sizeof (GtkWxTreeModel), 0, wxgtk_tree_model_init, - NULL + nullptr }; static const GInterfaceInfo tree_model_iface_info = { wxgtk_tree_model_tree_model_init, - NULL, - NULL + nullptr, + nullptr }; static const GInterfaceInfo sortable_iface_info = { wxgtk_tree_model_sortable_init, - NULL, - NULL + nullptr, + nullptr }; static const GInterfaceInfo drag_source_iface_info = { wxgtk_tree_model_drag_source_init, - NULL, - NULL + nullptr, + nullptr }; static const GInterfaceInfo drag_dest_iface_info = { wxgtk_tree_model_drag_dest_init, - NULL, - NULL + nullptr, + nullptr }; tree_model_type = g_type_register_static (G_TYPE_OBJECT, "GtkWxTreeModel", @@ -653,7 +653,7 @@ gtk_wx_tree_model_get_type (void) static GtkWxTreeModel * wxgtk_tree_model_new(void) { - GtkWxTreeModel *retval = (GtkWxTreeModel *) g_object_new (GTK_TYPE_WX_TREE_MODEL, NULL); + GtkWxTreeModel *retval = (GtkWxTreeModel *) g_object_new (GTK_TYPE_WX_TREE_MODEL, nullptr); return retval; } @@ -707,7 +707,7 @@ static void wxgtk_tree_model_init(GTypeInstance* instance, void*) { GtkWxTreeModel* tree_model = GTK_WX_TREE_MODEL(instance); - tree_model->internal = NULL; + tree_model->internal = nullptr; // 0 is handled specially in wxGtkTreeCellDataFunc, so don't use it as the // stamp. @@ -787,14 +787,14 @@ static GtkTreePath * wxgtk_tree_model_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter) { - g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (tree_model), NULL); + g_return_val_if_fail (GTK_IS_WX_TREE_MODEL (tree_model), nullptr); GtkWxTreeModel *wxtree_model = GTK_WX_TREE_MODEL (tree_model); if ( wxtree_model->stamp == 0 ) return gtk_tree_path_new(); - g_return_val_if_fail (iter->stamp == wxtree_model->stamp, NULL); + g_return_val_if_fail (iter->stamp == wxtree_model->stamp, nullptr); return wxtree_model->internal->get_path( iter ); } @@ -1025,7 +1025,7 @@ wxgtk_tree_model_get_sort_column_id (GtkTreeSortable *sortable, } static -wxDataViewColumn *gs_lastLeftClickHeader = NULL; +wxDataViewColumn *gs_lastLeftClickHeader = nullptr; static void wxgtk_tree_model_set_sort_column_id (GtkTreeSortable *sortable, @@ -1059,7 +1059,7 @@ wxgtk_tree_model_set_sort_column_id (GtkTreeSortable *sortable, dv->HandleWindowEvent( event ); } - gs_lastLeftClickHeader = NULL; + gs_lastLeftClickHeader = nullptr; } static void @@ -1070,7 +1070,7 @@ wxgtk_tree_model_set_sort_func (GtkTreeSortable *sortable, GDestroyNotify WXUNUSED(destroy)) { g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) ); - g_return_if_fail (func != NULL); + g_return_if_fail (func != nullptr); } static void @@ -1080,7 +1080,7 @@ wxgtk_tree_model_set_default_sort_func (GtkTreeSortable *sortable, GDestroyNotify WXUNUSED(destroy)) { g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) ); - g_return_if_fail (func != NULL); + g_return_if_fail (func != nullptr); //wxPrintf( "wxgtk_tree_model_set_default_sort_func\n" ); // TODO: remove this code @@ -1129,7 +1129,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_text_start_editing( GtkCellRendererState flags ); -static GObjectClass *text_cell_parent_class = NULL; +static GObjectClass *text_cell_parent_class = nullptr; } // extern "C" @@ -1143,15 +1143,15 @@ gtk_wx_cell_renderer_text_get_type (void) const GTypeInfo cell_wx_info = { sizeof (GtkCellRendererTextClass), - NULL, /* base_init */ - NULL, /* base_finalize */ + nullptr, /* base_init */ + nullptr, /* base_finalize */ gtk_wx_cell_renderer_text_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + nullptr, /* class_finalize */ + nullptr, /* class_data */ sizeof (GtkWxCellRendererText), 0, /* n_preallocs */ gtk_wx_cell_renderer_text_init, - NULL + nullptr }; cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER_TEXT, @@ -1165,7 +1165,7 @@ static void gtk_wx_cell_renderer_text_init(GTypeInstance* instance, void*) { GtkWxCellRendererText* cell = GTK_WX_CELL_RENDERER_TEXT(instance); - cell->wx_renderer = NULL; + cell->wx_renderer = nullptr; } static void @@ -1181,7 +1181,7 @@ gtk_wx_cell_renderer_text_class_init(void* klass, void*) static GtkWxCellRendererText* gtk_wx_cell_renderer_text_new (void) { - return (GtkWxCellRendererText*) g_object_new (GTK_TYPE_WX_CELL_RENDERER_TEXT, NULL); + return (GtkWxCellRendererText*) g_object_new (GTK_TYPE_WX_CELL_RENDERER_TEXT, nullptr); } static GtkCellEditable *gtk_wx_cell_renderer_text_start_editing( @@ -1208,7 +1208,7 @@ static GtkCellEditable *gtk_wx_cell_renderer_text_start_editing( return GTK_CELL_RENDERER_CLASS(text_cell_parent_class)-> start_editing( gtk_renderer, gdk_event, widget, path, background_area, cell_area, flags ); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1288,15 +1288,15 @@ gtk_wx_cell_editor_bin_get_type() const GTypeInfo cell_editor_bin_info = { sizeof (GtkWxCellEditorBinBaseClass), - NULL, /* base_init */ - NULL, /* base_finalize */ + nullptr, /* base_init */ + nullptr, /* base_finalize */ gtk_wx_cell_editor_bin_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + nullptr, /* class_finalize */ + nullptr, /* class_data */ sizeof (GtkWxCellEditorBin), 0, /* n_preallocs */ - NULL, // init - NULL + nullptr, // init + nullptr }; cell_editor_bin_type = g_type_register_static( @@ -1307,8 +1307,8 @@ gtk_wx_cell_editor_bin_get_type() static const GInterfaceInfo cell_editable_iface_info = { gtk_wx_cell_editor_bin_cell_editable_init, - NULL, - NULL + nullptr, + nullptr }; g_type_add_interface_static (cell_editor_bin_type, @@ -1353,10 +1353,10 @@ static GtkWidget* gtk_wx_cell_editor_bin_new(wxWindow* editor) { if ( !editor ) - return NULL; + return nullptr; GtkWxCellEditorBin* const - bin = (GtkWxCellEditorBin*)g_object_new (GTK_TYPE_WX_CELL_EDITOR_BIN, NULL); + bin = (GtkWxCellEditorBin*)g_object_new (GTK_TYPE_WX_CELL_EDITOR_BIN, nullptr); bin->editor = editor; gtk_container_add(GTK_CONTAINER(bin), editor->m_widget); @@ -1476,15 +1476,15 @@ gtk_wx_cell_renderer_get_type (void) const GTypeInfo cell_wx_info = { sizeof (GtkCellRendererClass), - NULL, /* base_init */ - NULL, /* base_finalize */ + nullptr, /* base_init */ + nullptr, /* base_finalize */ gtk_wx_cell_renderer_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + nullptr, /* class_finalize */ + nullptr, /* class_data */ sizeof (GtkWxCellRenderer), 0, /* n_preallocs */ gtk_wx_cell_renderer_init, - NULL + nullptr }; cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER, @@ -1498,8 +1498,8 @@ static void gtk_wx_cell_renderer_init(GTypeInstance* instance, void*) { GtkWxCellRenderer* cell = GTK_WX_CELL_RENDERER(instance); - cell->cell = NULL; - cell->editor_bin = NULL; + cell->cell = nullptr; + cell->editor_bin = nullptr; } static void @@ -1516,7 +1516,7 @@ gtk_wx_cell_renderer_class_init(void* klass, void*) static GtkCellRenderer* gtk_wx_cell_renderer_new (void) { - return (GtkCellRenderer*) g_object_new (GTK_TYPE_WX_CELL_RENDERER, NULL); + return (GtkCellRenderer*) g_object_new (GTK_TYPE_WX_CELL_RENDERER, nullptr); } static GtkCellEditable *gtk_wx_cell_renderer_start_editing( @@ -1533,17 +1533,17 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing( // Renderer doesn't support in-place editing if (!cell->HasEditorCtrl()) - return NULL; + return nullptr; // An in-place editing control is still around if (cell->GetEditorCtrl()) - return NULL; + return nullptr; wxDataViewItem item(cell->GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(path))); if (!cell->StartEditing(item, wxRectFromGDKRect(cell_area))) - return NULL; + return nullptr; wxrenderer->editor_bin = gtk_wx_cell_editor_bin_new(cell->GetEditorCtrl()); gtk_widget_show(wxrenderer->editor_bin); @@ -1661,7 +1661,7 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, wxDC* dc = cell->GetDC(); #ifdef __WXGTK3__ wxGraphicsContext* context = dc->GetGraphicsContext(); - void* nativeContext = NULL; + void* nativeContext = nullptr; if (context) nativeContext = context->GetNativeContext(); if (cr != nativeContext) @@ -1690,9 +1690,9 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, state |= wxDATAVIEW_CELL_FOCUSED; cell->WXCallRender( rect, dc, state ); - cell->GTKSetRenderParams(NULL); + cell->GTKSetRenderParams(nullptr); #ifdef __WXGTK3__ - dc->SetGraphicsContext(NULL); + dc->SetGraphicsContext(nullptr); #endif } @@ -1735,7 +1735,7 @@ gtk_wx_cell_renderer_activate( if ( !event ) { // activated by - return cell->ActivateCell(renderrect, model, item, model_col, NULL); + return cell->ActivateCell(renderrect, model, item, model_col, nullptr); } else if ( event->type == GDK_BUTTON_PRESS ) { @@ -1795,8 +1795,8 @@ wxGtkDataViewModelNotifier::wxGtkDataViewModelNotifier( wxGtkDataViewModelNotifier::~wxGtkDataViewModelNotifier() { - m_wx_model = NULL; - m_internal = NULL; + m_wx_model = nullptr; + m_internal = nullptr; } bool wxGtkDataViewModelNotifier::ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) @@ -1978,7 +1978,7 @@ wxgtk_cell_editable_editing_done( GtkCellEditable *editable, "editing-canceled") ) { gboolean wasCancelled; - g_object_get(editable, "editing-canceled", &wasCancelled, NULL); + g_object_get(editable, "editing-canceled", &wasCancelled, nullptr); if ( wasCancelled ) { wxrenderer->CancelEditing(); @@ -2017,7 +2017,7 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewC int align ) : wxDataViewRendererBase( varianttype, mode, align ) { - m_renderer = NULL; + m_renderer = nullptr; m_mode = mode; // we haven't changed them yet @@ -2472,14 +2472,14 @@ GType wxCellRendererPixbuf::Type() sizeof(GtkCellRendererPixbufClass), wxCellRendererPixbufClassInit, sizeof(wxCellRendererPixbuf), - NULL, GTypeFlags(0)); + nullptr, GTypeFlags(0)); } return type; } GtkCellRenderer* wxCellRendererPixbuf::New() { - wxCellRendererPixbuf* crp = WX_CELL_RENDERER_PIXBUF(g_object_new(Type(), NULL)); + wxCellRendererPixbuf* crp = WX_CELL_RENDERER_PIXBUF(g_object_new(Type(), nullptr)); crp->m_bundle = new wxBitmapBundle; return GTK_CELL_RENDERER(crp); } @@ -2488,13 +2488,13 @@ void wxCellRendererPixbuf::Set(const wxBitmapBundle& bundle) { *m_bundle = bundle; - GdkPixbuf* pixbuf = NULL; + GdkPixbuf* pixbuf = nullptr; if (bundle.IsOk()) { const wxSize size(bundle.GetDefaultSize()); pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, size.x, size.y); } - g_object_set(G_OBJECT(this), "pixbuf", pixbuf, NULL); + g_object_set(G_OBJECT(this), "pixbuf", pixbuf, nullptr); if (pixbuf) g_object_unref(pixbuf); } @@ -2526,7 +2526,7 @@ static void wxCellRendererPixbufFinalize(GObject* object) { wxCellRendererPixbuf* crp = WX_CELL_RENDERER_PIXBUF(object); delete crp->m_bundle; - crp->m_bundle = NULL; + crp->m_bundle = nullptr; G_OBJECT_CLASS(wxCellRendererPixbufParentClass)->finalize(object); } @@ -2581,8 +2581,8 @@ bool wxDataViewBitmapRenderer::SetValue( const wxVariant &value ) g_object_set(G_OBJECT(m_renderer), "pixbuf", bitmapBundle.IsOk() ? bitmapBundle.GetBitmap(wxDefaultSize).GetPixbuf() - : NULL, - NULL); + : nullptr, + nullptr); #endif return true; @@ -2697,7 +2697,7 @@ public: { GtkWidget *widget = window->m_treeview; // Set later - m_gdkwindow = NULL; + m_gdkwindow = nullptr; m_window = window; @@ -2734,12 +2734,12 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, bool no_init ) : wxDataViewCustomRendererBase( varianttype, mode, align ) { - m_dc = NULL; - m_text_renderer = NULL; - m_renderParams = NULL; + m_dc = nullptr; + m_text_renderer = nullptr; + m_renderParams = nullptr; if (no_init) - m_renderer = NULL; + m_renderer = nullptr; else Init(mode, align); } @@ -2838,9 +2838,9 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer() wxDC *wxDataViewCustomRenderer::GetDC() { - if (m_dc == NULL) + if (m_dc == nullptr) { - wxDataViewCtrl* ctrl = NULL; + wxDataViewCtrl* ctrl = nullptr; wxDataViewColumn* column = GetOwner(); if (column) ctrl = column->GetOwner(); @@ -2850,8 +2850,8 @@ wxDC *wxDataViewCustomRenderer::GetDC() wxASSERT(cr && cairo_status(cr) == 0); m_dc = new wxGTKCairoDC(cr, ctrl); #else - if (ctrl == NULL) - return NULL; + if (ctrl == nullptr) + return nullptr; m_dc = new wxDataViewCtrlDC(ctrl); #endif } @@ -2900,7 +2900,7 @@ void wxDataViewProgressRenderer::GTKSetLabel() wxGtkValue gvalue( G_TYPE_STRING ); // Take care to not use GetOwner() here if the label is empty, we can be - // called from ctor when GetOwner() is still NULL in this case. + // called from ctor when GetOwner() is still null in this case. wxScopedCharBuffer buf; if ( m_label.empty() ) buf = wxScopedCharBuffer::CreateNonOwned(""); @@ -2970,7 +2970,7 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString &choices for (size_t n = 0; n < m_choices.GetCount(); n++) { gtk_list_store_insert_with_values( - store, NULL, n, 0, + store, nullptr, n, 0, static_cast(m_choices[n].utf8_str()), -1 ); } @@ -2978,10 +2978,10 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString &choices "model", store, "text-column", 0, "has-entry", FALSE, - NULL); + nullptr); bool editable = (mode & wxDATAVIEW_CELL_EDITABLE) != 0; - g_object_set (m_renderer, "editable", editable, NULL); + g_object_set (m_renderer, "editable", editable, nullptr); SetAlignment(alignment); @@ -3122,7 +3122,7 @@ bool wxDataViewIconTextRenderer::SetValue( const wxVariant &value ) WX_CELL_RENDERER_PIXBUF(m_rendererIcon)->Set(m_value.GetBitmapBundle()); #else const wxIcon& icon = m_value.GetIcon(); - g_object_set(G_OBJECT(m_rendererIcon), "pixbuf", icon.IsOk() ? icon.GetPixbuf() : NULL, NULL); + g_object_set(G_OBJECT(m_rendererIcon), "pixbuf", icon.IsOk() ? icon.GetPixbuf() : nullptr, nullptr); #endif return true; @@ -3148,15 +3148,15 @@ void wxDataViewIconTextRenderer::SetAttr(const wxDataViewItemAttr& attr) { #ifdef __WXGTK3__ const GdkRGBA* rbga = attr.GetBackgroundColour(); - g_object_set(G_OBJECT(m_rendererIcon), "cell-background-rgba", rbga, NULL); + g_object_set(G_OBJECT(m_rendererIcon), "cell-background-rgba", rbga, nullptr); #else const GdkColor* color = attr.GetBackgroundColour().GetColor(); - g_object_set(G_OBJECT(m_rendererIcon), "cell-background-gdk", color, NULL); + g_object_set(G_OBJECT(m_rendererIcon), "cell-background-gdk", color, nullptr); #endif } else { - g_object_set(G_OBJECT(m_rendererIcon), "cell-background-set", false, NULL); + g_object_set(G_OBJECT(m_rendererIcon), "cell-background-set", false, nullptr); } } @@ -3295,7 +3295,7 @@ void wxDataViewColumn::Init(wxAlignment align, int flags, int width) colRenderer->GtkPackIntoColumn(column); gtk_tree_view_column_set_cell_data_func( column, cellRenderer, - wxGtkTreeCellDataFunc, (gpointer) colRenderer, NULL ); + wxGtkTreeCellDataFunc, (gpointer) colRenderer, nullptr ); } void wxDataViewColumn::OnInternalIdle() @@ -3467,7 +3467,7 @@ void wxDataViewColumn::UnsetAsSortKey() wxDataViewCtrlInternal* internal = m_owner->GtkGetInternal(); internal->SetSortColumn(-1); - internal->SetDataViewSortColumn(NULL); + internal->SetDataViewSortColumn(nullptr); } bool wxDataViewColumn::IsSortOrderAscending() const @@ -3669,14 +3669,14 @@ wxDataViewCtrlInternal::wxDataViewCtrlInternal( wxDataViewCtrl *owner, wxDataVie m_owner = owner; m_wx_model = wx_model; - m_root = NULL; + m_root = nullptr; m_sort_order = GTK_SORT_ASCENDING; m_sort_column = -1; m_sort_frozen = false; - m_dataview_sort_column = NULL; + m_dataview_sort_column = nullptr; - m_dragDataObject = NULL; - m_dropDataObject = NULL; + m_dragDataObject = nullptr; + m_dropDataObject = nullptr; m_dirty = false; m_selectionFuncSet = false; @@ -3732,7 +3732,7 @@ void wxDataViewCtrlInternal::UseModel(bool use) const gint stampOrig = m_gtk_model->stamp; m_gtk_model->stamp = 0; - gtk_tree_view_set_model(GTK_TREE_VIEW(m_owner->GtkGetTreeView()), NULL); + gtk_tree_view_set_model(GTK_TREE_VIEW(m_owner->GtkGetTreeView()), nullptr); m_gtk_model->stamp = stampOrig; } @@ -3756,7 +3756,7 @@ void wxDataViewCtrlInternal::OnInternalIdle() void wxDataViewCtrlInternal::InitTree() { wxDataViewItem item; - m_root = new wxGtkTreeModelNode( NULL, item, this ); + m_root = new wxGtkTreeModelNode( nullptr, item, this ); BuildBranch( m_root ); } @@ -3837,7 +3837,7 @@ gboolean wxDataViewCtrlInternal::row_draggable( GtkTreeDragSource *WXUNUSED(drag GtkTreePath *path ) { delete m_dragDataObject; - m_dragDataObject = NULL; + m_dragDataObject = nullptr; #ifdef __WXGTK4__ return false; @@ -3953,7 +3953,7 @@ bool wxDataViewCtrlInternal::Cleared() if (m_root) { delete m_root; - m_root = NULL; + m_root = nullptr; } InitTree(); @@ -4202,13 +4202,13 @@ gboolean wxDataViewCtrlInternal::iter_next( GtkTreeIter *iter ) if (n == -1) { - iter->user_data = NULL; + iter->user_data = nullptr; return FALSE; } if (n >= (int) wx_model->GetCount()-1) { - iter->user_data = NULL; + iter->user_data = nullptr; return FALSE; } @@ -4218,9 +4218,9 @@ gboolean wxDataViewCtrlInternal::iter_next( GtkTreeIter *iter ) else { wxGtkTreeModelNode *parent = FindParentNode( iter ); - if( parent == NULL ) + if( parent == nullptr ) { - iter->user_data = NULL; + iter->user_data = nullptr; return FALSE; } @@ -4228,7 +4228,7 @@ gboolean wxDataViewCtrlInternal::iter_next( GtkTreeIter *iter ) if (pos == (int) parent->GetChildCount()-1) { - iter->user_data = NULL; + iter->user_data = nullptr; return FALSE; } @@ -4282,7 +4282,7 @@ gboolean wxDataViewCtrlInternal::iter_has_child( GtkTreeIter *iter ) { wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model; - if (iter == NULL) + if (iter == nullptr) return (wx_model->GetCount() > 0); // this is a list, nodes have no children @@ -4290,7 +4290,7 @@ gboolean wxDataViewCtrlInternal::iter_has_child( GtkTreeIter *iter ) } else { - if (iter == NULL) + if (iter == nullptr) return (m_root->GetChildCount() > 0); wxDataViewItem item( (void*) iter->user_data ); @@ -4316,14 +4316,14 @@ gint wxDataViewCtrlInternal::iter_n_children( GtkTreeIter *iter ) { wxDataViewVirtualListModel *wx_model = (wxDataViewVirtualListModel*) m_wx_model; - if (iter == NULL) + if (iter == nullptr) return (gint) wx_model->GetCount(); return 0; } else { - if (iter == NULL) + if (iter == nullptr) return m_root->GetChildCount(); wxDataViewItem item( (void*) iter->user_data ); @@ -4364,7 +4364,7 @@ gboolean wxDataViewCtrlInternal::iter_nth_child( GtkTreeIter *iter, GtkTreeIter } else { - void* id = NULL; + void* id = nullptr; if (parent) id = (void*) parent->user_data; wxDataViewItem item( id ); @@ -4431,8 +4431,8 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( const wxDataViewItem &item if ( !item.IsOk() ) return m_root; - if( m_wx_model == NULL ) - return NULL; + if( m_wx_model == nullptr ) + return nullptr; ItemList list; list.DeleteContents( true ); @@ -4475,11 +4475,11 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( const wxDataViewItem &item if( j == len ) { - return NULL; + return nullptr; } } else - return NULL; + return nullptr; } return node; @@ -4499,7 +4499,7 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( GtkTreeIter *iter ) if (!result) { wxLogDebug( "Not found %p", iter->user_data ); - char *crash = NULL; + char *crash = nullptr; *crash = 0; } // TODO: remove this code @@ -4511,13 +4511,13 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindNode( GtkTreeIter *iter ) static wxGtkTreeModelNode* wxDataViewCtrlInternal_FindParentNode( wxDataViewModel * model, wxGtkTreeModelNode *treeNode, const wxDataViewItem &item ) { - if( model == NULL ) - return NULL; + if( model == nullptr ) + return nullptr; ItemList list; list.DeleteContents( true ); if( !item.IsOk() ) - return NULL; + return nullptr; wxDataViewItem it( model->GetParent( item ) ); while( it.IsOk() ) @@ -4546,11 +4546,11 @@ wxDataViewCtrlInternal_FindParentNode( wxDataViewModel * model, wxGtkTreeModelNo if( j == len ) { - return NULL; + return nullptr; } } else - return NULL; + return nullptr; } //Examine whether the node is item's parent node int len = node->GetChildCount(); @@ -4559,17 +4559,17 @@ wxDataViewCtrlInternal_FindParentNode( wxDataViewModel * model, wxGtkTreeModelNo if( node->GetChildren().Item( i ) == item.GetID() ) return node; } - return NULL; + return nullptr; } wxGtkTreeModelNode *wxDataViewCtrlInternal::FindParentNode( GtkTreeIter *iter ) { if (!iter) - return NULL; + return nullptr; wxDataViewItem item( (void*) iter->user_data ); if (!item.IsOk()) - return NULL; + return nullptr; return wxDataViewCtrlInternal_FindParentNode( m_wx_model, m_root, item ); } @@ -4577,7 +4577,7 @@ wxGtkTreeModelNode *wxDataViewCtrlInternal::FindParentNode( GtkTreeIter *iter ) wxGtkTreeModelNode *wxDataViewCtrlInternal::FindParentNode( const wxDataViewItem &item ) { if (!item.IsOk()) - return NULL; + return nullptr; return wxDataViewCtrlInternal_FindParentNode( m_wx_model, m_root, item ); } @@ -4672,14 +4672,14 @@ gtk_dataview_motion_notify_callback( GtkWidget *WXUNUSED(widget), if (gdk_event->is_hint) { #ifdef __WXGTK3__ - gdk_window_get_device_position(gdk_event->window, gdk_event->device, &x, &y, NULL); + gdk_window_get_device_position(gdk_event->window, gdk_event->device, &x, &y, nullptr); #else - gdk_window_get_pointer(gdk_event->window, &x, &y, NULL); + gdk_window_get_pointer(gdk_event->window, &x, &y, nullptr); #endif } wxGtkTreePath path; - GtkTreeViewColumn *column = NULL; + GtkTreeViewColumn *column = nullptr; gint cell_x = 0; gint cell_y = 0; if (gtk_tree_view_get_path_at_pos( @@ -4724,7 +4724,7 @@ gtk_dataview_button_press_callback( GtkWidget *WXUNUSED(widget), int x = int(gdk_event->x); int y = int(gdk_event->y); wxGtkTreePath path; - GtkTreeViewColumn *column = NULL; + GtkTreeViewColumn *column = nullptr; gint cell_x = 0; gint cell_y = 0; gtk_tree_view_get_path_at_pos @@ -4775,7 +4775,7 @@ wxDataViewCtrl::~wxDataViewCtrl() if ( m_treeview ) { GtkTreeViewColumn *col; - gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), nullptr, &col); wxDataViewColumn * const wxcol = GTKColumnToWX(col); if ( wxcol ) @@ -4797,8 +4797,8 @@ wxDataViewCtrl::~wxDataViewCtrl() void wxDataViewCtrl::Init() { - m_treeview = NULL; - m_internal = NULL; + m_treeview = nullptr; + m_internal = nullptr; m_cols.DeleteContents( true ); @@ -4820,7 +4820,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent, return false; } - m_widget = gtk_scrolled_window_new (NULL, NULL); + m_widget = gtk_scrolled_window_new (nullptr, nullptr); g_object_ref(m_widget); GTKScrolledWindowSetBorder(m_widget, style); @@ -4909,7 +4909,7 @@ wxDataViewItem wxDataViewCtrl::GTKPathToItem(GtkTreePath *path) const GtkTreeIter iter; return wxDataViewItem(path && m_internal->get_iter(&iter, path) ? iter.user_data - : NULL); + : nullptr); } void wxDataViewCtrl::OnInternalIdle() @@ -4935,8 +4935,8 @@ void wxDataViewCtrl::OnInternalIdle() GtkTreeIter iter; iter.user_data = (gpointer) m_ensureVisibleDefered.GetID(); wxGtkTreePath path(m_internal->get_path( &iter )); - gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, NULL, false, 0.0, 0.0 ); - m_ensureVisibleDefered = wxDataViewItem(0); + gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, nullptr, false, 0.0, 0.0 ); + m_ensureVisibleDefered = wxDataViewItem(nullptr); } } @@ -5030,7 +5030,7 @@ unsigned int wxDataViewCtrl::GetColumnCount() const wxDataViewColumn* wxDataViewCtrl::GTKColumnToWX(GtkTreeViewColumn *gtk_col) const { if ( !gtk_col ) - return NULL; + return nullptr; wxDataViewColumnList::const_iterator iter; for (iter = m_cols.begin(); iter != m_cols.end(); ++iter) @@ -5044,7 +5044,7 @@ wxDataViewColumn* wxDataViewCtrl::GTKColumnToWX(GtkTreeViewColumn *gtk_col) cons wxFAIL_MSG( "No matching column?" ); - return NULL; + return nullptr; } wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const @@ -5090,7 +5090,7 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const { - wxCHECK_MSG( m_internal, NULL, "model must be associated before calling GetSortingColumn" ); + wxCHECK_MSG( m_internal, nullptr, "model must be associated before calling GetSortingColumn" ); return m_internal->GetDataViewSortColumn(); } @@ -5132,7 +5132,7 @@ wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const return wxDataViewItem(); wxGtkTreePath path; - gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), path.ByRef(), NULL); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), path.ByRef(), nullptr); return GTKPathToItem(path); } @@ -5159,7 +5159,7 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item) iter.user_data = item.GetID(); wxGtkTreePath path(m_internal->get_path( &iter )); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, NULL, FALSE); + gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, nullptr, FALSE); } wxDataViewItem wxDataViewCtrl::GetTopItem() const @@ -5173,7 +5173,7 @@ wxDataViewItem wxDataViewCtrl::GetTopItem() const ( GTK_TREE_VIEW(m_treeview), start.ByRef(), - NULL + nullptr ) ) { return GTKPathToItem(start); @@ -5195,8 +5195,8 @@ int wxDataViewCtrl::GetCountPerPage() const 0, path.ByRef(), &column, - NULL, - NULL + nullptr, + nullptr ) ) { return -1; @@ -5218,12 +5218,12 @@ wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const { // The tree doesn't have any current item if it hadn't been created yet but // it's arguably not an error to call this function in this case so just - // return NULL without asserting. + // return nullptr without asserting. if ( !m_treeview ) - return NULL; + return nullptr; GtkTreeViewColumn *col; - gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); + gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), nullptr, &col); return GTKColumnToWX(col); } @@ -5285,7 +5285,7 @@ int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const else { GtkTreeIter iter; - if (gtk_tree_selection_get_selected( selection, NULL, &iter )) + if (gtk_tree_selection_get_selected( selection, nullptr, &iter )) { sel.Add( wxDataViewItem(iter.user_data) ); } @@ -5397,7 +5397,7 @@ void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item, GtkTreeIter iter; iter.user_data = (gpointer) item.GetID(); wxGtkTreePath path(m_internal->get_path( &iter )); - gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, NULL, false, 0.0, 0.0 ); + gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW(m_treeview), path, nullptr, false, 0.0, 0.0 ); } void wxDataViewCtrl::HitTest(const wxPoint& point, @@ -5410,10 +5410,10 @@ void wxDataViewCtrl::HitTest(const wxPoint& point, // gtk_tree_view_get_path_at_pos() is the wrong function. It doesn't mind the header but returns column. // See http://mail.gnome.org/archives/gtkmm-list/2005-January/msg00080.html // So we have to use both of them. - item = wxDataViewItem(0); - column = NULL; + item = wxDataViewItem(nullptr); + column = nullptr; wxGtkTreePath path, pathScratch; - GtkTreeViewColumn* GtkColumn = NULL; + GtkTreeViewColumn* GtkColumn = nullptr; GtkTreeViewDropPosition pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER; gint cell_x = 0; gint cell_y = 0; @@ -5431,7 +5431,7 @@ void wxDataViewCtrl::HitTest(const wxPoint& point, &cell_x, &cell_y ); - if ( GtkColumn != NULL ) + if ( GtkColumn != nullptr ) { // we got GTK column // the right call now which takes the header into account @@ -5460,7 +5460,7 @@ wxDataViewCtrl::GetItemRect(const wxDataViewItem& item, if ( !item ) return wxRect(); - GtkTreeViewColumn *gcolumn = NULL ; + GtkTreeViewColumn *gcolumn = nullptr ; if (column) gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle()); @@ -5478,7 +5478,7 @@ wxDataViewCtrl::GetItemRect(const wxDataViewItem& item, if ( item_rect.height == 0 ) return wxRect(); - // If column is NULL we compute the combined width of all the columns + // If column is null we compute the combined width of all the columns if ( !column ) { unsigned int cols = GetColumnCount(); diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 3d6f47c223..753f6a41aa 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -54,7 +54,7 @@ void wxGTKCairoDCImpl::DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool u { wxCHECK_RET(IsOk(), "invalid DC"); - cairo_t* cr = NULL; + cairo_t* cr = nullptr; if (m_graphicContext) cr = static_cast(m_graphicContext->GetNativeContext()); if (cr) @@ -204,7 +204,7 @@ bool wxGTKCairoDCImpl::DoGetPixel(int x, int y, wxColour* col) const { if (col) { - cairo_t* cr = NULL; + cairo_t* cr = nullptr; if (m_graphicContext) cr = static_cast(m_graphicContext->GetNativeContext()); if (cr) @@ -239,21 +239,21 @@ bool wxGTKCairoDCImpl::DoStretchBlit(int xdest, int ydest, int dstWidth, int dst wxCHECK_MSG(IsOk(), false, "invalid DC"); wxCHECK_MSG(source && source->IsOk(), false, "invalid source DC"); - cairo_t* cr = NULL; + cairo_t* cr = nullptr; if (m_graphicContext) cr = static_cast(m_graphicContext->GetNativeContext()); - cairo_t* cr_src = NULL; + cairo_t* cr_src = nullptr; wxGraphicsContext* gc_src = source->GetGraphicsContext(); if (gc_src) cr_src = static_cast(gc_src->GetNativeContext()); - if (cr == NULL || cr_src == NULL) + if (cr == nullptr || cr_src == nullptr) return false; cairo_surface_t* surfaceSrc = cairo_get_target(cr_src); cairo_surface_flush(surfaceSrc); - cairo_surface_t* surfaceTmp = NULL; + cairo_surface_t* surfaceTmp = nullptr; // If destination (this) and source wxDC refer to the same Cairo context // it means that we operate on one surface and results of drawing // can be invalid if destination and source regions overlap. @@ -315,7 +315,7 @@ bool wxGTKCairoDCImpl::DoStretchBlit(int xdest, int ydest, int dstWidth, int dst const wxRasterOperationMode rop_save = m_logicalFunction; SetLogicalFunction(rop); cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_NEAREST); - cairo_surface_t* maskSurf = NULL; + cairo_surface_t* maskSurf = nullptr; if (useMask) { if (bitmap.IsOk()) @@ -361,7 +361,7 @@ bool wxGTKCairoDCImpl::DoStretchBlit(int xdest, int ydest, int dstWidth, int dst void* wxGTKCairoDCImpl::GetCairoContext() const { - cairo_t* cr = NULL; + cairo_t* cr = nullptr; if (m_graphicContext) cr = static_cast(m_graphicContext->GetNativeContext()); return cr; @@ -410,9 +410,9 @@ wxWindowDCImpl::wxWindowDCImpl(wxWindowDC* owner, wxWindow* window) : wxGTKCairoDCImpl(owner, window) { GtkWidget* widget = window->m_wxwindow; - if (widget == NULL) + if (widget == nullptr) widget = window->m_widget; - GdkWindow* gdkWindow = NULL; + GdkWindow* gdkWindow = nullptr; if (widget) { gdkWindow = gtk_widget_get_window(widget); @@ -457,9 +457,9 @@ wxClientDCImpl::wxClientDCImpl(wxClientDC* owner, wxWindow* window) : wxGTKCairoDCImpl(owner, window) { GtkWidget* widget = window->m_wxwindow; - if (widget == NULL) + if (widget == nullptr) widget = window->m_widget; - GdkWindow* gdkWindow = NULL; + GdkWindow* gdkWindow = nullptr; if (widget) { window->GetClientSize(&m_size.x, &m_size.y); @@ -518,7 +518,7 @@ void wxPaintDCImpl::DestroyClippingRegion() //----------------------------------------------------------------------------- wxScreenDCImpl::wxScreenDCImpl(wxScreenDC* owner) - : wxGTKCairoDCImpl(owner, static_cast(NULL)) + : wxGTKCairoDCImpl(owner, static_cast(nullptr)) { GdkWindow* window = gdk_get_default_root_window(); InitSize(window); @@ -543,7 +543,7 @@ wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC* owner) } wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap) - : wxGTKCairoDCImpl(owner, static_cast(NULL)) + : wxGTKCairoDCImpl(owner, static_cast(nullptr)) , m_bitmap(bitmap) { Setup(); @@ -578,7 +578,7 @@ wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() void wxMemoryDCImpl::Setup() { - wxGraphicsContext* gc = NULL; + wxGraphicsContext* gc = nullptr; m_ok = m_bitmap.IsOk(); if (m_ok) { diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 8adfd0aeae..4d909d78d4 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -68,7 +68,7 @@ static GdkPixmap* GetHatch(int style) { wxASSERT(style >= wxBRUSHSTYLE_FIRST_HATCH && style <= wxBRUSHSTYLE_LAST_HATCH); const int i = style - wxBRUSHSTYLE_FIRST_HATCH; - if (hatches[i] == NULL) + if (hatches[i] == nullptr) { // This macro creates a bitmap from an XBM file included above. Notice // the need for the cast because gdk_bitmap_create_from_data() doesn't @@ -77,7 +77,7 @@ static GdkPixmap* GetHatch(int style) #define CREATE_FROM_XBM_DATA(name) \ gdk_bitmap_create_from_data \ ( \ - NULL, \ + nullptr, \ reinterpret_cast(name ## _bits), \ name ## _width, \ name ## _height \ @@ -146,7 +146,7 @@ struct wxGC static int wxGCPoolSize = 0; -static wxGC *wxGCPool = NULL; +static wxGC *wxGCPool = nullptr; static void wxInitGCPool() { @@ -159,7 +159,7 @@ static void wxInitGCPool() // Allocate initial pool. wxGCPool = (wxGC *)malloc(wxGCPoolSize * sizeof(wxGC)); - if (wxGCPool == NULL) + if (wxGCPool == nullptr) { // If we cannot malloc, then fail with error // when debug is enabled. If debug is not enabled, @@ -182,7 +182,7 @@ static void wxCleanUpGCPool() } free(wxGCPool); - wxGCPool = NULL; + wxGCPool = nullptr; wxGCPoolSize = 0; } @@ -211,7 +211,7 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type ) // We need to grow the GC pool. pptr = (wxGC *)realloc(wxGCPool, (wxGCPoolSize + GC_POOL_ALLOC_SIZE)*sizeof(wxGC)); - if (pptr != NULL) + if (pptr != nullptr) { // Initialize newly allocated pool. wxGCPool = pptr; @@ -234,7 +234,7 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type ) // The realloc failed. Fall through to error. wxFAIL_MSG( wxT("No GC available") ); - return NULL; + return nullptr; } static void wxFreePoolGC( GdkGC *gc ) @@ -260,16 +260,16 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGTKDCImpl); wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) : wxGTKDCImpl( owner ) { - m_gdkwindow = NULL; - m_penGC = NULL; - m_brushGC = NULL; - m_textGC = NULL; - m_bgGC = NULL; - m_cmap = NULL; + m_gdkwindow = nullptr; + m_penGC = nullptr; + m_brushGC = nullptr; + m_textGC = nullptr; + m_bgGC = nullptr; + m_cmap = nullptr; m_isScreenDC = false; - m_context = NULL; - m_layout = NULL; - m_fontdesc = NULL; + m_context = nullptr; + m_layout = nullptr; + m_fontdesc = nullptr; m_isClipBoxValid = false; } @@ -278,12 +278,12 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : { wxASSERT_MSG( window, wxT("DC needs a window") ); - m_gdkwindow = NULL; - m_penGC = NULL; - m_brushGC = NULL; - m_textGC = NULL; - m_bgGC = NULL; - m_cmap = NULL; + m_gdkwindow = nullptr; + m_penGC = nullptr; + m_brushGC = nullptr; + m_textGC = nullptr; + m_bgGC = nullptr; + m_cmap = nullptr; m_isScreenDC = false; m_font = window->GetFont(); m_isClipBoxValid = false; @@ -448,10 +448,10 @@ void wxWindowDCImpl::SetUpDC( bool isMemDC ) gdk_gc_set_function( m_penGC, GDK_COPY ); /* clipping */ - gdk_gc_set_clip_rectangle( m_penGC, NULL ); - gdk_gc_set_clip_rectangle( m_brushGC, NULL ); - gdk_gc_set_clip_rectangle( m_textGC, NULL ); - gdk_gc_set_clip_rectangle( m_bgGC, NULL ); + gdk_gc_set_clip_rectangle( m_penGC, nullptr ); + gdk_gc_set_clip_rectangle( m_brushGC, nullptr ); + gdk_gc_set_clip_rectangle( m_textGC, nullptr ); + gdk_gc_set_clip_rectangle( m_bgGC, nullptr ); } void wxWindowDCImpl::DoGetSize( int* width, int* height ) const @@ -481,7 +481,7 @@ bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y, bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const { - GdkImage* image = NULL; + GdkImage* image = nullptr; if (m_gdkwindow) { const int x = LogicalToDeviceX(x1); @@ -491,14 +491,14 @@ bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const if (rect.Contains(x, y)) image = gdk_drawable_get_image(m_gdkwindow, x, y, 1, 1); } - if (image == NULL) + if (image == nullptr) { col->UnRef(); return false; } GdkColormap* colormap = gdk_image_get_colormap(image); const unsigned pixel = gdk_image_get_pixel(image, 0, 0); - if (colormap == NULL) + if (colormap == nullptr) *col = pixel ? m_textForegroundColour : m_textBackgroundColour; else { @@ -545,7 +545,7 @@ void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y ) void wxWindowDCImpl::DrawingSetup(GdkGC*& gc, bool& originChanged) { gc = m_brushGC; - GdkPixmap* pixmap = NULL; + GdkPixmap* pixmap = nullptr; const int style = m_brush.GetStyle(); if (style == wxBRUSHSTYLE_STIPPLE || style == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) @@ -992,7 +992,7 @@ static GdkPixbuf* Scale(GdkPixmap* pixmap, int x, int y, int w, int h, int dst_w, int dst_h, double sx, double sy) { GdkPixbuf* pixbuf = gdk_pixbuf_get_from_drawable( - NULL, pixmap, NULL, x, y, 0, 0, w, h); + nullptr, pixmap, nullptr, x, y, 0, 0, w, h); GdkPixbuf* pixbuf2 = Scale(pixbuf, dst_w, dst_h, sx, sy); g_object_unref(pixbuf); return pixbuf2; @@ -1101,7 +1101,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, const bool hasAlpha = bitmap.HasAlpha(); GdkGC* const use_gc = m_penGC; - GdkPixmap* mask = NULL; + GdkPixmap* mask = nullptr; // mask does not work when drawing a pixbuf with alpha if (useMask && !hasAlpha) { @@ -1110,7 +1110,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, mask = *m; } - GdkPixmap* mask_new = NULL; + GdkPixmap* mask_new = nullptr; if (mask) { if (isScaled) @@ -1132,10 +1132,10 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, } // determine whether to use pixmap or pixbuf - GdkPixmap* pixmap = NULL; - GdkPixmap* pixmap_new = NULL; - GdkPixbuf* pixbuf = NULL; - GdkPixbuf* pixbuf_new = NULL; + GdkPixmap* pixmap = nullptr; + GdkPixmap* pixmap_new = nullptr; + GdkPixbuf* pixbuf = nullptr; + GdkPixbuf* pixbuf_new = nullptr; if (bitmap.HasPixmap()) pixmap = bitmap.GetPixmap(); if (pixmap && gdk_drawable_get_depth(pixmap) == 1) @@ -1147,7 +1147,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, pixmap_new = pixmap; } } - else if (hasAlpha || pixmap == NULL) + else if (hasAlpha || pixmap == nullptr) pixbuf = useMask ? bitmap.GetPixbuf() : bitmap.GetPixbufNoMask(); if (isScaled) @@ -1199,8 +1199,8 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, if (!m_gdkwindow) return false; - GdkDrawable* srcDrawable = NULL; - GdkPixmap* mask = NULL; + GdkDrawable* srcDrawable = nullptr; + GdkPixmap* mask = nullptr; wxMemoryDC* memDC = wxDynamicCast(source, wxMemoryDC); if (memDC) { @@ -1221,7 +1221,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxWindowDCImpl* gtk_impl = wxDynamicCast(impl, wxWindowDCImpl); if (gtk_impl) srcDrawable = gtk_impl->GetGDKWindow(); - if (srcDrawable == NULL) + if (srcDrawable == nullptr) return false; } @@ -1289,7 +1289,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, GdkGC* const use_gc = m_penGC; - GdkPixmap* mask_new = NULL; + GdkPixmap* mask_new = nullptr; if (mask) { int srcMask_x = src_x; @@ -1323,7 +1323,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, gdk_gc_set_clip_origin(use_gc, dst_x - srcMask_x, dst_y - srcMask_y); } - GdkPixmap* pixmap = NULL; + GdkPixmap* pixmap = nullptr; if (gdk_drawable_get_depth(srcDrawable) == 1 && (gdk_drawable_get_depth(m_gdkwindow) != 1 || isScaled)) { @@ -1337,7 +1337,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, const wxRasterOperationMode logical_func_save = m_logicalFunction; SetLogicalFunction(logical_func); - if (memDC == NULL) + if (memDC == nullptr) gdk_gc_set_subwindow(use_gc, GDK_INCLUDE_INFERIORS); if (isScaled) @@ -1355,7 +1355,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } SetLogicalFunction(logical_func_save); - if (memDC == NULL) + if (memDC == nullptr) gdk_gc_set_subwindow(use_gc, GDK_CLIP_BY_CHILDREN); if (pixmap) @@ -1388,7 +1388,7 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text, int xLogical, int y pango_layout_set_text(m_layout, wxGTK_CONV(text), -1); const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout); - const GdkColor* bg_col = NULL; + const GdkColor* bg_col = nullptr; if (m_backgroundMode == wxBRUSHSTYLE_SOLID) bg_col = m_textBackgroundColour.GetColor(); @@ -1438,11 +1438,11 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text, int xLogical, int y DeviceToLogicalX(x + maxX - minX), DeviceToLogicalY(y + maxY - minY)); } - gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x, y, m_layout, NULL, bg_col); + gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x, y, m_layout, nullptr, bg_col); - pango_context_set_matrix(m_context, NULL); + pango_context_set_matrix(m_context, nullptr); if (setAttrs) - pango_layout_set_attributes(m_layout, NULL); + pango_layout_set_attributes(m_layout, nullptr); } void wxWindowDCImpl::DoGetTextExtent(const wxString &string, @@ -1478,7 +1478,7 @@ wxCoord wxWindowDCImpl::GetCharWidth() const { pango_layout_set_text( m_layout, "H", 1 ); int w; - pango_layout_get_pixel_size( m_layout, &w, NULL ); + pango_layout_get_pixel_size( m_layout, &w, nullptr ); return w; } @@ -1620,7 +1620,7 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) case wxPENSTYLE_SOLID: default: lineStyle = GDK_LINE_SOLID; - req_dash = NULL; + req_dash = nullptr; req_nb_dash = 0; break; } @@ -2004,7 +2004,7 @@ void wxWindowDCImpl::DestroyClippingRegion() if (!m_gdkwindow) return; - GdkRegion* gdkRegion = NULL; + GdkRegion* gdkRegion = nullptr; if (!m_currentClippingRegion.IsEmpty()) gdkRegion = m_currentClippingRegion.GetRegion(); @@ -2019,13 +2019,13 @@ void wxWindowDCImpl::DestroyClippingRegion() void wxWindowDCImpl::Destroy() { if (m_penGC) wxFreePoolGC( m_penGC ); - m_penGC = NULL; + m_penGC = nullptr; if (m_brushGC) wxFreePoolGC( m_brushGC ); - m_brushGC = NULL; + m_brushGC = nullptr; if (m_textGC) wxFreePoolGC( m_textGC ); - m_textGC = NULL; + m_textGC = nullptr; if (m_bgGC) wxFreePoolGC( m_bgGC ); - m_bgGC = NULL; + m_bgGC = nullptr; } void wxWindowDCImpl::SetDeviceOrigin( wxCoord x, wxCoord y ) @@ -2092,7 +2092,7 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner ) wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win ) : wxWindowDCImpl( owner, win ) { - wxCHECK_RET( win, wxT("NULL window in wxClientDCImpl::wxClientDC") ); + wxCHECK_RET( win, wxT("nullptr window in wxClientDCImpl::wxClientDC") ); #ifdef __WXUNIVERSAL__ wxPoint ptOrigin = win->GetClientAreaOrigin(); diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index a12d8570d0..b9c4456db3 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -72,7 +72,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) else { m_ok = false; - m_gdkwindow = NULL; + m_gdkwindow = nullptr; } } diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index c399ad5775..a3115c037e 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -31,7 +31,7 @@ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxGUIEventLoop) void wxDialog::Init() { - m_modalLoop = NULL; + m_modalLoop = nullptr; m_modalShowing = false; } @@ -151,7 +151,7 @@ int wxDialog::ShowModal() if (wx_is_at_least_gtk2(24)) { sigId = g_signal_lookup("realize", GTK_TYPE_WIDGET); - hookId = g_signal_add_emission_hook(sigId, 0, realize_hook, NULL, NULL); + hookId = g_signal_add_emission_hook(sigId, 0, realize_hook, nullptr, nullptr); } #endif diff --git a/src/gtk/dirdlg.cpp b/src/gtk/dirdlg.cpp index 317acab13e..03e6779286 100644 --- a/src/gtk/dirdlg.cpp +++ b/src/gtk/dirdlg.cpp @@ -84,7 +84,7 @@ bool wxDirDialog::Create(wxWindow* parent, return false; } - GtkWindow* gtk_parent = NULL; + GtkWindow* gtk_parent = nullptr; if (parent) gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) ); @@ -104,7 +104,7 @@ bool wxDirDialog::Create(wxWindow* parent, "gtk-open", #endif GTK_RESPONSE_ACCEPT, - NULL); + nullptr); g_object_ref(m_widget); diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index 595ddbb598..afa8fc46b0 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -208,7 +208,7 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* { wxGCC_WARNING_SUPPRESS(deprecated-declarations) #if GTK_CHECK_VERSION(3,4,0) - if (gtk_check_version(3,4,0) == NULL) + if (gtk_check_version(3,4,0) == nullptr) gdk_screen_get_monitor_workarea(screen, monitor, dest); else #endif @@ -334,7 +334,7 @@ int wxDisplayImplGTK::GetDepth() const #if GTK_CHECK_VERSION(3,10,0) double wxDisplayImplGTK::GetScaleFactor() const { - if ( gtk_check_version(3,10,0) == NULL ) + if ( gtk_check_version(3,10,0) == nullptr ) return gdk_screen_get_monitor_scale_factor(m_screen, m_index); return 1.0; diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index 7b4883917d..2b21edf83a 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -174,7 +174,7 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget), drop_target->m_firstMotion = true; /* after this, invalidate the drop_target's GdkDragContext */ - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragContext( nullptr ); } } @@ -209,9 +209,9 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), drop_target->GTKSetDragContext( context ); // Does the source actually accept the data type? - if (drop_target->GTKGetMatchingPair() == (GdkAtom) 0) + if (drop_target->GTKGetMatchingPair() == (GdkAtom) nullptr) { - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragContext( nullptr ); return FALSE; } @@ -246,7 +246,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget), gdk_drag_status( context, result_action, time ); // after this, invalidate the drop_target's GdkDragContext - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragContext( nullptr ); // this has to be done because GDK has no "drag_enter" event drop_target->m_firstMotion = false; @@ -277,7 +277,7 @@ static gboolean target_drag_drop( GtkWidget *widget, drop_target->GTKSetDragContext( context ); // Does the source actually accept the data type? - if (drop_target->GTKGetMatchingPair() == (GdkAtom) 0) + if (drop_target->GTKGetMatchingPair() == (GdkAtom) nullptr) { // cancel the whole thing gtk_drag_finish( context, @@ -285,7 +285,7 @@ static gboolean target_drag_drop( GtkWidget *widget, FALSE, // don't delete data on dropping side time ); - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragContext( nullptr ); drop_target->m_firstMotion = true; @@ -334,10 +334,10 @@ static gboolean target_drag_drop( GtkWidget *widget, } /* after this, invalidate the drop_target's GdkDragContext */ - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragContext( nullptr ); /* after this, invalidate the drop_target's drag widget */ - drop_target->GTKSetDragWidget( NULL ); + drop_target->GTKSetDragWidget( nullptr ); /* this has to be done because GDK has no "drag_enter" event */ drop_target->m_firstMotion = true; @@ -397,8 +397,8 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget), } /* after this, invalidate the drop_target's GtkSelectionData and GdkDragContext */ - drop_target->GTKSetDragData( NULL ); - drop_target->GTKSetDragContext( NULL ); + drop_target->GTKSetDragData( nullptr ); + drop_target->GTKSetDragContext( nullptr ); } } @@ -410,9 +410,9 @@ wxDropTarget::wxDropTarget( wxDataObject *data ) : wxDropTargetBase( data ) { m_firstMotion = true; - m_dragContext = NULL; - m_dragWidget = NULL; - m_dragData = NULL; + m_dragContext = nullptr; + m_dragWidget = nullptr; + m_dragData = nullptr; m_dragTime = 0; } @@ -502,10 +502,10 @@ wxDataFormat wxDropTarget::GetMatchingPair() GdkAtom wxDropTarget::GTKGetMatchingPair(bool quiet) { if (!m_dataObject) - return (GdkAtom) 0; + return (GdkAtom) nullptr; if (!m_dragContext) - return (GdkAtom) 0; + return (GdkAtom) nullptr; const GList* child = gdk_drag_context_list_targets(m_dragContext); while (child) @@ -525,7 +525,7 @@ GdkAtom wxDropTarget::GTKGetMatchingPair(bool quiet) child = child->next; } - return (GdkAtom) 0; + return (GdkAtom) nullptr; } bool wxDropTarget::GetData() @@ -550,7 +550,7 @@ bool wxDropTarget::GetData() void wxDropTarget::GtkUnregisterWidget( GtkWidget *widget ) { - wxCHECK_RET( widget != NULL, wxT("unregister widget is NULL") ); + wxCHECK_RET( widget != nullptr, wxT("unregister widget is null") ); gtk_drag_dest_unset( widget ); @@ -566,7 +566,7 @@ void wxDropTarget::GtkUnregisterWidget( GtkWidget *widget ) void wxDropTarget::GtkRegisterWidget( GtkWidget *widget ) { - wxCHECK_RET( widget != NULL, wxT("register widget is NULL") ); + wxCHECK_RET( widget != nullptr, wxT("register widget is null") ); /* gtk_drag_dest_set() determines what default behaviour we'd like GTK to supply. we don't want to specify out targets (=formats) @@ -580,7 +580,7 @@ void wxDropTarget::GtkRegisterWidget( GtkWidget *widget ) gtk_drag_dest_set( widget, (GtkDestDefaults) 0, /* no default behaviour */ - NULL, /* we don't supply any formats here */ + nullptr, /* we don't supply any formats here */ 0, /* number of targets = 0 */ (GdkDragAction) 0 ); /* we don't supply any actions here */ @@ -699,7 +699,7 @@ wxDropSource::wxDropSource(wxWindow *win, { m_waiting = true; - m_iconWindow = NULL; + m_iconWindow = nullptr; m_window = win; m_widget = win->m_widget; @@ -720,7 +720,7 @@ wxDropSource::wxDropSource(wxDataObject& data, SetData( data ); - m_iconWindow = NULL; + m_iconWindow = nullptr; m_window = win; m_widget = win->m_widget; @@ -754,7 +754,7 @@ wxDropSource::~wxDropSource() void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) { // get the right icon to display - wxIcon *icon = NULL; + wxIcon *icon = nullptr; if ( action & GDK_ACTION_MOVE ) icon = &m_iconMove; else if ( action & GDK_ACTION_COPY ) @@ -767,7 +767,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) if ( icon->GetMask() ) mask = *icon->GetMask(); else - mask = NULL; + mask = nullptr; GdkPixmap *pixmap = icon->GetPixmap(); @@ -800,7 +800,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context ) gdk_window_set_background_pattern(gtk_widget_get_window(m_iconWindow), pattern); wxGCC_WARNING_RESTORE(deprecated-declarations) - cairo_surface_t* mask = NULL; + cairo_surface_t* mask = nullptr; if (icon->GetMask()) mask = *icon->GetMask(); if (mask) @@ -833,7 +833,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) return wxDragNone; // we can only start a drag after a mouse event - if (g_lastMouseEvent == NULL) + if (g_lastMouseEvent == nullptr) return wxDragNone; GTKConnectDragSignals(); @@ -841,7 +841,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) m_waiting = true; - GtkTargetList *target_list = gtk_target_list_new( NULL, 0 ); + GtkTargetList *target_list = gtk_target_list_new( nullptr, 0 ); wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ]; m_data->GetAllFormats( array ); diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index 5648099dfe..1567a993b6 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -154,7 +154,7 @@ public: virtual wxEventLoopSource* AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) override { - wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); + wxCHECK_MSG( fd != -1, nullptr, "can't monitor invalid fd" ); int condition = 0; if ( flags & wxEVENT_SOURCE_INPUT ) @@ -176,7 +176,7 @@ public: g_io_channel_unref(channel); if ( !sourceId ) - return NULL; + return nullptr; wxLogTrace(wxTRACE_EVT_SOURCE, "Adding event loop source for fd=%d with GTK id=%u", @@ -374,12 +374,12 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess) // and then call gtk_main_do_event()! // In particular in this way we also process input from sources like // GIOChannels (this is needed for e.g. wxGUIAppTraits::WaitForChild). - gdk_event_handler_set(wxgtk_main_do_event, this, NULL); + gdk_event_handler_set(wxgtk_main_do_event, this, nullptr); while (Pending()) // avoid false positives from our idle source gtk_main_iteration(); wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() - gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL); + gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, nullptr, nullptr); wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() wxEventLoopBase::DoYieldFor(eventsToProcess); diff --git a/src/gtk/filectrl.cpp b/src/gtk/filectrl.cpp index bb887e8fdf..e9c0db5654 100644 --- a/src/gtk/filectrl.cpp +++ b/src/gtk/filectrl.cpp @@ -190,7 +190,7 @@ void wxGtkFileChooser::SetFilterIndex( int filterIndex ) filter = g_slist_nth_data( filters, filterIndex ); - if ( filter != NULL ) + if ( filter != nullptr ) { gtk_file_chooser_set_filter( chooser, GTK_FILE_FILTER( filter ) ); } @@ -221,7 +221,7 @@ int wxGtkFileChooser::GetFilterIndex() const bool wxGtkFileChooser::HasFilterChoice() const { - return gtk_file_chooser_get_filter( m_widget ) != NULL; + return gtk_file_chooser_get_filter( m_widget ) != nullptr; } //----------------------------------------------------------------------------- diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 20dc80b26a..e2d334a3d2 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -140,8 +140,8 @@ static void gtk_filedialog_update_preview_callback(GtkFileChooser *chooser, if ( !filename ) return; - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(filename, 128, 128, NULL); - gboolean have_preview = pixbuf != NULL; + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(filename, 128, 128, nullptr); + gboolean have_preview = pixbuf != nullptr; gtk_image_set_from_pixbuf(GTK_IMAGE(preview), pixbuf); if ( pixbuf ) @@ -210,7 +210,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, } GtkFileChooserAction gtk_action; - GtkWindow* gtk_parent = NULL; + GtkWindow* gtk_parent = nullptr; if (parent) gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) ); @@ -245,7 +245,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, #endif GTK_RESPONSE_CANCEL, static_cast(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT, - NULL); + nullptr); g_object_ref(m_widget); GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget); @@ -359,7 +359,7 @@ wxFileDialog::~wxFileDialog() // get chooser to drop its reference right now, allowing wxWindow dtor // to verify that ref count drops to zero gtk_file_chooser_set_extra_widget( - GTK_FILE_CHOOSER(m_widget), NULL); + GTK_FILE_CHOOSER(m_widget), nullptr); } } diff --git a/src/gtk/filehistory.cpp b/src/gtk/filehistory.cpp index fb6db772a1..030f7e3439 100644 --- a/src/gtk/filehistory.cpp +++ b/src/gtk/filehistory.cpp @@ -40,7 +40,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file) const wxString fullPath = wxFileName(file).GetFullPath(); if ( wx_is_at_least_gtk2(10) ) { - wxGtkString uri(g_filename_to_uri(wxGTK_CONV_FN(fullPath), NULL, NULL)); + wxGtkString uri(g_filename_to_uri(wxGTK_CONV_FN(fullPath), nullptr, nullptr)); if ( uri ) gtk_recent_manager_add_item(gtk_recent_manager_get_default(), uri); diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index bdc03f80b2..5317f5f93a 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -66,7 +66,7 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, m_path = path; m_message = message; m_wildcard = wildcard; - if ((m_dialog = CreateDialog()) == NULL) + if ((m_dialog = CreateDialog()) == nullptr) return false; // little trick used to avoid problems when there are other GTK windows 'grabbed': @@ -78,8 +78,8 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, // Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton, // thus we add grab on m_dialog->m_widget when it's shown and remove it when it's // hidden simply using its "show" and "hide" events - clean & simple :) - g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL); - g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL); + g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), nullptr); + g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), nullptr); // use as label the currently selected file m_widget = gtk_file_chooser_button_new_with_dialog( m_dialog->m_widget ); @@ -248,7 +248,7 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, SetWindowStyle(style); m_message = message; m_wildcard = wildcard; - if ((m_dialog = CreateDialog()) == NULL) + if ((m_dialog = CreateDialog()) == nullptr) return false; // little trick used to avoid problems when there are other GTK windows 'grabbed': @@ -260,8 +260,8 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, // Unfortunately there's no way to hook in the 'clicked' event of the GtkFileChooserButton, // thus we add grab on m_dialog->m_widget when it's shown and remove it when it's // hidden simply using its "show" and "hide" events - clean & simple :) - g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), NULL); - g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), NULL); + g_signal_connect(m_dialog->m_widget, "show", G_CALLBACK(gtk_grab_add), nullptr); + g_signal_connect(m_dialog->m_widget, "hide", G_CALLBACK(gtk_grab_remove), nullptr); // NOTE: we deliberately ignore the given label as GtkFileChooserButton @@ -271,7 +271,7 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, SetPath(path); #ifdef __WXGTK3__ - if (gtk_check_version(3,8,0) == NULL) + if (gtk_check_version(3,8,0) == nullptr) g_signal_connect(m_widget, "file_set", G_CALLBACK(file_set), this); else #endif diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index e4fa528860..fae6b3c6d6 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -152,7 +152,7 @@ bool wxFontRefData::SetPixelSize(const wxSize& pixelSize) wxCHECK_MSG( pixelSize.GetWidth() >= 0 && pixelSize.GetHeight() > 0, false, "Negative values for the pixel size or zero pixel height are not allowed" ); - if (wx_pango_version_check(1,8,0) != NULL || + if (wx_pango_version_check(1,8,0) != nullptr || pixelSize.GetWidth() != 0) { // NOTE: pango_font_description_set_absolute_size() only sets the font height; @@ -340,7 +340,7 @@ wxFontEncoding wxFont::GetEncoding() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid font") ); return &(M_FONTDATA->m_nativeFontInfo); } @@ -516,7 +516,7 @@ extern PangoContext* wxGetPangoContext(); namespace { -FcConfig* gs_fcConfig = NULL; +FcConfig* gs_fcConfig = nullptr; // Module used to clean up the global FcConfig. class wxFcConfigDestroyModule : public wxModule @@ -530,7 +530,7 @@ public: if ( gs_fcConfig ) { FcConfigDestroy(gs_fcConfig); - gs_fcConfig = NULL; + gs_fcConfig = nullptr; } } @@ -547,7 +547,7 @@ bool wxFontBase::AddPrivateFont(const wxString& filename) // We already checked that we have the required functions at compile-time, // but we should also check if they're available at run-time in case we use // older versions of them than the ones we were compiled with. - if ( wx_pango_version_check(1,38,0) != NULL ) + if ( wx_pango_version_check(1,38,0) != nullptr ) { wxLogError(_("Using private fonts is not supported on this system: " "Pango library is too old, 1.38 or later required.")); diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp index cc8b2f93c8..28b3542dd6 100644 --- a/src/gtk/fontdlg.cpp +++ b/src/gtk/fontdlg.cpp @@ -32,7 +32,7 @@ static void response(GtkDialog* dialog, int response_id, wxFontDialog* win) { rc = wxID_OK; #if GTK_CHECK_VERSION(3,2,0) - if (gtk_check_version(3,2,0) == NULL) + if (gtk_check_version(3,2,0) == nullptr) { wxNativeFontInfo info; info.description = gtk_font_chooser_get_font_desc(GTK_FONT_CHOOSER(dialog)); @@ -75,7 +75,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) } const wxString message(_("Choose font")); - GtkWindow* gtk_parent = NULL; + GtkWindow* gtk_parent = nullptr; if (parent) gtk_parent = GTK_WINDOW(parent->m_widget); @@ -83,7 +83,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) #if GLIB_CHECK_VERSION(2, 34, 0) g_type_ensure(PANGO_TYPE_FONT_FACE); #endif - if (gtk_check_version(3,2,0) == NULL) + if (gtk_check_version(3,2,0) == nullptr) m_widget = gtk_font_chooser_dialog_new(wxGTK_CONV(message), gtk_parent); else #endif @@ -106,7 +106,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent) if ( info ) { #if GTK_CHECK_VERSION(3,2,0) - if (gtk_check_version(3,2,0) == NULL) + if (gtk_check_version(3,2,0) == nullptr) gtk_font_chooser_set_font_desc(GTK_FONT_CHOOSER(m_widget), info->description); else #endif diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 7a6a3e93db..8a9cdaabc8 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -53,7 +53,7 @@ bool wxFrame::Create( wxWindow *parent, void wxFrame::DoGetClientSize( int *width, int *height ) const { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + wxASSERT_MSG( (m_widget != nullptr), wxT("invalid frame") ); wxFrameBase::DoGetClientSize(width, height); @@ -67,7 +67,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const if (m_frameMenuBar && m_frameMenuBar->IsShown()) { int h; - gtk_widget_get_preferred_height(m_frameMenuBar->m_widget, NULL, &h); + gtk_widget_get_preferred_height(m_frameMenuBar->m_widget, nullptr, &h); *height -= h; } #endif // wxUSE_MENUS_NATIVE @@ -88,7 +88,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const if (width) { int w; - gtk_widget_get_preferred_width(m_frameToolBar->m_widget, NULL, &w); + gtk_widget_get_preferred_width(m_frameToolBar->m_widget, nullptr, &w); *width -= w; } } @@ -97,16 +97,16 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const if (height) { int h; - gtk_widget_get_preferred_height(m_frameToolBar->m_widget, NULL, &h); + gtk_widget_get_preferred_height(m_frameToolBar->m_widget, nullptr, &h); *height -= h; } } } #endif // wxUSE_TOOLBAR - if (width != NULL && *width < 0) + if (width != nullptr && *width < 0) *width = 0; - if (height != NULL && *height < 0) + if (height != nullptr && *height < 0) *height = 0; } @@ -119,17 +119,17 @@ bool wxFrame::ShowFullScreen(bool show, long style) #if wxUSE_MENUS m_frameMenuBar, #else - NULL, + nullptr, #endif #if wxUSE_TOOLBAR m_frameToolBar, #else - NULL, + nullptr, #endif #if wxUSE_STATUSBAR m_frameStatusBar, #else - NULL, + nullptr, #endif }; const long fsNoBar[] = { @@ -187,8 +187,8 @@ bool wxFrame::SendIdleEvents(wxIdleEvent& event) void wxFrame::DetachMenuBar() { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); + wxASSERT_MSG( (m_widget != nullptr), wxT("invalid frame") ); + wxASSERT_MSG( (m_wxwindow != nullptr), wxT("invalid frame") ); if ( m_frameMenuBar ) gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget ); diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index ae157c214c..c97260e4ed 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -192,7 +192,7 @@ bool wxGLCanvas::Create(wxWindow *parent, // wxWindow::Create() returns if parent is already visible) #if !wxUSE_GLCANVAS_EGL unsigned sig_id = g_signal_lookup("parent-set", GTK_TYPE_WIDGET); - g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL); + g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, nullptr); #endif wxWindow::Create( parent, id, pos, size, style, name ); diff --git a/src/gtk/gnome/gvfs.cpp b/src/gtk/gnome/gvfs.cpp index d7eb8248ea..951c64c296 100644 --- a/src/gtk/gnome/gvfs.cpp +++ b/src/gtk/gnome/gvfs.cpp @@ -90,7 +90,7 @@ bool wxGnomeVFSLibrary::InitializeMethods() return true; } -static wxGnomeVFSLibrary* gs_lgvfs = NULL; +static wxGnomeVFSLibrary* gs_lgvfs = nullptr; //---------------------------------------------------------------------------- // wxGnomeVFSMimeTypesManagerFactory diff --git a/src/gtk/hyperlink.cpp b/src/gtk/hyperlink.cpp index 8779db9d65..421860ca52 100644 --- a/src/gtk/hyperlink.cpp +++ b/src/gtk/hyperlink.cpp @@ -71,9 +71,9 @@ static void clicked_hook(GtkLinkButton* button, const char*, void*) return; } } - gtk_link_button_set_uri_hook(NULL, NULL, NULL); + gtk_link_button_set_uri_hook(nullptr, nullptr, nullptr); GTK_BUTTON_GET_CLASS(button)->clicked(GTK_BUTTON(button)); - gtk_link_button_set_uri_hook(clicked_hook, NULL, NULL); + gtk_link_button_set_uri_hook(clicked_hook, nullptr, nullptr); } } #endif @@ -143,7 +143,7 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, 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); + gtk_link_button_set_uri_hook(clicked_hook, nullptr, nullptr); #endif m_parent->DoAddChild( this ); @@ -244,7 +244,7 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const 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); + gtk_widget_style_get(widget, "visited-link-color", &link_color, nullptr); if (link_color) { color = *link_color; diff --git a/src/gtk/image_gtk.cpp b/src/gtk/image_gtk.cpp index 02215e3d55..05e5e4365e 100644 --- a/src/gtk/image_gtk.cpp +++ b/src/gtk/image_gtk.cpp @@ -72,10 +72,10 @@ GType wxGtkImage::Type() { const GTypeInfo info = { sizeof(GtkImageClass), - NULL, NULL, - wxGtkImageClassInit, NULL, NULL, - sizeof(wxGtkImage), 0, NULL, - NULL + nullptr, nullptr, + wxGtkImageClassInit, nullptr, nullptr, + sizeof(wxGtkImage), 0, nullptr, + nullptr }; type = g_type_register_static( GTK_TYPE_IMAGE, "wxGtkImage", &info, GTypeFlags(0)); @@ -85,7 +85,7 @@ GType wxGtkImage::Type() GtkWidget* wxGtkImage::New(BitmapProvider* provider) { - wxGtkImage* image = WX_GTK_IMAGE(g_object_new(Type(), NULL)); + wxGtkImage* image = WX_GTK_IMAGE(g_object_new(Type(), nullptr)); image->m_provider = provider; return GTK_WIDGET(image); } @@ -103,7 +103,7 @@ void wxGtkImage::Set(const wxBitmapBundle& bitmapBundle) // different bitmap below. wxBitmap bitmap = bitmapBundle.GetBitmap(wxDefaultSize); - GdkPixbuf* pixbuf = NULL; + GdkPixbuf* pixbuf = nullptr; if (bitmap.IsOk()) { pixbuf = bitmap.GetPixbuf(); @@ -165,7 +165,7 @@ static void wxGtkImageFinalize(GObject* object) { wxGtkImage* image = WX_GTK_IMAGE(object); delete image->m_provider; - image->m_provider = NULL; + image->m_provider = nullptr; G_OBJECT_CLASS(wxGtkImageParentClass)->finalize(object); } diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index 5f9ba2e0c6..4b96adae59 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -42,14 +42,14 @@ class wxInfoBarGTKImpl public: wxInfoBarGTKImpl() { - m_label = NULL; - m_close = NULL; + m_label = nullptr; + m_close = nullptr; } // label for the text shown in the bar GtkWidget *m_label; - // the default close button, NULL if not needed (m_buttons is not empty) or + // the default close button, nullptr if not needed (m_buttons is not empty) or // not created yet GtkWidget *m_close; @@ -150,8 +150,8 @@ bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid) // Run-time check is needed because the bug was introduced in 3.10 and // fixed in 3.22.29 (see 6b4d95e86dabfcdaa805fbf068a99e19736a39a4 and a // couple of previous commits in GTK+ repository). - if ( gtk_check_version(3, 10, 0) == NULL && - gtk_check_version(3, 22, 29) != NULL ) + if ( gtk_check_version(3, 10, 0) == nullptr && + gtk_check_version(3, 22, 29) != nullptr ) { GObject* const revealer = gtk_widget_get_template_child(GTK_WIDGET(m_widget), @@ -277,7 +277,7 @@ void wxInfoBar::AddButton(wxWindowID btnid, const wxString& label) if ( m_impl->m_close ) { gtk_widget_destroy(m_impl->m_close); - m_impl->m_close = NULL; + m_impl->m_close = nullptr; } GtkWidget * const button = GTKAddButton(btnid, label); diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 3e5864fc44..2201fe1c8c 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -235,7 +235,7 @@ search_callback(GtkTreeModel*, int, const char* key, GtkTreeIter* iter, void* da void wxListBox::Init() { - m_treeview = NULL; + m_treeview = nullptr; #if wxUSE_CHECKLISTBOX m_hasCheckBoxes = false; #endif // wxUSE_CHECKLISTBOX @@ -266,7 +266,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, return false; } - m_widget = gtk_scrolled_window_new( NULL, NULL ); + m_widget = gtk_scrolled_window_new( nullptr, nullptr ); g_object_ref(m_widget); GtkPolicyType vPolicy = GTK_POLICY_AUTOMATIC; @@ -296,7 +296,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_tree_view_insert_column_with_attributes(m_treeview, -1, "", gtk_cell_renderer_text_new(), "text", - WXLISTBOX_DATACOLUMN, NULL); + WXLISTBOX_DATACOLUMN, nullptr); // Now create+set the model (GtkListStore) - first argument # of columns #if wxUSE_CHECKLISTBOX @@ -318,7 +318,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, search_callback, this, NULL); + gtk_tree_view_set_search_equal_func(m_treeview, search_callback, this, nullptr); gtk_tree_view_set_enable_search(m_treeview, FALSE); @@ -355,7 +355,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, WXLISTBOX_DATACOLUMN, sort_callback, this, //userdata - NULL //"destroy notifier" + nullptr //"destroy notifier" ); } @@ -439,7 +439,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, void **clientData, wxClientDataType type) { - wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, wxNOT_FOUND, wxT("invalid listbox") ); InvalidateBestSize(); int n = DoInsertItemsInLoop(items, pos, clientData, type); @@ -474,7 +474,7 @@ int wxListBox::DoInsertOneItem(const wxString& item, unsigned int pos) void wxListBox::DoClear() { - wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); + wxCHECK_RET( m_treeview != nullptr, wxT("invalid listbox") ); { wxGtkEventsDisabler noEvents(this); @@ -489,7 +489,7 @@ void wxListBox::DoClear() void wxListBox::DoDeleteOneItem(unsigned int n) { - wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); + wxCHECK_RET( m_treeview != nullptr, wxT("invalid listbox") ); InvalidateBestSize(); @@ -529,7 +529,7 @@ void wxListBox::DoDeleteOneItem(unsigned int n) bool wxListBox::GTKGetIteratorFor(unsigned pos, GtkTreeIter *iter) const { if ( !gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(m_liststore), - iter, NULL, pos) ) + iter, nullptr, pos) ) { wxLogDebug(wxT("gtk_tree_model_iter_nth_child(%u) failed"), pos); return false; @@ -555,7 +555,7 @@ wxTreeEntry* wxListBox::GTKGetEntry(unsigned n) const { GtkTreeIter iter; if ( !GTKGetIteratorFor(n, &iter) ) - return NULL; + return nullptr; return GetEntry(m_liststore, &iter, this); } @@ -567,7 +567,7 @@ wxTreeEntry* wxListBox::GTKGetEntry(unsigned n) const void* wxListBox::DoGetItemClientData(unsigned int n) const { wxTreeEntry* entry = GTKGetEntry(n); - wxCHECK_MSG(entry, NULL, wxT("could not get entry")); + wxCHECK_MSG(entry, nullptr, wxT("could not get entry")); return wx_tree_entry_get_userdata(entry); } @@ -586,7 +586,7 @@ void wxListBox::DoSetItemClientData(unsigned int n, void* clientData) void wxListBox::SetString(unsigned int n, const wxString& label) { - wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); + wxCHECK_RET( m_treeview != nullptr, wxT("invalid listbox") ); GtkTreeIter iter; wxCHECK_RET(GTKGetIteratorFor(n, &iter), "invalid index"); @@ -603,7 +603,7 @@ void wxListBox::SetString(unsigned int n, const wxString& label) wxString wxListBox::GetString(unsigned int n) const { - wxCHECK_MSG( m_treeview != NULL, wxEmptyString, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, wxEmptyString, wxT("invalid listbox") ); wxTreeEntry* entry = GTKGetEntry(n); wxCHECK_MSG( entry, wxEmptyString, wxT("wrong listbox index") ); @@ -613,14 +613,14 @@ wxString wxListBox::GetString(unsigned int n) const unsigned int wxListBox::GetCount() const { - wxCHECK_MSG( m_treeview != NULL, 0, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, 0, wxT("invalid listbox") ); - return (unsigned int)gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), NULL); + return (unsigned int)gtk_tree_model_iter_n_children(GTK_TREE_MODEL(m_liststore), nullptr); } int wxListBox::FindString( const wxString &item, bool bCase ) const { - wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, wxNOT_FOUND, wxT("invalid listbox") ); //Sort of hackish - maybe there is a faster way unsigned int nCount = wxListBox::GetCount(); @@ -661,7 +661,7 @@ void wxListBox::GTKOnSelectionChanged() int wxListBox::GetSelection() const { - wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox")); + wxCHECK_MSG( m_treeview != nullptr, wxNOT_FOUND, wxT("invalid listbox")); wxCHECK_MSG( HasFlag(wxLB_SINGLE), wxNOT_FOUND, wxT("must be single selection listbox")); @@ -669,7 +669,7 @@ int wxListBox::GetSelection() const GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); // only works on single-sel - if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) + if (!gtk_tree_selection_get_selected(selection, nullptr, &iter)) return wxNOT_FOUND; return GTKGetIndexFor(iter); @@ -677,7 +677,7 @@ int wxListBox::GetSelection() const int wxListBox::GetSelections( wxArrayInt& aSelections ) const { - wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, wxNOT_FOUND, wxT("invalid listbox") ); aSelections.Empty(); @@ -701,7 +701,7 @@ int wxListBox::GetSelections( wxArrayInt& aSelections ) const bool wxListBox::IsSelected( int n ) const { - wxCHECK_MSG( m_treeview != NULL, false, wxT("invalid listbox") ); + wxCHECK_MSG( m_treeview != nullptr, false, wxT("invalid listbox") ); GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); @@ -713,7 +713,7 @@ bool wxListBox::IsSelected( int n ) const void wxListBox::DoSetSelection( int n, bool select ) { - wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); + wxCHECK_RET( m_treeview != nullptr, wxT("invalid listbox") ); wxGtkEventsDisabler noEvents(this); @@ -740,7 +740,7 @@ void wxListBox::DoSetSelection( int n, bool select ) 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_view_scroll_to_cell(m_treeview, path, nullptr, FALSE, 0.0f, 0.0f); } void wxListBox::DoScrollToCell(int n, float alignY, float alignX) @@ -760,7 +760,7 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX) 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, + gtk_tree_view_scroll_to_cell(m_treeview, path, nullptr, TRUE, alignY, alignX); } @@ -782,7 +782,7 @@ int wxListBox::GetTopItem() const wxGtkTreePath start; if ( wx_is_at_least_gtk2(8) && - gtk_tree_view_get_visible_range(m_treeview, start.ByRef(), NULL)) + gtk_tree_view_get_visible_range(m_treeview, start.ByRef(), nullptr)) { gint *ptr = gtk_tree_path_get_indices(start); @@ -806,8 +806,8 @@ int wxListBox::GetCountPerPage() const 0, path.ByRef(), &column, - NULL, - NULL + nullptr, + nullptr ) ) { return -1; @@ -839,7 +839,7 @@ int wxListBox::DoListHitTest(const wxPoint& point) const // need to translate from master window since it is in client coords gint binx, biny; gdk_window_get_geometry(gtk_tree_view_get_bin_window(m_treeview), - &binx, &biny, NULL, NULL); + &binx, &biny, nullptr, nullptr); wxGtkTreePath path; if ( !gtk_tree_view_get_path_at_pos @@ -848,9 +848,9 @@ int wxListBox::DoListHitTest(const wxPoint& point) const point.x - binx, point.y - biny, 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 + nullptr, // [out] column (always 0 here) + nullptr, // [out] x-coord relative to the cell (not interested) + nullptr // [out] y-coord relative to the cell ) ) { return wxNOT_FOUND; @@ -912,7 +912,7 @@ wxSize wxListBox::DoGetBestSize() const int wLine; for ( unsigned int i = 0; i < count; i++ ) { - GetTextExtent(GetString(i), &wLine, NULL); + GetTextExtent(GetString(i), &wLine, nullptr); if ( wLine > lbWidth ) lbWidth = wLine; } diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index a8ff73ef09..ce187442e7 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -44,7 +44,7 @@ switch_page(GtkNotebook* widget, GtkNotebookPage*, guint page_num, wxMDIParentFr if ( !client_window ) return; - child = NULL; + child = nullptr; GtkWidget* page = gtk_notebook_get_nth_page(widget, page_num); wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst(); @@ -52,7 +52,7 @@ switch_page(GtkNotebook* widget, GtkNotebookPage*, guint page_num, wxMDIParentFr { wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); - // child_frame can be NULL when this is called from dtor, probably + // child_frame can be null when this is called from dtor, probably // because g_signal_connect (m_widget, "switch_page", (see below) // isn't deleted early enough if (child_frame && child_frame->m_widget == page) @@ -115,7 +115,7 @@ void wxMDIParentFrame::OnInternalIdle() /* need to set the menubar of the child */ wxMDIChildFrame *active_child_frame = GetActiveChild(); - if (active_child_frame != NULL) + if (active_child_frame != nullptr) { wxMenuBar *menu_bar = active_child_frame->m_menuBar; if (menu_bar) @@ -199,7 +199,7 @@ void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const if (menubar && menubar->IsShown()) { GtkRequisition req; - gtk_widget_get_preferred_height(menubar->m_widget, NULL, &req.height); + gtk_widget_get_preferred_height(menubar->m_widget, nullptr, &req.height); *height -= req.height; if (*height < 0) *height = 0; } @@ -209,27 +209,27 @@ void wxMDIParentFrame::DoGetClientSize(int* width, int* height) const wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const { - if (!m_clientWindow) return NULL; + if (!m_clientWindow) return nullptr; GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); - if (!notebook) return NULL; + if (!notebook) return nullptr; gint i = gtk_notebook_get_current_page( notebook ); - if (i < 0) return NULL; + if (i < 0) return nullptr; GtkWidget* page = gtk_notebook_get_nth_page(notebook, i); - if (!page) return NULL; + if (!page) return nullptr; wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst(); while (node) { if ( wxPendingDelete.Member(node->GetData()) ) - return NULL; + return nullptr; wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); if (!child_frame) - return NULL; + return nullptr; if (child_frame->m_widget == page) return child_frame; @@ -237,7 +237,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const node = node->GetNext(); } - return NULL; + return nullptr; } void wxMDIParentFrame::ActivateNext() @@ -265,7 +265,7 @@ wxEND_EVENT_TABLE() void wxMDIChildFrame::Init() { - m_menuBar = NULL; + m_menuBar = nullptr; } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, @@ -301,7 +301,7 @@ void wxMDIChildFrame::GTKHandleRealized() void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { - wxASSERT_MSG( m_menuBar == NULL, "Only one menubar allowed" ); + wxASSERT_MSG( m_menuBar == nullptr, "Only one menubar allowed" ); m_menuBar = menu_bar; @@ -328,7 +328,7 @@ GtkNotebook *wxMDIChildFrame::GTKGetNotebook() const { wxMDIClientWindow * const client = wxStaticCast(GetParent(), wxMDIClientWindow); - wxCHECK( client, NULL ); + wxCHECK( client, nullptr ); return GTK_NOTEBOOK(client->m_widget); } @@ -434,7 +434,7 @@ void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child) GtkWidget *label_widget = gtk_label_new( s.mbc_str() ); #ifdef __WXGTK4__ - g_object_set(label_widget, "xalign", 0.0f, NULL); + g_object_set(label_widget, "xalign", 0.0f, nullptr); #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 64afcbf4bd..6f40bb544d 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -144,8 +144,8 @@ wxMenuBar::~wxMenuBar() void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style) { - if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) || - !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) + if (!PreCreation( nullptr, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( nullptr, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) { wxFAIL_MSG( wxT("wxMenuBar creation failed") ); return; @@ -188,12 +188,12 @@ wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long st wxMenuBar::wxMenuBar(long style) { - Init(0, NULL, NULL, style); + Init(0, nullptr, nullptr, style); } wxMenuBar::wxMenuBar() { - Init(0, NULL, NULL, 0); + Init(0, nullptr, nullptr, 0); } // recursive helpers for wxMenuBar::Attach() and Detach(): they are called to @@ -381,10 +381,10 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) wxMenu *menuOld = Remove(pos); if ( menuOld && !Insert(pos, menu, title) ) { - return NULL; + return nullptr; } - // either Insert() succeeded or Remove() failed and menuOld is NULL + // either Insert() succeeded or Remove() failed and menuOld is null return menuOld; } @@ -392,21 +392,21 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) - return NULL; + return nullptr; // remove item from menubar before destroying item to avoid spurious // warnings from Ubuntu libdbusmenu gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner); // remove submenu to avoid destroying it when item is destroyed #ifdef __WXGTK3__ - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu->m_owner), nullptr); #else gtk_menu_item_remove_submenu(GTK_MENU_ITEM(menu->m_owner)); #endif gtk_widget_destroy( menu->m_owner ); g_object_unref(menu->m_owner); - menu->m_owner = NULL; + menu->m_owner = nullptr; if ( m_menuBarFrame ) DetachFromFrame( menu, m_menuBarFrame ); @@ -457,7 +457,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) wxMenuItem* result = menu->FindChildItem(id); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); - while ( node && result == NULL ) + while ( node && result == nullptr ) { wxMenuItem *item = node->GetData(); if (item->IsSubMenu()) @@ -472,9 +472,9 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const { - wxMenuItem* result = 0; + wxMenuItem* result = nullptr; wxMenuList::compatibility_iterator node = m_menus.GetFirst(); - while (node && result == 0) + while (node && result == nullptr) { wxMenu *menu = node->GetData(); result = FindMenuItemByIdRecursive( menu, id ); @@ -483,7 +483,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const if ( menuForItem ) { - *menuForItem = result ? result->GetMenu() : NULL; + *menuForItem = result ? result->GetMenu() : nullptr; } return result; @@ -639,7 +639,7 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu, wxMenu *subMenu) : wxMenuItemBase(parentMenu, id, text, help, kind, subMenu) { - m_menuItem = NULL; + m_menuItem = nullptr; } wxMenuItem::~wxMenuItem() @@ -851,7 +851,7 @@ void wxMenu::Init() m_menu = gtk_menu_new(); g_object_ref_sink(m_menu); - m_owner = NULL; + m_owner = nullptr; #ifndef __WXGTK4__ // Tearoffs are entries, just like separators. So if we want this @@ -952,7 +952,7 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) { // See if we need to create a new radio group for this item or // add it to an existing one. - wxMenuItem* radioGroupItem = NULL; + wxMenuItem* radioGroupItem = nullptr; const size_t numItems = GetMenuItemCount(); const size_t n = pos == -1 ? numItems - 1 : size_t(pos); @@ -968,7 +968,7 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) } } - if (radioGroupItem == NULL && n != numItems - 1) + if (radioGroupItem == nullptr && n != numItems - 1) { wxMenuItem* const itemNext = FindItemByPosition(n + 1); if ( itemNext->GetKind() == wxITEM_RADIO ) @@ -979,7 +979,7 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) } } - GSList* group = NULL; + GSList* group = nullptr; if ( radioGroupItem ) { group = gtk_radio_menu_item_get_group( @@ -1010,7 +1010,7 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) if (stockid) // use stock bitmap for this item if available on the assumption // that it never hurts to follow GTK+ conventions more closely - menuItem = gtk_image_menu_item_new_from_stock(stockid, NULL); + menuItem = gtk_image_menu_item_new_from_stock(stockid, nullptr); else menuItem = gtk_menu_item_new_with_label(""); } @@ -1063,7 +1063,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem) GtkAppend(mitem); return mitem; } - return NULL; + return nullptr; } wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) @@ -1073,26 +1073,26 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) GtkAppend(item, int(pos)); return item; } - return NULL; + return nullptr; } wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { if ( !wxMenuBase::DoRemove(item) ) - return NULL; + return nullptr; GtkWidget * const mitem = item->GetMenuItem(); g_signal_handlers_disconnect_by_data(mitem, item); #ifdef __WXGTK3__ - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), nullptr); #else gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem)); #endif gtk_widget_destroy(mitem); - item->SetMenuItem(NULL); + item->SetMenuItem(nullptr); return item; } @@ -1581,7 +1581,7 @@ const char *wxGetStockGtkID(wxWindowID id) #undef STOCKITEM - return NULL; + return nullptr; } wxGCC_WARNING_RESTORE(cast-qual) wxGCC_WARNING_RESTORE() diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index c31a3ad16c..ee808fd6b2 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -68,7 +68,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_OUT, - NULL, NULL, NULL, // FIXME: No clipping? + nullptr, nullptr, nullptr, // FIXME: No clipping? 0, 0, win->m_width, win->m_height); @@ -188,10 +188,10 @@ gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, w wxGCC_WARNING_SUPPRESS(deprecated-declarations) gdk_device_grab( gdk_event->device, gdk_event->window, GDK_OWNERSHIP_NONE, - false, mask, NULL, gdk_event->time); + false, mask, nullptr, gdk_event->time); wxGCC_WARNING_RESTORE() #else - gdk_pointer_grab(gdk_event->window, false, mask, NULL, NULL, gdk_event->time); + gdk_pointer_grab(gdk_event->window, false, mask, nullptr, nullptr, gdk_event->time); #endif win->m_dragOffset.Set(int(gdk_event->x), int(gdk_event->y)); @@ -245,7 +245,7 @@ gtk_window_leave_callback(GtkWidget *widget, if (gdk_event->window != gtk_widget_get_window(widget)) return false; - gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); + gdk_window_set_cursor(gtk_widget_get_window(widget), nullptr); return FALSE; } @@ -280,7 +280,7 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, const int x = int(gdk_event->x); const int y = int(gdk_event->y); - GdkCursor* cursor = NULL; + GdkCursor* cursor = nullptr; GdkWindow* window = gtk_widget_get_window(widget); if ((x > win->m_width-14) && (y > win->m_height-14)) { @@ -457,7 +457,7 @@ void wxMiniFrame::SetTitle( const wxString &title ) GdkWindow* window = gtk_widget_get_window(gtk_bin_get_child(GTK_BIN(m_widget))); if (window) - gdk_window_invalidate_rect(window, NULL, false); + gdk_window_invalidate_rect(window, nullptr, false); } #endif // wxUSE_MINIFRAME diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 09b9eb80a1..3ac8995c16 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -110,10 +110,10 @@ void wxMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& label) void wxMessageDialog::GTKCreateMsgDialog() { // Avoid crash if wxMessageBox() is called before GTK is initialized - if (g_type_class_peek(GDK_TYPE_DISPLAY) == NULL) + if (g_type_class_peek(GDK_TYPE_DISPLAY) == nullptr) return; - GtkWindow * const parent = m_parent ? GTK_WINDOW(m_parent->m_widget) : NULL; + GtkWindow * const parent = m_parent ? GTK_WINDOW(m_parent->m_widget) : nullptr; GtkMessageType type = GTK_MESSAGE_ERROR; GtkButtonsType buttons = GTK_BUTTONS_NONE; @@ -273,7 +273,7 @@ int wxMessageDialog::ShowModal() GTKDisconnect(m_widget); gtk_widget_destroy(m_widget); g_object_unref(m_widget); - m_widget = NULL; + m_widget = nullptr; switch (result) { diff --git a/src/gtk/nativewin.cpp b/src/gtk/nativewin.cpp index 678b8f4023..d9f59d1199 100644 --- a/src/gtk/nativewin.cpp +++ b/src/gtk/nativewin.cpp @@ -61,7 +61,7 @@ wxNativeWindow::Create(wxWindow* parent, // Ensure that the best (and minimal) size is set to fully display the // widget. GtkRequisition req; - gtk_widget_get_preferred_size(widget, NULL, &req); + gtk_widget_get_preferred_size(widget, nullptr, &req); SetInitialSize(wxSize(req.width, req.height)); return true; @@ -106,7 +106,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win) { wxCHECK( win, false ); - if ( !wxTopLevelWindow::Create(NULL, wxID_ANY, wxString()) ) + if ( !wxTopLevelWindow::Create(nullptr, wxID_ANY, wxString()) ) return false; // we need to realize the window first before reparenting it @@ -139,7 +139,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowId anid) GdkWindow * const win = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), anid); #else wxUnusedVar(anid); - GdkWindow * const win = NULL; + GdkWindow * const win = nullptr; #endif #else GdkWindow * const win = gdk_window_foreign_new(anid); @@ -166,7 +166,7 @@ void wxNativeContainerWindow::OnNativeDestroyed() // gdk_window_destroy() results in X errors while nulling just the window // pointer and destroying m_widget results in many GTK errors GTKDisconnect(m_widget); - m_widget = NULL; + m_widget = nullptr; // notice that we intentionally don't use Close() nor Delete() here as our // window (and the windows of all of our children) is invalid any more and @@ -180,5 +180,5 @@ wxNativeContainerWindow::~wxNativeContainerWindow() // nothing to do here, either we have a valid m_widget and it will be // destroyed as usual (this corresponds to manual destruction of this C++ // object) or we are being deleted because the native window was destroyed - // and in this case our m_widget was set to NULL by OnNativeDestroyed() + // and in this case our m_widget was set to nullptr by OnNativeDestroyed() } diff --git a/src/gtk/nonownedwnd.cpp b/src/gtk/nonownedwnd.cpp index 47862b83d7..c70655f392 100644 --- a/src/gtk/nonownedwnd.cpp +++ b/src/gtk/nonownedwnd.cpp @@ -64,7 +64,7 @@ protected: wxWindow* const m_win; private: - // SetShape to the given GDK window by calling DoSetShape() if it's non-NULL. + // SetShape to the given GDK window by calling DoSetShape() if it's non-null. bool SetShapeIfNonNull(GdkWindow* window) { return window && DoSetShape(window); @@ -91,7 +91,7 @@ public: private: virtual bool DoSetShape(GdkWindow* window) override { - gdk_window_shape_combine_region(window, NULL, 0, 0); + gdk_window_shape_combine_region(window, nullptr, 0, 0); return true; } @@ -230,7 +230,7 @@ void wxNonOwnedWindow::GTKHandleRealized() if ( m_shapeImpl->CanBeDeleted() ) { delete m_shapeImpl; - m_shapeImpl = NULL; + m_shapeImpl = nullptr; } } } @@ -253,7 +253,7 @@ bool wxNonOwnedWindow::DoClearShape() // don't set the custom shape later when we're realized. delete m_shapeImpl; - m_shapeImpl = NULL; + m_shapeImpl = nullptr; return true; } @@ -262,7 +262,7 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region) { // In any case get rid of the old data. delete m_shapeImpl; - m_shapeImpl = NULL; + m_shapeImpl = nullptr; if ( gtk_widget_get_realized(m_widget) ) { diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index ae20c923f9..7000309f99 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -209,7 +209,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, int wxNotebook::GetSelection() const { - wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") ); + wxCHECK_MSG( m_widget != nullptr, wxNOT_FOUND, wxT("invalid notebook") ); return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) ); } @@ -287,7 +287,7 @@ bool wxNotebook::SetPageImage( size_t page, int image ) const wxBitmapBundle bundle = GetBitmapBundle(image); if ( bundle.IsOk() ) { - if (pageData->m_image == NULL) + if (pageData->m_image == nullptr) { pageData->m_image = wxGtkImage::New(); gtk_widget_show(pageData->m_image); @@ -299,7 +299,7 @@ bool wxNotebook::SetPageImage( size_t page, int image ) else if (pageData->m_image) { gtk_container_remove(GTK_CONTAINER(pageData->m_box), pageData->m_image); - pageData->m_image = NULL; + pageData->m_image = nullptr; } pageData->m_imageIndex = image; @@ -314,27 +314,27 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const for ( size_t n = 0; n < pageCount; n++ ) { GtkRequisition req; - gtk_widget_get_preferred_size(GetNotebookPage(n)->m_box, NULL, &req); + gtk_widget_get_preferred_size(GetNotebookPage(n)->m_box, nullptr, &req); sizeTabMax.IncTo(wxSize(req.width, req.height)); } wxSize sizeFull(sizePage); #ifdef __WXGTK3__ GtkBorder b; - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) { wxGtkStyleContext sc; - sc.Add(GTK_TYPE_NOTEBOOK, "notebook", "notebook", "frame", NULL); + sc.Add(GTK_TYPE_NOTEBOOK, "notebook", "notebook", "frame", nullptr); gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &b); sizeFull.IncBy(b.left + b.right, b.top + b.bottom); - sc.Add(G_TYPE_NONE, "header", IsVertical() ? "top" : "left", NULL); - sc.Add(G_TYPE_NONE, "tabs", NULL); - sc.Add(G_TYPE_NONE, "tab", NULL); + sc.Add(G_TYPE_NONE, "header", IsVertical() ? "top" : "left", nullptr); + sc.Add(G_TYPE_NONE, "tabs", nullptr); + sc.Add(G_TYPE_NONE, "tab", nullptr); wxSize tabMin; gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, - "min-width", &tabMin.x, "min-height", &tabMin.y, NULL); + "min-width", &tabMin.x, "min-height", &tabMin.y, nullptr); sizeTabMax.IncTo(tabMin); gtk_style_context_get_margin(sc, GTK_STATE_FLAG_NORMAL, &b); @@ -371,8 +371,8 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const int tab_hborder, tab_vborder, focus_width; g_object_get(G_OBJECT(m_widget), - "tab-hborder", &tab_hborder, "tab-vborder", &tab_vborder, NULL); - gtk_widget_style_get(m_widget, "focus-line-width", &focus_width, NULL); + "tab-hborder", &tab_hborder, "tab-vborder", &tab_vborder, nullptr); + gtk_widget_style_get(m_widget, "focus-line-width", &focus_width, nullptr); sizeTabMax.x += 2 * (tab_hborder + focus_width + m_widget->style->xthickness); sizeTabMax.y += 2 * (tab_vborder + focus_width + m_widget->style->ythickness); @@ -390,7 +390,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const void wxNotebook::SetPadding( const wxSize &padding ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid notebook") ); m_padding = padding.GetWidth(); @@ -429,12 +429,12 @@ wxNotebookPage *wxNotebook::DoRemovePage( size_t page ) // of sync during the PAGE_CHANGING/PAGE_CHANGED events. wxNotebookPage *client = GetPage(page); if ( !client ) - return NULL; + return nullptr; // Suppress bogus assertion failures happening deep inside ATK (used by // GTK) that can't be avoided in any other way, see #22176. wxGTKImpl::LogFilterByMessage filterLog( - "gtk_notebook_get_tab_label: assertion 'list != NULL' failed" + "gtk_notebook_get_tab_label: assertion 'list != nullptr' failed" ); // we don't need to unparent the client->m_widget; GTK+ will do @@ -458,7 +458,7 @@ bool wxNotebook::InsertPage( size_t position, bool select, int imageId ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid notebook") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid notebook") ); wxCHECK_MSG( win->GetParent() == this, false, wxT("Can't add a page whose parent is not the notebook!") ); @@ -502,7 +502,7 @@ bool wxNotebook::InsertPage( size_t position, } else { - pageData->m_image = NULL; + pageData->m_image = nullptr; } /* set the label text */ @@ -526,7 +526,7 @@ bool wxNotebook::InsertPage( size_t position, /* apply current style */ #ifdef __WXGTK3__ - GTKApplyStyle(pageData->m_label, NULL); + GTKApplyStyle(pageData->m_label, nullptr); #else GtkRcStyle *style = GTKCreateWidgetStyle(); if ( style ) @@ -663,7 +663,7 @@ GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const windows.push_back(GTK_NOTEBOOK(m_widget)->event_window); #endif - return NULL; + return nullptr; } // static diff --git a/src/gtk/notifmsg.cpp b/src/gtk/notifmsg.cpp index c8782524ea..726ea5fdab 100644 --- a/src/gtk/notifmsg.cpp +++ b/src/gtk/notifmsg.cpp @@ -98,7 +98,7 @@ class wxLibNotifyMsgImpl : public wxNotificationMessageImpl public: wxLibNotifyMsgImpl(wxNotificationMessageBase* notification) : wxNotificationMessageImpl(notification), - m_notification(NULL), + m_notification(nullptr), m_flags(wxICON_INFORMATION) { if ( !wxLibnotifyModule::Initialize() ) @@ -301,7 +301,7 @@ public: labelStr.utf8_str(), &wxLibNotifyMsgImplActionCallback, this, - NULL + nullptr ); return true; diff --git a/src/gtk/overlay.cpp b/src/gtk/overlay.cpp index 5679b410e8..97aa91d240 100644 --- a/src/gtk/overlay.cpp +++ b/src/gtk/overlay.cpp @@ -38,11 +38,11 @@ public: wxOverlay::Impl* wxOverlay::Create() { - if (wxGTKImpl::IsWayland(NULL)) + if (wxGTKImpl::IsWayland(nullptr)) return new wxOverlayImpl; // Use generic - return NULL; + return nullptr; } extern "C" { @@ -67,10 +67,10 @@ static gboolean map_event(GtkWidget* widget, GdkEvent*, wxOverlayImpl* overlay) wxOverlayImpl::wxOverlayImpl() { - m_overlay = NULL; - m_target = NULL; - m_surface = NULL; - m_cr = NULL; + m_overlay = nullptr; + m_target = nullptr; + m_surface = nullptr; + m_cr = nullptr; } wxOverlayImpl::~wxOverlayImpl() @@ -99,7 +99,7 @@ void wxOverlayImpl::Init(wxDC* dc, int x, int y, int width, int height) m_target = win->GetConnectWidget(); GtkWidget* const tlw = gtk_widget_get_toplevel(m_target); - if (m_overlay == NULL) + if (m_overlay == nullptr) { // The overlay is a TLW to get "save-under" behavior, which avoids // repainting of the underlying window. @@ -120,7 +120,7 @@ void wxOverlayImpl::Init(wxDC* dc, int x, int y, int width, int height) // doesn't work here, so use an input shape that is as small as possible. cairo_rectangle_int_t rect = { 0, 0, 1, 1 }; cairo_region_t* region = cairo_region_create_rectangle(&rect); - gtk_widget_input_shape_combine_region(m_overlay, NULL); + gtk_widget_input_shape_combine_region(m_overlay, nullptr); gtk_widget_input_shape_combine_region(m_overlay, region); cairo_region_destroy(region); @@ -163,14 +163,14 @@ void wxOverlayImpl::BeginDrawing(wxDC*) void wxOverlayImpl::EndDrawing(wxDC* dc) { - if (m_cr == NULL) + if (m_cr == nullptr) return; cairo_pattern_t* pattern = cairo_pop_group(m_cr); cairo_pattern_get_surface(pattern, &m_surface); cairo_surface_reference(m_surface); cairo_pattern_destroy(pattern); - m_cr = NULL; + m_cr = nullptr; const wxSize size(dc->GetSize()); if (m_rect.width < size.x || m_rect.height < size.y) @@ -198,7 +198,7 @@ void wxOverlayImpl::Reset() if (m_surface) { cairo_surface_destroy(m_surface); - m_surface = NULL; + m_surface = nullptr; } if (m_overlay) gtk_widget_hide(m_overlay); diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index 1fe4c90fe1..e32d8a335b 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -30,7 +30,7 @@ public: m_style = wxPENSTYLE_SOLID; m_joinStyle = wxJOIN_ROUND; m_capStyle = wxCAP_ROUND; - m_dash = NULL; + m_dash = nullptr; m_countDashes = 0; } @@ -206,7 +206,7 @@ int wxPen::GetDashCount() const wxDash* wxPen::GetDash() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid pen") ); return const_cast(M_PENDATA->m_dash); } @@ -254,6 +254,6 @@ void wxPen::SetStipple(const wxBitmap& WXUNUSED(stipple)) wxBitmap *wxPen::GetStipple() const { - return NULL; + return nullptr; } diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index 6c1b56f86d..1b543f609b 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -146,8 +146,8 @@ void wxPopupWindow::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED( void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") ); - wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid dialog") ); + wxASSERT_MSG( (m_widget != nullptr), wxT("invalid dialog") ); + wxASSERT_MSG( (m_wxwindow != nullptr), wxT("invalid dialog") ); int old_x = m_x; int old_y = m_y; diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 707cabcde0..6230d16c31 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -50,7 +50,7 @@ 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 + nullptr, // wxPAPER_NONE "na_letter", // wxPAPER_LETTER "na_legal", // wxPAPER_LEGAL "iso_a4", // wxPAPER_A4 @@ -187,12 +187,12 @@ static GtkPaperSize* wxGetGtkPaperSize(wxPaperSize paperId, const wxSize& size) // look for a size match in GTK's GtkPaperSize list const double w = size.x; const double h = size.y; - GtkPaperSize* paperSize = NULL; + GtkPaperSize* paperSize = nullptr; 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 && + if (paperSize == nullptr && fabs(w - gtk_paper_size_get_width(paperSize2, GTK_UNIT_MM)) < 1 && fabs(h - gtk_paper_size_get_height(paperSize2, GTK_UNIT_MM)) < 1) { @@ -296,7 +296,7 @@ wxDialog * wxGtkPrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent), wxPrintData * WXUNUSED(data)) { - return NULL; + return nullptr; } wxDCImpl* wxGtkPrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) @@ -383,8 +383,8 @@ wxIMPLEMENT_CLASS(wxGtkPrintNativeData, wxPrintNativeDataBase); wxGtkPrintNativeData::wxGtkPrintNativeData() { m_config = gtk_print_settings_new(); - m_job = NULL; - m_context = NULL; + m_job = nullptr; + m_context = nullptr; } wxGtkPrintNativeData::~wxGtkPrintNativeData() @@ -594,7 +594,7 @@ GtkPageSetup* GetPageSetupFromSettings(GtkPrintSettings* settings) gtk_page_setup_set_orientation (page_setup, gtk_print_settings_get_orientation (settings)); GtkPaperSize *paper_size = gtk_print_settings_get_paper_size (settings); - if (paper_size != NULL) + if (paper_size != nullptr) { gtk_page_setup_set_paper_size_and_default_margins (page_setup, paper_size); gtk_paper_size_free(paper_size); @@ -662,7 +662,7 @@ wxGtkPrintDialog::~wxGtkPrintDialog() static_cast(printData.GetNativeData()); GtkPrintOperation* printOp = native->GetPrintJob(); g_object_unref(printOp); - native->SetPrintJob(NULL); + native->SetPrintJob(nullptr); } // This is called even if we actually don't want the dialog to appear. @@ -696,14 +696,14 @@ int wxGtkPrintDialog::ShowModal() GtkPrintOperation * const printOp = native->GetPrintJob(); // If the settings are OK, we restore it. - if (settings != NULL) + if (settings != nullptr) gtk_print_operation_set_print_settings (printOp, settings); GtkPageSetup* pgSetup = GetPageSetupFromSettings(settings); gtk_print_operation_set_default_page_setup (printOp, pgSetup); g_object_unref(pgSetup); // Show the dialog if needed. - GError* gError = NULL; + GError* gError = nullptr; GtkPrintOperationResult response = gtk_print_operation_run ( printOp, @@ -712,7 +712,7 @@ int wxGtkPrintDialog::ShowModal() : GTK_PRINT_OPERATION_ACTION_PRINT, m_parent ? GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)) - : NULL, + : nullptr, &gError ); @@ -735,8 +735,8 @@ int wxGtkPrintDialog::ShowModal() // the settings such as the paper size and orientation there are not // reflected in the print settings, but must be retrieved from the page // setup struct itself separately. - GtkPageSetup* defPageSetup = NULL; - g_object_get(printOp, "default-page-setup", &defPageSetup, NULL); + GtkPageSetup* defPageSetup = nullptr; + g_object_get(printOp, "default-page-setup", &defPageSetup, nullptr); if ( defPageSetup ) { SetPageSetupToSettings(newSettings, defPageSetup); @@ -850,7 +850,7 @@ int wxGtkPageSetupDialog::ShowModal() dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(), m_parent ? GTK_WINDOW(m_parent->m_widget) - : NULL); + : nullptr); gtk_page_setup_unix_dialog_set_print_settings( GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData); @@ -926,8 +926,8 @@ wxIMPLEMENT_CLASS(wxGtkPrinter, wxPrinterBase); wxGtkPrinter::wxGtkPrinter( wxPrintDialogData *data ) : wxPrinterBase( data ) { - m_gpc = NULL; - m_dc = NULL; + m_gpc = nullptr; + m_dc = nullptr; if (data) m_printDialogData = *data; @@ -997,7 +997,7 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) // doesn't necessarily show int ret = dialog.ShowModal(); - printout->SetDC(NULL); + printout->SetDC(nullptr); wxDELETE(m_dc); if (ret == wxID_CANCEL) @@ -1121,7 +1121,7 @@ void wxGtkPrinter::DrawPage(wxPrintout *printout, switch (gtk_print_settings_get_print_pages(settings)) { case GTK_PRINT_PAGES_CURRENT: - g_object_get(G_OBJECT(operation), "current-page", &startPage, NULL); + g_object_get(G_OBJECT(operation), "current-page", &startPage, nullptr); endPage = startPage; break; case GTK_PRINT_PAGES_RANGES: @@ -1182,12 +1182,12 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) if (ret == wxID_CANCEL) { sm_lastError = wxPRINTER_CANCELLED; - return NULL; + return nullptr; } if (ret == wxID_NO) { sm_lastError = wxPRINTER_ERROR; - return NULL; + return nullptr; } wxDC* dc = dialog.GetPrintDC(); @@ -1277,7 +1277,7 @@ wxGtkPrinterDCImpl::~wxGtkPrinterDCImpl() bool wxGtkPrinterDCImpl::IsOk() const { - return m_gpc != NULL; + return m_gpc != nullptr; } void* wxGtkPrinterDCImpl::GetCairoContext() const @@ -1709,7 +1709,7 @@ void wxGtkPrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCo #if wxUSE_SPLINES void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) { - wxCHECK_RET(points, "NULL pointer to spline points?"); + wxCHECK_RET(points, "null pointer to spline points?"); wxCHECK_RET(points->GetCount() >= 2, "incomplete list of spline points?"); SetPen (m_pen); @@ -1809,7 +1809,7 @@ void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor #ifndef __WXGTK3__ wxBitmap bmpSource = bitmap; // we need a non-const instance. if (!useMask && !bitmap.HasPixbuf() && bitmap.GetMask()) - bmpSource.SetMask(NULL); + bmpSource.SetMask(nullptr); #endif cairo_save(m_cairo); @@ -1918,7 +1918,7 @@ void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo if (setAttrs) { // Undo underline attributes setting - pango_layout_set_attributes(m_layout, NULL); + pango_layout_set_attributes(m_layout, nullptr); } CalcBoundingBox(wxPoint(x, y), wxSize(w, h)); @@ -1995,7 +1995,7 @@ void wxGtkPrinterDCImpl::SetPen( const wxPen& pen ) break; case wxPENSTYLE_SOLID: case wxPENSTYLE_TRANSPARENT: - default: cairo_set_dash( m_cairo, NULL, 0, 0 ); break; + default: cairo_set_dash( m_cairo, nullptr, 0, 0 ); break; } switch (m_pen.GetCap()) @@ -2317,7 +2317,7 @@ bool wxGtkPrinterDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayIn do { PangoRectangle rect; - pango_layout_iter_get_cluster_extents(iter, NULL, &rect); + pango_layout_iter_get_cluster_extents(iter, nullptr, &rect); w += rect.width; widths.Add(PANGO_PIXELS(w)); } while (pango_layout_iter_next_cluster(iter)); @@ -2389,7 +2389,7 @@ void wxGtkPrintPreview::Init(wxPrintout * WXUNUSED(printout), wxPrintout * WXUNUSED(printoutForPrinting), wxPrintData *data) { - // convert wxPrintQuality to resolution (input pointer can be NULL) + // convert wxPrintQuality to resolution (input pointer can be null) wxPrintQuality quality = data ? data->GetQuality() : wxPRINT_QUALITY_MEDIUM; switch ( quality ) { @@ -2430,7 +2430,7 @@ wxGtkPrintPreview::wxGtkPrintPreview(wxPrintout *printout, wxPrintDialogData *data) : wxPrintPreviewBase(printout, printoutForPrinting, data) { - Init(printout, printoutForPrinting, data ? &data->GetPrintData() : NULL); + Init(printout, printoutForPrinting, data ? &data->GetPrintData() : nullptr); } wxGtkPrintPreview::wxGtkPrintPreview(wxPrintout *printout, diff --git a/src/gtk/private.cpp b/src/gtk/private.cpp index de4ab0460c..169bb203a0 100644 --- a/src/gtk/private.cpp +++ b/src/gtk/private.cpp @@ -33,11 +33,11 @@ namespace wxGTKPrivate { -static GtkWidget *gs_container = NULL; +static GtkWidget *gs_container = nullptr; static GtkContainer* GetContainer() { - if ( gs_container == NULL ) + if ( gs_container == nullptr ) { GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); gs_container = gtk_fixed_new(); @@ -48,7 +48,7 @@ static GtkContainer* GetContainer() GtkWidget *GetButtonWidget() { - static GtkWidget *s_button = NULL; + static GtkWidget *s_button = nullptr; if ( !s_button ) { @@ -63,7 +63,7 @@ GtkWidget *GetButtonWidget() GtkWidget *GetNotebookWidget() { - static GtkWidget *s_notebook = NULL; + static GtkWidget *s_notebook = nullptr; if ( !s_notebook ) { @@ -78,7 +78,7 @@ GtkWidget *GetNotebookWidget() GtkWidget *GetCheckButtonWidget() { - static GtkWidget *s_button = NULL; + static GtkWidget *s_button = nullptr; if ( !s_button ) { @@ -93,7 +93,7 @@ GtkWidget *GetCheckButtonWidget() GtkWidget * GetComboBoxWidget() { - static GtkWidget *s_button = NULL; + static GtkWidget *s_button = nullptr; if ( !s_button ) { @@ -109,7 +109,7 @@ GtkWidget * GetComboBoxWidget() GtkWidget *GetEntryWidget() { - static GtkWidget *s_entry = NULL; + static GtkWidget *s_entry = nullptr; if ( !s_entry ) { @@ -125,9 +125,9 @@ GtkWidget *GetEntryWidget() // This one just gets the button used by the column header. Although it's // still a gtk_button the themes will typically differentiate and draw them // differently if the button is in a treeview. -static GtkWidget *s_first_button = NULL; -static GtkWidget *s_other_button = NULL; -static GtkWidget *s_last_button = NULL; +static GtkWidget *s_first_button = nullptr; +static GtkWidget *s_other_button = nullptr; +static GtkWidget *s_last_button = nullptr; static void CreateHeaderButtons() { @@ -190,11 +190,11 @@ GtkWidget *GetHeaderButtonWidget() GtkWidget * GetRadioButtonWidget() { - static GtkWidget *s_button = NULL; + static GtkWidget *s_button = nullptr; if ( !s_button ) { - s_button = gtk_radio_button_new(NULL); + s_button = gtk_radio_button_new(nullptr); g_object_add_weak_pointer(G_OBJECT(s_button), (void**)&s_button); gtk_container_add(GetContainer(), s_button); gtk_widget_realize( s_button ); @@ -209,7 +209,7 @@ GtkWidget* GetSplitterWidget(wxOrientation orient) const GtkOrientation gtkOrient = orient == wxHORIZONTAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; GtkWidget*& widget = widgets[gtkOrient]; - if (widget == NULL) + if (widget == nullptr) { #ifdef __WXGTK3__ widget = gtk_paned_new(gtkOrient); @@ -229,7 +229,7 @@ GtkWidget* GetSplitterWidget(wxOrientation orient) GtkWidget * GetTextEntryWidget() { - static GtkWidget *s_button = NULL; + static GtkWidget *s_button = nullptr; if ( !s_button ) { @@ -244,7 +244,7 @@ GtkWidget * GetTextEntryWidget() GtkWidget *GetTreeWidget() { - static GtkWidget *s_tree = NULL; + static GtkWidget *s_tree = nullptr; if ( !s_tree ) { @@ -272,7 +272,7 @@ public: { GtkWidget* parent = gtk_widget_get_parent(gs_container); gtk_widget_destroy(parent); - gs_container = NULL; + gs_container = nullptr; } } diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index c93fde74d2..b937d26a27 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -186,7 +186,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose*, wxWindow*) { const GtkAllocation& a = widget->allocation; gtk_paint_flat_box(gtk_widget_get_style(widget), gtk_widget_get_window(widget), - GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, "", a.x, a.y, a.width, a.height); + GTK_STATE_NORMAL, GTK_SHADOW_NONE, nullptr, widget, "", a.x, a.y, a.width, a.height); return false; } } @@ -242,7 +242,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, unsigned int num_of_cols = GetColumnCount(); unsigned int num_of_rows = GetRowCount(); - GtkRadioButton *rbtn = NULL; + GtkRadioButton *rbtn = nullptr; #ifdef __WXGTK3__ GtkWidget* grid = gtk_grid_new(); @@ -256,7 +256,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, gtk_container_add( GTK_CONTAINER(m_widget), table ); #endif - GSList *radio_button_group = NULL; + GSList *radio_button_group = nullptr; for (unsigned int i = 0; i < (unsigned int)n; i++) { if ( i != 0 ) @@ -386,7 +386,7 @@ wxRadioBox::~wxRadioBox() bool wxRadioBox::Show( bool show ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") ); if (!wxControl::Show(show)) { @@ -415,7 +415,7 @@ bool wxRadioBox::Show( bool show ) void wxRadioBox::SetSelection( int n ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n ); @@ -432,7 +432,7 @@ void wxRadioBox::SetSelection( int n ) int wxRadioBox::GetSelection(void) const { - wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, wxNOT_FOUND, wxT("invalid radiobox") ); int count = 0; @@ -452,7 +452,7 @@ int wxRadioBox::GetSelection(void) const wxString wxRadioBox::GetString(unsigned int n) const { - wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, wxEmptyString, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( n ); @@ -467,14 +467,14 @@ wxString wxRadioBox::GetString(unsigned int n) const void wxRadioBox::SetLabel( const wxString& label ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobox") ); GTKSetLabelForFrame(GTK_FRAME(m_widget), label); } void wxRadioBox::SetString(unsigned int item, const wxString& label) { - wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item ); @@ -517,7 +517,7 @@ void wxRadioBox::DoEnable(bool enable) bool wxRadioBox::Enable(unsigned int item, bool enable) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item ); @@ -534,7 +534,7 @@ bool wxRadioBox::Enable(unsigned int item, bool enable) bool wxRadioBox::IsItemEnabled(unsigned int item) const { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item ); @@ -549,7 +549,7 @@ bool wxRadioBox::IsItemEnabled(unsigned int item) const bool wxRadioBox::Show(unsigned int item, bool show) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item ); @@ -567,7 +567,7 @@ bool wxRadioBox::Show(unsigned int item, bool show) bool wxRadioBox::IsItemShown(unsigned int item) const { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobox") ); wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.Item( item ); @@ -677,21 +677,21 @@ GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const { GtkWidget *button = GTK_WIDGET( node->GetData()->button ); - // don't put NULL pointers in the 'windows' array! + // don't put null pointers in the 'windows' array! if (gtk_widget_get_window(button)) windows.push_back(gtk_widget_get_window(button)); node = node->GetNext(); } - return NULL; + return nullptr; } // static wxVisualAttributes wxRadioBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { - return GetDefaultAttributesFromGTKWidget(gtk_radio_button_new_with_label(NULL, "")); + return GetDefaultAttributesFromGTKWidget(gtk_radio_button_new_with_label(nullptr, "")); } int wxRadioBox::GetItemFromPoint(const wxPoint& point) const diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index b77a52cdd6..d8491ead5a 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -63,7 +63,7 @@ bool wxRadioButton::Create( wxWindow *parent, // Check if this radio button should be put into an existing group. This // shouldn't be done if it's given a style to explicitly start a new group // or if it's not meant to be a part of a group at all. - GSList* radioButtonGroup = NULL; + GSList* radioButtonGroup = nullptr; if (!HasFlag(wxRB_GROUP) && !HasFlag(wxRB_SINGLE)) { // search backward for last group start @@ -109,7 +109,7 @@ bool wxRadioButton::Create( wxWindow *parent, void wxRadioButton::SetLabel( const wxString& label ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobutton") ); // save the original label wxControlBase::SetLabel(label); @@ -119,7 +119,7 @@ void wxRadioButton::SetLabel( const wxString& label ) void wxRadioButton::SetValue( bool val ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid radiobutton") ); if (val == GetValue()) return; @@ -144,7 +144,7 @@ void wxRadioButton::SetValue( bool val ) bool wxRadioButton::GetValue() const { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid radiobutton") ); return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0; } @@ -178,7 +178,7 @@ wxRadioButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const wxVisualAttributes wxRadioButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { - return GetDefaultAttributesFromGTKWidget(gtk_radio_button_new_with_label(NULL, "")); + return GetDefaultAttributesFromGTKWidget(gtk_radio_button_new_with_label(nullptr, "")); } diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index 5284ba25c5..07ee8b47d4 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -31,7 +31,7 @@ class wxRegionRefData : public wxGDIRefData public: wxRegionRefData() { - m_region = NULL; + m_region = nullptr; } wxRegionRefData(const wxRegionRefData& refData) @@ -201,7 +201,7 @@ wxGDIRefData *wxRegion::CreateGDIRefData() const { // should never be called wxFAIL; - return NULL; + return nullptr; } wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const @@ -267,9 +267,9 @@ bool wxRegion::DoUnionWithRect(const wxRect& r) bool wxRegion::DoUnionWithRegion( const wxRegion& region ) { - if (region.m_refData == NULL) + if (region.m_refData == nullptr) { } - else if (m_refData == NULL) + else if (m_refData == nullptr) { m_refData = new wxRegionRefData(*M_REGIONDATA_OF(region)); } @@ -288,7 +288,7 @@ bool wxRegion::DoUnionWithRegion( const wxRegion& region ) bool wxRegion::DoIntersect( const wxRegion& region ) { - if (region.m_refData == NULL || m_refData == NULL) + if (region.m_refData == nullptr || m_refData == nullptr) return false; AllocExclusive(); @@ -304,7 +304,7 @@ bool wxRegion::DoIntersect( const wxRegion& region ) bool wxRegion::DoSubtract( const wxRegion& region ) { - if (region.m_refData == NULL || m_refData == NULL) + if (region.m_refData == nullptr || m_refData == nullptr) return false; AllocExclusive(); @@ -320,9 +320,9 @@ bool wxRegion::DoSubtract( const wxRegion& region ) bool wxRegion::DoXor( const wxRegion& region ) { - if (region.m_refData == NULL) + if (region.m_refData == nullptr) { } - else if (m_refData == NULL) + else if (m_refData == nullptr) { // XOR-ing with an invalid region is the same as XOR-ing with an empty // one, i.e. it is simply a copy. @@ -392,18 +392,18 @@ bool wxRegion::DoGetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const bool wxRegion::IsEmpty() const { #ifdef __WXGTK3__ - return m_refData == NULL || cairo_region_is_empty(M_REGIONDATA->m_region); + return m_refData == nullptr || cairo_region_is_empty(M_REGIONDATA->m_region); #else - return m_refData == NULL || gdk_region_empty(M_REGIONDATA->m_region); + return m_refData == nullptr || gdk_region_empty(M_REGIONDATA->m_region); #endif } wxRegionContain wxRegion::DoContainsPoint( wxCoord x, wxCoord y ) const { #ifdef __WXGTK3__ - if (m_refData == NULL || !cairo_region_contains_point(M_REGIONDATA->m_region, x, y)) + if (m_refData == nullptr || !cairo_region_contains_point(M_REGIONDATA->m_region, x, y)) #else - if (m_refData == NULL || !gdk_region_point_in(M_REGIONDATA->m_region, x, y)) + if (m_refData == nullptr || !gdk_region_point_in(M_REGIONDATA->m_region, x, y)) #endif return wxOutRegion; @@ -446,7 +446,7 @@ GdkRegion *wxRegion::GetRegion() const #endif { if (!m_refData) - return NULL; + return nullptr; return M_REGIONDATA->m_region; } @@ -469,7 +469,7 @@ wxRegionIterator::wxRegionIterator( const wxRegion& region ) void wxRegionIterator::Init() { - m_rects = NULL; + m_rects = nullptr; m_numRects = 0; } @@ -485,7 +485,7 @@ void wxRegionIterator::CreateRects( const wxRegion& region ) #ifdef __WXGTK3__ cairo_region_t* cairoRegion = region.GetRegion(); - if (cairoRegion == NULL) + if (cairoRegion == nullptr) return; m_numRects = cairo_region_num_rectangles(cairoRegion); diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index eeb9527d53..fd41e15106 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -60,7 +60,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override; + wxHeaderButtonParams* params = nullptr) override; virtual int GetHeaderButtonHeight(wxWindow *win) override; @@ -155,7 +155,7 @@ typedef cairo_t wxGTKDrawable; static cairo_t* wxGetGTKDrawable(const wxDC& dc) { wxGraphicsContext* gc = dc.GetGraphicsContext(); - wxCHECK_MSG(gc, NULL, "cannot use wxRendererNative on wxDC of this type"); + wxCHECK_MSG(gc, nullptr, "cannot use wxRendererNative on wxDC of this type"); return static_cast(gc->GetNativeContext()); } @@ -166,15 +166,15 @@ static const GtkStateFlags stateTypeToFlags[] = { }; #else -#define NULL_RECT NULL, +#define NULL_RECT nullptr, typedef GdkWindow wxGTKDrawable; static GdkWindow* wxGetGTKDrawable(wxDC& dc) { - GdkWindow* gdk_window = NULL; + GdkWindow* gdk_window = nullptr; #if wxUSE_GRAPHICS_CONTEXT && defined(GDK_WINDOWING_X11) - cairo_t* cr = NULL; + cairo_t* cr = nullptr; wxGraphicsContext* gc = dc.GetGraphicsContext(); if (gc) cr = static_cast(gc->GetNativeContext()); @@ -187,7 +187,7 @@ static GdkWindow* wxGetGTKDrawable(wxDC& dc) gdk_xid_table_lookup(cairo_xlib_surface_get_drawable(surf))); } } - if (gdk_window == NULL) + if (gdk_window == nullptr) #endif { wxDCImpl *impl = dc.GetImpl(); @@ -231,12 +231,12 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, #ifdef __WXGTK3__ cairo_t* cr = wxGetGTKDrawable(dc); - if (cr == NULL) + if (cr == nullptr) return 0; // AddTreeviewHeaderButton() is only available in 3.20 or later. #if GTK_CHECK_VERSION(3,20,0) - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) { int pos = 1; if (flags & wxCONTROL_SPECIAL) @@ -273,7 +273,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, gdk_window, state, GTK_SHADOW_OUT, - NULL, + nullptr, button, "button", dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height @@ -289,7 +289,7 @@ int wxRendererGTK::GetHeaderButtonHeight(wxWindow *WXUNUSED(win)) GtkRequisition req; #ifdef __WXGTK3__ - gtk_widget_get_preferred_height(button, NULL, &req.height); + gtk_widget_get_preferred_height(button, nullptr, &req.height); #else GTK_WIDGET_GET_CLASS(button)->size_request(button, &req); #endif @@ -309,7 +309,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED_IN_GTK3(win), wxDC& dc, const wxRect& rect, int flags) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; GtkWidget *tree = wxGTKPrivate::GetTreeWidget(); @@ -319,14 +319,14 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED_IN_GTK3(win), if (flags & wxCONTROL_EXPANDED) { state = GTK_STATE_FLAG_ACTIVE; - if (gtk_check_version(3,14,0) == NULL) + if (gtk_check_version(3,14,0) == nullptr) state = GTK_STATE_FLAG_CHECKED; } if (flags & wxCONTROL_CURRENT) state |= GTK_STATE_FLAG_PRELIGHT; int expander_size; - gtk_widget_style_get(tree, "expander-size", &expander_size, NULL); + gtk_widget_style_get(tree, "expander-size", &expander_size, nullptr); // +1 to match GtkTreeView behavior expander_size++; const int x = rect.x + (rect.width - expander_size) / 2; @@ -355,7 +355,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED_IN_GTK3(win), gtk_widget_get_style(tree), drawable, state, - NULL, + nullptr, tree, "treeview", dc.LogicalToDeviceX(rect.x) + rect.width / 2 - x_diff, @@ -374,7 +374,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* WXUNUSED_IN_GTK3(win), static int GetGtkSplitterFullSize(GtkWidget* widget) { gint handle_size; - gtk_widget_style_get(widget, "handle_size", &handle_size, NULL); + gtk_widget_style_get(widget, "handle_size", &handle_size, nullptr); // Narrow handles don't work well with wxSplitterWindow if (handle_size < 5) handle_size = 5; @@ -411,14 +411,14 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, wxOrientation orient, int flags) { - if (gtk_widget_get_window(win->m_wxwindow) == NULL) + if (gtk_widget_get_window(win->m_wxwindow) == nullptr) { // window not realized yet return; } wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; // are we drawing vertical or horizontal splitter? @@ -449,8 +449,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, sc.AddWindow(); gtk_render_background(sc, drawable, rect.x, rect.y, rect.width, rect.height); - sc.Add(GTK_TYPE_PANED, "paned", "pane-separator", NULL); - if (gtk_check_version(3,20,0) == NULL) + sc.Add(GTK_TYPE_PANED, "paned", "pane-separator", nullptr); + if (gtk_check_version(3,20,0) == nullptr) sc.Add("separator"); gtk_style_context_set_state(sc, @@ -462,7 +462,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, x_diff = rect.width; GdkWindow* gdk_window = wxGetGTKDrawable(dc); - if (gdk_window == NULL) + if (gdk_window == nullptr) return; gtk_paint_handle ( @@ -470,7 +470,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, gdk_window, flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_SHADOW_NONE, - NULL /* no clipping */, + nullptr /* no clipping */, win->m_wxwindow, "paned", dc.LogicalToDeviceX(rect.x) - x_diff, @@ -522,7 +522,7 @@ wxRendererGTK::DrawDropArrow(wxWindow*, } #else GdkWindow* gdk_window = wxGetGTKDrawable(dc); - if (gdk_window == NULL) + if (gdk_window == nullptr) return; GtkWidget* button = wxGTKPrivate::GetButtonWidget(); @@ -534,7 +534,7 @@ wxRendererGTK::DrawDropArrow(wxWindow*, gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - NULL, + nullptr, button, "arrow", GTK_ARROW_DOWN, @@ -567,13 +567,13 @@ struct CheckBoxInfo wxUnusedVar(flags); sc.AddCheckButton(); - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) { sc.Add("check"); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "min-width", &indicator_width, "min-height", &indicator_height, - NULL); + nullptr); GtkBorder border, padding; gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); @@ -606,7 +606,7 @@ struct CheckBoxInfo gtk_widget_style_get(button, "indicator_size", &indicator_size, "indicator_spacing", &indicator_margin, - NULL); + nullptr); // If wxCONTROL_CELL is set then we want to get the size of wxCheckBox // control to draw the check mark centered and at the same position as @@ -619,7 +619,7 @@ struct CheckBoxInfo gtk_widget_style_get(button, "focus-line-width", &focus_width, "focus-padding", &focus_pad, - NULL); + nullptr); indicator_margin += focus_width + focus_pad; } @@ -708,14 +708,14 @@ wxRendererGTK::DrawCheckBox(wxWindow*, { #ifdef __WXGTK3__ cairo_t* cr = wxGetGTKDrawable(dc); - if (cr == NULL) + if (cr == nullptr) return; int state = GTK_STATE_FLAG_NORMAL; if (flags & wxCONTROL_CHECKED) { state = GTK_STATE_FLAG_ACTIVE; - if (gtk_check_version(3,14,0) == NULL) + if (gtk_check_version(3,14,0) == nullptr) state = GTK_STATE_FLAG_CHECKED; } if (flags & wxCONTROL_DISABLED) @@ -745,7 +745,7 @@ wxRendererGTK::DrawCheckBox(wxWindow*, x = -x - w; } - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) { gtk_style_context_set_state(sc, GtkStateFlags(state)); gtk_render_background(sc, cr, x, y, w, h); @@ -797,7 +797,7 @@ wxRendererGTK::DrawCheckBox(wxWindow*, shadow_type = GTK_SHADOW_OUT; GdkWindow* gdk_window = wxGetGTKDrawable(dc); - if (gdk_window == NULL) + if (gdk_window == nullptr) return; gtk_paint_check @@ -806,7 +806,7 @@ wxRendererGTK::DrawCheckBox(wxWindow*, gdk_window, state, shadow_type, - NULL, + nullptr, button, "cellcheck", dc.LogicalToDeviceX(rect.x) + info.margin_left, @@ -849,7 +849,7 @@ wxRendererGTK::DrawPushButton(wxWindow*, } #else GdkWindow* gdk_window = wxGetGTKDrawable(dc); - if (gdk_window == NULL) + if (gdk_window == nullptr) return; gtk_paint_box @@ -858,7 +858,7 @@ wxRendererGTK::DrawPushButton(wxWindow*, gdk_window, state, flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - NULL, + nullptr, button, "button", dc.LogicalToDeviceX(rect.x), @@ -876,7 +876,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, int flags ) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; if (flags & wxCONTROL_SELECTED) @@ -921,7 +921,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; GtkStateType state; @@ -942,7 +942,7 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i state, NULL_RECT win->m_wxwindow, - NULL, + nullptr, dc.LogicalToDeviceX(rect.x), dc.LogicalToDeviceY(rect.y), rect.width, @@ -954,7 +954,7 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int flags) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; #ifdef __WXGTK3__ @@ -965,7 +965,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int fl state = GTK_STATE_FLAG_INSENSITIVE; wxGtkStyleContext sc(dc.GetContentScaleFactor()); - sc.Add(GTK_TYPE_ENTRY, "entry", "entry", NULL); + sc.Add(GTK_TYPE_ENTRY, "entry", "entry", nullptr); gtk_style_context_set_state(sc, GtkStateFlags(state)); gtk_render_background(sc, drawable, rect.x, rect.y, rect.width, rect.height); @@ -1000,7 +1000,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int fl void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; GtkWidget* combo = wxGTKPrivate::GetComboBoxWidget(); @@ -1095,7 +1095,7 @@ void wxRendererGTK::DrawChoice(wxWindow* win, wxDC& dc, void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int flags) { wxGTKDrawable* drawable = wxGetGTKDrawable(dc); - if (drawable == NULL) + if (drawable == nullptr) return; #ifdef __WXGTK3__ @@ -1103,7 +1103,7 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int if (flags & wxCONTROL_CHECKED) { state = GTK_STATE_FLAG_ACTIVE; - if (gtk_check_version(3,14,0) == NULL) + if (gtk_check_version(3,14,0) == nullptr) state = GTK_STATE_FLAG_CHECKED; } if (flags & wxCONTROL_DISABLED) @@ -1115,12 +1115,12 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int int min_width, min_height; wxGtkStyleContext sc(dc.GetContentScaleFactor()); - sc.Add(GTK_TYPE_RADIO_BUTTON, "radiobutton", NULL); - if (gtk_check_version(3,20,0) == NULL) + sc.Add(GTK_TYPE_RADIO_BUTTON, "radiobutton", nullptr); + if (gtk_check_version(3,20,0) == nullptr) { sc.Add("radio"); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, - "min-width", &min_width, "min-height", &min_height, NULL); + "min-width", &min_width, "min-height", &min_height, nullptr); } else { diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index f9fc488838..355a7c264b 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -137,7 +137,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, } const bool isVertical = (style & wxSB_VERTICAL) != 0; - m_widget = gtk_scrollbar_new(GtkOrientation(isVertical), NULL); + m_widget = gtk_scrollbar_new(GtkOrientation(isVertical), nullptr); g_object_ref(m_widget); m_scrollBar[0] = (GtkRange*)m_widget; @@ -244,7 +244,7 @@ void wxScrollBar::SetRange(int range) wxVisualAttributes wxScrollBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { - return GetDefaultAttributesFromGTKWidget(gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL)); + return GetDefaultAttributesFromGTKWidget(gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, nullptr)); } #endif // wxUSE_SCROLLBAR diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index c9c03d4ce6..65918be366 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -113,14 +113,14 @@ void wxScrollHelper::AdjustScrollbars() return; } - m_targetWindow->GetClientSize(&w, NULL); + m_targetWindow->GetClientSize(&w, nullptr); DoAdjustHScrollbar(w, vw); - m_targetWindow->GetClientSize(NULL, &h); + m_targetWindow->GetClientSize(nullptr, &h); DoAdjustVScrollbar(h, vh); const int w_old = w; - m_targetWindow->GetClientSize(&w, NULL); + m_targetWindow->GetClientSize(&w, nullptr); if ( w != w_old ) { // It is necessary to repeat the calculations in this case to avoid an @@ -132,7 +132,7 @@ void wxScrollHelper::AdjustScrollbars() // leading to an unending series if the sizes are just right. DoAdjustHScrollbar(w, vw); - m_targetWindow->GetClientSize(NULL, &h); + m_targetWindow->GetClientSize(nullptr, &h); DoAdjustVScrollbar(h, vh); } } @@ -157,7 +157,7 @@ void wxScrollHelper::DoScrollOneDir(int orient, void wxScrollHelper::DoScroll( int x_pos, int y_pos ) { - wxCHECK_RET( m_targetWindow != 0, wxT("No target window") ); + wxCHECK_RET( m_targetWindow != nullptr, wxT("No target window") ); DoScrollOneDir(wxHORIZONTAL, x_pos, m_xScrollPixelsPerLine, &m_xScrollPosition); DoScrollOneDir(wxVERTICAL, y_pos, m_yScrollPixelsPerLine, &m_yScrollPosition); diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 58c0cd4939..261c55a90a 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -39,7 +39,7 @@ static GtkWidget* gs_tlw_parent; static GtkContainer* ContainerWidget() { static GtkContainer* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = GTK_CONTAINER(gtk_fixed_new()); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); @@ -52,9 +52,9 @@ static GtkContainer* ContainerWidget() static GtkWidget* ScrollBarWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { - s_widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL); + s_widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, nullptr); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); gtk_container_add(ContainerWidget(), s_widget); #ifndef __WXGTK3__ @@ -77,13 +77,13 @@ static void style_set(GtkWidget*, GtkStyle*, void*) static GtkWidget* ButtonWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_button_new(); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); gtk_container_add(ContainerWidget(), s_widget); gtk_widget_ensure_style(s_widget); - g_signal_connect(s_widget, "style_set", G_CALLBACK(style_set), NULL); + g_signal_connect(s_widget, "style_set", G_CALLBACK(style_set), nullptr); } return s_widget; } @@ -91,7 +91,7 @@ static GtkWidget* ButtonWidget() static GtkWidget* ListWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_tree_view_new_with_model( GTK_TREE_MODEL(gtk_list_store_new(1, G_TYPE_INT))); @@ -105,7 +105,7 @@ static GtkWidget* ListWidget() static GtkWidget* TextCtrlWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_text_view_new(); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); @@ -118,7 +118,7 @@ static GtkWidget* TextCtrlWidget() static GtkWidget* MenuItemWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_menu_item_new(); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); @@ -131,7 +131,7 @@ static GtkWidget* MenuItemWidget() static GtkWidget* MenuBarWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_menu_bar_new(); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); @@ -144,7 +144,7 @@ static GtkWidget* MenuBarWidget() static GtkWidget* ToolTipWidget() { static GtkWidget* s_widget; - if (s_widget == NULL) + if (s_widget == nullptr) { s_widget = gtk_window_new(GTK_WINDOW_POPUP); g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget); @@ -214,17 +214,17 @@ wxGtkStyleContext::wxGtkStyleContext(double scale) : m_path(gtk_widget_path_new()) , m_scale(int(scale)) { - m_context = NULL; + m_context = nullptr; } wxGtkStyleContext& wxGtkStyleContext::Add(GType type, const char* objectName, ...) { - if (m_context == NULL && type != GTK_TYPE_WINDOW) + if (m_context == nullptr && type != GTK_TYPE_WINDOW) AddWindow(); gtk_widget_path_append_type(m_path, type); #if GTK_CHECK_VERSION(3,20,0) - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) gtk_widget_path_iter_set_object_name(m_path, -1, objectName); #endif va_list args; @@ -236,14 +236,14 @@ wxGtkStyleContext& wxGtkStyleContext::Add(GType type, const char* objectName, .. GtkStyleContext* sc = gtk_style_context_new(); #if GTK_CHECK_VERSION(3,10,0) - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) gtk_style_context_set_scale(sc, m_scale); #endif gtk_style_context_set_path(sc, m_path); if (m_context) { #if GTK_CHECK_VERSION(3,4,0) - if (gtk_check_version(3,4,0) == NULL) + if (gtk_check_version(3,4,0) == nullptr) gtk_style_context_set_parent(sc, m_context); #endif g_object_unref(m_context); @@ -254,15 +254,15 @@ wxGtkStyleContext& wxGtkStyleContext::Add(GType type, const char* objectName, .. wxGtkStyleContext& wxGtkStyleContext::Add(const char* objectName) { - return Add(G_TYPE_NONE, objectName, NULL); + return Add(G_TYPE_NONE, objectName, nullptr); } wxGtkStyleContext::~wxGtkStyleContext() { gtk_widget_path_free(m_path); - if (m_context == NULL) + if (m_context == nullptr) return; - if (gtk_check_version(3,16,0) == NULL || gtk_check_version(3,4,0)) + if (gtk_check_version(3,16,0) == nullptr || gtk_check_version(3,4,0)) { g_object_unref(m_context); return; @@ -275,7 +275,7 @@ wxGtkStyleContext::~wxGtkStyleContext() if (parent) { g_object_ref(parent); - gtk_style_context_set_parent(sc, NULL); + gtk_style_context_set_parent(sc, nullptr); } g_object_unref(sc); sc = parent; @@ -285,40 +285,40 @@ wxGtkStyleContext::~wxGtkStyleContext() wxGtkStyleContext& wxGtkStyleContext::AddButton() { - return Add(GTK_TYPE_BUTTON, "button", "button", NULL); + return Add(GTK_TYPE_BUTTON, "button", "button", nullptr); } wxGtkStyleContext& wxGtkStyleContext::AddCheckButton() { - return Add(GTK_TYPE_CHECK_BUTTON, "checkbutton", NULL); + return Add(GTK_TYPE_CHECK_BUTTON, "checkbutton", nullptr); } #if GTK_CHECK_VERSION(3,10,0) wxGtkStyleContext& wxGtkStyleContext::AddHeaderbar() { - return Add(GTK_TYPE_HEADER_BAR, "headerbar", "titlebar", "header-bar", NULL); + return Add(GTK_TYPE_HEADER_BAR, "headerbar", "titlebar", "header-bar", nullptr); } #endif wxGtkStyleContext& wxGtkStyleContext::AddLabel() { - return Add(GTK_TYPE_LABEL, "label", NULL); + return Add(GTK_TYPE_LABEL, "label", nullptr); } wxGtkStyleContext& wxGtkStyleContext::AddMenu() { - return AddWindow("popup").Add(GTK_TYPE_MENU, "menu", "menu", NULL); + return AddWindow("popup").Add(GTK_TYPE_MENU, "menu", "menu", nullptr); } wxGtkStyleContext& wxGtkStyleContext::AddMenuItem() { - return AddMenu().Add(GTK_TYPE_MENU_ITEM, "menuitem", "menuitem", NULL); + return AddMenu().Add(GTK_TYPE_MENU_ITEM, "menuitem", "menuitem", nullptr); } wxGtkStyleContext& wxGtkStyleContext::AddTextview(const char* child1, const char* child2) { - Add(GTK_TYPE_TEXT_VIEW, "textview", "view", NULL); - if (child1 && gtk_check_version(3,20,0) == NULL) + Add(GTK_TYPE_TEXT_VIEW, "textview", "view", nullptr); + if (child1 && gtk_check_version(3,20,0) == nullptr) { Add(child1); if (child2) @@ -329,7 +329,7 @@ wxGtkStyleContext& wxGtkStyleContext::AddTextview(const char* child1, const char wxGtkStyleContext& wxGtkStyleContext::AddTreeview() { - return Add(GTK_TYPE_TREE_VIEW, "treeview", "view", NULL); + return Add(GTK_TYPE_TREE_VIEW, "treeview", "view", nullptr); } #if GTK_CHECK_VERSION(3,20,0) @@ -358,11 +358,11 @@ wxGtkStyleContext& wxGtkStyleContext::AddTreeviewHeaderButton(int pos) wxGtkStyleContext& wxGtkStyleContext::AddTooltip() { - wxASSERT(m_context == NULL); + wxASSERT(m_context == nullptr); GtkWidgetPath* path = m_path; gtk_widget_path_append_type(path, GTK_TYPE_WINDOW); #if GTK_CHECK_VERSION(3,20,0) - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) gtk_widget_path_iter_set_object_name(path, -1, "tooltip"); #endif gtk_widget_path_iter_add_class(path, -1, "background"); @@ -375,16 +375,16 @@ wxGtkStyleContext& wxGtkStyleContext::AddTooltip() wxGtkStyleContext& wxGtkStyleContext::AddWindow(const char* className2) { - return Add(GTK_TYPE_WINDOW, "window", "background", className2, NULL); + return Add(GTK_TYPE_WINDOW, "window", "background", className2, nullptr); } void wxGtkStyleContext::Bg(wxColour& color, int state) const { GdkRGBA* rgba; - cairo_pattern_t* pattern = NULL; + cairo_pattern_t* pattern = nullptr; gtk_style_context_set_state(m_context, GtkStateFlags(state)); gtk_style_context_get(m_context, GtkStateFlags(state), - "background-color", &rgba, "background-image", &pattern, NULL); + "background-color", &rgba, "background-image", &pattern, nullptr); color = wxColour(*rgba); gdk_rgba_free(rgba); @@ -457,7 +457,7 @@ void wxGtkStyleContext::Fg(wxColour& color, int state) const void wxGtkStyleContext::Border(wxColour& color) const { GdkRGBA* rgba; - gtk_style_context_get(m_context, GTK_STATE_FLAG_NORMAL, "border-color", &rgba, NULL); + gtk_style_context_get(m_context, GTK_STATE_FLAG_NORMAL, "border-color", &rgba, nullptr); color = wxColour(*rgba); gdk_rgba_free(rgba); } @@ -478,7 +478,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) { once = true; g_signal_connect(gtk_settings_get_default(), "notify::gtk-theme-name", - G_CALLBACK(notify_gtk_theme_name), NULL); + G_CALLBACK(notify_gtk_theme_name), nullptr); } wxGtkStyleContext sc; @@ -490,7 +490,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_GRADIENTACTIVECAPTION: case wxSYS_COLOUR_GRADIENTINACTIVECAPTION: #if GTK_CHECK_VERSION(3,10,0) - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) { int state = GTK_STATE_FLAG_NORMAL; if (index == wxSYS_COLOUR_INACTIVECAPTION || @@ -531,7 +531,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break; case wxSYS_COLOUR_CAPTIONTEXT: #if GTK_CHECK_VERSION(3,10,0) - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) { sc.AddHeaderbar().AddLabel().Fg(color); break; @@ -543,7 +543,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break; case wxSYS_COLOUR_INACTIVECAPTIONTEXT: #if GTK_CHECK_VERSION(3,10,0) - if (gtk_check_version(3,10,0) == NULL) + if (gtk_check_version(3,10,0) == nullptr) { sc.AddHeaderbar().AddLabel().Fg(color, GTK_STATE_FLAG_BACKDROP); break; @@ -554,7 +554,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) sc.AddLabel().Fg(color, GTK_STATE_FLAG_INSENSITIVE); break; case wxSYS_COLOUR_HOTLIGHT: - sc.Add(GTK_TYPE_LINK_BUTTON, "button", "link", NULL); + sc.Add(GTK_TYPE_LINK_BUTTON, "button", "link", nullptr); if (wx_is_at_least_gtk3(12)) sc.Fg(color, GTK_STATE_FLAG_LINK); #ifndef __WXGTK4__ @@ -591,7 +591,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) sc.AddMenu().Bg(color); break; case wxSYS_COLOUR_MENUBAR: - sc.Add(GTK_TYPE_MENU_BAR, "menubar", "menubar", NULL).Bg(color); + sc.Add(GTK_TYPE_MENU_BAR, "menubar", "menubar", nullptr).Bg(color); break; case wxSYS_COLOUR_MENUHILIGHT: sc.AddMenuItem().Bg(color, GTK_STATE_FLAG_PRELIGHT); @@ -747,10 +747,10 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) case wxSYS_COLOUR_HOTLIGHT: { GdkColor c = { 0, 0, 0, 0xeeee }; - if (gtk_check_version(2,10,0) == NULL) + if (gtk_check_version(2,10,0) == nullptr) { - GdkColor* linkColor = NULL; - gtk_widget_style_get(ButtonWidget(), "link-color", &linkColor, NULL); + GdkColor* linkColor = nullptr; + gtk_widget_style_get(ButtonWidget(), "link-color", &linkColor, nullptr); if (linkColor) { c = *linkColor; @@ -797,7 +797,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) { once = true; g_signal_connect(gtk_settings_get_default(), "notify::gtk-font-name", - G_CALLBACK(notify_gtk_font_name), NULL); + G_CALLBACK(notify_gtk_font_name), nullptr); } ContainerWidget(); int scale = 1; @@ -808,7 +808,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) wxGtkStyleContext sc(scale); sc.AddButton().AddLabel(); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, - GTK_STYLE_PROPERTY_FONT, &info.description, NULL); + GTK_STYLE_PROPERTY_FONT, &info.description, nullptr); #else info.description = ButtonStyle()->font_desc; #endif @@ -825,7 +825,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) #endif // wxUSE_FONTENUM #ifndef __WXGTK3__ - info.description = NULL; + info.description = nullptr; #endif } font = gs_fontSystem; @@ -841,7 +841,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) } // helper: return the GtkSettings either for the screen the current window is -// on or for the default screen if window is NULL +// on or for the default screen if window is null static GtkSettings *GetSettingsForWindowScreen(GdkWindow *window) { return window ? gtk_settings_get_for_screen(gdk_window_get_screen(window)) @@ -894,13 +894,13 @@ static int GetScrollbarWidth() #else wxGtkStyleContext sc; #endif - sc.Add(GTK_TYPE_SCROLLBAR, "scrollbar", "scrollbar", "vertical", "right", NULL); + sc.Add(GTK_TYPE_SCROLLBAR, "scrollbar", "scrollbar", "vertical", "right", nullptr); gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); sc.Add("contents").Add("trough").Add("slider"); - gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "min-width", &width, NULL); + gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "min-width", &width, nullptr); width += border.left + border.right; gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); @@ -915,7 +915,7 @@ static int GetScrollbarWidth() { int slider_width, trough_border; gtk_widget_style_get(ScrollBarWidget(), - "slider-width", &slider_width, "trough-border", &trough_border, NULL); + "slider-width", &slider_width, "trough-border", &trough_border, nullptr); width = slider_width + (2 * trough_border); } return width; @@ -923,7 +923,7 @@ static int GetScrollbarWidth() int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win ) { - GdkWindow *window = NULL; + GdkWindow *window = nullptr; if (win) window = gtk_widget_get_window(win->GetHandle()); @@ -946,7 +946,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win // In most cases the top extent is the titlebar, so we use the bottom extent // for the heights. int right, bottom; - if (wxGetFrameExtents(window, NULL, &right, NULL, &bottom)) + if (wxGetFrameExtents(window, nullptr, &right, nullptr, &bottom)) { switch (index) { @@ -973,14 +973,14 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win case wxSYS_DCLICK_Y: gint dclick_distance; g_object_get(GetSettingsForWindowScreen(window), - "gtk-double-click-distance", &dclick_distance, NULL); + "gtk-double-click-distance", &dclick_distance, nullptr); return dclick_distance * 2; case wxSYS_DCLICK_MSEC: gint dclick; g_object_get(GetSettingsForWindowScreen(window), - "gtk-double-click-time", &dclick, NULL); + "gtk-double-click-time", &dclick, nullptr); return dclick; case wxSYS_CARET_ON_MSEC: @@ -991,7 +991,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win g_object_get(GetSettingsForWindowScreen(window), "gtk-cursor-blink", &should_blink, "gtk-cursor-blink-time", &blink_time, - NULL); + nullptr); if (!should_blink) return 0; @@ -1008,7 +1008,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win g_object_get(GetSettingsForWindowScreen(window), "gtk-cursor-blink", &should_blink, "gtk-cursor-blink-timeout", &timeout, - NULL); + nullptr); if (!should_blink) return 0; @@ -1027,7 +1027,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win case wxSYS_DRAG_Y: gint drag_threshold; g_object_get(GetSettingsForWindowScreen(window), - "gtk-dnd-drag-threshold", &drag_threshold, NULL); + "gtk-dnd-drag-threshold", &drag_threshold, nullptr); // The correct thing here would be to double the value // since that is what the API wants. But the values @@ -1086,7 +1086,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, const wxWindow* win // Reconsider when we have a way to report to the user on which side it is. { int top; - if (wxGetFrameExtents(window, NULL, NULL, &top, NULL)) + if (wxGetFrameExtents(window, nullptr, nullptr, &top, nullptr)) { return top; // top frame extent } @@ -1137,14 +1137,14 @@ void wxSystemSettingsModule::OnExit() if (settings) { g_signal_handlers_disconnect_by_func(settings, - (void*)notify_gtk_theme_name, NULL); + (void*)notify_gtk_theme_name, nullptr); g_signal_handlers_disconnect_by_func(settings, - (void*)notify_gtk_font_name, NULL); + (void*)notify_gtk_font_name, nullptr); } #endif if (gs_tlw_parent) { gtk_widget_destroy(gs_tlw_parent); - gs_tlw_parent = NULL; + gs_tlw_parent = nullptr; } } diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 9d63d7a0e4..24b7a4796e 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -288,7 +288,7 @@ void wxSlider::Init() m_needThumbRelease = false; m_blockScrollEvent = false; m_tickFreq = 0; - m_scale = NULL; + m_scale = nullptr; } bool wxSlider::Create(wxWindow *parent, @@ -313,7 +313,7 @@ bool wxSlider::Create(wxWindow *parent, } const bool isVertical = (style & wxSL_VERTICAL) != 0; - m_scale = gtk_scale_new(GtkOrientation(isVertical), NULL); + m_scale = gtk_scale_new(GtkOrientation(isVertical), nullptr); if (style & wxSL_MIN_MAX_LABELS) { @@ -326,24 +326,24 @@ bool wxSlider::Create(wxWindow *parent, gtk_widget_show(box); gtk_box_pack_start(GTK_BOX(m_widget), box, true, true, 0); - m_minLabel = gtk_label_new(NULL); + m_minLabel = gtk_label_new(nullptr); gtk_widget_show( m_minLabel ); gtk_box_pack_start(GTK_BOX(box), m_minLabel, false, false, 0); // expanding empty space between the min/max labels - GtkWidget *space = gtk_label_new(NULL); + GtkWidget *space = gtk_label_new(nullptr); gtk_widget_show( space ); gtk_box_pack_start(GTK_BOX(box), space, true, false, 0); - m_maxLabel = gtk_label_new(NULL); + m_maxLabel = gtk_label_new(nullptr); gtk_widget_show( m_maxLabel ); gtk_box_pack_end(GTK_BOX(box), m_maxLabel, false, false, 0); } else { m_widget = m_scale; - m_maxLabel = NULL; - m_minLabel = NULL; + m_maxLabel = nullptr; + m_minLabel = nullptr; } g_object_ref(m_widget); @@ -382,7 +382,7 @@ bool wxSlider::Create(wxWindow *parent, g_signal_connect(m_scale, "button_press_event", G_CALLBACK(gtk_button_press_event), this); g_signal_connect(m_scale, "button_release_event", G_CALLBACK(gtk_button_release_event), this); g_signal_connect(m_scale, "move_slider", G_CALLBACK(gtk_move_slider), this); - g_signal_connect(m_scale, "format_value", G_CALLBACK(gtk_format_value), NULL); + g_signal_connect(m_scale, "format_value", G_CALLBACK(gtk_format_value), nullptr); g_signal_connect(m_scale, "value_changed", G_CALLBACK(gtk_value_changed), this); gulong handler_id = g_signal_connect(m_scale, "event_after", G_CALLBACK(gtk_event_after), this); g_signal_handler_block(m_scale, handler_id); @@ -539,7 +539,7 @@ void wxSlider::SetTick(int tickPos) posTicks = GTK_POS_BOTTOM; } - gtk_scale_add_mark(GTK_SCALE (m_scale), (double)tickPos, posTicks, NULL); + gtk_scale_add_mark(GTK_SCALE (m_scale), (double)tickPos, posTicks, nullptr); } #else wxUnusedVar(tickPos); @@ -594,7 +594,7 @@ GdkWindow *wxSlider::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const wxVisualAttributes wxSlider::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { - return GetDefaultAttributesFromGTKWidget(gtk_scale_new(GTK_ORIENTATION_VERTICAL, NULL)); + return GetDefaultAttributesFromGTKWidget(gtk_scale_new(GTK_ORIENTATION_VERTICAL, nullptr)); } #endif // wxUSE_SLIDER diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 8b1e29d317..361b58ffd4 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -120,11 +120,11 @@ bool wxSpinButton::Create(wxWindow *parent, 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) + if (gtk_check_version(3,12,0) == nullptr) gtk_entry_set_max_width_chars(GTK_ENTRY(m_widget), 0); #endif #ifdef __WXGTK3__ - if (gtk_check_version(3,20,0) == NULL) + if (gtk_check_version(3,20,0) == nullptr) { GTKApplyCssStyle( "entry { min-width:0; padding-left:0; padding-right:0 }" @@ -146,32 +146,32 @@ bool wxSpinButton::Create(wxWindow *parent, int wxSpinButton::GetMin() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); double min; - gtk_spin_button_get_range((GtkSpinButton*)m_widget, &min, NULL); + gtk_spin_button_get_range((GtkSpinButton*)m_widget, &min, nullptr); return int(min); } int wxSpinButton::GetMax() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); double max; - gtk_spin_button_get_range((GtkSpinButton*)m_widget, NULL, &max); + gtk_spin_button_get_range((GtkSpinButton*)m_widget, nullptr, &max); return int(max); } int wxSpinButton::GetValue() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); return m_pos; } void wxSpinButton::SetValue( int value ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid spin button") ); GtkDisableEvents(); gtk_spin_button_set_value((GtkSpinButton*)m_widget, value); @@ -181,7 +181,7 @@ void wxSpinButton::SetValue( int value ) void wxSpinButton::SetRange(int minVal, int maxVal) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid spin button") ); GtkDisableEvents(); gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal); @@ -237,7 +237,7 @@ GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED_IN_GTK2(window { #ifdef __WXGTK3__ GTKFindWindow(m_widget, windows); - return NULL; + return nullptr; #else return GTK_SPIN_BUTTON(m_widget)->panel; #endif diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index b9c00a3708..3b28a37ac5 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -144,7 +144,7 @@ wxBEGIN_EVENT_TABLE(wxSpinCtrlGTKBase, wxSpinCtrlBase) wxEND_EVENT_TABLE() wxSpinCtrlGTKBase::wxSpinCtrlGTKBase() - : m_textOverride(NULL) + : m_textOverride(nullptr) { } @@ -167,7 +167,7 @@ bool wxSpinCtrlGTKBase::GTKResetTextOverrideOnly() return false; delete m_textOverride; - m_textOverride = NULL; + m_textOverride = nullptr; return true; } @@ -249,7 +249,7 @@ double wxSpinCtrlGTKBase::DoGetValue() const double wxSpinCtrlGTKBase::GTKGetValue() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); // Get value directly from current control text, just as // gtk_spin_button_update() would do. Calling gtk_spin_button_update() causes @@ -263,7 +263,7 @@ double wxSpinCtrlGTKBase::GTKGetValue() const int handled = 0; g_signal_emit(m_widget, sig_id, 0, &value, &handled); if (!handled) - value = g_strtod(gtk_entry_get_text(GTK_ENTRY(m_widget)), NULL); + value = g_strtod(gtk_entry_get_text(GTK_ENTRY(m_widget)), nullptr); GtkAdjustment* adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(m_widget)); const double lower = gtk_adjustment_get_lower(adj); @@ -278,28 +278,28 @@ double wxSpinCtrlGTKBase::GTKGetValue() const double wxSpinCtrlGTKBase::DoGetMin() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); double min = 0; - gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), &min, NULL); + gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), &min, nullptr); return min; } double wxSpinCtrlGTKBase::DoGetMax() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); double max = 0; - gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), NULL, &max); + gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), nullptr, &max); return max; } double wxSpinCtrlGTKBase::DoGetIncrement() const { - wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); + wxCHECK_MSG( (m_widget != nullptr), 0, wxT("invalid spin button") ); double inc = 0; - gtk_spin_button_get_increments( GTK_SPIN_BUTTON(m_widget), &inc, NULL); + gtk_spin_button_get_increments( GTK_SPIN_BUTTON(m_widget), &inc, nullptr); return inc; } @@ -319,7 +319,7 @@ bool wxSpinCtrlGTKBase::GetSnapToTicks() const void wxSpinCtrlGTKBase::SetValue( const wxString& value ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid spin button") ); double n; if ( wxSscanf(value, "%lg", &n) == 1 ) @@ -341,7 +341,7 @@ void wxSpinCtrlGTKBase::SetValue( const wxString& value ) void wxSpinCtrlGTKBase::DoSetValue( double value ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid spin button") ); GTKResetTextOverride(); @@ -351,7 +351,7 @@ void wxSpinCtrlGTKBase::DoSetValue( double value ) void wxSpinCtrlGTKBase::SetSnapToTicks(bool snap_to_ticks) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != nullptr), "invalid spin button" ); gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON(m_widget), snap_to_ticks); } @@ -371,7 +371,7 @@ void wxSpinCtrlGTKBase::SetSelection(long from, long to) void wxSpinCtrlGTKBase::DoSetRange(double minVal, double maxVal) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid spin button") ); // Negative values in the range are allowed only if base == 10 if ( !wxSpinCtrlImpl::IsBaseCompatibleWithRange(int(minVal), int(maxVal), GetBase()) ) @@ -413,7 +413,7 @@ void wxSpinCtrlGTKBase::GtkEnableEvents() void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid spin ctrl") ); if (event.GetKeyCode() == WXK_RETURN) { @@ -457,7 +457,7 @@ GdkWindow *wxSpinCtrlGTKBase::GTKGetWindow(wxArrayGdkWindows& windows) const windows.push_back(spinbutton->panel); #endif - return NULL; + return nullptr; } wxSize wxSpinCtrlGTKBase::DoGetSizeFromTextSize(int xlen, int ylen) const diff --git a/src/gtk/srchctrl.cpp b/src/gtk/srchctrl.cpp index 856fe5ddea..c7469df6da 100644 --- a/src/gtk/srchctrl.cpp +++ b/src/gtk/srchctrl.cpp @@ -124,10 +124,10 @@ wxSearchCtrl::~wxSearchCtrl() void wxSearchCtrl::Init() { - m_entry = NULL; + m_entry = nullptr; #if wxUSE_MENUS - m_menu = NULL; + m_menu = nullptr; #endif // wxUSE_MENUS m_cancelButtonVisible = false; @@ -153,7 +153,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id, if ( HasFlag(wxBORDER_NONE) ) { - g_object_set (m_widget, "has-frame", FALSE, NULL); + g_object_set (m_widget, "has-frame", FALSE, nullptr); } GtkEntry * const entry = GetEntry(); @@ -237,7 +237,7 @@ void wxSearchCtrl::SetMenu( wxMenu* menu ) delete m_menu; m_menu = menu; - const bool hasMenu = m_menu != NULL; + const bool hasMenu = m_menu != nullptr; gtk_entry_set_icon_sensitive(m_entry, GTK_ENTRY_ICON_PRIMARY, hasMenu); gtk_entry_set_icon_activatable(m_entry, GTK_ENTRY_ICON_PRIMARY, hasMenu); @@ -275,7 +275,7 @@ void wxSearchCtrl::ShowCancelButton(bool show) gtk_entry_set_icon_from_icon_name(m_entry, GTK_ENTRY_ICON_SECONDARY, - show ? "edit-clear-symbolic" : NULL); + show ? "edit-clear-symbolic" : nullptr); m_cancelButtonVisible = show; } @@ -305,7 +305,7 @@ wxString wxSearchCtrl::GetDescriptiveText() const void wxSearchCtrl::OnChar(wxKeyEvent& key_event) { - wxCHECK_RET( m_entry != NULL, "invalid search ctrl" ); + wxCHECK_RET( m_entry != nullptr, "invalid search ctrl" ); if ( key_event.GetKeyCode() == WXK_RETURN ) { diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index f5a69afa5f..ee564997a2 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -48,7 +48,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose*, wxWindow*) { const GtkAllocation& a = widget->allocation; gtk_paint_flat_box(gtk_widget_get_style(widget), gtk_widget_get_window(widget), - GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, "", a.x, a.y, a.width, a.height); + GTK_STATE_NORMAL, GTK_SHADOW_NONE, nullptr, widget, "", a.x, a.y, a.width, a.height); return false; } } @@ -104,7 +104,7 @@ bool wxStaticBox::DoCreate(wxWindow *parent, m_labelWin = labelWin; - m_widget = gtk_frame_new(NULL); + m_widget = gtk_frame_new(nullptr); gtk_frame_set_label_widget(GTK_FRAME(m_widget), labelWidget); } @@ -127,7 +127,7 @@ bool wxStaticBox::DoCreate(wxWindow *parent, if (!wx_is_at_least_gtk2(12)) { // we connect this signal to perform label-clipping as GTK >= 2.12 does - g_signal_connect(m_widget, "size_allocate", G_CALLBACK(size_allocate), NULL); + g_signal_connect(m_widget, "size_allocate", G_CALLBACK(size_allocate), nullptr); } #endif @@ -153,7 +153,7 @@ void wxStaticBox::AddChild( wxWindowBase *child ) void wxStaticBox::SetLabel( const wxString& label ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid staticbox") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid staticbox") ); wxCHECK_RET( !m_labelWin, wxS("Doesn't make sense when using label window") ); @@ -201,8 +201,8 @@ void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const if (label) { int nat_width; - gtk_widget_get_preferred_width(label, NULL, &nat_width); - gtk_widget_get_preferred_height_for_width(label, nat_width, borderTop, NULL); + gtk_widget_get_preferred_width(label, nullptr, &nat_width); + gtk_widget_get_preferred_height_for_width(label, nat_width, borderTop, nullptr); } #else gtk_widget_ensure_style(m_widget); diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 524b6d97b8..6c957dc9e8 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -49,7 +49,7 @@ bool wxStaticText::Create(wxWindow *parent, return false; } - m_widget = gtk_label_new(NULL); + m_widget = gtk_label_new(nullptr); g_object_ref(m_widget); GtkJustification justify; @@ -108,7 +108,7 @@ bool wxStaticText::Create(wxWindow *parent, // GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2 static const float labelAlignments[] = { 0.0, 1.0, 0.5 }; #ifdef __WXGTK4__ - g_object_set(m_widget, "xalign", labelAlignments[justify], NULL); + g_object_set(m_widget, "xalign", labelAlignments[justify], nullptr); #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) gtk_misc_set_alignment(GTK_MISC(m_widget), labelAlignments[justify], 0.0); @@ -135,7 +135,7 @@ bool wxStaticText::Create(wxWindow *parent, void wxStaticText::GTKDoSetLabel(GTKLabelSetter setter, const wxString& label) { - wxCHECK_RET( m_widget != NULL, wxT("invalid static text") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid static text") ); (this->*setter)(GTK_LABEL(m_widget), label); @@ -209,7 +209,7 @@ bool wxStaticText::SetFont( const wxFont &font ) else // No special attributes any more. { // Just remove any attributes we had set. - gtk_label_set_attributes(GTK_LABEL(m_widget), NULL); + gtk_label_set_attributes(GTK_LABEL(m_widget), nullptr); } // The underlines for mnemonics are incompatible with using attributes diff --git a/src/gtk/taskbar.cpp b/src/gtk/taskbar.cpp index 7612727fb2..11bc98f50f 100644 --- a/src/gtk/taskbar.cpp +++ b/src/gtk/taskbar.cpp @@ -97,7 +97,7 @@ icon_destroy(GtkWidget*, wxTaskBarIcon::Private* priv) { // Icon window destroyed, probably because tray program has died. // Recreate icon so it will appear if tray program is restarted. - priv->m_eggTrayIcon = NULL; + priv->m_eggTrayIcon = nullptr; priv->SetIcon(); } #endif @@ -130,9 +130,9 @@ icon_button_press_event(GtkWidget*, GdkEventButton* event, wxTaskBarIcon* taskBa if (event->type == GDK_BUTTON_PRESS) { if (event->button == 1) - icon_activate(NULL, taskBarIcon); + icon_activate(nullptr, taskBarIcon); else if (event->button == 3) - icon_popup_menu(NULL, taskBarIcon); + icon_popup_menu(nullptr, taskBarIcon); } return false; } @@ -142,7 +142,7 @@ icon_button_press_event(GtkWidget*, GdkEventButton* event, wxTaskBarIcon* taskBa static void status_icon_popup_menu(GtkStatusIcon*, guint, guint, wxTaskBarIcon* taskBarIcon) { - icon_popup_menu(NULL, taskBarIcon); + icon_popup_menu(nullptr, taskBarIcon); } #endif } // extern "C" @@ -152,7 +152,7 @@ bool wxTaskBarIconBase::IsAvailable() { #ifdef GDK_WINDOWING_X11 #ifdef __WXGTK3__ - if (!wxGTKImpl::IsX11(NULL)) + if (!wxGTKImpl::IsX11(nullptr)) return false; #endif @@ -173,11 +173,11 @@ bool wxTaskBarIconBase::IsAvailable() wxTaskBarIcon::Private::Private(wxTaskBarIcon* taskBarIcon) { m_taskBarIcon = taskBarIcon; - m_statusIcon = NULL; - m_win = NULL; + m_statusIcon = nullptr; + m_win = nullptr; #ifndef __WXGTK3__ - m_eggTrayIcon = NULL; - m_tooltips = NULL; + m_eggTrayIcon = nullptr; + m_tooltips = nullptr; m_size = 0; #endif } @@ -254,7 +254,7 @@ void wxTaskBarIcon::Private::SetIcon() #endif } #if wxUSE_TOOLTIPS - const char *tip_text = NULL; + const char *tip_text = nullptr; if (!m_tipText.empty()) tip_text = m_tipText.utf8_str(); @@ -276,7 +276,7 @@ void wxTaskBarIcon::Private::SetIcon() #endif // GTK_CHECK_VERSION(2,10,0) { #ifndef __WXGTK3__ - if (tip_text && m_tooltips == NULL) + if (tip_text && m_tooltips == nullptr) { m_tooltips = gtk_tooltips_new(); g_object_ref(m_tooltips); @@ -346,7 +346,7 @@ bool wxTaskBarIcon::RemoveIcon() bool wxTaskBarIcon::IsIconInstalled() const { #ifdef __WXGTK3__ - return m_priv->m_statusIcon != NULL; + return m_priv->m_statusIcon != nullptr; #else return m_priv->m_statusIcon || m_priv->m_eggTrayIcon; #endif @@ -355,10 +355,10 @@ bool wxTaskBarIcon::IsIconInstalled() const bool wxTaskBarIcon::PopupMenu(wxMenu* menu) { #if wxUSE_MENUS - if (m_priv->m_win == NULL) + if (m_priv->m_win == nullptr) { m_priv->m_win = new wxTopLevelWindow( - NULL, wxID_ANY, wxString(), wxDefaultPosition, wxDefaultSize, 0); + nullptr, wxID_ANY, wxString(), wxDefaultPosition, wxDefaultSize, 0); m_priv->m_win->PushEventHandler(this); } wxPoint point(-1, -1); @@ -375,7 +375,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType) { - m_priv = NULL; + m_priv = nullptr; } wxTaskBarIcon::~wxTaskBarIcon() diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 14005d16aa..b99921d43d 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -51,7 +51,7 @@ static void wxGtkOnRemoveTag(GtkTextBuffer *buffer, char *prefix) { gchar *name; - g_object_get (tag, "name", &name, NULL); + g_object_get (tag, "name", &name, nullptr); if (!name || strncmp(name, prefix, strlen(prefix))) // anonymous tag or not starting with prefix - don't remove @@ -102,7 +102,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, if (!tag) tag = gtk_text_buffer_create_tag( text_buffer, buf, "font-desc", font_description, - NULL ); + nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); if (font.GetUnderlined()) @@ -114,7 +114,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, tag = gtk_text_buffer_create_tag( text_buffer, buf, "underline-set", TRUE, "underline", PANGO_UNDERLINE_SINGLE, - NULL ); + nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } if ( font.GetStrikethrough() ) @@ -126,7 +126,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, tag = gtk_text_buffer_create_tag( text_buffer, buf, "strikethrough-set", TRUE, "strikethrough", TRUE, - NULL ); + nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } } @@ -158,7 +158,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, tag = gtk_text_buffer_create_tag( text_buffer, buf, "underline-set", TRUE, "underline", pangoUnderlineStyle, - NULL ); + nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); #ifdef __WXGTK3__ @@ -175,7 +175,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, tag = gtk_text_buffer_create_tag( text_buffer, buf, "underline-rgba-set", TRUE, "underline-rgba", static_cast(colour), - NULL ); + nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } } @@ -193,7 +193,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, buf ); if (!tag) tag = gtk_text_buffer_create_tag( text_buffer, buf, - "foreground-gdk", colFg, NULL ); + "foreground-gdk", colFg, nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } @@ -208,7 +208,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, buf ); if (!tag) tag = gtk_text_buffer_create_tag( text_buffer, buf, - "background-gdk", colBg, NULL ); + "background-gdk", colBg, nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, start, end); } @@ -255,7 +255,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, buf ); if (!tag) tag = gtk_text_buffer_create_tag( text_buffer, buf, - "justification", align, NULL ); + "justification", align, nullptr ); gtk_text_buffer_apply_tag( text_buffer, tag, ¶_start, ¶_end ); } @@ -309,7 +309,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, buf ); if (!tag) tag = gtk_text_buffer_create_tag( text_buffer, buf, - "left-margin", gindent, "indent", gsubindent, NULL ); + "left-margin", gindent, "indent", gsubindent, nullptr ); gtk_text_buffer_apply_tag (text_buffer, tag, ¶_start, ¶_end); } @@ -357,7 +357,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text, for (size_t i = 0; i < tabs.GetCount(); i++) pango_tab_array_set_tab(tabArray, i, PANGO_TAB_LEFT, (gint)(tabs[i] * factor)); tag = gtk_text_buffer_create_tag( text_buffer, buftag, - "tabs", tabArray, NULL ); + "tabs", tabArray, nullptr ); pango_tab_array_free(tabArray); } gtk_text_buffer_apply_tag (text_buffer, tag, ¶_start, ¶_end); @@ -461,9 +461,9 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) // Might want to move this to au_check_range if an improved link checking doesn't // use some intelligent punctuation checking itself (beware of undesired iter modifications). if(g_unichar_ispunct( gtk_text_iter_get_char( &start ) ) ) - gtk_text_iter_forward_find_char( &start, pred_nonpunct, NULL, e ); + gtk_text_iter_forward_find_char( &start, pred_nonpunct, nullptr, e ); - gtk_text_iter_backward_find_char( &end, pred_nonpunct_or_slash, NULL, &start ); + gtk_text_iter_backward_find_char( &end, pred_nonpunct_or_slash, nullptr, &start ); gtk_text_iter_forward_char(&end); wxGtkString text(gtk_text_iter_get_text( &start, &end )); @@ -482,8 +482,8 @@ au_check_word( GtkTextIter *s, GtkTextIter *e ) { gulong signal_id = g_signal_handler_find (buffer, (GSignalMatchType) (G_SIGNAL_MATCH_FUNC), - 0, 0, NULL, - (gpointer)au_apply_tag_callback, NULL); + 0, 0, nullptr, + (gpointer)au_apply_tag_callback, nullptr); g_signal_handler_block (buffer, signal_id); gtk_text_buffer_apply_tag(buffer, tag, &start, &end); @@ -505,18 +505,18 @@ au_check_range(GtkTextIter *s, gtk_text_buffer_remove_tag(buffer, tag, s, range_end); if(g_unichar_isspace(gtk_text_iter_get_char(&range_start))) - gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, NULL, range_end); + gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, nullptr, range_end); while(!gtk_text_iter_equal(&range_start, range_end)) { word_end = range_start; - gtk_text_iter_forward_find_char(&word_end, pred_whitespace, NULL, range_end); + gtk_text_iter_forward_find_char(&word_end, pred_whitespace, nullptr, range_end); // Now we should have a word delimited by range_start and word_end, correct link tags au_check_word(&range_start, &word_end); range_start = word_end; - gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, NULL, range_end); + gtk_text_iter_forward_find_char(&range_start, pred_non_whitespace, nullptr, range_end); } } } @@ -571,8 +571,8 @@ au_insert_text_callback(GtkTextBuffer *buffer, gtk_text_iter_set_line(&line_start, gtk_text_iter_get_line(&start)); gtk_text_iter_forward_to_line_end(&line_end); - gtk_text_iter_backward_find_char(&words_start, pred_whitespace, NULL, &line_start); - gtk_text_iter_forward_find_char(&words_end, pred_whitespace, NULL, &line_end); + gtk_text_iter_backward_find_char(&words_start, pred_whitespace, nullptr, &line_start); + gtk_text_iter_forward_find_char(&words_end, pred_whitespace, nullptr, &line_end); au_check_range(&words_start, &words_end); } @@ -596,8 +596,8 @@ au_delete_range_callback(GtkTextBuffer * WXUNUSED(buffer), gtk_text_iter_set_line(&line_start, gtk_text_iter_get_line(start)); gtk_text_iter_forward_to_line_end(&line_end); - gtk_text_iter_backward_find_char(start, pred_whitespace, NULL, &line_start); - gtk_text_iter_forward_find_char(end, pred_whitespace, NULL, &line_end); + gtk_text_iter_backward_find_char(start, pred_whitespace, nullptr, &line_start); + gtk_text_iter_forward_find_char(end, pred_whitespace, nullptr, &line_end); au_check_range(start, end); } @@ -632,7 +632,7 @@ gtk_textctrl_populate_popup( GtkEntry *WXUNUSED(entry), GtkMenu *menu, wxTextCtr extern "C" { static void mark_set(GtkTextBuffer*, GtkTextIter*, GtkTextMark* mark, GSList** markList) { - if (gtk_text_mark_get_name(mark) == NULL) + if (gtk_text_mark_get_name(mark) == nullptr) *markList = g_slist_prepend(*markList, mark); } } @@ -689,10 +689,10 @@ void wxTextCtrl::Init() SetUpdateFont(false); - m_text = NULL; - m_buffer = NULL; - m_showPositionDefer = NULL; - m_anonymousMarkList = NULL; + m_text = nullptr; + m_buffer = nullptr; + m_showPositionDefer = nullptr; + m_anonymousMarkList = nullptr; m_afterLayoutId = 0; } @@ -748,7 +748,7 @@ bool wxTextCtrl::Create( wxWindow *parent, if (multi_line) { - m_buffer = gtk_text_buffer_new(NULL); + m_buffer = gtk_text_buffer_new(nullptr); 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); @@ -763,7 +763,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_text_buffer_create_mark(m_buffer, "ShowPosition", &iter, true); // create scrolled window - m_widget = gtk_scrolled_window_new( NULL, NULL ); + m_widget = gtk_scrolled_window_new( nullptr, nullptr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( m_widget ), GTK_POLICY_AUTOMATIC, style & wxTE_NO_VSCROLL @@ -862,7 +862,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_text_buffer_create_tag(m_buffer, "wxUrl", "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, - NULL); + nullptr); g_signal_connect_after (m_buffer, "delete_range", G_CALLBACK (au_delete_range_callback), this); @@ -874,7 +874,7 @@ bool wxTextCtrl::Create( wxWindow *parent, // The insert-text signal emitted inside it will take care of newly formed // or wholly copied URLs. g_signal_connect (m_buffer, "apply_tag", - G_CALLBACK (au_apply_tag_callback), NULL); + G_CALLBACK (au_apply_tag_callback), nullptr); // Check for URLs in the initial string passed to Create gtk_text_buffer_get_start_iter(m_buffer, &start); @@ -911,7 +911,7 @@ bool wxTextCtrl::Create( wxWindow *parent, GtkEditable *wxTextCtrl::GetEditable() const { - wxCHECK_MSG( IsSingleLine(), NULL, "shouldn't be called for multiline" ); + wxCHECK_MSG( IsSingleLine(), nullptr, "shouldn't be called for multiline" ); return GTK_EDITABLE(m_text); } @@ -921,7 +921,7 @@ GtkEntry *wxTextCtrl::GetEntry() const if (GTK_IS_ENTRY(m_text)) return (GtkEntry*)m_text; - return NULL; + return nullptr; } int wxTextCtrl::GTKIMFilterKeypress(GdkEventKey* event) const @@ -1121,7 +1121,7 @@ void wxTextCtrl::SetWindowStyleFlag(long style) wxString wxTextCtrl::GetValue() const { - wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, wxEmptyString, wxT("invalid text ctrl") ); return wxTextEntry::GetValue(); } @@ -1202,7 +1202,7 @@ void wxTextCtrl::GTKAfterLayout() if (m_showPositionDefer && !IsFrozen()) { gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(m_text), m_showPositionDefer); - m_showPositionDefer = NULL; + m_showPositionDefer = nullptr; } } @@ -1220,7 +1220,7 @@ static gboolean afterLayout(void* data) void wxTextCtrl::WriteText( const wxString &text ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( text.empty() ) { @@ -1241,7 +1241,7 @@ void wxTextCtrl::WriteText( const wxString &text ) // still be set e.g. because we're called from a menu event handler // triggered by a keyboard accelerator), so reset m_imKeyEvent temporarily. GdkEventKey* const imKeyEvent_save = m_imKeyEvent; - m_imKeyEvent = NULL; + m_imKeyEvent = nullptr; wxON_BLOCK_EXIT_SET(m_imKeyEvent, imKeyEvent_save); if ( !IsMultiLine() ) @@ -1309,7 +1309,7 @@ void wxTextCtrl::WriteText( const wxString &text ) { g_signal_connect(adj, "changed", G_CALLBACK(adjustmentChanged), &m_showPositionDefer); m_afterLayoutId = - g_idle_add_full(GTK_TEXT_VIEW_PRIORITY_VALIDATE + 1, afterLayout, this, NULL); + g_idle_add_full(GTK_TEXT_VIEW_PRIORITY_VALIDATE + 1, afterLayout, this, nullptr); } } @@ -1481,7 +1481,7 @@ int wxTextCtrl::GetNumberOfLines() const void wxTextCtrl::SetInsertionPoint( long pos ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1507,7 +1507,7 @@ void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetEditable( bool editable ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1580,7 +1580,7 @@ bool wxTextCtrl::MarkDirtyOnChange() void wxTextCtrl::SetSelection( long from, long to ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1700,7 +1700,7 @@ wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const long wxTextCtrl::GetInsertionPoint() const { - wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, 0, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1722,7 +1722,7 @@ long wxTextCtrl::GetInsertionPoint() const wxTextPos wxTextCtrl::GetLastPosition() const { - wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, 0, wxT("invalid text ctrl") ); int pos = 0; @@ -1743,7 +1743,7 @@ wxTextPos wxTextCtrl::GetLastPosition() const void wxTextCtrl::Remove( long from, long to ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1761,7 +1761,7 @@ void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Cut() { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) g_signal_emit_by_name (m_text, "cut-clipboard"); @@ -1771,7 +1771,7 @@ void wxTextCtrl::Cut() void wxTextCtrl::Copy() { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) g_signal_emit_by_name (m_text, "copy-clipboard"); @@ -1781,7 +1781,7 @@ void wxTextCtrl::Copy() void wxTextCtrl::Paste() { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( IsMultiLine() ) g_signal_emit_by_name (m_text, "paste-clipboard"); @@ -1793,7 +1793,7 @@ void wxTextCtrl::Paste() // selection. void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( !IsMultiLine() ) { @@ -1832,7 +1832,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const bool wxTextCtrl::IsEditable() const { - wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, false, wxT("invalid text ctrl") ); if ( IsMultiLine() ) { @@ -1851,7 +1851,7 @@ bool wxTextCtrl::IsModified() const void wxTextCtrl::OnChar( wxKeyEvent &key_event ) { - wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") ); + wxCHECK_RET( m_text != nullptr, wxT("invalid text ctrl") ); if ( key_event.GetKeyCode() == WXK_RETURN ) { @@ -1899,7 +1899,7 @@ GdkWindow *wxTextCtrl::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const // the font will change for subsequent text insertiongs bool wxTextCtrl::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, false, wxT("invalid text ctrl") ); if ( !wxTextCtrlBase::SetFont(font) ) { @@ -1951,7 +1951,7 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour) bool wxTextCtrl::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") ); + wxCHECK_MSG( m_text != nullptr, false, wxT("invalid text ctrl") ); if ( !wxControl::SetBackgroundColour( colour ) ) return false; @@ -2060,15 +2060,15 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) if ( wx_is_at_least_gtk3(16) ) { GSList* tags = gtk_text_iter_get_tags(&positioni); - for ( GSList* tagp = tags; tagp != NULL; tagp = tagp->next ) + for ( GSList* tagp = tags; tagp != nullptr; tagp = tagp->next ) { GtkTextTag* tag = static_cast(tagp->data); gboolean underlineSet = FALSE; - g_object_get(tag, "underline-rgba-set", &underlineSet, NULL); + g_object_get(tag, "underline-rgba-set", &underlineSet, nullptr); if ( underlineSet ) { - GdkRGBA* gdkColour = NULL; - g_object_get(tag, "underline-rgba", &gdkColour, NULL); + GdkRGBA* gdkColour = nullptr; + g_object_get(tag, "underline-rgba", &gdkColour, nullptr); if ( gdkColour ) underlineColour = wxColour(*gdkColour); gdk_rgba_free(gdkColour); @@ -2220,7 +2220,7 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const void wxTextCtrl::DoFreeze() { - wxCHECK_RET(m_text != NULL, wxT("invalid text ctrl")); + wxCHECK_RET(m_text != nullptr, wxT("invalid text ctrl")); GTKFreezeWidget(m_text); if (m_widget != m_text) @@ -2230,7 +2230,7 @@ void wxTextCtrl::DoFreeze() { // removing buffer dramatically speeds up insertion: g_object_ref(m_buffer); - GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL); + GtkTextBuffer* buf_new = gtk_text_buffer_new(nullptr); gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new); // gtk_text_view_set_buffer adds its own reference g_object_unref(buf_new); @@ -2247,7 +2247,7 @@ void wxTextCtrl::DoFreeze() gtk_text_buffer_delete_mark(m_buffer, mark); } g_slist_free(m_anonymousMarkList); - m_anonymousMarkList = NULL; + m_anonymousMarkList = nullptr; } } } @@ -2266,7 +2266,7 @@ void wxTextCtrl::DoThaw() { gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(m_text), m_showPositionDefer); if (m_afterLayoutId == 0) - m_showPositionDefer = NULL; + m_showPositionDefer = nullptr; } } diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index 2edf206294..d83ce513e5 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -357,7 +357,7 @@ public: // instead and only after checking that it is still valid. if ( GTK_IS_ENTRY(m_widgetEntry) ) { - gtk_entry_set_completion(m_widgetEntry, NULL); + gtk_entry_set_completion(m_widgetEntry, nullptr); g_signal_handlers_disconnect_by_data(m_widgetEntry, this); } @@ -405,7 +405,7 @@ protected: gtk_list_store_set (store, &iter, 0, (const gchar *)s.utf8_str(), -1); } - // Really change the completion model (which may be NULL). + // Really change the completion model (which may be null). void UseModel(GtkListStore* store) { GtkEntryCompletion* const c = gtk_entry_get_completion(m_widgetEntry); @@ -431,11 +431,11 @@ protected: class wxTextAutoCompleteFixed : public wxTextAutoCompleteData { public: - // Factory function, may return NULL if entry is invalid. + // Factory function, may return nullptr if entry is invalid. static wxTextAutoCompleteFixed* New(wxTextEntry *entry) { if ( !CanComplete(entry) ) - return NULL; + return nullptr; return new wxTextAutoCompleteFixed(entry); } @@ -478,11 +478,11 @@ public: static wxTextAutoCompleteDynamic* New(wxTextEntry *entry) { if ( !CanComplete(entry) ) - return NULL; + return nullptr; wxWindow * const win = GetEditableWindow(entry); if ( !win ) - return NULL; + return nullptr; return new wxTextAutoCompleteDynamic(entry, win); } @@ -499,7 +499,7 @@ public: return false; } - // Takes ownership of the pointer which must be non-NULL. + // Takes ownership of the pointer which must be non-null. virtual bool ChangeCompleter(wxTextCompleter *completer) override { delete m_completer; @@ -516,7 +516,7 @@ private: : wxTextAutoCompleteData(entry), m_win(win) { - m_completer = NULL; + m_completer = nullptr; win->Bind(wxEVT_TEXT, &wxTextAutoCompleteDynamic::OnEntryChanged, this); } @@ -550,7 +550,7 @@ private: } else { - UseModel(NULL); + UseModel(nullptr); } } @@ -602,8 +602,8 @@ wx_gtk_entry_parent_grab_notify (GtkWidget *widget, wxTextEntry::wxTextEntry() { - m_autoCompleteData = NULL; - m_coalesceData = NULL; + m_autoCompleteData = nullptr; + m_coalesceData = nullptr; m_isUpperCase = false; } @@ -845,7 +845,7 @@ bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) if ( !m_autoCompleteData || !m_autoCompleteData->ChangeStrings(choices) ) { delete m_autoCompleteData; - m_autoCompleteData = NULL; + m_autoCompleteData = nullptr; // If it failed, try creating a new object for fixed completion. wxTextAutoCompleteFixed* const ac = wxTextAutoCompleteFixed::New(this); @@ -868,7 +868,7 @@ bool wxTextEntry::DoAutoCompleteCustom(wxTextCompleter *completer) if ( m_autoCompleteData ) { delete m_autoCompleteData; - m_autoCompleteData = NULL; + m_autoCompleteData = nullptr; } //else: Nothing to do, we hadn't used auto-completion even before. } @@ -880,7 +880,7 @@ bool wxTextEntry::DoAutoCompleteCustom(wxTextCompleter *completer) !m_autoCompleteData->ChangeCompleter(completer) ) { delete m_autoCompleteData; - m_autoCompleteData = NULL; + m_autoCompleteData = nullptr; wxTextAutoCompleteDynamic* const ac = wxTextAutoCompleteDynamic::New(this); @@ -1113,7 +1113,7 @@ bool wxTextEntry::SetHint(const wxString& hint) { #if GTK_CHECK_VERSION(3,2,0) GtkEntry *entry = GetEntry(); - if (entry && gtk_check_version(3,2,0) == NULL) + if (entry && gtk_check_version(3,2,0) == nullptr) { gtk_entry_set_placeholder_text ( @@ -1130,7 +1130,7 @@ wxString wxTextEntry::GetHint() const { #if GTK_CHECK_VERSION(3,2,0) GtkEntry *entry = GetEntry(); - if (entry && gtk_check_version(3,2,0) == NULL) + if (entry && gtk_check_version(3,2,0) == nullptr) { return wxGTK_CONV_BACK_FONT ( @@ -1146,7 +1146,7 @@ wxString wxTextEntry::GetHint() const bool wxTextEntry::ClickDefaultButtonIfPossible() { GtkWidget* const widget = GTK_WIDGET(GetEntry()); - if (widget == NULL) + if (widget == nullptr) return false; // This does the same thing as gtk_entry_real_activate() in GTK itself. diff --git a/src/gtk/textmeasure.cpp b/src/gtk/textmeasure.cpp index 407a62f36b..c64b54b84b 100644 --- a/src/gtk/textmeasure.cpp +++ b/src/gtk/textmeasure.cpp @@ -39,11 +39,11 @@ void wxTextMeasure::Init() { - m_context = NULL; - m_layout = NULL; + m_context = nullptr; + m_layout = nullptr; #ifndef __WXGTK3__ - m_wdc = NULL; + m_wdc = nullptr; if ( m_dc ) { @@ -142,7 +142,7 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string, { // the logical rect bounds the ink rect PangoRectangle rect; - pango_layout_get_extents(m_layout, NULL, &rect); + pango_layout_get_extents(m_layout, nullptr, &rect); *width = PANGO_PIXELS(rect.width); *height = PANGO_PIXELS(rect.height); } @@ -186,11 +186,11 @@ bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text, // Code borrowed from Scintilla's PlatGTK PangoLayoutIter *iter = pango_layout_get_iter(m_layout); PangoRectangle pos; - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); + pango_layout_iter_get_cluster_extents(iter, nullptr, &pos); size_t i = 0; while (pango_layout_iter_next_cluster(iter)) { - pango_layout_iter_get_cluster_extents(iter, NULL, &pos); + pango_layout_iter_get_cluster_extents(iter, nullptr, &pos); int position = PANGO_PIXELS(pos.x); widths[i++] = position; } diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 135b4bf498..6fad5d4240 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -141,7 +141,7 @@ void wxToggleButton::GTKEnableEvents() // Set the value of the toggle button. void wxToggleButton::SetValue(bool state) { - wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); + wxCHECK_RET(m_widget != nullptr, wxT("invalid toggle button")); if (state == GetValue()) return; @@ -156,14 +156,14 @@ void wxToggleButton::SetValue(bool state) // Get the value of the toggle button. bool wxToggleButton::GetValue() const { - wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button")); + wxCHECK_MSG(m_widget != nullptr, false, wxT("invalid toggle button")); return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0; } void wxToggleButton::SetLabel(const wxString& label) { - wxCHECK_RET(m_widget != NULL, wxT("invalid toggle button")); + wxCHECK_RET(m_widget != nullptr, wxT("invalid toggle button")); wxAnyButton::SetLabel(label); @@ -185,7 +185,7 @@ void wxToggleButton::SetLabel(const wxString& label) #if wxUSE_MARKUP bool wxToggleButton::DoSetLabelMarkup(const wxString& markup) { - wxCHECK_MSG( m_widget != NULL, false, "invalid toggle button" ); + wxCHECK_MSG( m_widget != nullptr, false, "invalid toggle button" ); const wxString stripped = RemoveMarkup(markup); if ( stripped.empty() && !markup.empty() ) diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp index 4600b48cd9..4c7fff5b9a 100644 --- a/src/gtk/toolbar.cpp +++ b/src/gtk/toolbar.cpp @@ -44,13 +44,13 @@ public: : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind, clientData, shortHelpString, longHelpString) { - m_item = NULL; + m_item = nullptr; } wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) : wxToolBarToolBase(tbar, control, label) { - m_item = NULL; + m_item = nullptr; } void SetImage(); @@ -356,7 +356,7 @@ void wxToolBarTool::SetLabel(const wxString& label) } else { - gtk_tool_button_set_label(GTK_TOOL_BUTTON(m_item), NULL); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(m_item), nullptr); // To hide the label for toolbar with wxTB_HORZ_LAYOUT. gtk_tool_item_set_is_important(m_item, false); } @@ -390,14 +390,14 @@ wxToolBar::CreateTool(wxControl *control, const wxString& label) void wxToolBar::Init() { - m_toolbar = NULL; - m_tooltips = NULL; + m_toolbar = nullptr; + m_tooltips = nullptr; } wxToolBar::~wxToolBar() { #ifndef __WXGTK3__ - if (m_tooltips) // always NULL if GTK >= 2.12 + if (m_tooltips) // always null if GTK >= 2.12 { gtk_object_destroy(GTK_OBJECT(m_tooltips)); g_object_unref(m_tooltips); @@ -447,9 +447,9 @@ bool wxToolBar::Create( wxWindow *parent, m_widget = gtk_handle_box_new(); g_signal_connect(m_widget, "child_detached", - G_CALLBACK(child_detached), NULL); + G_CALLBACK(child_detached), nullptr); g_signal_connect(m_widget, "child_attached", - G_CALLBACK(child_attached), NULL); + G_CALLBACK(child_attached), nullptr); if (style & wxTB_FLAT) gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE ); @@ -568,7 +568,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) wxFALLTHROUGH; case wxITEM_DROPDOWN: case wxITEM_NORMAL: - tool->m_item = gtk_tool_button_new(NULL, ""); + tool->m_item = gtk_tool_button_new(nullptr, ""); g_signal_connect(tool->m_item, "clicked", G_CALLBACK(item_clicked), tool); break; @@ -637,7 +637,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) case wxTOOL_STYLE_CONTROL: wxWindow* control = tool->GetControl(); - if (gtk_widget_get_parent(control->m_widget) == NULL) + if (gtk_widget_get_parent(control->m_widget) == nullptr) AddChildGTK(control); #ifdef __WXGTK3__ tool->m_item = GTK_TOOL_ITEM(gtk_widget_get_parent(control->m_widget)); @@ -675,7 +675,7 @@ bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget); } gtk_widget_destroy(GTK_WIDGET(tool->m_item)); - tool->m_item = NULL; + tool->m_item = nullptr; InvalidateBestSize(); return true; @@ -683,19 +683,19 @@ bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase) GSList* wxToolBar::GetRadioGroup(size_t pos) { - GSList* radioGroup = NULL; - GtkToolItem* item = NULL; + GSList* radioGroup = nullptr; + GtkToolItem* item = nullptr; if (pos > 0) { item = gtk_toolbar_get_nth_item(m_toolbar, int(pos) - 1); if (!GTK_IS_RADIO_TOOL_BUTTON(item)) - item = NULL; + item = nullptr; } - if (item == NULL && pos < m_tools.size()) + if (item == nullptr && pos < m_tools.size()) { item = gtk_toolbar_get_nth_item(m_toolbar, int(pos)); if (!GTK_IS_RADIO_TOOL_BUTTON(item)) - item = NULL; + item = nullptr; } if (item) radioGroup = gtk_radio_tool_button_get_group((GtkRadioToolButton*)item); @@ -759,7 +759,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), // TODO: implement this using gtk_toolbar_get_drop_index() wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") ); - return NULL; + return nullptr; } void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) diff --git a/src/gtk/tooltip.cpp b/src/gtk/tooltip.cpp index df78390d10..ece800189d 100644 --- a/src/gtk/tooltip.cpp +++ b/src/gtk/tooltip.cpp @@ -24,7 +24,7 @@ //----------------------------------------------------------------------------- #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) -static GtkTooltips *gs_tooltips = NULL; +static GtkTooltips *gs_tooltips = nullptr; #endif //----------------------------------------------------------------------------- @@ -36,7 +36,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip( const wxString &tip ) : m_text(tip) { - m_window = NULL; + m_window = nullptr; } void wxToolTip::SetTip( const wxString &tip ) @@ -66,7 +66,7 @@ void wxToolTip::GTKApply(GtkWidget* widget, const char* tip) if ( !gs_tooltips ) gs_tooltips = gtk_tooltips_new(); - gtk_tooltips_set_tip(gs_tooltips, widget, tip, NULL); + gtk_tooltips_set_tip(gs_tooltips, widget, tip, nullptr); #endif } } @@ -82,7 +82,7 @@ void wxToolTip::Enable( bool flag ) GtkSettings* settings = gtk_settings_get_default(); wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (settings) - gtk_settings_set_long_property(settings, "gtk-enable-tooltips", flag, NULL); + gtk_settings_set_long_property(settings, "gtk-enable-tooltips", flag, nullptr); wxGCC_WARNING_RESTORE() } else @@ -112,7 +112,7 @@ void wxToolTip::SetDelay( long msecs ) GtkSettings* settings = gtk_settings_get_default(); wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (settings) - gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", msecs, NULL); + gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", msecs, nullptr); wxGCC_WARNING_RESTORE() } else diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 054dfa3d11..a883dd8128 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -59,7 +59,7 @@ 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_activeFrame = nullptr; extern wxCursor g_globalCursor; extern wxCursor g_busyCursor; @@ -90,7 +90,7 @@ static bool HasClientDecor(GtkWidget* widget) if (wxGTKImpl::IsWayland(display)) { #ifndef __WXGTK4__ - if (gtk_check_version(3, 22, 25) == NULL) + if (gtk_check_version(3, 22, 25) == nullptr) #endif return !gdk_wayland_display_prefers_ssd(display); } @@ -202,7 +202,7 @@ gboolean gtk_frame_focus_out_callback(GtkWidget * WXUNUSED(widget), event.SetEventObject(g_activeFrame); g_activeFrame->HandleWindowEvent(event); - g_activeFrame = NULL; + g_activeFrame = nullptr; } return FALSE; @@ -383,7 +383,7 @@ void wxTopLevelWindowGTK::GTKHandleRealized() #if GTK_CHECK_VERSION(3,10,0) if (wx_is_at_least_gtk3(10)) { - GtkWidget* titlebar = NULL; + GtkWidget* titlebar = nullptr; gtk_container_forall(GTK_CONTAINER(m_widget), findTitlebar, &titlebar); if (titlebar) { @@ -526,7 +526,7 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* Atom type; int format; gulong nitems, bytes_after; - guchar* data = NULL; + guchar* data = nullptr; Status status = XGetWindowProperty( GDK_DISPLAY_XDISPLAY(display), GDK_WINDOW_XID(window), @@ -616,13 +616,13 @@ static gboolean request_frame_extents_timeout(void* data) void wxTopLevelWindowGTK::Init() { - m_mainWidget = NULL; + m_mainWidget = nullptr; m_isIconized = false; m_fsIsShowing = false; m_themeEnabled = true; m_gdkDecor = m_gdkFunc = 0; - m_grabbedEventLoop = NULL; + m_grabbedEventLoop = nullptr; m_deferShow = true; m_deferShowAllowed = true; m_updateDecorSize = true; @@ -664,9 +664,9 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, gdk_set_program_class(wxTheApp->GetAppDisplayName().utf8_str()); #endif - // NB: m_widget may be !=NULL if it was created by derived class' Create, + // NB: m_widget may be !=nullptr if it was created by derived class' Create, // e.g. in wxTaskBarIconAreaGTK - if (m_widget == NULL) + if (m_widget == nullptr) { m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) @@ -756,7 +756,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, { #ifdef __WXGTK3__ GtkWindowPosition windowPos; - g_object_get(m_widget, "window-position", &windowPos, NULL); + g_object_get(m_widget, "window-position", &windowPos, nullptr); if (windowPos == GTK_WIN_POS_NONE) gtk_window_move(GTK_WINDOW(m_widget), m_x, m_y); #else @@ -786,7 +786,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // We need to customize the default GTK+ logic for key processing to make // it conforming to wxWidgets event processing order. g_signal_connect (m_widget, "key_press_event", - G_CALLBACK (wxgtk_tlw_key_press_event), NULL); + G_CALLBACK (wxgtk_tlw_key_press_event), nullptr); #ifdef __WXGTK3__ GdkDisplay* display = gtk_widget_get_display(m_widget); @@ -831,7 +831,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, #if GTK_CHECK_VERSION(3,10,0) else if ( wxGTKImpl::IsWayland(display) && - gtk_check_version(3,10,0) == NULL) + gtk_check_version(3,10,0) == nullptr) { gtk_window_set_titlebar(GTK_WINDOW(m_widget), gtk_header_bar_new()); } @@ -908,11 +908,11 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) { - gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); + gtk_window_set_focus( GTK_WINDOW(m_widget), nullptr ); } if (g_activeFrame == this) - g_activeFrame = NULL; + g_activeFrame = nullptr; g_signal_handlers_disconnect_by_func( gtk_settings_get_default(), (void*)notify_gtk_theme_name, this); @@ -947,7 +947,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) #if defined(GDK_WINDOWING_X11) && !defined(__WXGTK4__) GdkScreen* screen = gtk_widget_get_screen(m_widget); GdkDisplay* display = gdk_screen_get_display(screen); - Display* xdpy = NULL; + Display* xdpy = nullptr; Window xroot = None; wxX11FullScreenMethod method = wxX11_FS_WMSPEC; @@ -973,7 +973,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); } #if defined(GDK_WINDOWING_X11) && !defined(__WXGTK4__) - else if (xdpy != NULL) + else if (xdpy != nullptr) { GdkWindow* window = gtk_widget_get_window(m_widget); Window xid = GDK_WINDOW_XID(window); @@ -1039,11 +1039,11 @@ void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect gtk_widget_queue_draw( m_widget ); - GdkWindow* window = NULL; + GdkWindow* window = nullptr; if (m_wxwindow) window = gtk_widget_get_window(m_wxwindow); if (window) - gdk_window_invalidate_rect(window, NULL, true); + gdk_window_invalidate_rect(window, nullptr, true); } #if defined(__WXGTK3__) && defined(GDK_WINDOWING_X11) @@ -1051,7 +1051,7 @@ void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect static bool isUsingCSD(GtkWidget* widget) { const char* csd = getenv("GTK_CSD"); - if (csd == NULL || strcmp(csd, "1") != 0) + if (csd == nullptr || strcmp(csd, "1") != 0) return false; GdkScreen* screen = gtk_widget_get_screen(widget); @@ -1062,7 +1062,7 @@ static bool isUsingCSD(GtkWidget* widget) if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) return false; - if (gdk_screen_get_rgba_visual(screen) == NULL) + if (gdk_screen_get_rgba_visual(screen) == nullptr) return false; return true; @@ -1092,7 +1092,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) g_signal_handler_find(m_widget, GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET), - 0, NULL, NULL, this); + 0, nullptr, nullptr, this); #ifdef __WXGTK3__ // Don't defer with CSD, it isn't needed and causes pixman errors if (deferShow) @@ -1202,7 +1202,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) // by then because the wxTLW will have been half-destroyed by then. if (GTK_IS_WINDOW(m_widget)) { - gtk_window_set_focus( GTK_WINDOW(m_widget), NULL ); + gtk_window_set_focus( GTK_WINDOW(m_widget), nullptr ); } // make sure window has a non-default position, so when it is shown @@ -1359,7 +1359,7 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) { 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 - 1, reset_size_request, m_wxwindow, NULL); + g_idle_add_full(G_PRIORITY_LOW - 1, reset_size_request, m_wxwindow, nullptr); g_object_ref(m_wxwindow); } } @@ -1456,7 +1456,7 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, hints.height_inc = incH > 0 ? incH : 1; } gtk_window_set_geometry_hints( - (GtkWindow*)m_widget, NULL, &hints, (GdkWindowHints)hints_mask); + (GtkWindow*)m_widget, nullptr, &hints, (GdkWindowHints)hints_mask); } void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize) @@ -1632,7 +1632,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) // transient parent. The life demo exibits this problem. if (m_widget && gtk_widget_get_realized(m_widget)) { - GList* list = NULL; + GList* list = nullptr; for (size_t i = icons.GetIconCount(); i--;) list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf()); gtk_window_set_icon_list(GTK_WINDOW(m_widget), list); @@ -1654,7 +1654,7 @@ void wxTopLevelWindowGTK::Maximize(bool maximize) bool wxTopLevelWindowGTK::IsMaximized() const { - GdkWindow* window = NULL; + GdkWindow* window = nullptr; if (m_widget) window = gtk_widget_get_window(m_widget); return window && (gdk_window_get_state(window) & GDK_WINDOW_STATE_MAXIMIZED); @@ -1753,7 +1753,7 @@ void wxTopLevelWindowGTK::AddGrab() gtk_grab_add( m_widget ); eventLoop.Run(); gtk_grab_remove( m_widget ); - m_grabbedEventLoop = NULL; + m_grabbedEventLoop = nullptr; } } @@ -1762,13 +1762,13 @@ void wxTopLevelWindowGTK::RemoveGrab() if (m_grabbedEventLoop) { m_grabbedEventLoop->Exit(); - m_grabbedEventLoop = NULL; + m_grabbedEventLoop = nullptr; } } bool wxTopLevelWindowGTK::IsGrabbed() const { - return m_grabbedEventLoop != NULL; + return m_grabbedEventLoop != nullptr; } bool wxTopLevelWindowGTK::IsActive() @@ -1841,7 +1841,7 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) // RGBA visual is required GdkScreen* screen = gtk_widget_get_screen(m_widget); GdkVisual* visual = gdk_screen_get_rgba_visual(screen); - if (visual == NULL) + if (visual == nullptr) return false; if (gtk_widget_get_visual(m_widget) != visual) { @@ -1878,7 +1878,7 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) #endif // GTK_CHECK_VERSION(2,12,0) #ifdef GDK_WINDOWING_X11 GdkWindow* window = gtk_widget_get_window(m_widget); - if (window == NULL) + if (window == nullptr) return false; Display* dpy = GDK_WINDOW_XDISPLAY(window); diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 15cc2808ed..b48c5aba62 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -83,7 +83,7 @@ void *wxGetDisplay() wxDisplayInfo wxGetDisplayInfo() { - wxDisplayInfo info = { NULL, wxDisplayNone }; + wxDisplayInfo info = { nullptr, wxDisplayNone }; #if defined(GDK_WINDOWING_WAYLAND) || defined(GDK_WINDOWING_X11) GdkDisplay *display = gdk_window_get_display(wxGetTopLevelGDK()); #endif @@ -162,7 +162,7 @@ wxConvertFromGTK(const wxString& s, wxFontEncoding enc) #endif // !wxUSE_UNICODE -// Returns NULL if version is certainly greater or equal than major.minor.micro +// Returns nullptr if version is certainly greater or equal than major.minor.micro // Returns string describing the error if version is lower than // major.minor.micro OR it cannot be determined and one should not rely on the // availability of pango version major.minor.micro, nor the non-availability @@ -238,10 +238,10 @@ static wxString GetSM() char smerr[256]; char *client_id; - SmcConn smc_conn = SmcOpenConnection(NULL, NULL, + SmcConn smc_conn = SmcOpenConnection(nullptr, nullptr, 999, 999, - 0 /* mask */, NULL /* callbacks */, - NULL, &client_id, + 0 /* mask */, nullptr /* callbacks */, + nullptr, &client_id, WXSIZEOF(smerr), smerr); if ( !smc_conn ) @@ -258,7 +258,7 @@ static wxString GetSM() wxString ret = wxString::FromAscii( vendor ); free(vendor); - SmcCloseConnection(smc_conn, 0, NULL); + SmcCloseConnection(smc_conn, 0, nullptr); free(client_id); return ret; diff --git a/src/gtk/webview_webkit.cpp b/src/gtk/webview_webkit.cpp index 28a73acb45..780f220311 100644 --- a/src/gtk/webview_webkit.cpp +++ b/src/gtk/webview_webkit.cpp @@ -35,7 +35,7 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget, wxString url = webKitCtrl->GetCurrentURL(); WebKitLoadStatus status; - g_object_get(G_OBJECT(widget), "load-status", &status, NULL); + g_object_get(G_OBJECT(widget), "load-status", &status, nullptr); wxString target; // TODO: get target (if possible) @@ -160,7 +160,7 @@ wxgtk_webview_webkit_navigation(WebKitWebView *, { webKitCtrl->SetPage(*file->GetStream(), wxuri); } - //We need to throw some sort of error here if file is NULL + //We need to throw some sort of error here if file is null webkit_web_policy_decision_ignore(policy_decision); return TRUE; } @@ -435,7 +435,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); wxWebViewWebKit::wxWebViewWebKit() { - m_web_view = NULL; + m_web_view = nullptr; } bool wxWebViewWebKit::Create(wxWindow *parent, @@ -446,7 +446,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent, long style, const wxString& name) { - m_web_view = NULL; + m_web_view = nullptr; m_busy = false; m_guard = false; m_creating = false; @@ -866,7 +866,7 @@ wxString wxWebViewWebKit::GetSelectedText() const win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc)); sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win)); range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), - 0, NULL); + 0, nullptr); return wxString(webkit_dom_range_get_text(WEBKIT_DOM_RANGE(range)), wxConvUTF8); } @@ -885,11 +885,11 @@ wxString wxWebViewWebKit::GetSelectedSource() const win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc)); sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win)); range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), - 0, NULL); - div = webkit_dom_document_create_element(WEBKIT_DOM_DOCUMENT(doc), "div", NULL); + 0, nullptr); + div = webkit_dom_document_create_element(WEBKIT_DOM_DOCUMENT(doc), "div", nullptr); - clone = webkit_dom_range_clone_contents(WEBKIT_DOM_RANGE(range), NULL); - webkit_dom_node_append_child(&div->parent_instance, &clone->parent_instance, NULL); + clone = webkit_dom_range_clone_contents(WEBKIT_DOM_RANGE(range), nullptr); + webkit_dom_node_append_child(&div->parent_instance, &clone->parent_instance, nullptr); html = (WebKitDOMHTMLElement*)div; return wxString(webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(html)), @@ -925,7 +925,7 @@ bool wxWebViewWebKit::RunScript(const wxString& javascript, wxString* output) co wxCHECK_MSG( m_web_view, false, wxS("wxWebView must be created before calling RunScript()") ); - if ( output != NULL ) + if ( output != nullptr ) { wxLogWarning(_("Retrieving JavaScript script output is not supported with WebKit v1")); return false; @@ -946,7 +946,7 @@ void wxWebViewWebKit::EnableContextMenu(bool enable) { #if !WEBKIT_CHECK_VERSION(1, 10, 0) //If we are using an older version g_object_set(webkit_web_view_get_settings(m_web_view), - "enable-default-context-menu", enable, NULL); + "enable-default-context-menu", enable, nullptr); #endif wxWebView::EnableContextMenu(enable); } diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index efe4e75800..05be96a2e4 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -48,7 +48,7 @@ bool wxGetStringFromJSResult(WebKitJavascriptResult* js_result, wxString* output wxGCC_WARNING_RESTORE(deprecated-declarations) - JSValueRef exception = NULL; + JSValueRef exception = nullptr; wxJSStringRef js_value ( JSValueIsObject(context, value) @@ -60,14 +60,14 @@ bool wxGetStringFromJSResult(WebKitJavascriptResult* js_result, wxString* output { if ( output ) { - wxJSStringRef ex_value(JSValueToStringCopy(context, exception, NULL)); + wxJSStringRef ex_value(JSValueToStringCopy(context, exception, nullptr)); *output = ex_value.ToWxString(); } return false; } - if ( output != NULL ) + if ( output != nullptr ) *output = js_value.ToWxString(); return true; @@ -370,7 +370,7 @@ wxgtk_webview_webkit_title_changed(GtkWidget* widget, wxWebViewWebKit *webKitCtrl) { gchar *title; - g_object_get(G_OBJECT(widget), "title", &title, NULL); + g_object_get(G_OBJECT(widget), "title", &title, nullptr); wxWebViewEvent event(wxEVT_WEBVIEW_TITLE_CHANGED, webKitCtrl->GetId(), @@ -552,15 +552,15 @@ wxgtk_new_connection_cb(GDBusServer *, GDBusConnection *connection, GDBusProxy **proxy) { - GError *error = NULL; + GError *error = nullptr; GDBusProxyFlags flags = GDBusProxyFlags(G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS); *proxy = g_dbus_proxy_new_sync(connection, flags, - NULL, - NULL, + nullptr, + nullptr, WXGTK_WEB_EXTENSION_OBJECT_PATH, WXGTK_WEB_EXTENSION_INTERFACE, - NULL, + nullptr, &error); if (error) { @@ -576,7 +576,7 @@ gboolean wxgtk_dbus_peer_is_authorized(GCredentials *peer_credentials) { static GCredentials *own_credentials = g_credentials_new(); - GError *error = NULL; + GError *error = nullptr; if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error)) { @@ -620,9 +620,9 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); wxWebViewWebKit::wxWebViewWebKit() { - m_web_view = NULL; - m_dbusServer = NULL; - m_extension = NULL; + m_web_view = nullptr; + m_dbusServer = nullptr; + m_extension = nullptr; } bool wxWebViewWebKit::Create(wxWindow *parent, @@ -633,9 +633,9 @@ bool wxWebViewWebKit::Create(wxWindow *parent, long style, const wxString& name) { - m_web_view = NULL; - m_dbusServer = NULL; - m_extension = NULL; + m_web_view = nullptr; + m_dbusServer = nullptr; + m_extension = nullptr; m_busy = false; m_guard = false; m_creating = false; @@ -899,10 +899,10 @@ static void wxgtk_can_execute_editing_command_cb(GObject*, bool wxWebViewWebKit::CanExecuteEditingCommand(const gchar* command) const { - GAsyncResult *result = NULL; + GAsyncResult *result = nullptr; webkit_web_view_can_execute_editing_command(m_web_view, command, - NULL, + nullptr, wxgtk_can_execute_editing_command_cb, &result); @@ -914,7 +914,7 @@ bool wxWebViewWebKit::CanExecuteEditingCommand(const gchar* command) const gboolean can_execute = webkit_web_view_can_execute_editing_command_finish(m_web_view, result, - NULL); + nullptr); g_object_unref(result); return can_execute != 0; @@ -1008,8 +1008,8 @@ wxString wxWebViewWebKit::GetPageSource() const return wxString(); } - GAsyncResult *result = NULL; - webkit_web_resource_get_data(resource, NULL, + GAsyncResult *result = nullptr; + webkit_web_resource_get_data(resource, nullptr, wxgtk_web_resource_get_data_cb, &result); @@ -1021,7 +1021,7 @@ wxString wxWebViewWebKit::GetPageSource() const size_t length; guchar *source = webkit_web_resource_get_data_finish(resource, result, - &length, NULL); + &length, nullptr); if (result) { g_object_unref(result); @@ -1081,7 +1081,7 @@ void wxWebViewWebKit::DoSetPage(const wxString& html, const wxString& baseUri) void wxWebViewWebKit::Print() { WebKitPrintOperation* printop = webkit_print_operation_new(m_web_view); - webkit_print_operation_run_dialog(printop, NULL); + webkit_print_operation_run_dialog(printop, nullptr); g_object_unref(printop); } @@ -1105,7 +1105,7 @@ bool wxWebViewWebKit::IsEditable() const { #if WEBKIT_CHECK_VERSION(2, 8, 0) gboolean editable; - g_object_get(m_web_view, "editable", &editable, NULL); + g_object_get(m_web_view, "editable", &editable, nullptr); return editable != 0; #else return false; @@ -1122,7 +1122,7 @@ void wxWebViewWebKit::DeleteSelection() "DeleteSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { g_variant_unref(retval); @@ -1140,7 +1140,7 @@ bool wxWebViewWebKit::HasSelection() const "HasSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { gboolean has_selection = FALSE; @@ -1168,7 +1168,7 @@ wxString wxWebViewWebKit::GetSelectedText() const "GetSelectedText", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { char *text; @@ -1190,7 +1190,7 @@ wxString wxWebViewWebKit::GetSelectedSource() const "GetSelectedSource", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { char *source; @@ -1212,7 +1212,7 @@ void wxWebViewWebKit::ClearSelection() "ClearSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { g_variant_unref(retval); @@ -1230,7 +1230,7 @@ wxString wxWebViewWebKit::GetPageText() const "GetPageText", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, - NULL, NULL); + nullptr, nullptr); if (retval) { char *text; @@ -1302,7 +1302,7 @@ void wxWebViewWebKit::RunScriptAsync(const wxString& javascript, void* clientDat webkit_web_view_run_javascript(m_web_view, wrapJS.GetWrappedCode().utf8_str(), - NULL, + nullptr, wxgtk_run_javascript_cb, params); } @@ -1343,7 +1343,7 @@ bool wxWebViewWebKit::AddUserScript(const wxString& javascript, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, (injectionTime == wxWEBVIEW_INJECT_AT_DOCUMENT_START) ? WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START : WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END, - NULL, NULL + nullptr, nullptr ); WebKitUserContentManager *ucm = webkit_web_view_get_user_content_manager(m_web_view); webkit_user_content_manager_add_script(ucm, userScript); @@ -1364,7 +1364,7 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) WebKitWebContext* context = webkit_web_context_get_default(); webkit_web_context_register_uri_scheme(context, handler->GetName().utf8_str(), (WebKitURISchemeRequestCallback)wxgtk_webview_webkit_uri_scheme_request_cb, - this, NULL); + this, nullptr); } void wxWebViewWebKit::EnableContextMenu(bool enable) @@ -1489,7 +1489,7 @@ void wxWebViewWebKit::SetupWebExtensionServer() char *address = g_strdup_printf("unix:tmpdir=%s", g_get_tmp_dir()); char *guid = g_dbus_generate_guid(); GDBusAuthObserver *observer = g_dbus_auth_observer_new(); - GError *error = NULL; + GError *error = nullptr; g_signal_connect(observer, "authorize-authenticated-peer", G_CALLBACK(wxgtk_authorize_authenticated_peer_cb), this); @@ -1498,7 +1498,7 @@ void wxWebViewWebKit::SetupWebExtensionServer() G_DBUS_SERVER_FLAGS_NONE, guid, observer, - NULL, + nullptr, &error); if (error) diff --git a/src/gtk/webview_webkit2_extension.cpp b/src/gtk/webview_webkit2_extension.cpp index b470b05f47..fd8c828da4 100644 --- a/src/gtk/webview_webkit2_extension.cpp +++ b/src/gtk/webview_webkit2_extension.cpp @@ -65,7 +65,7 @@ wxgtk_webview_dbus_connection_created_cb(GObject *source_object, void* user_data); } // extern "C" -static wxWebViewWebKitExtension *gs_extension = NULL; +static wxWebViewWebKitExtension *gs_extension = nullptr; class wxWebViewWebKitExtension { @@ -100,7 +100,7 @@ wxWebViewWebKitExtension::wxWebViewWebKitExtension(WebKitWebExtension *extension g_dbus_connection_new_for_address(server_address, G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, observer, - NULL, + nullptr, wxgtk_webview_dbus_connection_created_cb, this); g_object_unref(observer); @@ -136,21 +136,21 @@ void wxWebViewWebKitExtension::GetSelectedSource(GVariant *parameters, g_object_unref(win); if (!sel) { - ReturnDBusStringValue(invocation, NULL); + ReturnDBusStringValue(invocation, nullptr); return; } - WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, nullptr); if (!range) { - ReturnDBusStringValue(invocation, NULL); + ReturnDBusStringValue(invocation, nullptr); return; } WebKitDOMElement *div = webkit_dom_document_create_element(doc, "div", - NULL); + nullptr); WebKitDOMDocumentFragment *clone = webkit_dom_range_clone_contents(range, - NULL); + nullptr); webkit_dom_node_append_child(&div->parent_instance, - &clone->parent_instance, NULL); + &clone->parent_instance, nullptr); WebKitDOMElement *html = (WebKitDOMElement*)div; #if WEBKIT_CHECK_VERSION(2, 8, 0) gchar *text = webkit_dom_element_get_inner_html(html); @@ -214,13 +214,13 @@ void wxWebViewWebKitExtension::GetSelectedText(GVariant *parameters, g_object_unref(win); if (!sel) { - ReturnDBusStringValue(invocation, NULL); + ReturnDBusStringValue(invocation, nullptr); return; } - WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL); + WebKitDOMRange *range = webkit_dom_dom_selection_get_range_at(sel, 0, nullptr); if (!range) { - ReturnDBusStringValue(invocation, NULL); + ReturnDBusStringValue(invocation, nullptr); return; } gchar *text = webkit_dom_range_get_text(range); @@ -247,7 +247,7 @@ void wxWebViewWebKitExtension::ClearSelection(GVariant *parameters, webkit_dom_dom_selection_remove_all_ranges(sel); } - g_dbus_method_invocation_return_value(invocation, NULL); + g_dbus_method_invocation_return_value(invocation, nullptr); } void wxWebViewWebKitExtension::HasSelection(GVariant *parameters, @@ -293,7 +293,7 @@ void wxWebViewWebKitExtension::DeleteSelection(GVariant *parameters, webkit_dom_dom_selection_delete_from_document(sel); } - g_dbus_method_invocation_return_value(invocation, NULL); + g_dbus_method_invocation_return_value(invocation, nullptr); } void wxWebViewWebKitExtension::ReturnDBusStringValue(GDBusMethodInvocation *invocation, gchar *value) @@ -358,8 +358,8 @@ wxgtk_webview_handle_method_call(GDBusConnection*, static const GDBusInterfaceVTable interface_vtable = { wxgtk_webview_handle_method_call, - NULL, - NULL + nullptr, + nullptr }; static @@ -367,7 +367,7 @@ gboolean wxgtk_webview_dbus_peer_is_authorized(GCredentials *peer_credentials) { static GCredentials *own_credentials = g_credentials_new(); - GError *error = NULL; + GError *error = nullptr; if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error)) { @@ -398,9 +398,9 @@ wxgtk_webview_dbus_connection_created_cb(GObject*, void* user_data) { static GDBusNodeInfo *introspection_data = - g_dbus_node_info_new_for_xml(introspection_xml, NULL); + g_dbus_node_info_new_for_xml(introspection_xml, nullptr); - GError *error = NULL; + GError *error = nullptr; GDBusConnection *connection = g_dbus_connection_new_for_address_finish(result, &error); if (error) @@ -418,7 +418,7 @@ wxgtk_webview_dbus_connection_created_cb(GObject*, introspection_data->interfaces[0], &interface_vtable, extension, - NULL, + nullptr, &error); if (!registration_id) { diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp index b2cc971f8c..12dca59764 100644 --- a/src/gtk/win_gtk.cpp +++ b/src/gtk/win_gtk.cpp @@ -188,7 +188,7 @@ static void children_get_preferred_size(const GList* p) if (gtk_widget_get_visible(child->widget)) { GtkRequisition req; - gtk_widget_get_preferred_size(child->widget, &req, NULL); + gtk_widget_get_preferred_size(child->widget, &req, nullptr); } } } @@ -197,7 +197,7 @@ static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natu { children_get_preferred_size(WX_PIZZA(widget)->m_children); *minimum = 0; - gtk_widget_get_size_request(widget, natural, NULL); + gtk_widget_get_size_request(widget, natural, nullptr); if (*natural < 0) *natural = 0; } @@ -206,7 +206,7 @@ static void pizza_get_preferred_height(GtkWidget* widget, int* minimum, int* nat { children_get_preferred_size(WX_PIZZA(widget)->m_children); *minimum = 0; - gtk_widget_get_size_request(widget, NULL, natural); + gtk_widget_get_size_request(widget, nullptr, natural); if (*natural < 0) *natural = 0; } @@ -313,7 +313,7 @@ static void class_init(void* g_class, void*) G_TYPE_FROM_CLASS(g_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(wxPizzaClass, set_scroll_adjustments), - NULL, NULL, + nullptr, nullptr, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); #endif @@ -336,16 +336,16 @@ GType wxPizza::type() } const GTypeInfo info = { sizeof(wxPizzaClass), - NULL, NULL, + nullptr, nullptr, class_init, - NULL, NULL, + nullptr, nullptr, sizeof(wxPizza), 0, - NULL, NULL + nullptr, nullptr }; type = g_type_register_static( GTK_TYPE_FIXED, name, &info, GTypeFlags(0)); #ifdef __WXGTK3__ - const GInterfaceInfo interface_info = { NULL, NULL, NULL }; + const GInterfaceInfo interface_info = { nullptr, nullptr, nullptr }; g_type_add_interface_static(type, GTK_TYPE_SCROLLABLE, &interface_info); #endif } @@ -354,9 +354,9 @@ GType wxPizza::type() GtkWidget* wxPizza::New(long windowStyle) { - GtkWidget* widget = GTK_WIDGET(g_object_new(type(), NULL)); + GtkWidget* widget = GTK_WIDGET(g_object_new(type(), nullptr)); wxPizza* pizza = WX_PIZZA(widget); - pizza->m_children = NULL; + pizza->m_children = nullptr; pizza->m_scroll_x = 0; pizza->m_scroll_y = 0; pizza->m_windowStyle = windowStyle; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9ec4cb46e5..cf588dc958 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -205,24 +205,24 @@ extern wxCursor g_globalCursor; // mouse capture state: the window which has it and if the mouse is currently // inside it -static wxWindowGTK *g_captureWindow = NULL; +static wxWindowGTK *g_captureWindow = nullptr; static bool g_captureWindowHasMouse = false; // The window that currently has focus: -static wxWindowGTK *gs_currentFocus = NULL; +static wxWindowGTK *gs_currentFocus = nullptr; // The window that is scheduled to get focus in the next event loop iteration -// or NULL if there's no pending focus change: -static wxWindowGTK *gs_pendingFocus = NULL; +// or nullptr if there's no pending focus change: +static wxWindowGTK *gs_pendingFocus = nullptr; // The window that had focus before we lost it last time: -static wxWindowGTK *gs_lastFocus = NULL; +static wxWindowGTK *gs_lastFocus = nullptr; // the window that has deferred focus-out event pending, if any (see // GTKAddDeferredFocusOut() for details) -static wxWindowGTK *gs_deferredFocusOut = NULL; +static wxWindowGTK *gs_deferredFocusOut = nullptr; // global variables because GTK+ DnD want to have the // mouse event that caused it -GdkEvent *g_lastMouseEvent = NULL; +GdkEvent *g_lastMouseEvent = nullptr; int g_lastButtonNumber = 0; #ifdef __WXGTK3__ @@ -351,24 +351,24 @@ static bool wxGetTopLevel(GtkWidget** widget, GdkWindow** window) GtkWidget* wxGetTopLevelGTK() { - GtkWidget* widget = NULL; - wxGetTopLevel(&widget, NULL); + GtkWidget* widget = nullptr; + wxGetTopLevel(&widget, nullptr); return widget; } GdkWindow* wxGetTopLevelGDK() { GdkWindow* window; - if (!wxGetTopLevel(NULL, &window)) + if (!wxGetTopLevel(nullptr, &window)) window = gdk_get_default_root_window(); return window; } PangoContext* wxGetPangoContext() { - PangoContext* context = NULL; + PangoContext* context = nullptr; GtkWidget* widget; - if (wxGetTopLevel(&widget, NULL)) + if (wxGetTopLevel(&widget, nullptr)) { context = gtk_widget_get_pango_context(widget); g_object_ref(context); @@ -385,7 +385,7 @@ PangoContext* wxGetPangoContext() // 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) + if (wx_pango_version_check(1,22,0) == nullptr) { context = pango_font_map_create_context( pango_cairo_font_map_get_default ()); @@ -401,7 +401,7 @@ PangoContext* wxGetPangoContext() #ifdef __WXGTK3__ static bool IsBackend(void* instance, const char* string) { - if (instance == NULL) + if (instance == nullptr) instance = wxGetTopLevelGDK(); const char* name = g_type_name(G_TYPE_FROM_INSTANCE(instance)); return strncmp(string, name, strlen(string)) == 0; @@ -500,7 +500,7 @@ draw_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) GdkRGBA* c; gtk_style_context_save(sc); gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL); - gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL); + gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, nullptr); gtk_style_context_restore(sc); gdk_cairo_set_source_rgba(cr, c); gdk_rgba_free(c); @@ -1278,7 +1278,7 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), // we should send the key_down event anyway. const int intercepted_by_IM = win->GTKIMFilterKeypress(gdk_event); - win->m_imKeyEvent = NULL; + win->m_imKeyEvent = nullptr; if ( intercepted_by_IM ) { @@ -1523,7 +1523,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y) } else { - if ((child->m_wxwindow == NULL) && + if ((child->m_wxwindow == nullptr) && win->IsClientAreaChild(child) && (child->m_x <= xx) && (child->m_y <= yy) && @@ -1708,7 +1708,7 @@ gtk_window_button_press_callback( GtkWidget* WXUNUSED_IN_GTK3(widget), event.SetId( win->GetId() ); bool ret = win->GTKProcessEvent( event ); - g_lastMouseEvent = NULL; + g_lastMouseEvent = nullptr; if ( ret ) return TRUE; @@ -1798,7 +1798,7 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), // could actually be harmful, see #16055. (void)win->GTKProcessEvent(event); - g_lastMouseEvent = NULL; + g_lastMouseEvent = nullptr; return FALSE; } @@ -1828,7 +1828,7 @@ static void SendSetCursorEvent(wxWindowGTK* win, int x, int y) break; w = w->GetParent(); - if (w == NULL || w->m_widget == NULL || !gtk_widget_get_visible(w->m_widget)) + if (w == nullptr || w->m_widget == nullptr || !gtk_widget_get_visible(w->m_widget)) break; posClient = w->ScreenToClient(posScreen); } @@ -1858,11 +1858,11 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget), { // synthesise a mouse enter or leave event if needed GdkWindow* winUnderMouse = - wx_gdk_device_get_window_at_position(gdk_event->device, NULL, NULL); + wx_gdk_device_get_window_at_position(gdk_event->device, nullptr, nullptr); GdkDisplay* display = winUnderMouse ? gdk_window_get_display(winUnderMouse) - : NULL; + : nullptr; if ( !display ) display = gdk_display_get_default(); @@ -1897,7 +1897,7 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget), bool ret = win->GTKProcessEvent(event); - g_lastMouseEvent = NULL; + g_lastMouseEvent = nullptr; // Request additional motion events. Done at the end to increase the // chances that lower priority events requested by the handler above, such @@ -1909,7 +1909,7 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget), #ifdef __WXGTK3__ gdk_event_request_motions(gdk_event); #else - gdk_window_get_pointer(gdk_event->window, NULL, NULL, NULL); + gdk_window_get_pointer(gdk_event->window, nullptr, nullptr, nullptr); #endif } @@ -2262,7 +2262,7 @@ size_allocate(GtkWidget* WXUNUSED_IN_GTK2(widget), GtkAllocation* alloc, wxWindo GtkStyleContext* sc = gtk_widget_get_style_context(widget); int outline_offset, outline_width; gtk_style_context_get(sc, gtk_style_context_get_state(sc), - "outline-offset", &outline_offset, "outline-width", &outline_width, NULL); + "outline-offset", &outline_offset, "outline-width", &outline_width, nullptr); const int outline = outline_offset + outline_width; GtkAllocation a = *alloc; if (outline > 0) @@ -2360,7 +2360,7 @@ static void frame_clock_layout_after(GdkFrameClock*, wxWindowGTK* win) { for (GSList* p = gs_setSizeRequestList; p; p = p->next) { - if (p->data == NULL) + if (p->data == nullptr) continue; wxWindowGTK* w = static_cast(p->data); @@ -2370,7 +2370,7 @@ static void frame_clock_layout_after(GdkFrameClock*, wxWindowGTK* win) gtk_widget_set_size_request(w->m_widget, a.width, a.height); } g_slist_free(gs_setSizeRequestList); - gs_setSizeRequestList = NULL; + gs_setSizeRequestList = nullptr; } } #endif // GTK_CHECK_VERSION(3,8,0) @@ -2383,7 +2383,7 @@ void wxWindowGTK::GTKHandleRealized() if (m_wxwindow) { - if (m_imContext == NULL) + if (m_imContext == nullptr) { // Create input method handler m_imContext = gtk_im_multicontext_new(); @@ -2421,16 +2421,16 @@ void wxWindowGTK::GTKHandleRealized() m_backgroundStyle == wxBG_STYLE_PAINT || m_backgroundStyle == wxBG_STYLE_TRANSPARENT)) { - gdk_window_set_back_pixmap(window, NULL, false); + gdk_window_set_back_pixmap(window, nullptr, false); } #endif #if GTK_CHECK_VERSION(3,8,0) - if (IsTopLevel() && gtk_check_version(3,8,0) == NULL) + if (IsTopLevel() && gtk_check_version(3,8,0) == nullptr) { 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_handler_find(clock, G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this)) { g_signal_connect(clock, "layout", G_CALLBACK(frame_clock_layout), this); g_signal_connect_after(clock, "layout", G_CALLBACK(frame_clock_layout_after), this); @@ -2452,7 +2452,7 @@ void wxWindowGTK::GTKHandleUnrealize() if (m_wxwindow) { if (m_imContext) - gtk_im_context_set_client_window(m_imContext, NULL); + gtk_im_context_set_client_window(m_imContext, nullptr); } } @@ -2531,10 +2531,10 @@ wxMouseState wxGetMouseState() GdkDevice* device = gdk_device_manager_get_client_pointer(manager); wxGCC_WARNING_RESTORE() #endif - gdk_device_get_position(device, NULL, &x, &y); - gdk_device_get_state(device, window, NULL, &mask); + gdk_device_get_position(device, nullptr, &x, &y); + gdk_device_get_state(device, window, nullptr, &mask); #else - gdk_display_get_pointer(display, NULL, &x, &y, &mask); + gdk_display_get_pointer(display, nullptr, &x, &y, &mask); #endif ms.SetX(x); @@ -2567,9 +2567,9 @@ wxMouseState wxGetMouseState() void wxWindowGTK::Init() { // GTK specific - m_widget = NULL; - m_wxwindow = NULL; - m_focusWidget = NULL; + m_widget = nullptr; + m_wxwindow = nullptr; + m_focusWidget = nullptr; // position/size m_x = 0; @@ -2582,8 +2582,8 @@ void wxWindowGTK::Init() m_noExpose = false; m_nativeSizeEvent = false; #ifdef __WXGTK3__ - m_paintContext = NULL; - m_styleProvider = NULL; + m_paintContext = nullptr; + m_styleProvider = nullptr; m_needSizeEvent = false; #endif @@ -2593,7 +2593,7 @@ void wxWindowGTK::Init() // initialize scrolling stuff for ( int dir = 0; dir < ScrollDir_Max; dir++ ) { - m_scrollBar[dir] = NULL; + m_scrollBar[dir] = nullptr; m_scrollPos[dir] = 0; } @@ -2604,8 +2604,8 @@ void wxWindowGTK::Init() m_clipPaintRegion = false; - m_imContext = NULL; - m_imKeyEvent = NULL; + m_imContext = nullptr; + m_imKeyEvent = nullptr; m_dirtyTabOrder = false; } @@ -2632,7 +2632,7 @@ void wxWindowGTK::GTKCreateScrolledWindowWith(GtkWidget* view) wxASSERT_MSG( HasFlag(wxHSCROLL) || HasFlag(wxVSCROLL), wxS("Must not be called if scrolling is not needed.") ); - m_widget = gtk_scrolled_window_new( NULL, NULL ); + m_widget = gtk_scrolled_window_new( nullptr, nullptr ); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); @@ -2759,21 +2759,21 @@ wxWindowGTK::~wxWindowGTK() SendDestroyEvent(); if (gs_currentFocus == this) - gs_currentFocus = NULL; + gs_currentFocus = nullptr; if (gs_pendingFocus == this) - gs_pendingFocus = NULL; + gs_pendingFocus = nullptr; if (gs_lastFocus == this) - gs_lastFocus = NULL; + gs_lastFocus = nullptr; if ( gs_deferredFocusOut == this ) - gs_deferredFocusOut = NULL; + gs_deferredFocusOut = nullptr; // This is a real error, unlike the above, but it's already checked for in // the base class dtor and asserting here results is useless and, even // worse, results in abnormal termination when running unit tests which // throw exceptions from their assert handler, so don't assert here. if ( g_captureWindow == this ) - g_captureWindow = NULL; + g_captureWindow = nullptr; if (m_wxwindow) { @@ -2792,7 +2792,7 @@ wxWindowGTK::~wxWindowGTK() if ( m_imContext ) { g_object_unref(m_imContext); - m_imContext = NULL; + m_imContext = nullptr; } #ifdef __WXGTK3__ @@ -2814,16 +2814,16 @@ wxWindowGTK::~wxWindowGTK() gtk_widget_destroy(m_widget); // Release our reference, should be the last one g_object_unref(m_widget); - m_widget = NULL; + m_widget = nullptr; } - m_wxwindow = NULL; + m_wxwindow = nullptr; } bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size ) { if ( GTKNeedsParent() ) { - wxCHECK_MSG( parent, false, wxT("Must have non-NULL parent") ); + wxCHECK_MSG( parent, false, wxT("Must have non-null parent") ); } // Use either the given size, or the default if -1 is given. @@ -2842,7 +2842,7 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w void wxWindowGTK::PostCreation() { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); + wxASSERT_MSG( (m_widget != nullptr), wxT("invalid window") ); SetLayoutDirection(wxLayout_Default); @@ -2889,7 +2889,7 @@ void wxWindowGTK::PostCreation() if (!GTK_IS_WINDOW(m_widget)) { - if (m_focusWidget == NULL) + if (m_focusWidget == nullptr) m_focusWidget = m_widget; if (m_wxwindow) @@ -3601,7 +3601,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, m_gestureState = 0; m_allowedGestures = 0; m_activeGestures = 0; - m_touchSequence = NULL; + m_touchSequence = nullptr; if ( eventsMask & wxTOUCH_VERTICAL_PAN_GESTURE ) { @@ -3622,7 +3622,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, } else { - m_vertical_pan_gesture = NULL; + m_vertical_pan_gesture = nullptr; } if ( eventsMask & wxTOUCH_HORIZONTAL_PAN_GESTURE ) @@ -3649,7 +3649,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, } else { - m_horizontal_pan_gesture = NULL; + m_horizontal_pan_gesture = nullptr; } if ( eventsMask & wxTOUCH_ZOOM_GESTURE ) @@ -3671,7 +3671,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, } else { - m_zoom_gesture = NULL; + m_zoom_gesture = nullptr; } if ( eventsMask & wxTOUCH_ROTATE_GESTURE ) @@ -3693,7 +3693,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, } else { - m_rotate_gesture = NULL; + m_rotate_gesture = nullptr; } if ( eventsMask & wxTOUCH_PRESS_GESTURES ) @@ -3713,7 +3713,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, } else { - m_long_press_gesture = NULL; + m_long_press_gesture = nullptr; } wxASSERT_MSG( eventsMask == 0, "Unknown touch event mask bit specified" ); @@ -3723,7 +3723,7 @@ void wxWindowGesturesData::Reinit(wxWindowGTK* win, #if !GTK_CHECK_VERSION(3,18,0) #define GDK_TOUCHPAD_GESTURE_MASK (1 << 24) #endif - if ( gtk_check_version(3, 18, 0) == NULL ) + if ( gtk_check_version(3, 18, 0) == nullptr ) { gtk_widget_add_events(widget, GDK_TOUCHPAD_GESTURE_MASK); } @@ -3756,7 +3756,7 @@ bool wxWindowGTK::EnableTouchEvents(int eventsMask) { #ifdef wxGTK_HAS_GESTURES_SUPPORT // Check if gestures support is also available during run-time. - if ( gtk_check_version(3, 14, 0) == NULL ) + if ( gtk_check_version(3, 14, 0) == nullptr ) { wxWindowGesturesData* const dataOld = wxWindowGestures::FromObject(static_cast(this)); @@ -3802,12 +3802,12 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) isSourceAttached = true; static GSourceFuncs funcs = { source_prepare, source_check, source_dispatch, - NULL, NULL, NULL + nullptr, nullptr, nullptr }; 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_source_attach(source, nullptr); g_source_unref(source); } @@ -3849,7 +3849,7 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height) { GtkWidget* parent = gtk_widget_get_parent(m_widget); - wxPizza* pizza = NULL; + wxPizza* pizza = nullptr; if (WX_IS_PIZZA(parent)) { pizza = WX_PIZZA(parent); @@ -3876,7 +3876,7 @@ void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height) { // obligatory size request before size allocate to avoid GTK3 warnings GtkRequisition req; - gtk_widget_get_preferred_size(m_widget, &req, NULL); + gtk_widget_get_preferred_size(m_widget, &req, nullptr); if (pizza) pizza->size_allocate_child(m_widget, x, y, width, height); @@ -3971,8 +3971,8 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags /* the default button has a border around it */ if (gtk_widget_get_can_default(m_widget)) { - GtkBorder *default_border = NULL; - gtk_widget_style_get( m_widget, "default_border", &default_border, NULL ); + GtkBorder *default_border = nullptr; + gtk_widget_style_get( m_widget, "default_border", &default_border, nullptr ); if (default_border) { x -= default_border->left; @@ -4051,7 +4051,7 @@ void wxWindowGTK::DoGetSize( int *width, int *height ) const void wxWindowGTK::DoSetClientSize( int width, int height ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); const wxSize size = GetSize(); const wxSize clientSize = GetClientSize(); @@ -4060,7 +4060,7 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) void wxWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); if (m_useCachedClientSize) { @@ -4089,7 +4089,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const if (scrollbar_spacing < 0) { gtk_widget_style_get( - m_widget, "scrollbar-spacing", &scrollbar_spacing, NULL); + m_widget, "scrollbar-spacing", &scrollbar_spacing, nullptr); } for ( int i = 0; i < ScrollDir_Max; i++ ) @@ -4127,7 +4127,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const { if (height) { - gtk_widget_get_preferred_height(widget, NULL, &req.height); + gtk_widget_get_preferred_height(widget, nullptr, &req.height); h -= req.height + scrollbar_spacing; } } @@ -4135,7 +4135,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const { if (width) { - gtk_widget_get_preferred_width(widget, NULL, &req.width); + gtk_widget_get_preferred_width(widget, nullptr, &req.width); w -= req.width + scrollbar_spacing; } } @@ -4177,7 +4177,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const { int dx = 0; int dy = 0; - GtkWidget* parent = NULL; + GtkWidget* parent = nullptr; if (m_widget) parent = gtk_widget_get_parent(m_widget); if (WX_IS_PIZZA(parent)) @@ -4192,14 +4192,14 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); GtkWidget* widget = m_widget; if (m_wxwindow) widget = m_wxwindow; GdkWindow* source = gtk_widget_get_window(widget); - if ((!m_isGtkPositionValid || source == NULL) && !IsTopLevel() && m_parent) + if ((!m_isGtkPositionValid || source == nullptr) && !IsTopLevel() && m_parent) { m_parent->DoClientToScreen(x, y); int xx, yy; @@ -4220,10 +4220,10 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { int w; // undo RTL conversion done by parent - static_cast(m_parent)->DoGetClientSize(&w, NULL); + static_cast(m_parent)->DoGetClientSize(&w, nullptr); *x = w - *x; - DoGetClientSize(&w, NULL); + DoGetClientSize(&w, nullptr); *x += xx; *x = w - *x; } @@ -4231,7 +4231,7 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const return; } - if (source == NULL) + if (source == nullptr) { wxLogDebug("ClientToScreen cannot work when toplevel window is not shown"); return; @@ -4266,14 +4266,14 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); GtkWidget* widget = m_widget; if (m_wxwindow) widget = m_wxwindow; GdkWindow* source = gtk_widget_get_window(widget); - if ((!m_isGtkPositionValid || source == NULL) && !IsTopLevel() && m_parent) + if ((!m_isGtkPositionValid || source == nullptr) && !IsTopLevel() && m_parent) { m_parent->DoScreenToClient(x, y); int xx, yy; @@ -4294,10 +4294,10 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { int w; // undo RTL conversion done by parent - static_cast(m_parent)->DoGetClientSize(&w, NULL); + static_cast(m_parent)->DoGetClientSize(&w, nullptr); *x = w - *x; - DoGetClientSize(&w, NULL); + DoGetClientSize(&w, nullptr); *x -= xx; *x = w - *x; } @@ -4305,7 +4305,7 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const return; } - if (source == NULL) + if (source == nullptr) { wxLogDebug("ScreenToClient cannot work when toplevel window is not shown"); return; @@ -4378,7 +4378,7 @@ bool wxWindowGTK::Show( bool show ) bool wxWindowGTK::IsShown() const { // return false for non-selected wxNotebook pages - return m_isShown && (m_widget == NULL || gtk_widget_get_child_visible(m_widget)); + return m_isShown && (m_widget == nullptr || gtk_widget_get_child_visible(m_widget)); } void wxWindowGTK::DoEnable( bool enable ) @@ -4409,7 +4409,7 @@ void wxWindowGTK::DoEnable( bool enable ) int wxWindowGTK::GetCharHeight() const { - wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != nullptr), 12, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.IsOk(), 12, wxT("invalid font") ); @@ -4425,7 +4425,7 @@ int wxWindowGTK::GetCharHeight() const pango_layout_set_text(layout, "H", 1); PangoLayoutLine* line; #if PANGO_VERSION_CHECK(1,16,0) - if ( wx_pango_version_check(1,16,0) == NULL ) + if ( wx_pango_version_check(1,16,0) == nullptr ) { line = pango_layout_get_line_readonly(layout, 0); } @@ -4436,7 +4436,7 @@ int wxWindowGTK::GetCharHeight() const } PangoRectangle rect; - pango_layout_line_get_extents(line, NULL, &rect); + pango_layout_line_get_extents(line, nullptr, &rect); g_object_unref (layout); @@ -4445,7 +4445,7 @@ int wxWindowGTK::GetCharHeight() const int wxWindowGTK::GetCharWidth() const { - wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != nullptr), 8, wxT("invalid window") ); wxFont font = GetFont(); wxCHECK_MSG( font.IsOk(), 8, wxT("invalid font") ); @@ -4461,7 +4461,7 @@ int wxWindowGTK::GetCharWidth() const pango_layout_set_text(layout, "g", 1); PangoLayoutLine* line; #if PANGO_VERSION_CHECK(1,16,0) - if ( wx_pango_version_check(1,16,0) == NULL ) + if ( wx_pango_version_check(1,16,0) == nullptr ) { line = pango_layout_get_line_readonly(layout, 0); } @@ -4472,7 +4472,7 @@ int wxWindowGTK::GetCharWidth() const } PangoRectangle rect; - pango_layout_line_get_extents(line, NULL, &rect); + pango_layout_line_get_extents(line, nullptr, &rect); g_object_unref (layout); @@ -4504,7 +4504,7 @@ double wxWindowGTK::GetContentScaleFactor() const { double scaleFactor = 1; #if GTK_CHECK_VERSION(3,10,0) - if (m_widget && gtk_check_version(3,10,0) == NULL) + if (m_widget && gtk_check_version(3,10,0) == nullptr) { scaleFactor = gtk_widget_get_scale_factor(m_widget); } @@ -4552,7 +4552,7 @@ bool wxWindowGTK::GTKHandleFocusIn() wxLogTrace(TRACE_FOCUS, "filtered out spurious focus change within %s", wxDumpWindow(this)); - gs_deferredFocusOut = NULL; + gs_deferredFocusOut = nullptr; return retval; } @@ -4576,7 +4576,7 @@ bool wxWindowGTK::GTKHandleFocusIn() { wxLogTrace(TRACE_FOCUS, "Resetting pending focus %s on focus set", wxDumpWindow(gs_pendingFocus)); - gs_pendingFocus = NULL; + gs_pendingFocus = nullptr; } #if wxUSE_CARET @@ -4616,7 +4616,7 @@ bool wxWindowGTK::GTKHandleFocusOut() { wxLogTrace(TRACE_FOCUS, "Resetting pending focus %s on focus loss", wxDumpWindow(this)); - gs_pendingFocus = NULL; + gs_pendingFocus = nullptr; } // NB: If a control is composed of several GtkWidgets and when focus @@ -4628,7 +4628,7 @@ bool wxWindowGTK::GTKHandleFocusOut() // (i.e. in GTKHandleFocusIn() or at idle time). if ( GTKNeedsToFilterSameWindowFocus() ) { - wxASSERT_MSG( gs_deferredFocusOut == NULL, + wxASSERT_MSG( gs_deferredFocusOut == nullptr, "deferred focus out event already pending" ); wxLogTrace(TRACE_FOCUS, "deferring focus_out event for %s", @@ -4656,11 +4656,11 @@ void wxWindowGTK::GTKHandleFocusOutNoDeferring() if ( gs_currentFocus != this ) { // Something is terribly wrong, gs_currentFocus is out of sync with the - // real focus. We will reset it to NULL anyway, because after this + // real focus. We will reset it to nullptr anyway, because after this // focus-out event is handled, one of the following with happen: // // * either focus will go out of the app altogether, in which case - // gs_currentFocus _should_ be NULL + // gs_currentFocus _should_ be null // // * or it goes to another control, in which case focus-in event will // follow immediately and it will set gs_currentFocus to the right @@ -4668,7 +4668,7 @@ void wxWindowGTK::GTKHandleFocusOutNoDeferring() wxLogDebug("window %s lost focus even though it didn't have it", wxDumpWindow(this)); } - gs_currentFocus = NULL; + gs_currentFocus = nullptr; #if wxUSE_CARET // caret needs to be informed about focus change @@ -4690,7 +4690,7 @@ void wxWindowGTK::GTKHandleDeferredFocusOut() // NB: See GTKHandleFocusOut() for explanation. This function is called // from either GTKHandleFocusIn() or OnInternalIdle() to process // deferred event for this window. - gs_deferredFocusOut = NULL; + gs_deferredFocusOut = nullptr; wxLogTrace(TRACE_FOCUS, "processing deferred focus_out event for %s", @@ -4701,7 +4701,7 @@ void wxWindowGTK::GTKHandleDeferredFocusOut() void wxWindowGTK::SetFocus() { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); // Setting "physical" focus is not immediate in GTK+ and while // gtk_widget_is_focus ("determines if the widget is the focus widget @@ -4715,7 +4715,7 @@ void wxWindowGTK::SetFocus() // Because we want to FindFocus() call immediately following // foo->SetFocus() to return foo, we have to keep track of "pending" focus // ourselves. - gs_pendingFocus = NULL; + gs_pendingFocus = nullptr; if (gs_currentFocus != this) gs_pendingFocus = this; @@ -4759,7 +4759,7 @@ void wxWindowGTK::SetCanFocus(bool canFocus) bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) { - wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); + wxCHECK_MSG( (m_widget != nullptr), false, wxT("invalid window") ); wxWindowGTK * const newParent = (wxWindowGTK *)newParentBase; @@ -4770,7 +4770,7 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) wxASSERT( GTK_IS_WIDGET(m_widget) ); - // Notice that old m_parent pointer might be non-NULL here but the widget + // Notice that old m_parent pointer might be non-null here but the widget // still not have any parent at GTK level if it's a notebook page that had // been removed from the notebook so test this at GTK level and not wx one. if ( GtkWidget *parentGTK = gtk_widget_get_parent(m_widget) ) @@ -4796,8 +4796,8 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) void wxWindowGTK::DoAddChild(wxWindowGTK *child) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); - wxASSERT_MSG( (child != NULL), wxT("invalid child window") ); + wxASSERT_MSG( (m_widget != nullptr), wxT("invalid window") ); + wxASSERT_MSG( (child != nullptr), wxT("invalid child window") ); /* add to list */ AddChild( child ); @@ -4930,8 +4930,8 @@ void wxWindowGTK::RealizeTabOrder() // this opportunity to update the mnemonic widgets for the widgets // that need them - GList *chain = NULL; - wxWindowGTK* mnemonicWindow = NULL; + GList *chain = nullptr; + wxWindowGTK* mnemonicWindow = nullptr; for ( wxWindowList::const_iterator i = m_children.begin(); i != m_children.end(); @@ -4959,7 +4959,7 @@ void wxWindowGTK::RealizeTabOrder() } mnemonicWindow->GTKWidgetDoSetMnemonic(w); - mnemonicWindow = NULL; + mnemonicWindow = nullptr; } } @@ -4991,7 +4991,7 @@ void wxWindowGTK::RealizeTabOrder() void wxWindowGTK::Raise() { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); if (m_wxwindow && gtk_widget_get_window(m_wxwindow)) { @@ -5005,7 +5005,7 @@ void wxWindowGTK::Raise() void wxWindowGTK::Lower() { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); if (m_wxwindow && gtk_widget_get_window(m_wxwindow)) { @@ -5031,7 +5031,7 @@ void wxWindowGTK::GTKUpdateCursor(bool isBusyOrGlobalCursor, bool isRealize, con { m_needCursorReset = false; - if (m_widget == NULL || !gtk_widget_get_realized(m_widget)) + if (m_widget == nullptr || !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 @@ -5046,11 +5046,11 @@ void wxWindowGTK::GTKUpdateCursor(bool isBusyOrGlobalCursor, bool isRealize, con isBusyOrGlobalCursor = true; } } - GdkCursor* cursor = NULL; + GdkCursor* cursor = nullptr; if (!isBusyOrGlobalCursor) cursor = (overrideCursor ? *overrideCursor : m_cursor).GetCursor(); - GdkWindow* window = NULL; + GdkWindow* window = nullptr; if (cursor || isBusyOrGlobalCursor || !isRealize) { wxArrayGdkWindows windows; @@ -5067,7 +5067,7 @@ void wxWindowGTK::GTKUpdateCursor(bool isBusyOrGlobalCursor, bool isRealize, con } } } - if (window && cursor == NULL && m_wxwindow == NULL && !isBusyOrGlobalCursor && !isRealize) + if (window && cursor == nullptr && m_wxwindow == nullptr && !isBusyOrGlobalCursor && !isRealize) { void* data; gdk_window_get_user_data(window, &data); @@ -5090,7 +5090,7 @@ void wxWindowGTK::GTKUpdateCursor(bool isBusyOrGlobalCursor, bool isRealize, con void wxWindowGTK::WarpPointer( int x, int y ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); ClientToScreen(&x, &y); GdkDisplay* display = gtk_widget_get_display(m_widget); @@ -5170,7 +5170,7 @@ void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), gdk_window_invalidate_rect(window, &r, true); } else - gdk_window_invalidate_rect(window, NULL, true); + gdk_window_invalidate_rect(window, nullptr, true); } } else if (m_widget) @@ -5195,7 +5195,7 @@ void wxWindowGTK::Update() gdk_display_sync(display); GdkWindow* window = GTKGetDrawingWindow(); - if (window == NULL) + if (window == nullptr) window = gtk_widget_get_window(m_widget); wxGCC_WARNING_SUPPRESS(deprecated-declarations) @@ -5255,7 +5255,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) #else // !__WXGTK3__ m_updateRegion = wxRegion(region); #if wxGTK_HAS_COMPOSITING_SUPPORT - cairo_t* cr = NULL; + cairo_t* cr = nullptr; #endif #endif // !__WXGTK3__ // Clip to paint region in wxClientDC @@ -5371,7 +5371,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) #endif // !__WXGTK3__ } #ifdef __WXGTK3__ - else if (m_backgroundColour.IsOk() && gtk_check_version(3,20,0) == NULL) + else if (m_backgroundColour.IsOk() && gtk_check_version(3,20,0) == nullptr) { cairo_save(cr); gdk_cairo_set_source_rgba(cr, m_backgroundColour); @@ -5407,7 +5407,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) !compositeChild->IsTopLevel()) { #ifndef __WXGTK3__ - if (cr == NULL) + if (cr == nullptr) { cr = gdk_cairo_create(m_wxwindow->window); gdk_cairo_region(cr, m_nativeUpdateRegion.GetRegion()); @@ -5434,7 +5434,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) m_clipPaintRegion = false; #ifdef __WXGTK3__ - m_paintContext = NULL; + m_paintContext = nullptr; #endif m_updateRegion.Clear(); m_nativeUpdateRegion.Clear(); @@ -5442,7 +5442,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) void wxWindowGTK::SetDoubleBuffered( bool on ) { - wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); + wxCHECK_RET( (m_widget != nullptr), wxT("invalid window") ); if ( m_wxwindow ) { @@ -5461,7 +5461,7 @@ bool wxWindowGTK::IsDoubleBuffered() const void wxWindowGTK::ClearBackground() { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); } #if wxUSE_TOOLTIPS @@ -5474,7 +5474,7 @@ void wxWindowGTK::DoSetToolTip( wxToolTip *tip ) if (m_tooltip) m_tooltip->GTKSetWindow(static_cast(this)); else - GTKApplyToolTip(NULL); + GTKApplyToolTip(nullptr); } } @@ -5543,7 +5543,7 @@ void wxWindowGTK::GTKApplyCssStyle(GtkCssProvider* provider, const char* style) 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_css_provider_load_from_data(provider, style, -1, nullptr); gtk_style_context_add_provider(gtk_widget_get_style_context(m_widget), GTK_STYLE_PROVIDER(provider), @@ -5756,15 +5756,15 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle) } } - if (m_styleProvider == NULL && (isFg || isBg || isFont)) + if (m_styleProvider == nullptr && (isFg || isBg || isFont)) m_styleProvider = GTK_STYLE_PROVIDER(gtk_css_provider_new()); wxGtkString s(g_string_free(css, false)); if (m_styleProvider) { gtk_css_provider_load_from_data( - GTK_CSS_PROVIDER(m_styleProvider), s, -1, NULL); - DoApplyWidgetStyle(NULL); + GTK_CSS_PROVIDER(m_styleProvider), s, -1, nullptr); + DoApplyWidgetStyle(nullptr); } #else GtkRcStyle* style = GTKCreateWidgetStyle(); @@ -5804,7 +5804,7 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) if ((style == wxBG_STYLE_PAINT || style == wxBG_STYLE_TRANSPARENT) && (window = GTKGetDrawingWindow())) { - gdk_window_set_back_pixmap(window, NULL, false); + gdk_window_set_back_pixmap(window, nullptr, false); } #endif // !__WXGTK3__ @@ -5860,8 +5860,8 @@ bool wxWindowGTK::IsTransparentBackgroundSupported(wxString* reason) const GdkWindow* wxWindowGTK::GTKFindWindow(GtkWidget* widget) { GdkWindow* window = gtk_widget_get_window(widget); - if (window == NULL) - return NULL; + if (window == nullptr) + return nullptr; for (const GList* p = gdk_window_peek_children(window); p; p = p->next) { window = GDK_WINDOW(p->data); @@ -5870,13 +5870,13 @@ GdkWindow* wxWindowGTK::GTKFindWindow(GtkWidget* widget) if (data == widget) return window; } - return NULL; + return nullptr; } void wxWindowGTK::GTKFindWindow(GtkWidget* widget, wxArrayGdkWindows& windows) { GdkWindow* window = gtk_widget_get_window(widget); - if (window == NULL) + if (window == nullptr) return; for (const GList* p = gdk_window_peek_children(window); p; p = p->next) { @@ -5911,7 +5911,7 @@ void wxPopupMenuPositionCallback( GtkMenu *menu, // ensure that the menu appears entirely on the same display as the window GtkRequisition req; #ifdef __WXGTK3__ - gtk_widget_get_preferred_size(GTK_WIDGET(menu), &req, NULL); + gtk_widget_get_preferred_size(GTK_WIDGET(menu), &req, nullptr); #else gtk_widget_get_child_requisition(GTK_WIDGET(menu), &req); #endif @@ -5939,7 +5939,7 @@ void wxPopupMenuPositionCallback( GtkMenu *menu, bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); + wxCHECK_MSG( m_widget != nullptr, false, wxT("invalid window") ); menu->SetupBitmaps(this); @@ -5949,8 +5949,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) if ( x == -1 && y == -1 ) { // use GTK's default positioning algorithm - userdata = NULL; - posfunc = NULL; + userdata = nullptr; + posfunc = nullptr; } else { @@ -5966,12 +5966,12 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) if (wxGTKImpl::IsWayland(window) && wx_is_at_least_gtk3(22)) { if (x == -1 && y == -1) - gtk_menu_popup_at_pointer(GTK_MENU(menu->m_menu), NULL); + gtk_menu_popup_at_pointer(GTK_MENU(menu->m_menu), nullptr); else { const GdkRectangle rect = { x, y, 1, 1 }; gtk_menu_popup_at_rect(GTK_MENU(menu->m_menu), - window, &rect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); + window, &rect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, nullptr); } } else @@ -5981,8 +5981,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) gtk_menu_popup( GTK_MENU(menu->m_menu), - NULL, // parent menu shell - NULL, // parent menu item + nullptr, // parent menu shell + nullptr, // parent menu item posfunc, // function to position it userdata, // client data 0, // button used to activate it @@ -6013,7 +6013,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); GtkWidget *dnd_widget = GetConnectWidget(); @@ -6116,13 +6116,13 @@ bool wxWindowGTK::SetFont( const wxFont &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) + if (gtk_check_version(3,8,0) == nullptr) gs_sizeRevalidateList = g_list_prepend(gs_sizeRevalidateList, this); - else if (gtk_check_version(3,6,0) == NULL) + else if (gtk_check_version(3,6,0) == nullptr) { 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); + g_idle_add_full(GTK_PRIORITY_RESIZE - 1, before_resize, this, nullptr); else gs_sizeRevalidateList = g_list_prepend(gs_sizeRevalidateList, this); } @@ -6133,9 +6133,9 @@ bool wxWindowGTK::SetFont( const wxFont &font ) void wxWindowGTK::DoCaptureMouse() { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); - GdkWindow *window = NULL; + GdkWindow *window = nullptr; if (m_wxwindow) window = GTKGetDrawingWindow(); else @@ -6146,7 +6146,7 @@ void wxWindowGTK::DoCaptureMouse() #ifdef __WXGTK4__ GdkDisplay* display = gdk_window_get_display(window); GdkSeat* seat = gdk_display_get_default_seat(display); - gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_POINTER, false, NULL, NULL, NULL, 0); + gdk_seat_grab(seat, window, GDK_SEAT_CAPABILITY_POINTER, false, nullptr, nullptr, nullptr, 0); #else const GdkEventMask mask = GdkEventMask( GDK_SCROLL_MASK | @@ -6161,13 +6161,13 @@ void wxWindowGTK::DoCaptureMouse() GdkDevice* device = gdk_device_manager_get_client_pointer(manager); gdk_device_grab( device, window, GDK_OWNERSHIP_NONE, false, mask, - NULL, unsigned(GDK_CURRENT_TIME)); + nullptr, unsigned(GDK_CURRENT_TIME)); wxGCC_WARNING_RESTORE() #else gdk_pointer_grab( window, FALSE, mask, - NULL, - NULL, + nullptr, + nullptr, (guint32)GDK_CURRENT_TIME ); #endif #endif // !__WXGTK4__ @@ -6177,13 +6177,13 @@ void wxWindowGTK::DoCaptureMouse() void wxWindowGTK::DoReleaseMouse() { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") ); - g_captureWindow = NULL; + g_captureWindow = nullptr; - GdkWindow *window = NULL; + GdkWindow *window = nullptr; if (m_wxwindow) window = GTKGetDrawingWindow(); else @@ -6224,13 +6224,13 @@ void wxWindowGTK::GTKReleaseMouseAndNotify() #else gdk_display_pointer_ungrab(display, unsigned(GDK_CURRENT_TIME)); #endif - g_captureWindow = NULL; + g_captureWindow = nullptr; NotifyCaptureLost(); } void wxWindowGTK::GTKHandleCaptureLost() { - g_captureWindow = NULL; + g_captureWindow = nullptr; NotifyCaptureLost(); } @@ -6389,9 +6389,9 @@ wxEventType wxWindowGTK::GTKGetScrollEventType(GtkRange* range) void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { - wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); + wxCHECK_RET( m_widget != nullptr, wxT("invalid window") ); - wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + wxCHECK_RET( m_wxwindow != nullptr, wxT("window needs client area for scrolling") ); // No scrolling requested. if ((dx == 0) && (dy == 0)) return; @@ -6403,7 +6403,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = false; #if wxUSE_CARET - bool restoreCaret = (GetCaret() != NULL && GetCaret()->IsVisible()); + bool restoreCaret = (GetCaret() != nullptr && GetCaret()->IsVisible()); if (restoreCaret) { wxRect caretRect(GetCaret()->GetPosition(), GetCaret()->GetSize()); @@ -6465,9 +6465,9 @@ void wxGetMousePosition(int* x, int* y) GdkDevice* device = gdk_device_manager_get_client_pointer(manager); wxGCC_WARNING_RESTORE() #endif - gdk_device_get_position(device, NULL, x, y); + gdk_device_get_position(device, nullptr, x, y); #else - gdk_display_get_pointer(display, NULL, x, y, NULL); + gdk_display_get_pointer(display, nullptr, x, y, nullptr); #endif } @@ -6480,7 +6480,7 @@ wxPoint wxGetMousePosition() GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const { - GdkWindow* window = NULL; + GdkWindow* window = nullptr; if (m_wxwindow) window = gtk_widget_get_window(m_wxwindow); return window; diff --git a/src/html/chm.cpp b/src/html/chm.cpp index dfe4835173..ef3720551c 100644 --- a/src/html/chm.cpp +++ b/src/html/chm.cpp @@ -101,9 +101,9 @@ wxChmTools::wxChmTools(const wxFileName &archive) wxASSERT_MSG( !m_chmFileName.empty(), wxT("empty archive name") ); - m_archive = NULL; - m_decompressor = NULL; - m_fileNames = NULL; + m_archive = nullptr; + m_decompressor = nullptr; + m_fileNames = nullptr; m_lasterror = 0; struct mschmd_header *chmh; @@ -111,7 +111,7 @@ wxChmTools::wxChmTools(const wxFileName &archive) struct mschmd_file *file; // Create decompressor - chmd = mspack_create_chm_decompressor(NULL); + chmd = mspack_create_chm_decompressor(nullptr); m_decompressor = (struct mschm_decompressor *) chmd; // NB: we must make a copy of the string because chmd->open won't call @@ -308,7 +308,7 @@ struct mschmd_file *wxChmTools::GetMschmdFile(const wxString& pattern_orig) } } - return NULL; + return nullptr; } const wxString wxChmTools::GetLastErrorMessage() @@ -414,11 +414,11 @@ wxChmInputStream::wxChmInputStream(const wxString& archive, { m_pos = 0; m_size = 0; - m_content = NULL; - m_contentStream = NULL; + m_content = nullptr; + m_contentStream = nullptr; m_lasterror = wxSTREAM_NO_ERROR; m_chm = new wxChmTools (wxFileName(archive)); - m_file = NULL; + m_file = nullptr; m_fileName = wxString(filename).MakeLower(); m_simulateHHP = simulate; @@ -455,14 +455,14 @@ wxChmInputStream::~wxChmInputStream() if (m_content) { free (m_content); - m_content=NULL; + m_content=nullptr; } } bool wxChmInputStream::Eof() const { - return (m_content==NULL || - m_contentStream==NULL || + return (m_content==nullptr || + m_contentStream==nullptr || m_contentStream->Eof() || (size_t)m_pos>m_size); } @@ -632,10 +632,10 @@ wxChmInputStream::CreateHHPStream() case 7: // COMPILED_FILE tmp = "Binary Index=YES\r\n"; out->Write( (const void *) tmp, strlen(tmp)); - tmp = NULL; + tmp = nullptr; break; case 4: // STRUCT SYSTEM INFO - tmp = NULL ; + tmp = nullptr ; if ( len >= 28 ) { char *structptr = (char*) buf ; @@ -649,7 +649,7 @@ wxChmInputStream::CreateHHPStream() } break ; default: - tmp=NULL; + tmp=nullptr; } if (tmp) @@ -660,7 +660,7 @@ wxChmInputStream::CreateHHPStream() } free(buf); - buf=NULL; + buf=nullptr; } @@ -775,7 +775,7 @@ private: wxChmFSHandler::wxChmFSHandler() : wxFileSystemHandler() { m_lasterror=0; - m_chm=NULL; + m_chm=nullptr; } wxChmFSHandler::~wxChmFSHandler() @@ -804,7 +804,7 @@ wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), if ( GetProtocol(left) != wxT("file") ) { wxLogError(_("CHM handler currently supports only local files!")); - return NULL; + return nullptr; } // Work around javascript @@ -829,7 +829,7 @@ wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), wxFileName leftFilename = wxFileSystem::URLToFileName(left); if (!leftFilename.FileExists()) - return NULL; + return nullptr; // Open a stream to read the content of the chm-file s = new wxChmInputStream(leftFilename.GetFullPath(), right, true); @@ -844,7 +844,7 @@ wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), } delete s; - return NULL; + return nullptr; } diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index b71ddd8315..18dddf401d 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -49,11 +49,11 @@ wxHtmlHelpController::wxHtmlHelpController(wxWindow* parentWindow, int style): void wxHtmlHelpController::Init(int style) { - m_helpWindow = NULL; - m_helpFrame = NULL; - m_helpDialog = NULL; + m_helpWindow = nullptr; + m_helpFrame = nullptr; + m_helpDialog = nullptr; #if wxUSE_CONFIG - m_Config = NULL; + m_Config = nullptr; m_ConfigRoot.clear(); #endif // wxUSE_CONFIG m_titleFormat = _("Help: %s"); @@ -89,10 +89,10 @@ void wxHtmlHelpController::DestroyHelpWindow() dialog->EndModal(wxID_OK); } parent->Destroy(); - m_helpWindow = NULL; + m_helpWindow = nullptr; } - m_helpDialog = NULL; - m_helpFrame = NULL; + m_helpDialog = nullptr; + m_helpFrame = nullptr; } void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) @@ -107,10 +107,10 @@ void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) OnQuit(); if ( m_helpWindow ) - m_helpWindow->SetController(NULL); - m_helpWindow = NULL; - m_helpDialog = NULL; - m_helpFrame = NULL; + m_helpWindow->SetController(nullptr); + m_helpWindow = nullptr; + m_helpDialog = nullptr; + m_helpFrame = nullptr; } void wxHtmlHelpController::SetShouldPreventAppExit(bool enable) @@ -148,7 +148,7 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg) { wxBusyCursor cur; #if wxUSE_BUSYINFO - wxBusyInfo* busy = NULL; + wxBusyInfo* busy = nullptr; wxString info; if (show_wait_msg) { @@ -207,10 +207,10 @@ wxWindow* wxHtmlHelpController::CreateHelpWindow() } #if wxUSE_CONFIG - if (m_Config == NULL) + if (m_Config == nullptr) { m_Config = wxConfigBase::Get(false); - if (m_Config != NULL) + if (m_Config != nullptr) m_ConfigRoot = wxT("wxWindows/wxHtmlHelpController"); } #endif // wxUSE_CONFIG @@ -305,16 +305,16 @@ bool wxHtmlHelpController::DisplaySection(int sectionNo) bool wxHtmlHelpController::DisplayTextPopup(const wxString& text, const wxPoint& WXUNUSED(pos)) { #if wxUSE_TIPWINDOW - static wxTipWindow* s_tipWindow = NULL; + static wxTipWindow* s_tipWindow = nullptr; if (s_tipWindow) { // Prevent s_tipWindow being nulled in OnIdle, // thereby removing the chance for the window to be closed by ShowHelp - s_tipWindow->SetTipWindowPtr(NULL); + s_tipWindow->SetTipWindowPtr(nullptr); s_tipWindow->Close(); } - s_tipWindow = NULL; + s_tipWindow = nullptr; if ( !text.empty() ) { @@ -373,9 +373,9 @@ wxFrame* wxHtmlHelpController::GetFrameParameters(wxSize *size, (* size) = dialog->GetSize(); if (pos) (* pos) = dialog->GetPosition(); - return NULL; + return nullptr; } - return NULL; + return nullptr; } bool wxHtmlHelpController::Quit() diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 0fe07c378f..8484625c51 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -40,7 +40,7 @@ WX_DEFINE_OBJARRAY(wxHtmlHelpDataItems) // static helper functions //----------------------------------------------------------------------------- -// Reads one line, stores it into buf and returns pointer to new line or NULL. +// Reads one line, stores it into buf and returns pointer to new line or nullptr. static const wxChar* ReadLine(const wxChar *line, wxChar *buf, size_t bufsize) { wxChar *writeptr = buf; @@ -54,7 +54,7 @@ static const wxChar* ReadLine(const wxChar *line, wxChar *buf, size_t bufsize) while (*readptr == wxT('\r') || *readptr == wxT('\n')) readptr++; if (*readptr == 0) - return NULL; + return nullptr; else return readptr; } @@ -67,9 +67,9 @@ wxHtmlHelpIndexCompareFunc(wxHtmlHelpDataItem **a, wxHtmlHelpDataItem **b) wxHtmlHelpDataItem *ia = *a; wxHtmlHelpDataItem *ib = *b; - if (ia == NULL) + if (ia == nullptr) return -1; - if (ib == NULL) + if (ib == nullptr) return 1; if (ia->parent == ib->parent) @@ -118,7 +118,7 @@ public: GetEntitiesParser()->SetEncoding(wxFONTENCODING_ISO8859_1); } - wxObject* GetProduct() override { return NULL; } + wxObject* GetProduct() override { return nullptr; } protected: virtual void AddText(const wxString& WXUNUSED(txt)) override {} @@ -146,12 +146,12 @@ class HP_TagHandler : public wxHtmlTagHandler public: HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() { - m_data = NULL; + m_data = nullptr; m_book = b; m_level = 0; m_id = wxID_ANY; m_count = 0; - m_parentItem = NULL; + m_parentItem = nullptr; } wxString GetSupportedTags() override { return wxT("UL,OBJECT,PARAM"); } bool HandleTag(const wxHtmlTag& tag) override; @@ -161,7 +161,7 @@ class HP_TagHandler : public wxHtmlTagHandler m_data = &data; m_count = 0; m_level = 0; - m_parentItem = NULL; + m_parentItem = nullptr; } wxDECLARE_NO_COPY_CLASS(HP_TagHandler); @@ -174,7 +174,7 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) { wxHtmlHelpDataItem *oldparent = m_parentItem; m_level++; - m_parentItem = (m_count > 0) ? &(*m_data)[m_data->size()-1] : NULL; + m_parentItem = (m_count > 0) ? &(*m_data)[m_data->size()-1] : nullptr; ParseInner(tag); m_level--; m_parentItem = oldparent; @@ -282,7 +282,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, HP_TagHandler *handler = new HP_TagHandler(book); parser.AddTagHandler(handler); - f = ( contentsfile.empty() ? NULL : fsys.OpenFile(contentsfile) ); + f = ( contentsfile.empty() ? nullptr : fsys.OpenFile(contentsfile) ); if (f) { buf.clear(); @@ -296,7 +296,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, wxLogError(_("Cannot open contents file: %s"), contentsfile); } - f = ( indexfile.empty() ? NULL : fsys.OpenFile(indexfile) ); + f = ( indexfile.empty() ? nullptr : fsys.OpenFile(indexfile) ); if (f) { buf.clear(); @@ -444,7 +444,7 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) CacheWriteString(f, m_index[i].page); CacheWriteInt32(f, m_index[i].level); // save distance to parent item, if any: - if (m_index[i].parent == NULL) + if (m_index[i].parent == nullptr) { CacheWriteInt32(f, 0); } @@ -554,15 +554,15 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached")); - if (fi == NULL || + if (fi == nullptr || #if wxUSE_DATETIME fi->GetModificationTime() < bookfile.GetModificationTime() || #endif // wxUSE_DATETIME !LoadCachedBook(bookr, fi->GetStream())) { - if (fi != NULL) delete fi; + if (fi != nullptr) delete fi; fi = fsys.OpenFile(m_tempPath + wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached")); - if (m_tempPath.empty() || fi == NULL || + if (m_tempPath.empty() || fi == nullptr || #if wxUSE_DATETIME fi->GetModificationTime() < bookfile.GetModificationTime() || #endif // wxUSE_DATETIME @@ -579,7 +579,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, } } - if (fi != NULL) delete fi; + if (fi != nullptr) delete fi; // Now store the contents range bookr->SetContentsRange(cont_start, m_contents.size()); @@ -655,7 +655,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) charset; fi = fsys.OpenFile(book); - if (fi == NULL) + if (fi == nullptr) { wxLogError(_("Cannot open HTML help book: %s"), book); return false; @@ -689,7 +689,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) contents = linebuf + wxStrlen(wxT("contents file=")); if (wxStrstr(linebuf, wxT("charset=")) == linebuf) charset = linebuf + wxStrlen(wxT("charset=")); - } while (lineptr != NULL); + } while (lineptr != nullptr); wxFontEncoding enc = wxFONTENCODING_SYSTEM; #if wxUSE_FONTMAP @@ -799,7 +799,7 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key : m_Keyword(keyword) { m_Data = data; - wxHtmlBookRecord* bookr = NULL; + wxHtmlBookRecord* bookr = nullptr; if (!book.empty()) { // we have to search in a specific book. Find it first @@ -840,7 +840,7 @@ bool wxHtmlSearchStatus::Search() } m_Name.clear(); - m_CurItem = NULL; + m_CurItem = nullptr; thepage = m_Data->m_contents[i].page; m_Active = (++m_CurIndex < m_MaxIndex); diff --git a/src/html/helpdlg.cpp b/src/html/helpdlg.cpp index ff5bf8471e..e9f976f775 100644 --- a/src/html/helpdlg.cpp +++ b/src/html/helpdlg.cpp @@ -50,8 +50,8 @@ void wxHtmlHelpDialog::Init(wxHtmlHelpData* data) { // Simply pass the pointer on to the help window m_Data = data; - m_HtmlHelpWin = NULL; - m_helpController = NULL; + m_HtmlHelpWin = nullptr; + m_helpController = nullptr; } // Create: builds the GUI components. diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index ac7714e42c..ef3d65ae9e 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -78,8 +78,8 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) { // Simply pass the pointer on to the help window m_Data = data; - m_HtmlHelpWin = NULL; - m_helpController = NULL; + m_HtmlHelpWin = nullptr; + m_helpController = nullptr; m_shouldPreventAppExit = false; } diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index e557e093c5..de859d6a11 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -164,7 +164,7 @@ void wxHtmlHelpWindow::UpdateMergedIndex() const wxHtmlHelpDataItems& items = m_Data->GetIndexArray(); size_t len = items.size(); - wxHtmlHelpMergedIndexItem *history[128] = {NULL}; + wxHtmlHelpMergedIndexItem *history[128] = {nullptr}; for (size_t i = 0; i < len; i++) { @@ -183,7 +183,7 @@ void wxHtmlHelpWindow::UpdateMergedIndex() wxHtmlHelpMergedIndexItem *mi = new wxHtmlHelpMergedIndexItem(); mi->name = item.GetIndentedName(); mi->items.Add(&item); - mi->parent = (item.level == 0) ? NULL : history[item.level - 1]; + mi->parent = (item.level == 0) ? nullptr : history[item.level - 1]; history[item.level] = mi; merged.Add(mi); } @@ -238,28 +238,28 @@ void wxHtmlHelpWindow::Init(wxHtmlHelpData* data) m_IndexPage = 0; m_SearchPage = 0; - m_ContentsBox = NULL; - m_IndexList = NULL; - m_IndexButton = NULL; - m_IndexButtonAll = NULL; - m_IndexText = NULL; - m_SearchList = NULL; - m_SearchButton = NULL; - m_SearchText = NULL; - m_SearchChoice = NULL; - m_IndexCountInfo = NULL; - m_Splitter = NULL; - m_NavigPan = NULL; - m_NavigNotebook = NULL; - m_HtmlWin = NULL; - m_Bookmarks = NULL; - m_SearchCaseSensitive = NULL; - m_SearchWholeWords = NULL; + m_ContentsBox = nullptr; + m_IndexList = nullptr; + m_IndexButton = nullptr; + m_IndexButtonAll = nullptr; + m_IndexText = nullptr; + m_SearchList = nullptr; + m_SearchButton = nullptr; + m_SearchText = nullptr; + m_SearchChoice = nullptr; + m_IndexCountInfo = nullptr; + m_Splitter = nullptr; + m_NavigPan = nullptr; + m_NavigNotebook = nullptr; + m_HtmlWin = nullptr; + m_Bookmarks = nullptr; + m_SearchCaseSensitive = nullptr; + m_SearchWholeWords = nullptr; - m_mergedIndex = NULL; + m_mergedIndex = nullptr; #if wxUSE_CONFIG - m_Config = NULL; + m_Config = nullptr; m_ConfigRoot.clear(); #endif // wxUSE_CONFIG @@ -269,7 +269,7 @@ void wxHtmlHelpWindow::Init(wxHtmlHelpData* data) m_Cfg.sashpos = 240; m_Cfg.navig_on = true; - m_NormalFonts = m_FixedFonts = NULL; + m_NormalFonts = m_FixedFonts = nullptr; m_NormalFace.clear(); m_FixedFace.clear(); #ifdef __WXMSW__ @@ -279,13 +279,13 @@ void wxHtmlHelpWindow::Init(wxHtmlHelpData* data) #endif #if wxUSE_PRINTING_ARCHITECTURE - m_Printer = NULL; + m_Printer = nullptr; #endif - m_PagesHash = NULL; + m_PagesHash = nullptr; m_UpdateContents = true; - m_toolBar = NULL; - m_helpController = NULL; + m_toolBar = nullptr; + m_helpController = nullptr; } // Create: builds the GUI components. @@ -293,9 +293,9 @@ void wxHtmlHelpWindow::Init(wxHtmlHelpData* data) // controls. // m_HtmlWin will *always* be created, but it's important to realize that // m_ContentsBox, m_IndexList, m_SearchList, m_SearchButton, m_SearchText and -// m_SearchButton may be NULL. +// m_SearchButton may be null. // moreover, if no contents, index or searchpage is needed, m_Splitter and -// m_NavigPan will be NULL too (with m_HtmlWin directly connected to the frame) +// m_NavigPan will be null too (with m_HtmlWin directly connected to the frame) bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -339,7 +339,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, } #endif //wxUSE_TOOLBAR - wxSizer *navigSizer = NULL; + wxSizer *navigSizer = nullptr; #ifdef __WXMSW__ wxBorder htmlWindowBorder = wxBORDER_THEME; @@ -407,7 +407,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, m_Bookmarks = new wxComboBox(dummy, wxID_HTML_BOOKMARKSLIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, - 0, NULL, comboStyle); + 0, nullptr, comboStyle); m_Bookmarks->Append(_("(bookmarks)")); for (unsigned i = 0; i < m_BookmarksNames.GetCount(); i++) m_Bookmarks->Append(m_BookmarksNames[i]); @@ -488,7 +488,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, wxALIGN_RIGHT | wxST_NO_AUTORESIZE); m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxLB_SINGLE); + 0, nullptr, wxLB_SINGLE); #if wxUSE_TOOLTIPS m_IndexButton->SetToolTip(_("Display all index items that contain given substring. Search is case insensitive.")); @@ -530,7 +530,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, #endif //wxUSE_TOOLTIPS m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, - 0, NULL, wxLB_SINGLE); + 0, nullptr, wxLB_SINGLE); sizer->Add(m_SearchText, 0, wxEXPAND | wxALL, 10); sizer->Add(m_SearchChoice, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10); @@ -589,7 +589,7 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, wxHtmlHelpWindow::~wxHtmlHelpWindow() { if ( m_helpController ) - m_helpController->SetHelpWindow(NULL); + m_helpController->SetHelpWindow(nullptr); delete m_mergedIndex; @@ -792,7 +792,7 @@ void wxHtmlHelpWindow::DisplayIndexItem(const wxHtmlHelpMergedIndexItem *it) _("Please choose the page to display:"), _("Help Topics"), arr, - (void**)NULL, // No client data + (void**)nullptr, // No client data wxCHOICEDLG_STYLE & ~wxCENTRE); if (dlg.ShowModal() == wxID_OK) { @@ -1200,11 +1200,11 @@ public: sizer->Add(NormalFont = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), - 0, NULL, wxCB_DROPDOWN | wxCB_READONLY)); + 0, nullptr, wxCB_DROPDOWN | wxCB_READONLY)); sizer->Add(FixedFont = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, wxDefaultCoord), - 0, NULL, wxCB_DROPDOWN | wxCB_READONLY)); + 0, nullptr, wxCB_DROPDOWN | wxCB_READONLY)); sizer->Add(FontSize = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 2, 100, 2, wxT("wxSpinCtrl"))); @@ -1288,12 +1288,12 @@ void wxHtmlHelpWindow::OptionsDialog() { wxHtmlHelpWindowOptionsDialog dlg(this); - if (m_NormalFonts == NULL) + if (m_NormalFonts == nullptr) { m_NormalFonts = new wxArrayString(wxFontEnumerator::GetFacenames()); m_NormalFonts->Sort(); // ascending sort } - if (m_FixedFonts == NULL) + if (m_FixedFonts == nullptr) { m_FixedFonts = new wxArrayString( wxFontEnumerator::GetFacenames(wxFONTENCODING_SYSTEM, @@ -1356,7 +1356,7 @@ void wxHtmlHelpWindow::NotifyPageChanged() if (m_UpdateContents && m_PagesHash) { wxString page = wxHtmlHelpHtmlWindow::GetOpenedPageWithAnchor(m_HtmlWin); - wxHtmlHelpHashData *ha = NULL; + wxHtmlHelpHashData *ha = nullptr; if (!page.empty()) ha = (wxHtmlHelpHashData*) m_PagesHash->Get(page); @@ -1392,7 +1392,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event) if (m_PagesHash) { wxString page = wxHtmlHelpHtmlWindow::GetOpenedPageWithAnchor(m_HtmlWin); - wxHtmlHelpHashData *ha = NULL; + wxHtmlHelpHashData *ha = nullptr; if (!page.empty()) ha = (wxHtmlHelpHashData*) m_PagesHash->Get(page); if (ha && ha->m_Index > 0) @@ -1410,7 +1410,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event) if (m_PagesHash) { wxString page = wxHtmlHelpHtmlWindow::GetOpenedPageWithAnchor(m_HtmlWin); - wxHtmlHelpHashData *ha = NULL; + wxHtmlHelpHashData *ha = nullptr; if (!page.empty()) ha = (wxHtmlHelpHashData*) m_PagesHash->Get(page); if (ha && ha->m_Index > 0) @@ -1439,7 +1439,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event) if (m_PagesHash) { wxString page = wxHtmlHelpHtmlWindow::GetOpenedPageWithAnchor(m_HtmlWin); - wxHtmlHelpHashData *ha = NULL; + wxHtmlHelpHashData *ha = nullptr; if (!page.empty()) ha = (wxHtmlHelpHashData*) m_PagesHash->Get(page); @@ -1519,7 +1519,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event) #if wxUSE_PRINTING_ARCHITECTURE case wxID_HTML_PRINT : { - if (m_Printer == NULL) + if (m_Printer == nullptr) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); if (!m_HtmlWin->GetOpenedPage()) { diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index b6053d9ffb..e762d2aa3e 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -79,13 +79,13 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlCell, wxObject); wxHtmlCell::wxHtmlCell() : wxObject() { - m_Next = NULL; - m_Parent = NULL; + m_Next = nullptr; + m_Parent = nullptr; m_Width = m_Height = m_Descent = 0; m_ScriptMode = wxHTML_SCRIPT_NORMAL; // or mode m_ScriptBaseline = 0; // or baseline m_CanLiveOnPagebreak = true; - m_Link = NULL; + m_Link = nullptr; } wxHtmlCell::~wxHtmlCell() @@ -193,7 +193,7 @@ void wxHtmlCell::Layout(int WXUNUSED(w)) const wxHtmlCell* wxHtmlCell::Find(int WXUNUSED(condition), const void* WXUNUSED(param)) const { - return NULL; + return nullptr; } @@ -213,7 +213,7 @@ wxHtmlCell *wxHtmlCell::FindCellByPos(wxCoord x, wxCoord y, (y >= 0+m_Height || (y >= 0 && x >= 0))) return wxConstCast(this, wxHtmlCell); else - return NULL; + return nullptr; } } @@ -668,7 +668,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlContainerCell, wxHtmlCell); wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCell() { - m_Cells = m_LastCell = NULL; + m_Cells = m_LastCell = nullptr; m_Parent = parent; m_MaxTotalWidth = 0; if (m_Parent) m_Parent->InsertCell(this); @@ -814,7 +814,7 @@ void wxHtmlContainerCell::Layout(int w) // my own layout: wxHtmlCell *cell = m_Cells, *line = m_Cells; - while (cell != NULL) + while (cell != nullptr) { switch (m_AlignVer) { @@ -862,7 +862,7 @@ void wxHtmlContainerCell::Layout(int w) } // force new line if occurred: - if ((cell == NULL) || + if ((cell == nullptr) || (xpos + nextWordWidth > s_width && cell->IsLinebreakAllowed())) { if (xpos > MaxLineWidth) MaxLineWidth = xpos; @@ -885,7 +885,7 @@ void wxHtmlContainerCell::Layout(int w) ypos += ysizeup; - if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL) + if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == nullptr) { while (line != cell) { @@ -1180,7 +1180,7 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const // VZ: I don't know if we should pass absolute or relative coords to // wxHtmlCell::GetLink()? As the base class version just ignores them // anyhow, it hardly matters right now but should still be clarified - return cell ? cell->GetLink(x, y) : NULL; + return cell ? cell->GetLink(x, y) : nullptr; } @@ -1207,7 +1207,7 @@ void wxHtmlContainerCell::Detach(wxHtmlCell *cell) { m_Cells = cell->GetNext(); if ( m_LastCell == cell ) - m_LastCell = NULL; + m_LastCell = nullptr; } else // Not the first child. { @@ -1231,8 +1231,8 @@ void wxHtmlContainerCell::Detach(wxHtmlCell *cell) } } - cell->SetParent(NULL); - cell->SetNext(NULL); + cell->SetParent(nullptr); + cell->SetNext(nullptr); } @@ -1287,7 +1287,7 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co if (r) return r; } } - return NULL; + return nullptr; } @@ -1326,7 +1326,7 @@ wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y, } else if ( flags & wxHTML_FIND_NEAREST_BEFORE ) { - wxHtmlCell *c2, *c = NULL; + wxHtmlCell *c2, *c = nullptr; for ( const wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext() ) { if ( cell->IsFormattingCell() ) @@ -1342,7 +1342,7 @@ wxHtmlCell *wxHtmlContainerCell::FindCellByPos(wxCoord x, wxCoord y, if (c) return c; } - return NULL; + return nullptr; } @@ -1371,7 +1371,7 @@ wxHtmlCell *wxHtmlContainerCell::GetFirstTerminal() const return c2; } } - return NULL; + return nullptr; } wxHtmlCell *wxHtmlContainerCell::GetLastTerminal() const @@ -1384,7 +1384,7 @@ wxHtmlCell *wxHtmlContainerCell::GetLastTerminal() const return c; wxHtmlCell *ctmp; - wxHtmlCell *c2 = NULL; + wxHtmlCell *c2 = nullptr; for (c = m_Cells; c; c = c->GetNext()) { ctmp = c->GetLastTerminal(); @@ -1394,7 +1394,7 @@ wxHtmlCell *wxHtmlContainerCell::GetLastTerminal() const return c2; } else - return NULL; + return nullptr; } @@ -1661,14 +1661,14 @@ void wxHtmlWidgetCell::Layout(int w) const wxHtmlCell* wxHtmlTerminalCellsInterator::operator++() { if ( !m_pos ) - return NULL; + return nullptr; do { if ( m_pos == m_to ) { - m_pos = NULL; - return NULL; + m_pos = nullptr; + return nullptr; } if ( m_pos->GetNext() ) @@ -1677,15 +1677,15 @@ const wxHtmlCell* wxHtmlTerminalCellsInterator::operator++() { // we must go up the hierarchy until we reach container where this // is not the last child, and then go down to first terminal cell: - while ( m_pos->GetNext() == NULL ) + while ( m_pos->GetNext() == nullptr ) { m_pos = m_pos->GetParent(); if ( !m_pos ) - return NULL; + return nullptr; } m_pos = m_pos->GetNext(); } - while ( m_pos->GetFirstChild() != NULL ) + while ( m_pos->GetFirstChild() != nullptr ) m_pos = m_pos->GetFirstChild(); } while ( !m_pos->IsTerminalCell() ); diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index c73f32c29b..da7bc0bea5 100644 --- a/src/html/htmlfilt.cpp +++ b/src/html/htmlfilt.cpp @@ -57,7 +57,7 @@ wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const wxInputStream *s = file.GetStream(); wxString doc, doc2; - if (s == NULL) return wxEmptyString; + if (s == nullptr) return wxEmptyString; ReadString(doc, s, wxConvISO8859_1); doc.Replace(wxT("&"), wxT("&"), true); @@ -129,7 +129,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const wxInputStream *s = file.GetStream(); wxString doc; - if (s == NULL) + if (s == nullptr) { wxLogError(_("Cannot open HTML document: %s"), file.GetLocation()); return wxEmptyString; diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 721eb1edef..734b535253 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -70,15 +70,15 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlParser,wxObject); wxHtmlParser::wxHtmlParser() : wxObject(), - m_FS(NULL) + m_FS(nullptr) { - m_Source = NULL; + m_Source = nullptr; m_entitiesParser = new wxHtmlEntitiesParser; - m_Tags = NULL; - m_CurTag = NULL; - m_TextPieces = NULL; + m_Tags = nullptr; + m_CurTag = nullptr; + m_TextPieces = nullptr; m_CurTextPiece = 0; - m_SavedStates = NULL; + m_SavedStates = nullptr; } wxHtmlParser::~wxHtmlParser() @@ -125,7 +125,7 @@ void wxHtmlParser::SetSource(const wxString& src) delete m_Source; m_Source = new wxString(src); CreateDOMTree(); - m_CurTag = NULL; + m_CurTag = nullptr; m_CurTextPiece = 0; } @@ -133,7 +133,7 @@ void wxHtmlParser::CreateDOMTree() { wxHtmlTagsCache cache(*m_Source); m_TextPieces = new wxHtmlTextPieces; - CreateDOMSubTree(NULL, m_Source->begin(), m_Source->end(), &cache); + CreateDOMSubTree(nullptr, m_Source->begin(), m_Source->end(), &cache); m_CurTextPiece = 0; } @@ -154,7 +154,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, // and ending tag verbosely. Setting i=end_pos will skip to the very // end of this function where text piece is added, bypassing any child // tags parsing (CDATA element can't have child elements by definition): - if (cur != NULL && wxIsCDATAElement(cur->GetName())) + if (cur != nullptr && wxIsCDATAElement(cur->GetName())) { i = end_pos; } @@ -185,7 +185,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, i, end_pos, cache, m_entitiesParser); else { - chd = new wxHtmlTag(NULL, m_Source, + chd = new wxHtmlTag(nullptr, m_Source, i, end_pos, cache, m_entitiesParser); if (!m_Tags) { @@ -240,7 +240,7 @@ void wxHtmlParser::DestroyDOMTree() delete t1; t1 = t2; } - m_Tags = m_CurTag = NULL; + m_Tags = m_CurTag = nullptr; wxDELETE(m_TextPieces); } @@ -374,11 +374,11 @@ void wxHtmlParser::SetSourceAndSaveState(const wxString& src) s->m_nextState = m_SavedStates; m_SavedStates = s; - m_CurTag = NULL; - m_Tags = NULL; - m_TextPieces = NULL; + m_CurTag = nullptr; + m_Tags = nullptr; + m_TextPieces = nullptr; m_CurTextPiece = 0; - m_Source = NULL; + m_Source = nullptr; SetSource(src); } @@ -432,7 +432,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxHtmlEntitiesParser, wxObject); wxHtmlEntitiesParser::wxHtmlEntitiesParser() #if !wxUSE_UNICODE - : m_conv(NULL), m_encoding(wxFONTENCODING_SYSTEM) + : m_conv(nullptr), m_encoding(wxFONTENCODING_SYSTEM) #endif { } @@ -454,7 +454,7 @@ void wxHtmlEntitiesParser::SetEncoding(wxFontEncoding encoding) m_encoding = encoding; if (m_encoding == wxFONTENCODING_SYSTEM) - m_conv = NULL; + m_conv = nullptr; else m_conv = new wxCSConv(wxFontMapper::GetEncodingName(m_encoding)); } @@ -833,7 +833,7 @@ wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity) const ENTITY("zeta", 950), ENTITY("zwj", 8205), ENTITY("zwnj", 8204), - {NULL, 0}}; + {nullptr, 0}}; #undef ENTITY static size_t substitutions_cnt = 0; @@ -863,7 +863,7 @@ wxFSFile *wxHtmlParser::OpenURL(wxHtmlURLType type, if (type == wxHTML_URL_IMAGE) flags |= wxFS_SEEKABLE; - return m_FS ? m_FS->OpenFile(url, flags) : NULL; + return m_FS ? m_FS->OpenFile(url, flags) : nullptr; } @@ -877,7 +877,7 @@ class wxMetaTagParser : public wxHtmlParser public: wxMetaTagParser() { } - wxObject* GetProduct() override { return NULL; } + wxObject* GetProduct() override { return nullptr; } protected: virtual void AddText(const wxString& WXUNUSED(txt)) override {} diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 3a7015522e..cf2daf1381 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -301,20 +301,20 @@ wxHtmlTag::wxHtmlTag(wxHtmlTag *parent, { /* Setup DOM relations */ - m_Next = NULL; - m_FirstChild = m_LastChild = NULL; + m_Next = nullptr; + m_FirstChild = m_LastChild = nullptr; m_Parent = parent; if (parent) { m_Prev = m_Parent->m_LastChild; - if (m_Prev == NULL) + if (m_Prev == nullptr) m_Parent->m_FirstChild = this; else m_Prev->m_Next = this; m_Parent->m_LastChild = this; } else - m_Prev = NULL; + m_Prev = nullptr; /* Find parameters and their values: */ @@ -509,7 +509,7 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_quotes) const bool wxHtmlTag::GetParamAsString(const wxString& par, wxString *str) const { - wxCHECK_MSG( str, false, wxT("NULL output string argument") ); + wxCHECK_MSG( str, false, wxT("null output string argument") ); int index = m_ParamNames.Index(par, false); if (index == wxNOT_FOUND) @@ -680,7 +680,7 @@ wxHtmlTag *wxHtmlTag::GetNextTag() const if (m_FirstChild) return m_FirstChild; if (m_Next) return m_Next; wxHtmlTag *cur = m_Parent; - if (!cur) return NULL; + if (!cur) return nullptr; while (cur->m_Parent && !cur->m_Next) cur = cur->m_Parent; return cur->m_Next; diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 2b47ac829e..c4a4c1b825 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -154,8 +154,8 @@ WX_DEFINE_LIST(wxHtmlProcessorList) wxHtmlWindowMouseHelper::wxHtmlWindowMouseHelper(wxHtmlWindowInterface *iface) : m_tmpMouseMoved(false), - m_tmpLastLink(NULL), - m_tmpLastCell(NULL), + m_tmpLastLink(nullptr), + m_tmpLastCell(nullptr), m_interface(iface) { } @@ -174,7 +174,7 @@ bool wxHtmlWindowMouseHelper::HandleMouseClick(wxHtmlCell *rootCell, wxHtmlCell *cell = rootCell->FindCellByPos(pos.x, pos.y); // this check is needed because FindCellByPos returns terminal cell and - // containers may have empty borders -- in this case NULL will be + // containers may have empty borders -- in this case nullptr will be // returned if (!cell) return false; @@ -188,11 +188,11 @@ bool wxHtmlWindowMouseHelper::HandleMouseClick(wxHtmlCell *rootCell, void wxHtmlWindowMouseHelper::HandleIdle(wxHtmlCell *rootCell, const wxPoint& pos) { - wxHtmlCell *cell = rootCell ? rootCell->FindCellByPos(pos.x, pos.y) : NULL; + wxHtmlCell *cell = rootCell ? rootCell->FindCellByPos(pos.x, pos.y) : nullptr; if (cell != m_tmpLastCell) { - wxHtmlLinkInfo *lnk = NULL; + wxHtmlLinkInfo *lnk = nullptr; if (cell) { // adjust the coordinates to be relative to this cell: @@ -249,7 +249,7 @@ bool wxHtmlWindowMouseHelper::OnCellClicked(wxHtmlCell *cell, { // if the event wasn't handled, do the default processing here: - wxASSERT_MSG( cell, wxT("can't be called with NULL cell") ); + wxASSERT_MSG( cell, wxT("can't be called with null cell") ); // If we don't return true, HTML listboxes will always think that they should take // the focus @@ -279,11 +279,11 @@ void wxHtmlWindowMouseHelper::OnCellMouseHover(wxHtmlCell * cell, //----------------------------------------------------------------------------- wxList wxHtmlWindow::m_Filters; -wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL; -wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL; -wxCursor *wxHtmlWindow::ms_cursorLink = NULL; -wxCursor *wxHtmlWindow::ms_cursorText = NULL; -wxCursor *wxHtmlWindow::ms_cursorDefault = NULL; +wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = nullptr; +wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = nullptr; +wxCursor *wxHtmlWindow::ms_cursorLink = nullptr; +wxCursor *wxHtmlWindow::ms_cursorText = nullptr; +wxCursor *wxHtmlWindow::ms_cursorDefault = nullptr; void wxHtmlWindow::CleanUpStatics() { @@ -302,29 +302,29 @@ void wxHtmlWindow::Init() m_tmpCanDrawLocks = 0; m_FS = new wxFileSystem(); #if wxUSE_STATUSBAR - m_RelatedStatusBar = NULL; + m_RelatedStatusBar = nullptr; m_RelatedStatusBarIndex = -1; #endif // wxUSE_STATUSBAR - m_RelatedFrame = NULL; + m_RelatedFrame = nullptr; m_TitleFormat = wxT("%s"); m_OpenedPage.clear(); m_OpenedAnchor.clear(); m_OpenedPageTitle.clear(); - m_Cell = NULL; + m_Cell = nullptr; m_Parser = new wxHtmlWinParser(this); m_Parser->SetFS(m_FS); m_HistoryPos = -1; m_HistoryOn = true; m_History = new wxHtmlHistoryArray; - m_Processors = NULL; + m_Processors = nullptr; SetBorders(10); - m_selection = NULL; + m_selection = nullptr; m_makingSelection = false; #if wxUSE_CLIPBOARD - m_timerAutoScroll = NULL; + m_timerAutoScroll = nullptr; m_lastDoubleClick = 0; #endif // wxUSE_CLIPBOARD - m_tmpSelFromCell = NULL; + m_tmpSelFromCell = nullptr; } bool wxHtmlWindow::Create(wxWindow *parent, wxWindowID id, @@ -445,7 +445,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) wxDELETE(m_selection); // we will soon delete all the cells, so clear pointers to them: - m_tmpSelFromCell = NULL; + m_tmpSelFromCell = nullptr; // pass HTML through registered processors: if (m_Processors || m_GlobalProcessors) @@ -495,7 +495,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) m_Parser->SetDC(&dc, pixelScale, 1.0); - // notice that it's important to set m_Cell to NULL here before calling + // notice that it's important to set m_Cell to nullptr here before calling // Parse() below, even if it will be overwritten by its return value as // without this we may crash if it's used from inside Parse(), so use // wxDELETE() and not just delete here @@ -505,7 +505,7 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) // The parser doesn't need the DC any more, so ensure it's not left with a // dangling pointer after the DC object goes out of scope. - m_Parser->SetDC(NULL); + m_Parser->SetDC(nullptr); m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER); @@ -574,14 +574,14 @@ bool wxHtmlWindow::LoadPage(const wxString& location) wxFSFile *f = m_Parser->OpenURL(wxHTML_URL_PAGE, location); // try to interpret 'location' as filename instead of URL: - if (f == NULL) + if (f == nullptr) { wxFileName fn(location); wxString location2 = wxFileSystem::FileNameToURL(fn); f = m_Parser->OpenURL(wxHTML_URL_PAGE, location2); } - if (f == NULL) + if (f == nullptr) { wxLogError(_("Unable to open requested HTML document: %s"), location); m_tmpCanDrawLocks--; @@ -616,7 +616,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location) } if (src.empty()) { - if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter(); + if (m_DefaultFilter == nullptr) m_DefaultFilter = GetDefaultFilter(); src = m_DefaultFilter->ReadFile(*f); } @@ -705,7 +705,7 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) int y; - for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY(); + for (y = 0; c != nullptr; c = c->GetParent()) y += c->GetPosY(); Scroll(-1, y / wxHTML_SCROLL_STEP); m_OpenedAnchor = anchor; return true; @@ -957,7 +957,7 @@ wxString wxHtmlWindow::DoSelectionToText(wxHtmlSelection *sel) wxString text; wxHtmlTerminalCellsInterator i(sel->GetFromCell(), sel->GetToCell()); - const wxHtmlCell *prev = NULL; + const wxHtmlCell *prev = nullptr; while ( i ) { @@ -1038,7 +1038,7 @@ void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) { // the default behaviour is to load the URL in this window const wxMouseEvent *e = event.GetLinkInfo().GetEvent(); - if (e == NULL || e->LeftUp()) + if (e == nullptr || e->LeftUp()) LoadPage(event.GetLinkInfo().GetHref()); } } @@ -1088,7 +1088,7 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dcPaint(this); - if (m_tmpCanDrawLocks > 0 || m_Cell == NULL) + if (m_tmpCanDrawLocks > 0 || m_Cell == nullptr) return; int x, y; @@ -1355,7 +1355,7 @@ void wxHtmlWindow::OnMouseDown(wxMouseEvent& event) Refresh(); } m_tmpSelFromPos = CalcUnscrolledPosition(event.GetPosition()); - m_tmpSelFromCell = NULL; + m_tmpSelFromCell = nullptr; CaptureMouse(); } @@ -1374,7 +1374,7 @@ void wxHtmlWindow::OnMouseUp(wxMouseEvent& event) ReleaseMouse(); m_makingSelection = false; - // if m_selection=NULL, the user didn't move the mouse far enough from + // if m_selection=nullptr, the user didn't move the mouse far enough from // starting point and the mouse up event is part of a click, the user // is not selecting text: if ( m_selection ) @@ -1402,7 +1402,7 @@ void wxHtmlWindow::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) // discard the selecting operation m_makingSelection = false; wxDELETE(m_selection); - m_tmpSelFromCell = NULL; + m_tmpSelFromCell = nullptr; Refresh(); } #endif // wxUSE_CLIPBOARD @@ -1412,7 +1412,7 @@ void wxHtmlWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - if (m_Cell != NULL && DidMouseMove()) + if (m_Cell != nullptr && DidMouseMove()) { #ifdef DEBUG_HTML_SELECTION Refresh(); @@ -1693,8 +1693,8 @@ void wxHtmlWindow::SelectLine(const wxPoint& pos) int y2 = y1 + cell->GetHeight(); int y; const wxHtmlCell *c; - const wxHtmlCell *before = NULL; - const wxHtmlCell *after = NULL; + const wxHtmlCell *before = nullptr; + const wxHtmlCell *after = nullptr; // find last cell of line: for ( c = cell->GetNext(); c; c = c->GetNext()) @@ -1719,7 +1719,7 @@ void wxHtmlWindow::SelectLine(const wxPoint& pos) before = c; } else - before = NULL; + before = nullptr; } if ( !before ) before = cell; diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index a982f628da..c5fccd85e9 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -64,9 +64,9 @@ wxHtmlDCRenderer::wxHtmlDCRenderer() : wxObject() { - m_DC = NULL; + m_DC = nullptr; m_Width = m_Height = 0; - m_Cells = NULL; + m_Cells = nullptr; m_ownsCells = false; m_Parser.SetFS(&m_FS); SetStandardFonts(DEFAULT_PRINT_FONT_SIZE); @@ -277,7 +277,7 @@ wxHtmlPrintout::CheckFit(const wxSize& pageArea, const wxSize& docArea) const wxMessageDialog dlg ( - NULL, + nullptr, wxString::Format ( _("The document \"%s\" doesn't fit on the page " @@ -438,7 +438,7 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile) else ff = fs.OpenFile(htmlfile); - if (ff == NULL) + if (ff == nullptr) { wxLogError(htmlfile + _(": file does not exist!")); return; @@ -624,7 +624,7 @@ wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxWindow *parentWin { m_ParentWindow = parentWindow; m_Name = name; - m_PrintData = NULL; + m_PrintData = nullptr; m_PageSetupData = new wxPageSetupDialogData; m_PageSetupData->EnableMargins(true); @@ -647,7 +647,7 @@ wxHtmlEasyPrinting::~wxHtmlEasyPrinting() wxPrintData *wxHtmlEasyPrinting::GetPrintData() { - if (m_PrintData == NULL) + if (m_PrintData == nullptr) m_PrintData = new wxPrintData(); return m_PrintData; } @@ -794,7 +794,7 @@ void wxHtmlEasyPrinting::SetFonts(const wxString& normal_face, const wxString& f for (int i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i]; } else - m_FontsSizes = NULL; + m_FontsSizes = nullptr; } void wxHtmlEasyPrinting::SetStandardFonts(int size, diff --git a/src/html/m_dflist.cpp b/src/html/m_dflist.cpp index b23e1b1cf9..037bb1bf18 100644 --- a/src/html/m_dflist.cpp +++ b/src/html/m_dflist.cpp @@ -35,7 +35,7 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD" ) if (tag.GetName() == wxT("DL")) { - if (m_WParser->GetContainer()->GetFirstChild() != NULL) + if (m_WParser->GetContainer()->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); @@ -44,7 +44,7 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD" ) ParseInner(tag); - if (m_WParser->GetContainer()->GetFirstChild() != NULL) + if (m_WParser->GetContainer()->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index c4f7f77a08..ee74a49433 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -213,7 +213,7 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next; return a->GetLink( x, y ); } - return NULL; + return nullptr; } @@ -367,17 +367,17 @@ wxHtmlImageCell::wxHtmlImageCell(wxHtmlWindowInterface *windowIface, m_windowIface = windowIface; m_scale = scale; m_showFrame = false; - m_bitmap = NULL; + m_bitmap = nullptr; m_bmpW = w; m_bmpH = h; m_align = align; m_bmpWpercent = wpercent; m_bmpHpresent = hpresent; - m_imageMap = NULL; + m_imageMap = nullptr; SetCanLiveOnPagebreak(false); #if wxUSE_GIF && wxUSE_TIMER - m_gifDecoder = NULL; - m_gifTimer = NULL; + m_gifDecoder = nullptr; + m_gifTimer = nullptr; m_physX = m_physY = wxDefaultCoord; m_nCurrFrame = 0; #endif @@ -433,7 +433,7 @@ wxHtmlImageCell::wxHtmlImageCell(wxHtmlWindowInterface *windowIface, } } } - else // input==NULL, use "broken image" bitmap + else // input==nullptr, use "broken image" bitmap { if ( m_bmpW == wxDefaultCoord && m_bmpH == wxDefaultCoord ) { @@ -545,7 +545,7 @@ void wxHtmlImageCell::Layout(int w) m_Width = w*m_bmpW/100; - if (!m_bmpHpresent && m_bitmap != NULL) + if (!m_bmpHpresent && m_bitmap != nullptr) m_Height = m_bitmap->GetLogicalHeight()*m_Width/m_bitmap->GetLogicalWidth(); else m_Height = static_cast(m_scale*m_bmpH); @@ -684,13 +684,13 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") bool wpercent = false; bool hpresent = false; int al; - wxFSFile *str = NULL; + wxFSFile *str = nullptr; wxString mn; double scaleHDPI = 1.0; #if defined(__WXOSX_COCOA__) // Try to find a 2x resolution image with @2x appended before the file extension. - wxWindow* win = m_WParser->GetWindowInterface() ? m_WParser->GetWindowInterface()->GetHTMLWindow() : NULL; + wxWindow* win = m_WParser->GetWindowInterface() ? m_WParser->GetWindowInterface()->GetHTMLWindow() : nullptr; if (!win) win = wxApp::GetMainTopWindow(); if (win && win->GetContentScaleFactor() > 1.0) @@ -778,7 +778,7 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") { wxString coords = tag.GetParam(wxT("COORDS")); tmp.MakeUpper(); - wxHtmlImageMapAreaCell *cel = NULL; + wxHtmlImageMapAreaCell *cel = nullptr; if (tmp == wxT("POLY")) { cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() ); @@ -792,9 +792,9 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() ); } wxString href; - if (cel != NULL && tag.GetParamAsString(wxT("HREF"), &href)) + if (cel != nullptr && tag.GetParamAsString(wxT("HREF"), &href)) cel->SetLink(wxHtmlLinkInfo(href, tag.GetParam(wxT("TARGET")))); - if (cel != NULL) + if (cel != nullptr) m_WParser->GetContainer()->InsertCell( cel ); } } diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index e66621cd26..fc00350d7d 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -95,7 +95,7 @@ TAG_HANDLER_BEGIN(P, "P") TAG_HANDLER_PROC(tag) { - if (m_WParser->GetContainer()->GetFirstChild() != NULL) + if (m_WParser->GetContainer()->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); @@ -138,7 +138,7 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER") wxHtmlContainerCell *c = m_WParser->GetContainer(); m_WParser->SetAlign(wxHTML_ALIGN_CENTER); - if (c->GetFirstChild() != NULL) + if (c->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); @@ -151,7 +151,7 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER") ParseInner(tag); m_WParser->SetAlign(old); - if (c->GetFirstChild() != NULL) + if (c->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); @@ -188,7 +188,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") { // As usual, reuse the current container if it's empty. wxHtmlContainerCell *c = m_WParser->GetContainer(); - if (c->GetFirstChild() != NULL) + if (c->GetFirstChild() != nullptr) { // If not, open a new one. m_WParser->CloseContainer(); @@ -223,7 +223,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") { int old = m_WParser->GetAlign(); wxHtmlContainerCell *c = m_WParser->GetContainer(); - if (c->GetFirstChild() != NULL) + if (c->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); @@ -240,7 +240,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") ParseInner(tag); m_WParser->SetAlign(old); - if (c->GetFirstChild() != NULL) + if (c->GetFirstChild() != nullptr) { m_WParser->CloseContainer(); m_WParser->OpenContainer(); diff --git a/src/html/m_list.cpp b/src/html/m_list.cpp index 7fecfc8722..cd3cd1c237 100644 --- a/src/html/m_list.cpp +++ b/src/html/m_list.cpp @@ -95,7 +95,7 @@ class wxHtmlListCell : public wxHtmlContainerCell wxHtmlListCell::wxHtmlListCell(wxHtmlContainerCell *parent) : wxHtmlContainerCell(parent) { m_NumRows = 0; - m_RowInfo = 0; + m_RowInfo = nullptr; m_ListmarkWidth = 0; } @@ -161,8 +161,8 @@ void wxHtmlListCell::AddRow(wxHtmlContainerCell *mark, wxHtmlContainerCell *cont void wxHtmlListCell::ReallocRows(int rows) { m_RowInfo = (wxHtmlListItemStruct*) realloc(m_RowInfo, sizeof(wxHtmlListItemStruct) * rows); - m_RowInfo[rows - 1].mark = NULL; - m_RowInfo[rows - 1].cont = NULL; + m_RowInfo[rows - 1].mark = nullptr; + m_RowInfo[rows - 1].cont = nullptr; m_RowInfo[rows - 1].minWidth = 0; m_RowInfo[rows - 1].maxWidth = 0; @@ -223,7 +223,7 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI") TAG_HANDLER_CONSTR(OLULLI) { - m_List = NULL; + m_List = nullptr; m_Numbering = 0; } diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index e7a1eafeec..752e885bae 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -125,9 +125,9 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t : wxHtmlContainerCell(parent) { m_PixelScale = pixel_scale; - m_ColsInfo = NULL; + m_ColsInfo = nullptr; m_NumCols = m_NumRows = m_NumAllocatedRows = 0; - m_CellInfo = NULL; + m_CellInfo = nullptr; m_ActualCol = m_ActualRow = -1; /* scan params: */ @@ -227,7 +227,7 @@ void wxHtmlTableCell::ReallocRows(int rows) for (int row = m_NumRows; row < rows ; ++row) { if (m_NumCols == 0) - m_CellInfo[row] = NULL; + m_CellInfo[row] = nullptr; else { m_CellInfo[row] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols); @@ -710,8 +710,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") TAG_HANDLER_CONSTR(TABLE) { - m_Table = NULL; - m_enclosingContainer = NULL; + m_Table = nullptr; + m_enclosingContainer = nullptr; m_tAlign.clear(); m_rAlign.clear(); } diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index a3f06e1d64..37276d2fce 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -36,21 +36,21 @@ wxList wxHtmlWinParser::m_Modules; wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindowInterface *wndIface) { - m_tmpStrBuf = NULL; + m_tmpStrBuf = nullptr; m_tmpStrBufSize = 0; m_windowInterface = wndIface; - m_Container = NULL; - m_DC = NULL; + m_Container = nullptr; + m_DC = nullptr; m_CharHeight = m_CharWidth = 0; m_UseLink = false; #if !wxUSE_UNICODE m_nbsp = 0; - m_EncConv = NULL; + m_EncConv = nullptr; m_InputEnc = wxFONTENCODING_ISO8859_1; m_OutputEnc = wxFONTENCODING_DEFAULT; #endif m_whitespaceMode = Whitespace_Normal; - m_lastWordCell = NULL; + m_lastWordCell = nullptr; m_posColumn = 0; { @@ -61,13 +61,13 @@ wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindowInterface *wndIface) for (l = 0; l < 2; l++) for (m = 0; m < 7; m++) { - m_FontsTable[i][j][k][l][m] = NULL; + m_FontsTable[i][j][k][l][m] = nullptr; #if !wxUSE_UNICODE m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT; #endif } - SetFonts(wxEmptyString, wxEmptyString, NULL); + SetFonts(wxEmptyString, wxEmptyString, nullptr); } // fill in wxHtmlParser's tables: @@ -90,7 +90,7 @@ wxHtmlWinParser::~wxHtmlWinParser() for (l = 0; l < 2; l++) for (m = 0; m < 7; m++) { - if (m_FontsTable[i][j][k][l][m] != NULL) + if (m_FontsTable[i][j][k][l][m] != nullptr) delete m_FontsTable[i][j][k][l][m]; } #if !wxUSE_UNICODE @@ -165,10 +165,10 @@ void wxHtmlWinParser::SetFonts(const wxString& normal_face, for (k = 0; k < 2; k++) for (l = 0; l < 2; l++) for (m = 0; m < 7; m++) { - if (m_FontsTable[i][j][k][l][m] != NULL) + if (m_FontsTable[i][j][k][l][m] != nullptr) { delete m_FontsTable[i][j][k][l][m]; - m_FontsTable[i][j][k][l][m] = NULL; + m_FontsTable[i][j][k][l][m] = nullptr; } } } @@ -193,7 +193,7 @@ void wxHtmlWinParser::SetStandardFonts(int size, void wxHtmlWinParser::InitParser(const wxString& source) { wxHtmlParser::InitParser(source); - wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!")); + wxASSERT_MSG(m_DC != nullptr, wxT("no DC assigned to wxHtmlWinParser!!")); m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE; m_FontSize = 3; //default one @@ -219,7 +219,7 @@ void wxHtmlWinParser::InitParser(const wxString& source) m_ScriptMode = wxHTML_SCRIPT_NORMAL; m_ScriptBaseline = 0; m_tmpLastWasSpace = false; - m_lastWordCell = NULL; + m_lastWordCell = nullptr; // open the toplevel container that contains everything else and that // is never closed (this makes parser's life easier): @@ -254,7 +254,7 @@ void wxHtmlWinParser::InitParser(const wxString& source) void wxHtmlWinParser::DoneParser() { - m_Container = NULL; + m_Container = nullptr; #if !wxUSE_UNICODE SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call #endif @@ -325,7 +325,7 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type, } if ( status == wxHTML_BLOCK ) - return NULL; + return nullptr; int flags = wxFS_READ; if (type == wxHTML_URL_IMAGE) @@ -594,7 +594,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont() wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]); #endif - if (*fontptr != NULL && (*faceptr != face + if (*fontptr != nullptr && (*faceptr != face #if !wxUSE_UNICODE || *encptr != m_OutputEnc #endif @@ -603,7 +603,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont() wxDELETE(*fontptr); } - if (*fontptr == NULL) + if (*fontptr == nullptr) { *faceptr = face; *fontptr = new wxFont( diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index d2bc403780..744482639f 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -564,7 +564,7 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size // The standard height is generally higher than this, but if not (e.g. when // using a larger font) increase the button height as well. int yText; - wxGetCharSize(GetHwndOf(btn), NULL, &yText, btn->GetFont()); + wxGetCharSize(GetHwndOf(btn), nullptr, &yText, btn->GetFont()); yText = wxGetEditHeightFromCharHeight(yText, btn); sizeBtn.IncTo(wxSize(-1, yText)); @@ -597,7 +597,7 @@ void wxAnyButton::SetLabel(const wxString& label) if ( m_markupText ) { delete m_markupText; - m_markupText = NULL; + m_markupText = nullptr; // Unfortunately we don't really know whether we can reset the button // to be non-owner-drawn or not: if we had made it owner-drawn just @@ -650,11 +650,11 @@ void wxAnyButton::AdjustForBitmapSize(wxSize &size) const // Initialize margins with the default values (at least under // Windows 7) in case GetThemeMargins() fails. MARGINS margins = {3, 3, 3, 3}; - ::GetThemeMargins(theme, NULL, + ::GetThemeMargins(theme, nullptr, BP_PUSHBUTTON, PBS_NORMAL, TMT_CONTENTMARGINS, - NULL, + nullptr, &margins); // XP doesn't draw themed buttons correctly when the client @@ -785,7 +785,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmapBundle& bitmapBundle, State which) if ( which == State_Normal ) { delete m_imageData; - m_imageData = NULL; + m_imageData = nullptr; } if ( !bitmapBundle.IsOk() ) @@ -807,7 +807,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmapBundle& bitmapBundle, State which) } #if wxUSE_UXTHEME - wxXPButtonImageData *oldData = NULL; + wxXPButtonImageData *oldData = nullptr; #endif // wxUSE_UXTHEME // Check if we already had bitmaps of different size. @@ -825,7 +825,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmapBundle& bitmapBundle, State which) oldData = wxDynamicCast(m_imageData, wxXPButtonImageData); if ( oldData ) { - m_imageData = NULL; + m_imageData = nullptr; } #endif // wxUSE_UXTHEME //else: wxODButtonImageData doesn't require anything special @@ -1068,7 +1068,7 @@ void DrawButtonText(HDC hdc, ::OffsetRect(&rc, 0, y0 + lineNum * hLine); - ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(lines[lineNum]), + ::DrawState(hdc, nullptr, nullptr, wxMSW_CONV_LPARAM(lines[lineNum]), lines[lineNum].length(), rc.left, rc.top, rc.right, rc.bottom, dsFlags); } @@ -1284,12 +1284,12 @@ void DrawXPBackground(wxAnyButton *button, HDC hdc, RECT& rectBtn, UINT state) ::DrawThemeParentBackground(GetHwndOf(button), hdc, &rectBtn); - wxWindowBeingErased = NULL; + wxWindowBeingErased = nullptr; } // draw background ::DrawThemeBackground(theme, hdc, BP_PUSHBUTTON, iState, - &rectBtn, NULL); + &rectBtn, nullptr); // calculate content area margins, using the defaults in case we fail to // retrieve the current theme margins @@ -1323,7 +1323,7 @@ void wxAnyButton::MakeOwnerDrawn() // We need to use owner-drawn specific data structure so we have // to create it and copy the data from native data structure, // if necessary. - if ( m_imageData && wxDynamicCast(m_imageData, wxODButtonImageData) == NULL ) + if ( m_imageData && wxDynamicCast(m_imageData, wxODButtonImageData) == nullptr ) { wxODButtonImageData* newData = new wxODButtonImageData(this, m_imageData->GetBitmapBundle(State_Normal)); for ( int n = 0; n < State_Max; n++ ) diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 26630d7052..0a420925d9 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -564,7 +564,7 @@ bool wxConsoleStderr::Write(const wxString& text) return false; } - if ( !::WriteConsole(m_hStderr, text.t_str(), text.length(), &ret, NULL) ) + if ( !::WriteConsole(m_hStderr, text.t_str(), text.length(), &ret, nullptr) ) { wxLogLastError(wxT("WriteConsole")); return false; @@ -606,7 +606,7 @@ bool wxGUIAppTraits::WriteToStderr(const wxString& WXUNUSED(text)) WXHWND wxGUIAppTraits::GetMainHWND() const { const wxWindow* const w = wxApp::GetMainTopWindow(); - return w ? w->GetHWND() : NULL; + return w ? w->GetHWND() : nullptr; } // =========================================================================== @@ -635,7 +635,7 @@ public: wxCallBaseCleanup(wxApp *app) : m_app(app) { } ~wxCallBaseCleanup() { if ( m_app ) m_app->wxAppBase::CleanUp(); } - void Dismiss() { m_app = NULL; } + void Dismiss() { m_app = nullptr; } private: wxApp *m_app; @@ -683,7 +683,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, wndclass.lpfnWndProc = (WNDPROC)wxWndProc; wndclass.hInstance = wxGetInstance(); - wndclass.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wndclass.hCursor = ::LoadCursor(nullptr, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1); wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles; @@ -696,7 +696,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, { wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), regClass.regname)); - return NULL; + return nullptr; } } @@ -707,7 +707,7 @@ const wxChar *wxApp::GetRegisteredClassName(const wxChar *name, wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"), regClass.regname)); ::UnregisterClass(regClass.regname.c_str(), wxGetInstance()); - return NULL; + return nullptr; } gs_regClassesInfo.push_back(regClass); @@ -988,7 +988,7 @@ bool wxApp::OnExceptionInMainLoop() switch ( ::MessageBox ( - NULL, + nullptr, wxT("An unhandled exception occurred. Press \"Abort\" to \ terminate the program,\r\n\ \"Retry\" to exit the program normally and \"Ignore\" to try to continue."), diff --git a/src/msw/appprogress.cpp b/src/msw/appprogress.cpp index 99a65b6a98..1c83b5571d 100644 --- a/src/msw/appprogress.cpp +++ b/src/msw/appprogress.cpp @@ -25,7 +25,7 @@ wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue) : m_maxValue(maxValue) { - if ( parent == NULL ) + if ( parent == nullptr ) { for ( wxWindowList::const_iterator it = wxTopLevelWindows.begin(); it != wxTopLevelWindows.end(); diff --git a/src/msw/artmsw.cpp b/src/msw/artmsw.cpp index 4ff76f5429..5ba4916075 100644 --- a/src/msw/artmsw.cpp +++ b/src/msw/artmsw.cpp @@ -49,7 +49,7 @@ MSW_SHDefExtractIcon(LPCTSTR pszIconFile, int iIndex, UINT uFlags, typedef HRESULT (WINAPI *SHDefExtractIcon_t)(LPCTSTR, int, UINT, HICON*, HICON*, UINT); - static SHDefExtractIcon_t s_SHDefExtractIcon = NULL; + static SHDefExtractIcon_t s_SHDefExtractIcon = nullptr; if ( !s_SHDefExtractIcon ) { wxDynamicLibrary shell32(wxT("shell32.dll")); @@ -124,8 +124,8 @@ MSW_SHGetStockIconInfo(SHSTOCKICONID siid, wxBitmap MSWGetBitmapFromIconLocation(const TCHAR* path, int index, const wxSize& size) { - HICON hIcon = NULL; - if ( MSW_SHDefExtractIcon(path, index, 0, &hIcon, NULL, size.x) != S_OK ) + HICON hIcon = nullptr; + if ( MSW_SHDefExtractIcon(path, index, 0, &hIcon, nullptr, size.x) != S_OK ) return wxNullBitmap; // Note that using "size.x" twice here is not a typo: normally size.y is @@ -263,7 +263,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, { // handle message box icons specially (wxIcon ctor treat these names // as special cases via wxICOResourceHandler::LoadIcon): - const char *name = NULL; + const char *name = nullptr; if ( id == wxART_ERROR ) name = "wxICON_ERROR"; else if ( id == wxART_INFORMATION ) diff --git a/src/msw/basemsw.cpp b/src/msw/basemsw.cpp index 7623bab46a..25a253b7ae 100644 --- a/src/msw/basemsw.cpp +++ b/src/msw/basemsw.cpp @@ -52,7 +52,7 @@ bool wxAppTraits::SafeMessageBox(const wxString& text, // anything and it has a useful side effect of disabling any existing TLWs // if there are any. // - // Note that we also might have chosen to always use MB_TASKMODAL and NULL + // Note that we also might have chosen to always use MB_TASKMODAL and null // parent. This would have the advantage of always disabling all the window // which, but at the cost of the behaviour mentioned above and other // related problems, e.g. showing ugly default icon in Alt-Tab list and an @@ -82,7 +82,7 @@ WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) void *wxConsoleAppTraits::BeforeChildWaitLoop() { // nothing to do here - return NULL; + return nullptr; } void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) @@ -118,7 +118,7 @@ wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop() #if wxUSE_CONSOLE_EVENTLOOP return new wxEventLoop(); #else // !wxUSE_CONSOLE_EVENTLOOP - return NULL; + return nullptr; #endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP } diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 9a5c7a7d8b..2809c02c79 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -137,7 +137,7 @@ private: // 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); + void InitFromDIB(const wxDIB& dib, HBITMAP hbitmap = nullptr); #endif // wxUSE_WXDIB // optional mask for transparent drawing @@ -203,13 +203,13 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject); void wxBitmapRefData::Init() { #if wxDEBUG_LEVEL - m_selectedInto = NULL; + m_selectedInto = nullptr; #endif - m_bitmapMask = NULL; + m_bitmapMask = nullptr; - m_hBitmap = (WXHBITMAP) NULL; + m_hBitmap = nullptr; #if wxUSE_WXDIB - m_dib = NULL; + m_dib = nullptr; #endif m_isDIB = @@ -343,9 +343,9 @@ void wxBitmapRefData::CopyFromDIB(const wxDIB& dib, int depth /* = -1 */) HBITMAP hbitmap; #ifdef SOMETIMES_USE_DIB // MemoryHDC defaults to monochrome - hbitmap = dib.CreateDDB(depth == 1 ? HDC(MemoryHDC()) : NULL); + hbitmap = dib.CreateDDB(depth == 1 ? HDC(MemoryHDC()) : nullptr); #else // ALWAYS_USE_DIB - hbitmap = NULL; + hbitmap = nullptr; #endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB InitFromDIB(dib, hbitmap); @@ -423,7 +423,7 @@ static void PremultiplyPixels(unsigned char* begin, unsigned char* end) // 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) +static bool CheckAlpha(HBITMAP hbmp, HBITMAP* hdib = nullptr) { BITMAP bm; if ( !::GetObject(hbmp, sizeof(bm), &bm) || (bm.bmBitsPixel != 32) ) @@ -458,13 +458,13 @@ static bool CheckAlpha(HBITMAP hbmp, HBITMAP* hdib = NULL) } // Return HDIB containing premultiplied bitmap data if the original bitmap is -// not premultiplied, otherwise return NULL. +// not premultiplied, otherwise return nullptr. // // 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 +// original bitmap uses premultiplied alpha or not and can return nullptr 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. @@ -475,11 +475,11 @@ static HBITMAP CreatePremultipliedDIBIfNeeded(HBITMAP hbmp) BITMAP bm; if ( !::GetObject(hbmp, sizeof(bm), &bm) || (bm.bmBitsPixel != 32) ) - return NULL; + return nullptr; wxDIB dib(hbmp); if ( !dib.IsOk() ) - return NULL; + return nullptr; unsigned char* pixels = dib.GetData(); unsigned char* const end = pixels + 4*dib.GetWidth()*dib.GetHeight(); @@ -496,7 +496,7 @@ static HBITMAP CreatePremultipliedDIBIfNeeded(HBITMAP hbmp) } } - return NULL; + return nullptr; } #endif // wxUSE_WXDIB @@ -536,7 +536,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, // 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); + HBITMAP hbmp = ::CreateBitmap(w, h, 1, wxDisplayDepth(), nullptr); if ( !hbmp ) { wxLogLastError(wxT("wxBitmap::CopyFromIconOrCursor - CreateBitmap")); @@ -814,7 +814,7 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) #ifndef ALWAYS_USE_DIB if ( d > 0 ) { - hbmp = ::CreateBitmap(w, h, 1, d, NULL); + hbmp = ::CreateBitmap(w, h, 1, d, nullptr); if ( !hbmp ) { wxLogLastError(wxT("CreateBitmap")); @@ -1204,21 +1204,21 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const wxPalette* wxBitmap::GetPalette() const { return GetBitmapData() ? &GetBitmapData()->m_bitmapPalette - : NULL; + : nullptr; } #endif wxMask *wxBitmap::GetMask() const { - return GetBitmapData() ? GetBitmapData()->GetMask() : NULL; + return GetBitmapData() ? GetBitmapData()->GetMask() : nullptr; } wxDC *wxBitmap::GetSelectedInto() const { #if wxDEBUG_LEVEL - return GetBitmapData() ? GetBitmapData()->m_selectedInto : NULL; + return GetBitmapData() ? GetBitmapData()->m_selectedInto : nullptr; #else - return NULL; + return nullptr; #endif } @@ -1290,7 +1290,7 @@ void wxBitmap::MSWBlendMaskWithAlpha() bmpRowStart.OffsetY(bmpData, 1); } } - GetBitmapData()->SetMask((wxMask*)NULL); + GetBitmapData()->SetMask((wxMask*)nullptr); wxASSERT(HasAlpha()); wxASSERT(!GetMask()); #endif // wxHAS_RAW_BITMAP @@ -1331,7 +1331,7 @@ void wxBitmap::SetMask(wxMask *mask) bool wxBitmap::InitFromHBITMAP(WXHBITMAP bmp, int width, int height, int depth) { #if wxDEBUG_LEVEL >= 2 - if ( bmp != NULL ) + if ( bmp != nullptr ) { BITMAP bm; if ( ::GetObject(bmp, sizeof(bm), &bm) == sizeof(bm) ) @@ -1369,13 +1369,13 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) if ( !IsOk() ) { // no bitmap, no data (raw or otherwise) - return NULL; + return nullptr; } if ( bpp == 1 && GetDepth() != 1 ) { wxFAIL_MSG( wxT("use wxQuantize if you want to convert color wxBitmap to mono") ); - return NULL; + return nullptr; } // if we're already a DIB we can access our data directly, but if not we @@ -1384,7 +1384,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) HBITMAP hDIB; if ( !GetBitmapData()->m_isDIB ) { - wxCHECK_MSG( !GetBitmapData()->m_dib, NULL, + wxCHECK_MSG( !GetBitmapData()->m_dib, nullptr, wxT("GetRawData() may be called only once") ); wxDIB *dib = new wxDIB(*this, bpp); @@ -1392,7 +1392,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { delete dib; - return NULL; + return nullptr; } // we'll free it in UngetRawData() @@ -1410,7 +1410,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { wxFAIL_MSG( wxT("failed to get DIBSECTION from a DIB?") ); - return NULL; + return nullptr; } // check that the bitmap is in correct format @@ -1418,7 +1418,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { wxFAIL_MSG( wxT("incorrect bitmap type in wxBitmap::GetRawData()") ); - return NULL; + return nullptr; } // ok, store the relevant info in wxPixelDataBase @@ -1443,7 +1443,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) return bits; #else - return NULL; + return nullptr; #endif } @@ -1458,7 +1458,7 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) if ( !GetBitmapData()->m_isDIB ) { wxDIB *dib = GetBitmapData()->m_dib; - GetBitmapData()->m_dib = NULL; + GetBitmapData()->m_dib = nullptr; GetBitmapData()->Free(); int depth = GetDepth() == 1 && dib->GetDepth() != GetDepth() ? 1 : -1; @@ -1624,8 +1624,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) COLORREF maskColour = wxColourToPalRGB(colour); m_maskBitmap = (WXHBITMAP)::CreateBitmap(width, height, 1, 1, 0); - HDC srcDC = ::CreateCompatibleDC(NULL); - HDC destDC = ::CreateCompatibleDC(NULL); + HDC srcDC = ::CreateCompatibleDC(nullptr); + HDC destDC = ::CreateCompatibleDC(nullptr); if ( !srcDC || !destDC ) { wxLogLastError(wxT("CreateCompatibleDC")); @@ -1731,10 +1731,10 @@ wxBitmap wxMask::GetBitmap() const } // Copy the bitmap. - HDC hdcSrc = ::CreateCompatibleDC((HDC)NULL); + HDC hdcSrc = ::CreateCompatibleDC(nullptr); HBITMAP hSrcOldBmp = (HBITMAP)::SelectObject(hdcSrc, m_maskBitmap); - HDC hdcMem = ::CreateCompatibleDC((HDC)NULL); + HDC hdcMem = ::CreateCompatibleDC(nullptr); HBITMAP hMemOldBmp = (HBITMAP)::SelectObject(hdcMem, hNewBitmap); ::BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY); @@ -1863,7 +1863,7 @@ HICON wxBitmapToIconOrCursor(const wxBitmap& bmp, // Create an empty mask bitmap. // it doesn't seem to work if we mess with the mask at all. AutoHBITMAP - hMonoBitmap(CreateBitmap(curBmp.GetWidth(),curBmp.GetHeight(),1,1,NULL)); + hMonoBitmap(CreateBitmap(curBmp.GetWidth(),curBmp.GetHeight(),1,1,nullptr)); ICONINFO iconInfo; wxZeroMemory(iconInfo); @@ -1951,8 +1951,8 @@ HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) h = bm.bmHeight; } - HDC hdcSrc = ::CreateCompatibleDC(NULL); - HDC hdcDst = ::CreateCompatibleDC(NULL); + HDC hdcSrc = ::CreateCompatibleDC(nullptr); + HDC hdcDst = ::CreateCompatibleDC(nullptr); if ( !hdcSrc || !hdcDst ) { wxLogLastError(wxT("CreateCompatibleDC")); diff --git a/src/msw/bmpbndl.cpp b/src/msw/bmpbndl.cpp index 5466fd1780..0fdef35ec0 100644 --- a/src/msw/bmpbndl.cpp +++ b/src/msw/bmpbndl.cpp @@ -302,7 +302,7 @@ wxBitmapBundle wxBitmapBundle::FromResources(const wxString& name) // First of all, find all resources starting with this name. RCEnumCallbackData data(name); - if ( !::EnumResourceNames(NULL, // this HMODULE + if ( !::EnumResourceNames(nullptr, // this HMODULE RT_RCDATA, EnumRCBitmaps, reinterpret_cast(&data)) ) @@ -341,7 +341,7 @@ wxBitmapBundle wxBitmapBundle::FromSVGResource(const wxString& name, const wxSiz // used for the embedded images. We could allow specifying the type as part // of the name in the future (e.g. "type:name" or something like this) if // really needed. - wxCharBuffer svgData = wxCharBuffer::CreateOwned(wxLoadUserResource(name, RT_RCDATA, NULL, wxGetInstance())); + wxCharBuffer svgData = wxCharBuffer::CreateOwned(wxLoadUserResource(name, RT_RCDATA, nullptr, wxGetInstance())); if ( !svgData.data() ) { diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp index 85c23c1ba6..d6d0ee96ae 100644 --- a/src/msw/bmpcbox.cpp +++ b/src/msw/bmpcbox.cpp @@ -235,7 +235,7 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items, if ( clientData ) index = wxComboBox::DoInsertItems(items[i], pos+i, clientData+i, type); else - index = wxComboBox::DoInsertItems(items[i], pos+i, NULL, wxClientData_None); + index = wxComboBox::DoInsertItems(items[i], pos+i, nullptr, wxClientData_None); wxASSERT_MSG( index != wxNOT_FOUND, wxS("Invalid wxBitmapComboBox state") ); if ( index == wxNOT_FOUND ) diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index 1af03eacfa..6835a186af 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -86,14 +86,14 @@ wxBrushRefData::wxBrushRefData(const wxColour& colour, wxBrushStyle style) { m_style = style; - m_hBrush = NULL; + m_hBrush = nullptr; } wxBrushRefData::wxBrushRefData(const wxBitmap& stipple) { DoSetStipple(stipple); - m_hBrush = NULL; + m_hBrush = nullptr; } wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) @@ -104,7 +104,7 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) m_style = data.m_style; // we can't share HBRUSH, we'd need to create another one ourselves - m_hBrush = NULL; + m_hBrush = nullptr; } wxBrushRefData::~wxBrushRefData() @@ -141,7 +141,7 @@ void wxBrushRefData::Free() { ::DeleteObject(m_hBrush); - m_hBrush = NULL; + m_hBrush = nullptr; } } @@ -277,7 +277,7 @@ wxBrushStyle wxBrush::GetStyle() const wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") ); return M_BRUSHDATA->GetStipple(); } diff --git a/src/msw/button.cpp b/src/msw/button.cpp index b8bb295d6e..759f27ab6a 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -232,7 +232,7 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* win) one. We handle this by maintaining a permanent and a temporary default items in - wxControlContainer (both may be NULL). When a button becomes the current + wxControlContainer (both may be null). When a button becomes the current control (i.e. gets focus) it sets itself as the temporary default which ensures that it has the right appearance and that Enter will be redirected to it. When the button loses focus, it unsets the temporary default and so @@ -254,7 +254,7 @@ wxWindow *wxButton::SetDefault() } // return the top level parent window if it's not being deleted yet, otherwise -// return NULL +// return nullptr static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) { for ( ;; ) @@ -265,7 +265,7 @@ static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) if ( !parent || win->IsTopLevel() ) { if ( win->IsBeingDeleted() ) - return NULL; + return nullptr; break; } @@ -309,7 +309,7 @@ void wxButton::UnsetTmpDefault() if ( !tlw ) return; - tlw->SetTmpDefaultItem(NULL); + tlw->SetTmpDefaultItem(nullptr); wxWindow *winOldDefault = tlw->GetDefaultItem(); @@ -325,7 +325,7 @@ void wxButton::UnsetTmpDefault() void wxButton::SetDefaultStyle(wxButton *btn, bool on) { - // we may be called with NULL pointer -- simpler to do the check here than + // we may be called with null pointer -- simpler to do the check here than // in the caller which does wxDynamicCast() if ( !btn ) return; diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index d98ab2c3c7..b610012bcf 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -92,7 +92,7 @@ wxCalendarCtrl::Create(wxWindow *parent, { // get a copy of standard class and modify it WNDCLASS wc; - if ( ::GetClassInfo(NULL, MONTHCAL_CLASS, &wc) ) + if ( ::GetClassInfo(nullptr, MONTHCAL_CLASS, &wc) ) { wc.lpszClassName = wxT("_wx_SysMonthCtl32"); wc.style |= CS_DBLCLKS; @@ -394,7 +394,7 @@ void wxCalendarCtrl::UpdateMarks() // possibility that we can display several of them: one before the current // one and up to 12 after it. MONTHDAYSTATE states[14] = { 0 }; - const DWORD nMonths = MonthCal_GetMonthRange(GetHwnd(), GMR_DAYSTATE, NULL); + const DWORD nMonths = MonthCal_GetMonthRange(GetHwnd(), GMR_DAYSTATE, nullptr); // although in principle the calendar might not show any days from the // preceding months, it seems like it always does, consider e.g. Feb 2010 diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index da32d9870c..09d7ae3989 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -418,7 +418,7 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event) // scroll one item down if the item is the last one // and isn't visible at all int h; - GetClientSize(NULL, &h); + GetClientSize(nullptr, &h); if ( rect.GetBottom() > h ) ScrollLines(1); } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 72616faa81..5ceed564d4 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -343,8 +343,8 @@ void wxChoice::SetString(unsigned int n, const wxString& s) // string in place // we need to preserve the client data manually - void *oldData = NULL; - wxClientData *oldObjData = NULL; + void *oldData = nullptr; + wxClientData *oldObjData = nullptr; if ( HasClientUntypedData() ) oldData = GetClientData(n); else if ( HasClientObjectData() ) @@ -426,7 +426,7 @@ void* wxChoice::DoGetItemClientData(unsigned int n) const wxLogLastError(wxT("CB_GETITEMDATA")); // unfortunately, there is no way to return an error code to the user - rc = (LPARAM) NULL; + rc = 0; } return (void *)rc; diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index f349449fbd..5a1a5d5452 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -186,8 +186,8 @@ bool wxSetClipboardData(wxDataFormat dataFormat, { wxBitmap *bitmap = (wxBitmap *)data; - HDC hdcMem = CreateCompatibleDC((HDC) NULL); - HDC hdcSrc = CreateCompatibleDC((HDC) NULL); + HDC hdcMem = CreateCompatibleDC(nullptr); + HDC hdcSrc = CreateCompatibleDC(nullptr); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, (HBITMAP)bitmap->GetHBITMAP()); HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc, @@ -296,7 +296,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, mf->xExt = width; mf->yExt = height; mf->hMF = (HMETAFILE) wxMF->GetHMETAFILE(); - wxMF->SetHMETAFILE((WXHANDLE) NULL); + wxMF->SetHMETAFILE(nullptr); } // unlock data handle = SetClipboardData(CF_METAFILEPICT, data); @@ -474,7 +474,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject); wxClipboard::wxClipboard() { - m_lastDataObject = NULL; + m_lastDataObject = nullptr; m_isOpened = false; } @@ -498,13 +498,13 @@ void wxClipboard::Clear() HRESULT hr = OleIsCurrentClipboard(m_lastDataObject); if (S_OK == hr) { - hr = OleSetClipboard(NULL); + hr = OleSetClipboard(nullptr); if ( FAILED(hr) ) { - wxLogApiError(wxT("OleSetClipboard(NULL)"), hr); + wxLogApiError(wxT("OleSetClipboard(nullptr)"), hr); } } - m_lastDataObject = NULL; + m_lastDataObject = nullptr; } #endif // wxUSE_OLE_CLIPBOARD } @@ -516,7 +516,7 @@ bool wxClipboard::Flush() { // don't touch data set by other applications HRESULT hr = OleIsCurrentClipboard(m_lastDataObject); - m_lastDataObject = NULL; + m_lastDataObject = nullptr; if (S_OK == hr) { hr = OleFlushClipboard(); @@ -614,9 +614,9 @@ bool wxClipboard::AddData( wxDataObject *data ) return false; } - // we have to call either OleSetClipboard(NULL) or OleFlushClipboard() when + // we have to call either OleSetClipboard(nullptr) or OleFlushClipboard() when // using OLE clipboard when the app terminates - by default, we call - // OleSetClipboard(NULL) which won't waste RAM, but the app can call + // OleSetClipboard(nullptr) which won't waste RAM, but the app can call // wxClipboard::Flush() to change this m_lastDataObject = data->GetInterface(); @@ -724,7 +724,7 @@ bool wxClipboard::GetData( wxDataObject& data ) return false; #if wxUSE_OLE_CLIPBOARD - IDataObject *pDataObject = NULL; + IDataObject *pDataObject = nullptr; HRESULT hr = OleGetClipboard(&pDataObject); if ( FAILED(hr) || !pDataObject ) { @@ -760,7 +760,7 @@ bool wxClipboard::GetData( wxDataObject& data ) // converted) formats. #if wxDEBUG_LEVEL >= 2 // get the format enumerator - IEnumFORMATETC *pEnumFormatEtc = NULL; + IEnumFORMATETC *pEnumFormatEtc = nullptr; hr = pDataObject->EnumFormatEtc(DATADIR_GET, &pEnumFormatEtc); if ( FAILED(hr) || !pEnumFormatEtc ) { @@ -810,7 +810,7 @@ bool wxClipboard::GetData( wxDataObject& data ) continue; formatEtc.cfFormat = cf; - formatEtc.ptd = NULL; + formatEtc.ptd = nullptr; formatEtc.dwAspect = DVASPECT_CONTENT; formatEtc.lindex = -1; diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index 81353412f9..2259922f8c 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -52,7 +52,7 @@ static wxRect gs_rectDialog(0, 0, 222, 324); // The dialog currently being shown or null. -static wxColourDialog* gs_activeDialog = NULL; +static wxColourDialog* gs_activeDialog = nullptr; // ---------------------------------------------------------------------------- // wxWin macros @@ -178,7 +178,7 @@ int wxColourDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); - WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + WXHWND hWndParent = parent ? GetHwndOf(parent) : nullptr; wxWindowDisabler disableOthers(this, parent); diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index b8f4e46b11..720e2758f9 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -422,7 +422,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) // // Draw parent's background, if necessary - RECT* rUseForTb = NULL; + RECT* rUseForTb = nullptr; if ( ::IsThemeBackgroundPartiallyTransparent( hTheme, comboBoxPart, bgState ) ) rUseForTb = &rFull; @@ -436,7 +436,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) // Draw the control background (including the border) if ( m_widthCustomBorder > 0 ) { - ::DrawThemeBackground( hTheme, hDc, comboBoxPart, bgState, rUseForBg, NULL ); + ::DrawThemeBackground( hTheme, hDc, comboBoxPart, bgState, rUseForBg, nullptr ); } else { @@ -472,7 +472,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) butPart = CP_DROPDOWNBUTTONLEFT; } - ::DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, NULL ); + ::DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, nullptr ); } else if ( useVistaComboBox && (m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE) ) @@ -569,7 +569,7 @@ static wxUint32 GetUserPreferencesMask() if ( valueSet ) return userPreferencesMask; - wxRegKey* pKey = NULL; + wxRegKey* pKey = nullptr; wxRegKey key1(wxRegKey::HKCU, wxT("Software\\Policies\\Microsoft\\Control Panel")); wxRegKey key2(wxRegKey::HKCU, wxT("Software\\Policies\\Microsoft\\Windows\\Control Panel")); wxRegKey key3(wxRegKey::HKCU, wxT("Control Panel\\Desktop")); diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 91db31427b..dbbdbb488d 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -81,7 +81,7 @@ wxComboEditWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // --------------------------------------------------------------------------- // the pointer to standard radio button wnd proc -static WNDPROC gs_wndprocEdit = (WNDPROC)NULL; +static WNDPROC gs_wndprocEdit = nullptr; // ============================================================================ // implementation @@ -412,7 +412,7 @@ WXHWND wxComboBox::GetEditHWNDIfAvailable() const } // we assume that the only child of the combobox is the edit window - return (WXHWND)::FindWindowEx(GetHwnd(), NULL, wxT("EDIT"), NULL); + return (WXHWND)::FindWindowEx(GetHwnd(), nullptr, wxT("EDIT"), nullptr); } WXHWND wxComboBox::GetEditHWND() const @@ -806,7 +806,7 @@ wxWindow *wxComboBox::MSWFindItem(long id, WXHWND hWnd) const if ( id == GetId() && hWnd && hWnd != GetHWND() ) { // Must be the case described above. - return NULL; + return nullptr; } return wxChoice::MSWFindItem(id, hWnd); diff --git a/src/msw/control.cpp b/src/msw/control.cpp index e111d272ca..519e5b031f 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -182,7 +182,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname, // else) to fix themed borders when they're used (if they're not, this // is harmless, and it's simpler and more fool proof to always do it // rather than try to determine whether we need to do it or not). - ::SetWindowPos(GetHwnd(), NULL, 0, 0, 0, 0, + ::SetWindowPos(GetHwnd(), nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | diff --git a/src/msw/crashrpt.cpp b/src/msw/crashrpt.cpp index 02b23db2d3..4be516045c 100644 --- a/src/msw/crashrpt.cpp +++ b/src/msw/crashrpt.cpp @@ -41,7 +41,7 @@ class BusyCursor public: BusyCursor() { - HCURSOR hcursorBusy = ::LoadCursor(NULL, IDC_WAIT); + HCURSOR hcursorBusy = ::LoadCursor(nullptr, IDC_WAIT); m_hcursorOld = ::SetCursor(hcursorBusy); } @@ -113,10 +113,10 @@ wxCrashReportImpl::wxCrashReportImpl(const wxChar *filename) filename, GENERIC_WRITE, 0, // no sharing - NULL, // default security + nullptr, // default security CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, - NULL // no template file + nullptr // no template file ); } @@ -210,8 +210,8 @@ bool wxCrashReportImpl::Generate(int flags, EXCEPTION_POINTERS *ep) m_hFile, // file to write to dumpFlags, // kind of dump to craete &minidumpExcInfo, - NULL, // no extra user-defined data - NULL // no callbacks + nullptr, // no extra user-defined data + nullptr // no callbacks ) ) { Output(wxT("MiniDumpWriteDump() failed.")); @@ -269,7 +269,7 @@ bool wxCrashReport::GenerateNow(int flags) __try { - RaiseException(0x1976, 0, 0, NULL); + RaiseException(0x1976, 0, 0, nullptr); } __except( rc = Generate(flags, (EXCEPTION_POINTERS *)GetExceptionInformation()), EXCEPTION_CONTINUE_EXECUTION ) diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index bd2ab60110..30397729b8 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -76,7 +76,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject); // Current cursor, in order to hang on to cursor handle when setting the cursor // globally -static wxCursor *gs_globalCursor = NULL; +static wxCursor *gs_globalCursor = nullptr; // ---------------------------------------------------------------------------- // private classes @@ -248,7 +248,7 @@ wxCursor::wxCursor(const wxString& filename, default: wxLogError( wxT("unknown cursor resource type '%d'"), kind ); - hcursor = NULL; + hcursor = nullptr; } if ( hcursor ) @@ -292,7 +292,7 @@ HCURSOR CreateReverseCursor(HCURSOR cursor) { AutoIconInfo info; if ( !info.GetFrom(cursor) ) - return NULL; + return nullptr; const unsigned displayID = (unsigned)wxDisplay::GetFromPoint(wxGetMousePosition()); wxDisplay disp(displayID == 0u || displayID < wxDisplay::GetCount() ? displayID : 0u); @@ -322,7 +322,7 @@ void wxCursor::InitFromStock(wxStockCursor idCursor) LPCTSTR name; } stdCursors[] = { - { true, NULL }, // wxCURSOR_NONE + { true, nullptr }, // wxCURSOR_NONE { true, IDC_ARROW }, // wxCURSOR_ARROW { false, wxT("WXCURSOR_RIGHT_ARROW") }, // wxCURSOR_RIGHT_ARROW { false, wxT("WXCURSOR_BULLSEYE") }, // wxCURSOR_BULLSEYE @@ -363,7 +363,7 @@ void wxCursor::InitFromStock(wxStockCursor idCursor) const StdCursor& stdCursor = stdCursors[idCursor]; bool deleteLater = !stdCursor.isStd; - HCURSOR hcursor = ::LoadCursor(stdCursor.isStd ? NULL : wxGetInstance(), + HCURSOR hcursor = ::LoadCursor(stdCursor.isStd ? nullptr : wxGetInstance(), stdCursor.name); // IDC_HAND may not be available on some versions of Windows. @@ -375,7 +375,7 @@ void wxCursor::InitFromStock(wxStockCursor idCursor) if ( !hcursor && idCursor == wxCURSOR_RIGHT_ARROW) { - hcursor = ::LoadCursor(NULL, IDC_ARROW); + hcursor = ::LoadCursor(nullptr, IDC_ARROW); if ( hcursor ) { hcursor = CreateReverseCursor(hcursor); diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index 43318e9336..6a4c0477c5 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -118,7 +118,7 @@ void wxDateTimePickerCtrl::MSWUpdateFormatIfNeeded(bool valid) void wxDateTimePickerCtrl::MSWUpdateFormat(bool valid) { - // We just use NULL to reset to the default format when the date is valid, + // We just use nullptr to reset to the default format when the date is valid, // as the control seems to remember whichever format was used when it was // created, i.e. this works both with and without wxDP_SHOWCENTURY. @@ -126,7 +126,7 @@ void wxDateTimePickerCtrl::MSWUpdateFormat(bool valid) // wxUSE_UNICODE_UTF8 case, where t_str() doesn't return a pointer. const TCHAR* format; if ( valid ) - format = NULL; + format = nullptr; else format = m_nullText.t_str(); @@ -200,7 +200,7 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const GetHwndOf(m_parent), 0, wxGetInstance(), - NULL + nullptr ); wxCHECK_MSG( hwnd, wxSize(), wxS("SysDateTimePick32 creation unexpected failed") ); diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 585ce0b988..62560f27fe 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -144,7 +144,7 @@ public: { } - // return the symbol with the given name or NULL if the DLL not loaded + // return the symbol with the given name or nullptr if the DLL not loaded // or symbol not present void *GetSymbol(const wxChar *name) { @@ -157,10 +157,10 @@ public: // reset the name whether we succeeded or failed so that we don't // try again the next time - m_dllName = NULL; + m_dllName = nullptr; } - return m_dll.IsLoaded() ? m_dll.GetSymbol(name) : NULL; + return m_dll.IsLoaded() ? m_dll.GetSymbol(name) : nullptr; } void Unload() @@ -189,19 +189,19 @@ static wxOnceOnlyDLLLoader wxGDI32DLL(wxT("gdi32.dll")); typedef BOOL (WINAPI *AlphaBlend_t)(HDC,int,int,int,int, HDC,int,int,int,int, BLENDFUNCTION); -static AlphaBlend_t gs_pfnAlphaBlend = NULL; +static AlphaBlend_t gs_pfnAlphaBlend = nullptr; static bool gs_triedToLoadAlphaBlend = false; typedef BOOL (WINAPI *GradientFill_t)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); -static GradientFill_t gs_pfnGradientFill = NULL; +static GradientFill_t gs_pfnGradientFill = nullptr; static bool gs_triedToLoadGradientFill = false; typedef DWORD (WINAPI *GetLayout_t)(HDC); -static GetLayout_t gs_pfnGetLayout = NULL; +static GetLayout_t gs_pfnGetLayout = nullptr; static bool gs_triedToLoadGetLayout = false; typedef DWORD (WINAPI *SetLayout_t)(HDC, DWORD); -static SetLayout_t gs_pfnSetLayout = NULL; +static SetLayout_t gs_pfnSetLayout = nullptr; static bool gs_triedToLoadSetLayout = false; #endif // USE_DYNAMIC_GDI_FUNCS @@ -218,16 +218,16 @@ public: wxMSIMG32DLL.Unload(); wxGDI32DLL.Unload(); #ifdef USE_DYNAMIC_GDI_FUNCS - gs_pfnGetLayout = NULL; + gs_pfnGetLayout = nullptr; gs_triedToLoadGetLayout = false; - gs_pfnSetLayout = NULL; + gs_pfnSetLayout = nullptr; gs_triedToLoadSetLayout = false; - gs_pfnAlphaBlend = NULL; + gs_pfnAlphaBlend = nullptr; gs_triedToLoadAlphaBlend = false; - gs_pfnGradientFill = NULL; + gs_pfnGradientFill = nullptr; gs_triedToLoadGradientFill = false; #endif // USE_DYNAMIC_GDI_FUNCS } @@ -547,7 +547,7 @@ wxMSWDCImpl::~wxMSWDCImpl() else { // Must have been a wxScreenDC - ::ReleaseDC((HWND) NULL, GetHdc()); + ::ReleaseDC(nullptr, GetHdc()); } } } @@ -565,7 +565,7 @@ void wxMSWDCImpl::SelectOldObjects(WXHDC dc) ::SelectObject((HDC) dc, (HBITMAP) m_oldBitmap); if (m_selectedBitmap.IsOk()) { - m_selectedBitmap.SetSelectedInto(NULL); + m_selectedBitmap.SetSelectedInto(nullptr); } } m_oldBitmap = 0; @@ -669,12 +669,12 @@ void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn, bool doRtlOffset) { wxCHECK_RET( hrgn, wxT("invalid clipping region") ); - HRGN hRgnRTL = NULL; + HRGN hRgnRTL = nullptr; // DC with enabled RTL layout needs a mirrored region // so we have to create such a region temporarily. if ( GetLayoutDirection() == wxLayout_RightToLeft ) { - DWORD bufLen = ::GetRegionData(hrgn, 0, NULL); // Get the storage size + DWORD bufLen = ::GetRegionData(hrgn, 0, nullptr); // Get the storage size wxScopedArray pDataBuf(bufLen); RGNDATA* const rgndata = reinterpret_cast(pDataBuf.get()); if ( ::GetRegionData(hrgn, bufLen, rgndata) != bufLen ) @@ -901,7 +901,7 @@ bool wxMSWDCImpl::DoFloodFill(wxCoord x, bool wxMSWDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const { - wxCHECK_MSG( col, false, wxT("NULL colour parameter in wxMSWDCImpl::GetPixel") ); + wxCHECK_MSG( col, false, wxT("null colour parameter in wxMSWDCImpl::GetPixel") ); // get the color of the pixel COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)); @@ -1270,7 +1270,7 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) // B2 = (2*P1 + P2)/3 // B3 = P2 - wxCHECK_RET( points, "NULL pointer to spline points?" ); + wxCHECK_RET( points, "null pointer to spline points?" ); const size_t n_points = points->size(); wxCHECK_RET( n_points >= 2 , "incomplete list of spline points?" ); @@ -1404,7 +1404,7 @@ void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) } else { - ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL); + ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, nullptr, DI_NORMAL); } CalcBoundingBox(wxPoint(x, y), icon.GetSize()); @@ -1442,7 +1442,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool } else { - curBmp.SetMask(NULL); + curBmp.SetMask(nullptr); } } @@ -1535,7 +1535,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool HDC memdc = wxMSWImpl::CreateCompatibleDCWithLayout( cdc ); HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( ); - wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") ); + wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is null?") ); wxTextColoursChanger textCol(GetHdc(), *this); @@ -1591,8 +1591,8 @@ void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) { - if ( ::ExtTextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), 0, NULL, - text.c_str(), text.length(), NULL) == 0 ) + if ( ::ExtTextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), 0, nullptr, + text.c_str(), text.length(), nullptr) == 0 ) { wxLogLastError(wxT("TextOut")); } @@ -1846,7 +1846,7 @@ void wxMSWDCImpl::SetBrush(const wxBrush& brush) GetHdc(), m_deviceOriginX % sizeBrushBitmap.x, m_deviceOriginY % sizeBrushBitmap.y, - NULL // [out] previous brush origin + nullptr // [out] previous brush origin ) ) { wxLogLastError(wxT("SetBrushOrgEx()")); @@ -2018,7 +2018,7 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y bool wxMSWDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const { - wxTextMeasure txm(GetOwner(), NULL); // don't change the font + wxTextMeasure txm(GetOwner(), nullptr); // don't change the font return txm.GetPartialTextExtents(text, widths, 1.0); } @@ -2074,10 +2074,10 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() devExtY /= gcd; logExtY /= gcd; - ::SetViewportExtEx(GetHdc(), devExtX, devExtY, NULL); - ::SetWindowExtEx(GetHdc(), logExtX, logExtY, NULL); + ::SetViewportExtEx(GetHdc(), devExtX, devExtY, nullptr); + ::SetWindowExtEx(GetHdc(), logExtX, logExtY, nullptr); - ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL); + ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, nullptr); m_isClipBoxValid = false; } @@ -2338,7 +2338,7 @@ wxAffineMatrix2D wxMSWDCImpl::GetTransformMatrix() const void wxMSWDCImpl::ResetTransformMatrix() { - ::ModifyWorldTransform(GetHdc(), NULL, MWT_IDENTITY); + ::ModifyWorldTransform(GetHdc(), nullptr, MWT_IDENTITY); ::SetGraphicsMode(GetHdc(), GM_COMPATIBLE); m_isClipBoxValid = false; } @@ -2367,7 +2367,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, wxRasterOperationMode rop, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask) { - wxCHECK_MSG( source, false, wxT("wxMSWDCImpl::Blit(): NULL wxDC pointer") ); + wxCHECK_MSG( source, false, wxT("wxMSWDCImpl::Blit(): null wxDC pointer") ); wxMSWDCImpl *implSrc = wxDynamicCast( source->GetImpl(), wxMSWDCImpl ); if ( !implSrc ) @@ -2406,7 +2406,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } } - wxMask *mask = NULL; + wxMask *mask = nullptr; if ( useMask ) { mask = bmpSrc.GetMask(); @@ -2457,7 +2457,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, if ( dwRop == BLACKNESS || dwRop == WHITENESS || dwRop == DSTINVERT || dwRop == DSTCOPY ) { - hdcSrc = NULL; + hdcSrc = nullptr; } bool success = false; @@ -2501,7 +2501,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, #if wxUSE_DC_CACHEING // create a temp buffer bitmap and DCs to access it and the mask - wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, hdcSrc); + wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(nullptr, hdcSrc); dc_mask = (HDC) dcCacheEntry1->m_dc; wxDCCacheEntry* dcCacheEntry2 = FindDCInCache(dcCacheEntry1, GetHDC()); diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 9ef4a5cd15..d31d7ef839 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -253,7 +253,7 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) : wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : wxClientDCImpl( owner ) { - wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") ); + wxCHECK_RET( window, wxT("null canvas in wxPaintDCImpl ctor") ); using namespace wxMSWImpl; wxCHECK_RET( !paintStack.empty(), @@ -275,7 +275,7 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : m_hDC = info->GetHDC(); } - // Note: at this point m_hDC can be NULL under MicroWindows, when dragging. + // Note: at this point m_hDC can be null under MicroWindows, when dragging. if (!GetHDC()) return; @@ -302,7 +302,7 @@ wxPaintDCInfo *wxPaintDCImpl::FindInCache(wxWindow *win) { PaintDCInfos::const_iterator it = gs_PaintDCInfos.find( win ); - return it != gs_PaintDCInfos.end() ? it->second : NULL; + return it != gs_PaintDCInfos.end() ? it->second : nullptr; } /* static */ diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index b648779c34..d87a1e5871 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -41,14 +41,14 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxMSWDCImpl); wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxMSWDCImpl( owner ) { - CreateCompatible(NULL); + CreateCompatible(nullptr); Init(); } wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ) : wxMSWDCImpl( owner ) { - CreateCompatible(NULL); + CreateCompatible(nullptr); Init(); DoSelect(bitmap); } @@ -56,7 +56,7 @@ wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ) wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ) : wxMSWDCImpl( owner ) { - wxCHECK_RET( dc, wxT("NULL dc in wxMemoryDC ctor") ); + wxCHECK_RET( dc, wxT("null dc in wxMemoryDC ctor") ); CreateCompatible(dc); @@ -79,7 +79,7 @@ void wxMemoryDCImpl::Init() bool wxMemoryDCImpl::CreateCompatible(wxDC *dc) { - wxDCImpl *impl = dc ? dc->GetImpl() : NULL ; + wxDCImpl *impl = dc ? dc->GetImpl() : nullptr ; wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl ); if ( dc && !msw_impl) { @@ -87,7 +87,7 @@ bool wxMemoryDCImpl::CreateCompatible(wxDC *dc) return false; } - m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*msw_impl) : NULL); + m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*msw_impl) : nullptr); // as we created the DC, we must delete it in the dtor m_bOwnsDC = true; @@ -105,7 +105,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) ::SelectObject(GetHdc(), (HBITMAP) m_oldBitmap); if ( m_selectedBitmap.IsOk() ) { - m_selectedBitmap.SetSelectedInto(NULL); + m_selectedBitmap.SetSelectedInto(nullptr); m_selectedBitmap = wxNullBitmap; } } @@ -113,7 +113,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) // check for whether the bitmap is already selected into a device context wxASSERT_MSG( !bitmap.GetSelectedInto() || (bitmap.GetSelectedInto() == GetOwner()), - wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") ); + wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(nullptr)") ); m_selectedBitmap = bitmap; WXHBITMAP hBmp = m_selectedBitmap.GetHBITMAP(); diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index b12aa4c73c..944f1df84f 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -89,16 +89,16 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, PRINTDLG pd; pd.lStructSize = sizeof( PRINTDLG ); - pd.hwndOwner = (HWND) NULL; - pd.hDevMode = (HANDLE)NULL; - pd.hDevNames = (HANDLE)NULL; + pd.hwndOwner = (HWND) nullptr; + pd.hDevMode = (HANDLE)nullptr; + pd.hDevNames = (HANDLE)nullptr; pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS; pd.nFromPage = 0; pd.nToPage = 0; pd.nMinPage = 0; pd.nMaxPage = 0; pd.nCopies = 1; - pd.hInstance = (HINSTANCE)NULL; + pd.hInstance = (HINSTANCE)nullptr; m_ok = PrintDlg( &pd ) != 0; if ( m_ok ) @@ -114,7 +114,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, m_hDC = (WXHDC) CreateDC(driver_name.t_str(), device_name.t_str(), file.fn_str(), - NULL); + nullptr); } else // we don't have all parameters, ask the user { @@ -183,11 +183,11 @@ bool wxPrinterDCImpl::StartDoc(const wxString& message) wxString filename(m_printData.GetFilename()); if (filename.empty()) - docinfo.lpszOutput = NULL; + docinfo.lpszOutput = nullptr; else docinfo.lpszOutput = filename.t_str(); - docinfo.lpszDatatype = NULL; + docinfo.lpszDatatype = nullptr; docinfo.fwType = 0; if (!m_hDC) @@ -263,9 +263,9 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) PRINTDLG pd; memset(&pd, 0, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); - pd.hwndOwner = (HWND)NULL; - pd.hDevMode = NULL; // Will be created by PrintDlg - pd.hDevNames = NULL; // Ditto + pd.hwndOwner = nullptr; + pd.hDevMode = nullptr; // Will be created by PrintDlg + pd.hDevNames = nullptr; // Ditto pd.Flags = PD_RETURNDEFAULT; pd.nCopies = 1; @@ -293,13 +293,13 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) } // unlock pd.hDevNames GlobalFree(pd.hDevNames); - pd.hDevNames=NULL; + pd.hDevNames=nullptr; } if (pd.hDevMode) { GlobalFree(pd.hDevMode); - pd.hDevMode=NULL; + pd.hDevMode=nullptr; } return ( !deviceName.empty() ); } @@ -338,9 +338,9 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) HDC hDC = ::CreateDC ( - NULL, // no driver name as we use device name + nullptr, // no driver name as we use device name deviceName.t_str(), - NULL, // unused + nullptr, // unused static_cast(lockDevMode.Get()) ); if ( !hDC ) @@ -437,7 +437,7 @@ bool wxPrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, return false; wxBitmap& bmp = msw_impl->GetSelectedBitmap(); - wxMask *mask = useMask ? bmp.GetMask() : NULL; + wxMask *mask = useMask ? bmp.GetMask() : nullptr; if ( mask ) { // If we are printing source colours are screen colours not printer diff --git a/src/msw/dcscreen.cpp b/src/msw/dcscreen.cpp index e04c8d3c7f..f5530545e6 100644 --- a/src/msw/dcscreen.cpp +++ b/src/msw/dcscreen.cpp @@ -27,7 +27,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxMSWDCImpl); wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) : wxMSWDCImpl( owner ) { - m_hDC = (WXHDC) ::GetDC((HWND) NULL); + m_hDC = (WXHDC) ::GetDC(nullptr); // the background mode is only used for text background and is set in // DrawText() to OPAQUE as required, otherwise always TRANSPARENT diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index 6521df5669..2942850681 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -92,7 +92,7 @@ static void DDELogError(const wxString& s, UINT error = DMLERR_NO_ERROR); WX_DECLARE_STRING_HASH_MAP( HSZ, wxAtomMap ); static DWORD DDEIdInst = 0L; -static wxDDEConnection *DDECurrentlyConnecting = NULL; +static wxDDEConnection *DDECurrentlyConnecting = nullptr; static wxAtomMap wxAtomTable; #include "wx/listimpl.cpp" @@ -182,7 +182,7 @@ void wxDDECleanUp() static wxDDEConnection *DDEFindConnection(HCONV hConv) { wxDDEServerList::compatibility_iterator serverNode = wxDDEServerObjects.GetFirst(); - wxDDEConnection *found = NULL; + wxDDEConnection *found = nullptr; while (serverNode && !found) { wxDDEServer *object = serverNode->GetData(); @@ -234,7 +234,7 @@ static void DDEDeleteConnection(HCONV hConv) static wxDDEServer *DDEFindServer(const wxString& s) { wxDDEServerList::compatibility_iterator node = wxDDEServerObjects.GetFirst(); - wxDDEServer *found = NULL; + wxDDEServer *found = nullptr; while (node && !found) { wxDDEServer *object = node->GetData(); @@ -275,8 +275,8 @@ bool wxDDEServer::Create(const wxString& server) } - bool success = (DdeNameService(DDEIdInst, hsz, (HSZ) NULL, DNS_REGISTER) - != NULL); + bool success = (DdeNameService(DDEIdInst, hsz, (HSZ) nullptr, DNS_REGISTER) + != nullptr); if (!success) { @@ -298,7 +298,7 @@ wxDDEServer::~wxDDEServer() if (hsz) { if ( !DdeNameService(DDEIdInst, hsz, - (HSZ) NULL, DNS_UNREGISTER) ) + (HSZ) nullptr, DNS_UNREGISTER) ) { DDELogError(wxString::Format( _("Failed to unregister DDE server '%s'"), @@ -339,7 +339,7 @@ wxConnectionBase *wxDDEServer::OnAcceptConnection(const wxString& /* topic */) wxDDEConnection *wxDDEServer::FindConnection(WXHCONV conv) { wxDDEConnectionList::compatibility_iterator node = m_connections.GetFirst(); - wxDDEConnection *found = NULL; + wxDDEConnection *found = nullptr; while (node && !found) { wxDDEConnection *connection = node->GetData(); @@ -406,7 +406,7 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& WXUNUSED(host), if ( !hszServer ) { - return NULL; + return nullptr; } @@ -415,12 +415,12 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& WXUNUSED(host), if ( !hszTopic ) { DDEFreeString(hszServer); - return NULL; + return nullptr; } HCONV hConv = ::DdeConnect(DDEIdInst, hszServer, hszTopic, - (PCONVCONTEXT) NULL); + (PCONVCONTEXT) nullptr); DDEFreeString(hszServer); DDEFreeString(hszTopic); @@ -445,7 +445,7 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& WXUNUSED(host), } } - return NULL; + return nullptr; } wxConnectionBase *wxDDEClient::OnMakeConnection() @@ -456,7 +456,7 @@ wxConnectionBase *wxDDEClient::OnMakeConnection() wxDDEConnection *wxDDEClient::FindConnection(WXHCONV conv) { wxDDEConnectionList::compatibility_iterator node = m_connections.GetFirst(); - wxDDEConnection *found = NULL; + wxDDEConnection *found = nullptr; while (node && !found) { wxDDEConnection *connection = node->GetData(); @@ -491,20 +491,20 @@ bool wxDDEClient::DeleteConnection(WXHCONV conv) wxDDEConnection::wxDDEConnection(void *buffer, size_t size) : wxConnectionBase(buffer, size) { - m_client = NULL; - m_server = NULL; + m_client = nullptr; + m_server = nullptr; m_hConv = 0; - m_sendingData = NULL; + m_sendingData = nullptr; } wxDDEConnection::wxDDEConnection() : wxConnectionBase() { m_hConv = 0; - m_sendingData = NULL; - m_server = NULL; - m_client = NULL; + m_sendingData = nullptr; + m_server = nullptr; + m_client = nullptr; } wxDDEConnection::~wxDDEConnection() @@ -545,9 +545,9 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) wxT("wxDDEServer::Execute() supports only text data") ); wxMemoryBuffer buffer; - LPBYTE realData = NULL; + LPBYTE realData = nullptr; size_t realSize = 0; - wxMBConv *conv = NULL; + wxMBConv *conv = nullptr; // Windows only supports either ANSI or UTF-16 format depending on the // build, so we need to convert the data if it doesn't use it already @@ -571,7 +571,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) const char * const text = (const char *)data; const size_t len = size; - realSize = conv->ToWChar(NULL, 0, text, len); + realSize = conv->ToWChar(nullptr, 0, text, len); if ( realSize == wxCONV_FAILED ) return false; @@ -612,7 +612,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) const wchar_t * const wtext = (const wchar_t *)data; const size_t len = size/sizeof(wchar_t); - realSize = conv->FromWChar(NULL, 0, wtext, len); + realSize = conv->FromWChar(nullptr, 0, wtext, len); if ( realSize == wxCONV_FAILED ) return false; @@ -630,7 +630,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) bool ok = DdeClientTransaction(realData, realSize, GetHConv(), - NULL, + nullptr, // MSDN: if the transaction specified by // the wType parameter does not pass data // or is XTYP_EXECUTE, wFmt should be zero. @@ -653,7 +653,7 @@ const void *wxDDEConnection::Request(const wxString& item, size_t *size, wxIPCFo HSZ atom = DDEGetAtom(item); - HDDEDATA returned_data = DdeClientTransaction(NULL, 0, + HDDEDATA returned_data = DdeClientTransaction(nullptr, 0, GetHConv(), atom, format, XTYP_REQUEST, @@ -663,13 +663,13 @@ const void *wxDDEConnection::Request(const wxString& item, size_t *size, wxIPCFo { DDELogError(wxT("DDE data request failed")); - return NULL; + return nullptr; } - DWORD len = DdeGetData(returned_data, NULL, 0, 0); + DWORD len = DdeGetData(returned_data, nullptr, 0, 0); void *data = GetBufferAtLeast(len); - wxASSERT_MSG(data != NULL, + wxASSERT_MSG(data != nullptr, wxT("Buffer too small in wxDDEConnection::Request") ); (void) DdeGetData(returned_data, (LPBYTE)data, len, 0); @@ -706,7 +706,7 @@ bool wxDDEConnection::StartAdvise(const wxString& item) DWORD result; HSZ atom = DDEGetAtom(item); - bool ok = DdeClientTransaction(NULL, 0, + bool ok = DdeClientTransaction(nullptr, 0, GetHConv(), atom, CF_TEXT, XTYP_ADVSTART, @@ -725,7 +725,7 @@ bool wxDDEConnection::StopAdvise(const wxString& item) DWORD result; HSZ atom = DDEGetAtom(item); - bool ok = DdeClientTransaction(NULL, 0, + bool ok = DdeClientTransaction(nullptr, 0, GetHConv(), atom, CF_TEXT, XTYP_ADVSTOP, @@ -744,7 +744,7 @@ bool wxDDEConnection::StopAdvise(const wxString& item) static wxCharBuffer ConvertToUTF8(const wxMBConv& conv, const void* data, size_t size) { - return wxConvUTF8.cWC2MB(conv.cMB2WC((const char*)data, size, NULL)); + return wxConvUTF8.cWC2MB(conv.cMB2WC((const char*)data, size, nullptr)); } // Calls that SERVER can make @@ -859,7 +859,7 @@ _DDECallback(UINT wType, if (DDECurrentlyConnecting) { DDECurrentlyConnecting->m_hConv = (WXHCONV) hConv; - DDECurrentlyConnecting = NULL; + DDECurrentlyConnecting = nullptr; return (DDERETURN)(DWORD)true; } break; @@ -886,10 +886,10 @@ _DDECallback(UINT wType, if (connection) { - DWORD len = DdeGetData(hData, NULL, 0, 0); + DWORD len = DdeGetData(hData, nullptr, 0, 0); void *data = connection->GetBufferAtLeast(len); - wxASSERT_MSG(data != NULL, + wxASSERT_MSG(data != nullptr, wxT("Buffer too small in _DDECallback (XTYP_EXECUTE)") ); DdeGetData(hData, (LPBYTE)data, len, 0); @@ -969,10 +969,10 @@ _DDECallback(UINT wType, { wxString item_name = DDEStringFromAtom(hsz2); - DWORD len = DdeGetData(hData, NULL, 0, 0); + DWORD len = DdeGetData(hData, nullptr, 0, 0); void *data = connection->GetBufferAtLeast(len); - wxASSERT_MSG(data != NULL, + wxASSERT_MSG(data != nullptr, wxT("Buffer too small in _DDECallback (XTYP_POKE)") ); DdeGetData(hData, (LPBYTE)data, len, 0); @@ -1040,7 +1040,7 @@ _DDECallback(UINT wType, 0 ); - connection->m_sendingData = NULL; + connection->m_sendingData = nullptr; return (DDERETURN)data; } @@ -1056,10 +1056,10 @@ _DDECallback(UINT wType, { wxString item_name = DDEStringFromAtom(hsz2); - DWORD len = DdeGetData(hData, NULL, 0, 0); + DWORD len = DdeGetData(hData, nullptr, 0, 0); char* const data = (char *)connection->GetBufferAtLeast(len); - wxASSERT_MSG(data != NULL, + wxASSERT_MSG(data != nullptr, wxT("Buffer too small in _DDECallback (XTYP_ADVDATA)") ); DdeGetData(hData, (LPBYTE)data, len, 0); @@ -1076,7 +1076,7 @@ _DDECallback(UINT wType, } wxIPCFormat format; - if ( wxConvUTF8.ToWChar(NULL, 0, data, len) != wxCONV_FAILED ) + if ( wxConvUTF8.ToWChar(nullptr, 0, data, len) != wxCONV_FAILED ) format = wxIPC_UTF8TEXT; else format = wxIPC_TEXT; diff --git a/src/msw/debughlp.cpp b/src/msw/debughlp.cpp index 4f130fea5d..f417eae985 100644 --- a/src/msw/debughlp.cpp +++ b/src/msw/debughlp.cpp @@ -481,7 +481,7 @@ wxDbgHelpDLL::DumpUDT(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level) // between GetWriteBuf() and UngetWriteBuf() calls) and assert when we // try to access it contents using public methods, so instead use our // knowledge of its internals - const wxChar *p = NULL; + const wxChar *p = nullptr; if ( !::IsBadReadPtr(ps, sizeof(wxString)) ) { p = ps->data(); @@ -489,7 +489,7 @@ wxDbgHelpDLL::DumpUDT(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level) if ( ::IsBadReadPtr(data, sizeof(wxStringData)) || ::IsBadReadPtr(p, sizeof(wxChar *)*data->nAllocLength) ) { - p = NULL; // don't touch this pointer with 10 feet pole + p = nullptr; // don't touch this pointer with 10 feet pole } } @@ -758,14 +758,14 @@ wxDbgHelpDLL::CallSymInitialize(HANDLE hProcess, BOOL fInvadeProcess) #ifdef UNICODE if ( SymInitializeW ) { - if ( SymInitializeW(hProcess, NULL, fInvadeProcess) ) + if ( SymInitializeW(hProcess, nullptr, fInvadeProcess) ) return TRUE; } #endif // UNICODE if ( SymInitialize ) { - if ( SymInitialize(hProcess, NULL, fInvadeProcess) ) + if ( SymInitialize(hProcess, nullptr, fInvadeProcess) ) return TRUE; } @@ -914,7 +914,7 @@ wxDbgHelpDLL::CallSymEnumSymbols(HANDLE hProcess, #ifdef UNICODE if ( SymEnumSymbolsW ) { - if ( SymEnumSymbolsW(hProcess, baseOfDll, NULL, callback, callbackParam) ) + if ( SymEnumSymbolsW(hProcess, baseOfDll, nullptr, callback, callbackParam) ) return TRUE; } @@ -922,13 +922,13 @@ wxDbgHelpDLL::CallSymEnumSymbols(HANDLE hProcess, { wxEnumSymbolsCallbackBridge br(callback, callbackParam); - if ( SymEnumSymbols(hProcess, baseOfDll, NULL, wxEnumSymbolsCallback, &br) ) + if ( SymEnumSymbols(hProcess, baseOfDll, nullptr, wxEnumSymbolsCallback, &br) ) return TRUE; } #else // !UNICODE if ( SymEnumSymbols ) { - if ( SymEnumSymbols(hProcess, baseOfDll, NULL, callback, callbackParam) ) + if ( SymEnumSymbols(hProcess, baseOfDll, nullptr, callback, callbackParam) ) return TRUE; } #endif // UNICODE/!UNICODE diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index b95a299ea0..52d921bc12 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -81,7 +81,7 @@ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData) void wxDialog::Init() { m_isShown = false; - m_modalData = NULL; + m_modalData = nullptr; m_hGripper = 0; } @@ -233,7 +233,7 @@ void wxDialog::CreateGripper() GetHwnd(), 0, wxGetInstance(), - NULL + nullptr ); } } @@ -345,7 +345,7 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar processed = true; if ( HasFlag(wxFULL_REPAINT_ON_RESIZE) ) { - ::InvalidateRect(GetHwnd(), NULL, false /* erase bg */); + ::InvalidateRect(GetHwnd(), nullptr, false /* erase bg */); } break; } diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp index 74b02a6eae..280600be85 100644 --- a/src/msw/dialup.cpp +++ b/src/msw/dialup.cpp @@ -53,7 +53,7 @@ wxDEFINE_EVENT( wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent ); static const wxChar * wxMSWDIALUP_WNDCLASSNAME = wxT("_wxDialUpManager_Internal_Class"); -static const wxChar *gs_classForDialUpWindow = NULL; +static const wxChar *gs_classForDialUpWindow = nullptr; // ---------------------------------------------------------------------------- // constants @@ -124,7 +124,7 @@ struct WXDLLEXPORT wxRasThreadData wxRasThreadData() { hWnd = 0; - dialUpManager = NULL; + dialUpManager = nullptr; } ~wxRasThreadData() @@ -179,7 +179,7 @@ public: // for wxRasDialFunc static HWND GetRasWindow() { return ms_hwndRas; } - static void ResetRasWindow() { ms_hwndRas = NULL; } + static void ResetRasWindow() { ms_hwndRas = nullptr; } static wxDialUpManagerMSW *GetDialer() { return ms_dialer; } private: @@ -280,7 +280,7 @@ public: if ( gs_classForDialUpWindow ) { ::UnregisterClass(wxMSWDIALUP_WNDCLASSNAME, wxGetInstance()); - gs_classForDialUpWindow = NULL; + gs_classForDialUpWindow = nullptr; } } @@ -337,7 +337,7 @@ RASCONNECTIONNOTIFICATION wxDialUpManagerMSW::ms_pfnRasConnectionNotification = int wxDialUpManagerMSW::ms_userSpecifiedOnlineStatus = -1; int wxDialUpManagerMSW::ms_isConnected = -1; -wxDialUpManagerMSW *wxDialUpManagerMSW::ms_dialer = NULL; +wxDialUpManagerMSW *wxDialUpManagerMSW::ms_dialer = nullptr; // ---------------------------------------------------------------------------- // ctor and dtor: the dynamic linking happens here @@ -373,7 +373,7 @@ wxDialUpManagerMSW::wxDialUpManagerMSW() // this will contain the name of the function we failed to resolve // if any at the end - const char *funcName = NULL; + const char *funcName = nullptr; // get the function from rasapi32.dll and abort if it's not found #define RESOLVE_RAS_FUNCTION(type, name) \ @@ -558,7 +558,7 @@ void wxDialUpManagerMSW::CleanUpThreadData() // the thread still needs m_data so we can't free it here, rather // let the thread do it itself - m_data = NULL; + m_data = nullptr; } CloseHandle(m_hThread); @@ -630,14 +630,14 @@ void wxDialUpManagerMSW::OnDialProgress(RASCONNSTATE rasconnstate, ms_hRasConnection = 0; } - ms_dialer = NULL; + ms_dialer = nullptr; NotifyApp(false /* !connected */, true /* we dialed ourselves */); } else if ( rasconnstate == RASCS_Connected ) { ms_isConnected = true; - ms_dialer = NULL; + ms_dialer = nullptr; NotifyApp(true /* connected */, true /* we dialed ourselves */); } @@ -666,7 +666,7 @@ size_t wxDialUpManagerMSW::GetISPNames(wxArrayString& names) const dwRet = ms_pfnRasEnumEntries ( wxRESERVED_PARAM, - NULL, // default phone book (or all) + nullptr, // default phone book (or all) rasEntries, // [out] buffer for the entries &size, // [in/out] size of the buffer &nEntries // [out] number of entries fetched @@ -676,7 +676,7 @@ size_t wxDialUpManagerMSW::GetISPNames(wxArrayString& names) const { // reallocate the buffer void *n = realloc(rasEntries, size); - if (n == NULL) + if (n == nullptr) { free(rasEntries); return 0; @@ -781,7 +781,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, BOOL gotPassword; DWORD dwRet = ms_pfnRasGetEntryDialParams ( - NULL, // default phonebook + nullptr, // default phonebook &rasDialParams, // [in/out] the params of this entry &gotPassword // [out] did we get password? ); @@ -806,14 +806,14 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, rasDialParams.szDomain[0] = '*'; rasDialParams.szDomain[1] = '\0'; - // apparently, this is not really necessary - passing NULL instead of the + // apparently, this is not really necessary - passing nullptr instead of the // phone book has the same effect #if 0 wxString phoneBook; if ( wxGetOsVersion() == wxWINDOWS_NT ) { // first get the length - UINT nLen = ::GetSystemDirectory(NULL, 0); + UINT nLen = ::GetSystemDirectory(nullptr, 0); nLen++; if ( !::GetSystemDirectory(phoneBook.GetWriteBuf(nLen), nLen) ) @@ -835,8 +835,8 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, DWORD dwRet = ms_pfnRasDial ( - NULL, // no extended features - NULL, // default phone book file (NT only) + nullptr, // no extended features + nullptr, // default phone book file (NT only) &rasDialParams, 0, // use callback for notifications async ? (void *)wxRasDialFunc // cast needed for gcc 3.1 @@ -865,7 +865,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, ms_hRasConnection = 0; } - ms_dialer = NULL; + ms_dialer = nullptr; return false; } @@ -881,7 +881,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, bool wxDialUpManagerMSW::IsDialing() const { - return GetDialer() != NULL; + return GetDialer() != nullptr; } bool wxDialUpManagerMSW::CancelDialing() @@ -894,7 +894,7 @@ bool wxDialUpManagerMSW::CancelDialing() wxASSERT_MSG( ms_hRasConnection, wxT("dialing but no connection?") ); - ms_dialer = NULL; + ms_dialer = nullptr; return HangUp(); } @@ -1100,7 +1100,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) DWORD tid; m_hThread = CreateThread ( - NULL, + nullptr, 0, (LPTHREAD_START_ROUTINE)wxRasMonitorThread, (void *)m_data, diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index f6c6bcde83..9dbf43e107 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -132,7 +132,7 @@ bool wxDIB::Create(int width, int height, int depth) &info, // bitmap description DIB_RGB_COLORS, // use RGB, not palette &m_data, // [out] DIB bits - NULL, // don't use file mapping + nullptr, // don't use file mapping 0 // file mapping offset (not used here) ); @@ -475,7 +475,7 @@ size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp) // use this one BITMAPINFO bi2; - const bool wantSizeOnly = pbi == NULL; + const bool wantSizeOnly = pbi == nullptr; if ( wantSizeOnly ) pbi = &bi2; @@ -501,8 +501,8 @@ size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp) hbmp, // the source DDB 0, // first scan line h, // number of lines to copy - wantSizeOnly ? NULL // pointer to the buffer or - : (char *)pbi + dwLen, // NULL if we don't have it + wantSizeOnly ? nullptr // pointer to the buffer or + : (char *)pbi + dwLen, // nullptr if we don't have it pbi, // bitmap header DIB_RGB_COLORS // or DIB_PAL_COLORS ) ) @@ -520,11 +520,11 @@ size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp) HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) { // first calculate the size needed - const size_t size = ConvertFromBitmap(NULL, hbmp); + const size_t size = ConvertFromBitmap(nullptr, hbmp); if ( !size ) { // conversion to DDB failed? - return NULL; + return nullptr; } HGLOBAL hDIB = ::GlobalAlloc(GMEM_MOVEABLE, size); @@ -535,7 +535,7 @@ HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) wxLogError(_("Failed to allocate %luKb of memory for bitmap data."), (unsigned long)(size / 1024)); - return NULL; + return nullptr; } if ( !ConvertFromBitmap((BITMAPINFO *)(void *)GlobalPtrLock(hDIB), hbmp) ) @@ -544,7 +544,7 @@ HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) // now? wxFAIL_MSG( wxT("wxDIB::ConvertFromBitmap() unexpectedly failed") ); - return NULL; + return nullptr; } return hDIB; @@ -558,7 +558,7 @@ HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) wxPalette *wxDIB::CreatePalette() const { - wxCHECK_MSG( m_handle, NULL, wxT("wxDIB::CreatePalette(): invalid object") ); + wxCHECK_MSG( m_handle, nullptr, wxT("wxDIB::CreatePalette(): invalid object") ); DIBSECTION ds; if ( !GetDIBSection(m_handle, &ds) ) @@ -582,7 +582,7 @@ wxPalette *wxDIB::CreatePalette() const // // NB: another possibility would be to return // GetStockObject(DEFAULT_PALETTE) or even CreateHalftonePalette()? - return NULL; + return nullptr; } MemoryHDC hDC; @@ -591,7 +591,7 @@ wxPalette *wxDIB::CreatePalette() const // going to have biClrUsed of them so add necessary space LOGPALETTE *pPalette = (LOGPALETTE *) malloc(sizeof(LOGPALETTE) + (biClrUsed - 1)*sizeof(PALETTEENTRY)); - wxCHECK_MSG( pPalette, NULL, wxT("out of memory") ); + wxCHECK_MSG( pPalette, nullptr, wxT("out of memory") ); // initialize the palette header pPalette->palVersion = 0x300; // magic number, not in docs but works @@ -618,7 +618,7 @@ wxPalette *wxDIB::CreatePalette() const { wxLogLastError(wxT("CreatePalette")); - return NULL; + return nullptr; } wxPalette *palette = new wxPalette; @@ -709,7 +709,7 @@ bool wxDIB::Create(const wxImage& image, PixelFormat pf, int dstDepth) const int dstBytesPerLine = GetLineSize(w, dstDepth); const unsigned char *src = (dstDepth != 1 ? image.GetData() : eightBitData.get()) + ((h - 1) * srcBytesPerLine); const unsigned char *alpha = hasAlpha ? image.GetAlpha() + (h - 1)*w - : NULL; + : nullptr; unsigned char *dstLineStart = (unsigned char *)m_data; for ( int y = 0; y < h; y++ ) { @@ -830,7 +830,7 @@ wxImage wxDIB::ConvertToImage(ConversionFlags flags) const const int srcBytesPerLine = GetLineSize(w, bpp); unsigned char *dst = image.GetData() + ((h - 1) * dstBytesPerLine); unsigned char *alpha = image.HasAlpha() ? image.GetAlpha() + (h - 1)*w - : NULL; + : nullptr; const unsigned char *srcLineStart = (unsigned char *)GetData(); for ( int y = 0; y < h; y++ ) { diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp index d43c21e363..5b05d23d48 100644 --- a/src/msw/dir.cpp +++ b/src/msw/dir.cpp @@ -338,7 +338,7 @@ bool wxDirData::Read(wxString *filename) wxDir::wxDir(const wxString& dirname) { - m_data = NULL; + m_data = nullptr; (void)Open(dirname); } @@ -356,7 +356,7 @@ bool wxDir::Open(const wxString& dirname) } else { - m_data = NULL; + m_data = nullptr; return false; } @@ -364,7 +364,7 @@ bool wxDir::Open(const wxString& dirname) bool wxDir::IsOpened() const { - return m_data != NULL; + return m_data != nullptr; } wxString wxDir::GetName() const @@ -394,7 +394,7 @@ void wxDir::Close() if ( m_data ) { delete m_data; - m_data = NULL; + m_data = nullptr; } } diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index e307b9160b..9096bd4ec1 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -142,7 +142,7 @@ int wxDirDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(); - WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + WXHWND hWndParent = parent ? GetHwndOf(parent) : nullptr; wxWindowDisabler disableOthers(this, parent); @@ -182,8 +182,8 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner) { BROWSEINFO bi; bi.hwndOwner = owner; - bi.pidlRoot = NULL; - bi.pszDisplayName = NULL; + bi.pidlRoot = nullptr; + bi.pszDisplayName = nullptr; bi.lpszTitle = m_message.c_str(); bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = BrowseCallbackProc; @@ -279,7 +279,7 @@ wxIFileDialog::wxIFileDialog(const CLSID& clsid) HRESULT hr = ::CoCreateInstance ( clsid, - NULL, // no outer IUnknown + nullptr, // no outer IUnknown CLSCTX_INPROC_SERVER, wxIID_PPV_ARGS(IFileDialog, &m_fileDialog) ); @@ -405,7 +405,7 @@ HRESULT InitShellItemFromPath(wxCOMPtr& item, const wxString& path) hr = s_pfnSHCreateItemFromParsingName ( pathWithoutSlashes->wc_str(), - NULL, + nullptr, wxIID_PPV_ARGS(IShellItem, &item) ); if ( FAILED(hr) ) diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 5869c99937..22cd36756f 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -217,7 +217,7 @@ private: { GetDpiForMonitorData() { - m_pfnGetDpiForMonitor = NULL; + m_pfnGetDpiForMonitor = nullptr; m_initialized = false; } @@ -242,7 +242,7 @@ private: if ( m_dllShcore.IsLoaded() ) { m_dllShcore.Unload(); - m_pfnGetDpiForMonitor = NULL; + m_pfnGetDpiForMonitor = nullptr; } } @@ -343,12 +343,12 @@ wxVideoMode wxDisplayMSW::GetCurrentMode() const { wxVideoMode mode; - // The first parameter of EnumDisplaySettings() must be NULL according + // The first parameter of EnumDisplaySettings() must be null according // to MSDN, in order to specify the current display on the computer // on which the calling thread is running. const wxString name = GetName(); const wxChar * const deviceName = name.empty() - ? (const wxChar*)NULL + ? nullptr : (const wxChar*)name.c_str(); DEVMODE dm; @@ -371,12 +371,12 @@ wxArrayVideoModes wxDisplayMSW::GetModes(const wxVideoMode& modeMatch) const { wxArrayVideoModes modes; - // The first parameter of EnumDisplaySettings() must be NULL according + // The first parameter of EnumDisplaySettings() must be null according // to MSDN, in order to specify the current display on the computer // on which the calling thread is running. const wxString name = GetName(); const wxChar * const deviceName = name.empty() - ? (const wxChar*)NULL + ? nullptr : (const wxChar*)name.c_str(); DEVMODE dm; @@ -416,7 +416,7 @@ bool wxDisplayMSW::ChangeMode(const wxVideoMode& mode) if ( mode == wxDefaultVideoMode ) { // reset the video mode to default - pDevMode = NULL; + pDevMode = nullptr; flags = 0; } else // change to the given mode @@ -453,10 +453,10 @@ bool wxDisplayMSW::ChangeMode(const wxVideoMode& mode) switch ( ::ChangeDisplaySettingsEx ( GetName().t_str(), // display name - pDevMode, // dev mode or NULL to reset + pDevMode, // dev mode or nullptr to reset wxRESERVED_PARAM, flags, - NULL // pointer to video parameters (not used) + nullptr // pointer to video parameters (not used) ) ) { case DISP_CHANGE_SUCCESSFUL: @@ -507,8 +507,8 @@ wxDisplayWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) wxDisplayFactoryMSW::wxDisplayFactoryMSW() { - m_hiddenHwnd = NULL; - m_hiddenClass = NULL; + m_hiddenHwnd = nullptr; + m_hiddenClass = nullptr; DoRefreshMonitors(); @@ -565,10 +565,10 @@ void wxDisplayFactoryMSW::DoRefreshMonitors() { m_displays.clear(); - // Note that we pass NULL as first parameter here because using screen HDC + // Note that we pass nullptr as first parameter here because using screen HDC // doesn't work reliably: notably, it doesn't enumerate any displays if // this code is executed while a UAC prompt is shown or during log-off. - if ( !::EnumDisplayMonitors(NULL, NULL, MultimonEnumProc, (LPARAM)this) ) + if ( !::EnumDisplayMonitors(nullptr, nullptr, MultimonEnumProc, (LPARAM)this) ) { wxLogLastError(wxT("EnumDisplayMonitors")); } @@ -579,7 +579,7 @@ BOOL CALLBACK wxDisplayFactoryMSW::MultimonEnumProc( HMONITOR hMonitor, // handle to display monitor HDC /* hdcMonitor */, // handle to monitor-appropriate device context: - // not set due to our use of EnumDisplayMonitors(NULL, ...) + // not set due to our use of EnumDisplayMonitors(nullptr, ...) LPRECT WXUNUSED(lprcMonitor), // pointer to monitor intersection rectangle LPARAM dwData) // data passed from EnumDisplayMonitors (this) { @@ -591,7 +591,7 @@ wxDisplayFactoryMSW::MultimonEnumProc( wxLogLastError(wxT("GetMonitorInfo")); } - HDC hdcMonitor = ::CreateDC(NULL, monInfo.szDevice, NULL, NULL); + HDC hdcMonitor = ::CreateDC(nullptr, monInfo.szDevice, nullptr, nullptr); const int hdcDepth = wxGetHDCDepth(hdcMonitor); ::DeleteDC(hdcMonitor); @@ -603,7 +603,7 @@ wxDisplayFactoryMSW::MultimonEnumProc( wxDisplayImpl *wxDisplayFactoryMSW::CreateDisplay(unsigned n) { - wxCHECK_MSG( n < m_displays.size(), NULL, wxT("An invalid index was passed to wxDisplay") ); + wxCHECK_MSG( n < m_displays.size(), nullptr, wxT("An invalid index was passed to wxDisplay") ); return new wxDisplayMSW(n, m_displays[n]); } diff --git a/src/msw/dlmsw.cpp b/src/msw/dlmsw.cpp index 4ccf57ec61..5e4b16a5dd 100644 --- a/src/msw/dlmsw.cpp +++ b/src/msw/dlmsw.cpp @@ -139,7 +139,7 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(const wxChar* name, wxDllType wxDynamicLibrary::GetProgramHandle() { - return (wxDllType)::GetModuleHandle(NULL); + return (wxDllType)::GetModuleHandle(nullptr); } // ---------------------------------------------------------------------------- @@ -240,7 +240,7 @@ 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 +// to get the module handle from the given address. Returns nullptr 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) @@ -259,13 +259,13 @@ HMODULE CallGetModuleHandleEx(const void* addr) } if ( !s_pfnGetModuleHandleEx ) - return NULL; + return nullptr; // 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 nullptr; return hmod; } @@ -279,7 +279,7 @@ void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) if ( !hmod ) { wxLogLastError(wxT("GetModuleHandleEx")); - return NULL; + return nullptr; } if ( path ) @@ -292,7 +292,7 @@ void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) // in principle, MAX_PATH could be unsufficient and we should try // increasing the buffer size here. wxLogLastError(wxT("GetModuleFromAddress")); - return NULL; + return nullptr; } libname[MAX_PATH-1] = wxT('\0'); @@ -310,7 +310,7 @@ WXHMODULE wxDynamicLibrary::MSWGetModuleHandle(const wxString& name, void *addr) { // we want to use GetModuleHandleEx() instead of usual GetModuleHandle() // because the former works correctly for comctl32.dll while the latter - // returns NULL when comctl32.dll version 6 is used under XP (note that + // returns nullptr when comctl32.dll version 6 is used under XP (note that // GetModuleHandleEx() is only available under XP and later, coincidence?) HMODULE hmod = CallGetModuleHandleEx(addr); diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index 3a0c72ef7a..8636ff0a91 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -84,7 +84,7 @@ void wxDragImage::Init() #if !wxUSE_SIMPLER_DRAGIMAGE m_hCursorImageList = 0; #endif - m_window = NULL; + m_window = nullptr; m_fullScreen = false; } @@ -381,13 +381,13 @@ bool wxDragImage::EndDrag() ::ShowCursor(TRUE); #endif - m_window = NULL; + m_window = nullptr; return true; } // Move the image: call from OnMouseMove. Pt is in window client coordinates if window -// is non-NULL, or in screen coordinates if NULL. +// is non-null, or in screen coordinates if null. bool wxDragImage::Move(const wxPoint& pt) { wxASSERT_MSG( (m_hImageList != 0), wxT("Image list must not be null in Move.")); diff --git a/src/msw/enhmeta.cpp b/src/msw/enhmeta.cpp index 7d9a9fc1a6..523716080b 100644 --- a/src/msw/enhmeta.cpp +++ b/src/msw/enhmeta.cpp @@ -54,9 +54,9 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject); // private functions // ---------------------------------------------------------------------------- -// we must pass NULL if the string is empty to metafile functions +// we must pass nullptr if the string is empty to metafile functions static inline const wxChar *GetMetaFileName(const wxString& fn) - { return !fn ? NULL : wxMSW_CONV_LPCTSTR(fn); } + { return !fn ? nullptr : wxMSW_CONV_LPCTSTR(fn); } // ============================================================================ // implementation @@ -70,7 +70,7 @@ wxGDIRefData *wxEnhMetaFile::CreateGDIRefData() const { wxFAIL_MSG( wxT("must be implemented if used") ); - return NULL; + return nullptr; } wxGDIRefData * @@ -78,7 +78,7 @@ wxEnhMetaFile::CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const { wxFAIL_MSG( wxT("must be implemented if used") ); - return NULL; + return nullptr; } void wxEnhMetaFile::Init() @@ -303,7 +303,7 @@ void wxEnhMetaFileDCImpl::Create(HDC hdcRef, else { // GDI will try to find out the size for us (not recommended) - pRect = (LPRECT)NULL; + pRect = (LPRECT)nullptr; } m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename), @@ -324,14 +324,14 @@ void wxEnhMetaFileDCImpl::DoGetSize(int *width, int *height) const wxEnhMetaFile *wxEnhMetaFileDCImpl::Close() { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid wxEnhMetaFileDC") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid wxEnhMetaFileDC") ); HENHMETAFILE hMF = ::CloseEnhMetaFile(GetHdc()); if ( !hMF ) { wxLogLastError(wxT("CloseEnhMetaFile")); - return NULL; + return nullptr; } wxEnhMetaFile *mf = new wxEnhMetaFile; @@ -377,7 +377,7 @@ wxEnhMetaFile *wxEnhMetaFileDC::Close() { wxEnhMetaFileDCImpl * const impl = static_cast(GetImpl()); - wxCHECK_MSG( impl, NULL, wxT("no wxEnhMetaFileDC implementation") ); + wxCHECK_MSG( impl, nullptr, wxT("no wxEnhMetaFileDC implementation") ); return impl->Close(); } @@ -430,7 +430,7 @@ bool wxEnhMetaFileDataObject::GetDataHere(const wxDataFormat& format, void *buf) if ( format == wxDF_ENHMETAFILE ) { - HENHMETAFILE hEMFCopy = ::CopyEnhMetaFile(hEMF, NULL); + HENHMETAFILE hEMFCopy = ::CopyEnhMetaFile(hEMF, nullptr); if ( !hEMFCopy ) { wxLogLastError(wxT("CopyEnhMetaFile")); @@ -449,7 +449,7 @@ bool wxEnhMetaFileDataObject::GetDataHere(const wxDataFormat& format, void *buf) ScreenHDC hdc; // first get the buffer size and alloc memory - size_t size = ::GetWinMetaFileBits(hEMF, 0, NULL, MM_ANISOTROPIC, hdc); + size_t size = ::GetWinMetaFileBits(hEMF, 0, nullptr, MM_ANISOTROPIC, hdc); wxCHECK_MSG( size, false, wxT("GetWinMetaFileBits() failed") ); BYTE *bits = (BYTE *)malloc(size); @@ -508,7 +508,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format, const METAFILEPICT *mfpict = (const METAFILEPICT *)buf; // first get the buffer size - size_t size = ::GetMetaFileBitsEx(mfpict->hMF, 0, NULL); + size_t size = ::GetMetaFileBitsEx(mfpict->hMF, 0, nullptr); wxCHECK_MSG( size, false, wxT("GetMetaFileBitsEx() failed") ); // then get metafile bits @@ -556,7 +556,7 @@ bool wxEnhMetaFileSimpleDataObject::GetDataHere(void *buf) const HENHMETAFILE hEMF = (HENHMETAFILE)m_metafile.GetHENHMETAFILE(); - HENHMETAFILE hEMFCopy = ::CopyEnhMetaFile(hEMF, NULL); + HENHMETAFILE hEMFCopy = ::CopyEnhMetaFile(hEMF, nullptr); if ( !hEMFCopy ) { wxLogLastError(wxT("CopyEnhMetaFile")); diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index 17e9055709..c390188d22 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -46,7 +46,7 @@ // GUI wxEventLoop implementation // ============================================================================ -wxWindowMSW *wxGUIEventLoop::ms_winCritical = NULL; +wxWindowMSW *wxGUIEventLoop::ms_winCritical = nullptr; bool wxGUIEventLoop::IsChildOfCriticalWindow(wxWindowMSW *win) { @@ -78,7 +78,7 @@ bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) // If the control has a wx parent, break and give the parent a chance // to process the window message wndThis = wxGetWindowFromHWND((WXHWND)hwnd); - if (wndThis != NULL) + if (wndThis != nullptr) break; } @@ -100,7 +100,7 @@ bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) // stop an endless stream of WM_PAINTs which would have resulted if we // didn't validate the invalidated part of the window if ( msg->message == WM_PAINT ) - ::ValidateRect(hwnd, NULL); + ::ValidateRect(hwnd, nullptr); return true; } @@ -395,7 +395,7 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess) else { // remove the message and store it - ::GetMessage(&msg, NULL, 0, 0); + ::GetMessage(&msg, nullptr, 0, 0); m_arrMSG.Add(msg); } } diff --git a/src/msw/evtloopconsole.cpp b/src/msw/evtloopconsole.cpp index a50953740c..d2733eb95a 100644 --- a/src/msw/evtloopconsole.cpp +++ b/src/msw/evtloopconsole.cpp @@ -41,7 +41,7 @@ wxMSWEventLoopBase::wxMSWEventLoopBase() m_exitcode = 0; // Create initially not signalled auto-reset event object. - m_heventWake = ::CreateEvent(NULL, FALSE, FALSE, NULL); + m_heventWake = ::CreateEvent(nullptr, FALSE, FALSE, nullptr); if ( !m_heventWake ) wxLogLastError(wxS("CreateEvent(wake)")); } diff --git a/src/msw/fdrepdlg.cpp b/src/msw/fdrepdlg.cpp index fd6c6f787d..52b9505063 100644 --- a/src/msw/fdrepdlg.cpp +++ b/src/msw/fdrepdlg.cpp @@ -292,8 +292,8 @@ wxFindReplaceDialogHookProc(HWND hwnd, void wxFindReplaceDialog::Init() { - m_impl = NULL; - m_FindReplaceData = NULL; + m_impl = nullptr; + m_FindReplaceData = nullptr; // as we're created in the hidden state, bring the internal flag in sync m_isShown = false; @@ -334,7 +334,7 @@ wxFindReplaceDialog::~wxFindReplaceDialog() m_isShown = false; // and from destroying our window [again] - m_hWnd = (WXHWND)NULL; + m_hWnd = (WXHWND)nullptr; } bool wxFindReplaceDialog::Create(wxWindow *parent, @@ -351,7 +351,7 @@ bool wxFindReplaceDialog::Create(wxWindow *parent, SetTitle(title); // we must have a parent as it will get the messages from us - return parent != NULL; + return parent != nullptr; } // ---------------------------------------------------------------------------- diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 37e58666a7..9c240aafcc 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -507,7 +507,7 @@ public: // Currently there is 1-to-1 correspondence between IDs and the // controls we create, except that we start assigning IDs with 1. if ( id < 1 || id > m_controls.size() ) - return NULL; + return nullptr; return m_controls[id - 1]; } @@ -522,7 +522,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddPushButton"), hr); - return NULL; + return nullptr; } return new wxFileDialogButtonImplFDC(m_fdc, m_lastId); @@ -536,7 +536,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddCheckButton"), hr); - return NULL; + return nullptr; } return new wxFileDialogCheckBoxImplFDC(m_fdc, m_lastId); @@ -553,7 +553,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddRadioButtonList"), hr); - return NULL; + return nullptr; } m_radioListId = m_lastAuxId; @@ -564,7 +564,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddControlItem"), hr); - return NULL; + return nullptr; } wxFileDialogRadioButtonImplFDC* const @@ -583,7 +583,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddComboBox"), hr); - return NULL; + return nullptr; } // We pass the ID of the first control that will be added to the @@ -597,7 +597,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddControlItem"), hr); - return NULL; + return nullptr; } } @@ -621,7 +621,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddEditBox"), hr); - return NULL; + return nullptr; } if ( !label.empty() ) @@ -642,7 +642,7 @@ public: if ( FAILED(hr) ) { wxLogApiError(wxS("IFileDialogCustomize::AddText"), hr); - return NULL; + return nullptr; } return new wxFileDialogStaticTextImplFDC(m_fdc, m_lastId); @@ -745,7 +745,7 @@ public: } else { - *ppv = NULL; + *ppv = nullptr; return E_NOINTERFACE; } @@ -1002,7 +1002,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, { // NB: all style checks are done by wxFileDialogBase::Create - m_data = NULL; + m_data = nullptr; // Must set to zero, otherwise the wx routines won't size the window // the second time you call the file dialog, because it thinks it is @@ -1222,7 +1222,7 @@ int wxFileDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); - WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + WXHWND hWndParent = parent ? GetHwndOf(parent) : nullptr; wxWindowDisabler disableOthers(this, parent); @@ -1328,7 +1328,7 @@ int wxFileDialog::ShowCommFileDialog(WXHWND hWndParent) // create the extra control in an empty dialog just to find its size: this // is not terribly efficient but we do need to know the size before // creating the native dialog and this seems to be the only way - wxDialog dlg(NULL, wxID_ANY, wxString()); + wxDialog dlg(nullptr, wxID_ANY, wxString()); const wxSize extraSize = CreateExtraControlWithParent(&dlg)->GetSize(); // convert the size of the extra controls to the dialog units diff --git a/src/msw/font.cpp b/src/msw/font.cpp index df4bd8256e..81b9365aa8 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -276,10 +276,10 @@ protected: ScreenHDC hdc; SelectInHDC selectFont(hdc, (HFONT)GetHFONT()); - UINT otmSize = GetOutlineTextMetrics(hdc, 0, NULL); + UINT otmSize = GetOutlineTextMetrics(hdc, 0, nullptr); if ( !otmSize ) { - wxLogLastError("GetOutlineTextMetrics(NULL)"); + wxLogLastError("GetOutlineTextMetrics(nullptr)"); return wxString(); } @@ -326,7 +326,7 @@ protected: wxFontRefData::wxFontRefData(const wxFontInfo& info) { - m_hFont = NULL; + m_hFont = nullptr; m_sizeUsingPixels = info.IsUsingSizeInPixels(); if ( m_sizeUsingPixels ) @@ -857,8 +857,8 @@ bool wxFont::RealizeResource() { // NOTE: the GetHFONT() call automatically triggers a reallocation of // the HFONT if necessary (will do nothing if we already have the resource); - // it returns NULL only if there is a failure in wxFontRefData::Alloc()... - return GetHFONT() != NULL; + // it returns nullptr only if there is a failure in wxFontRefData::Alloc()... + return GetHFONT() != nullptr; } bool wxFont::FreeResource(bool WXUNUSED(force)) @@ -1059,7 +1059,7 @@ wxFontEncoding wxFont::GetEncoding() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { - return IsOk() ? &(M_FONTDATA->GetNativeFontInfo()) : NULL; + return IsOk() ? &(M_FONTDATA->GetNativeFontInfo()) : nullptr; } bool wxFont::IsFixedWidth() const diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp index 819188d1ee..e1dc13b5e2 100644 --- a/src/msw/fontdlg.cpp +++ b/src/msw/fontdlg.cpp @@ -102,7 +102,7 @@ int wxFontDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); - WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + WXHWND hWndParent = parent ? GetHwndOf(parent) : nullptr; wxWindowDisabler disableOthers(this, parent); diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index 8ff003ff07..3c62e2eaff 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -140,7 +140,7 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) void wxFontEnumeratorHelper::DoEnumerate() { - HDC hDC = ::GetDC(NULL); + HDC hDC = ::GetDC(nullptr); LOGFONT lf; lf.lfCharSet = (BYTE)m_charset; @@ -149,7 +149,7 @@ void wxFontEnumeratorHelper::DoEnumerate() ::EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this, wxRESERVED_PARAM) ; - ::ReleaseDC(NULL, hDC); + ::ReleaseDC(nullptr, hDC); } bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 1d540083bb..2b499745ad 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -275,7 +275,7 @@ void wxFillLogFont(LOGFONT *logFont, const wxFont *font) wxFont wxCreateFontFromLogFont(const LOGFONT *logFont) { - return wxFont(wxNativeFontInfo(*logFont, NULL)); + return wxFont(wxNativeFontInfo(*logFont, nullptr)); } #endif // WXWIN_COMPATIBILITY_3_0 diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index cbfd63b593..953708db13 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -96,7 +96,7 @@ wxEND_EVENT_TABLE() void wxFrame::Init() { #if wxUSE_MENUS - m_hMenu = NULL; + m_hMenu = nullptr; m_menuDepth = 0; #endif // wxUSE_MENUS @@ -107,7 +107,7 @@ void wxFrame::Init() m_wasMinimized = false; #if wxUSE_TASKBARBUTTON - m_taskBarButton = NULL; + m_taskBarButton = nullptr; #endif } @@ -139,7 +139,7 @@ bool wxFrame::Create(wxWindow *parent, DWORD dwFlag); wxDynamicLibrary dllUser32(wxT("user32.dll")); - ChangeWindowMessageFilter_t pfnChangeWindowMessageFilter = NULL; + ChangeWindowMessageFilter_t pfnChangeWindowMessageFilter = nullptr; wxDL_INIT_FUNC(pfn, ChangeWindowMessageFilter, dllUser32); if ( pfnChangeWindowMessageFilter ) { @@ -283,7 +283,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, wxWindowID id, const wxString& name) { - wxStatusBar *statusBar wxDUMMY_INITIALIZE(NULL); + wxStatusBar *statusBar wxDUMMY_INITIALIZE(nullptr); #if wxUSE_NATIVE_STATUSBAR if ( !UsesNativeStatusBar() ) @@ -339,7 +339,7 @@ void wxFrame::PositionStatusBar() // account for this difference. If not, the statusbar will be positioned // too high or low. int shOld; - m_frameStatusBar->GetSize(NULL, &shOld); + m_frameStatusBar->GetSize(nullptr, &shOld); // 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 @@ -349,7 +349,7 @@ void wxFrame::PositionStatusBar() m_frameStatusBar->SetSize(x, h, w, wxDefaultCoord, wxSIZE_AUTO_HEIGHT); int sh; - m_frameStatusBar->GetSize(NULL, &sh); + m_frameStatusBar->GetSize(nullptr, &sh); h += shOld - sh; // Since we wish the status bar to be directly under the client area, @@ -371,7 +371,7 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) m_hMenu = (WXHMENU)0; InternalSetMenuBar(); } - else // set new non NULL menu bar + else // set new non null menu bar { // Can set a menubar several times. if ( menubar->GetHMenu() ) @@ -515,7 +515,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) #endif // wxUSE_TOOLBAR if (style & wxFULLSCREEN_NOMENUBAR) - SetMenu((HWND)GetHWND(), (HMENU) NULL); + SetMenu((HWND)GetHWND(), (HMENU) nullptr); #if wxUSE_STATUSBAR wxStatusBar *theStatusBar = GetStatusBar(); diff --git a/src/msw/fswatcher.cpp b/src/msw/fswatcher.cpp index 8a35eff451..6057ecc138 100644 --- a/src/msw/fswatcher.cpp +++ b/src/msw/fswatcher.cpp @@ -158,8 +158,8 @@ bool wxFSWatcherImplMSW::DoSetUpWatch(wxFSWatchEntryMSW& watch) int ret = ReadDirectoryChangesW(watch.GetHandle(), watch.GetBuffer(), wxFSWatchEntryMSW::BUFFER_SIZE, bWatchSubtree, - flags, NULL, - watch.GetOverlapped(), NULL); + flags, nullptr, + watch.GetOverlapped(), nullptr); if (!ret) { wxLogSysError(_("Unable to set up watch for '%s'"), @@ -219,8 +219,8 @@ wxThread::ExitCode wxIOCPThread::Entry() bool wxIOCPThread::ReadEvents() { DWORD count = 0; - wxFSWatchEntryMSW* watch = NULL; - OVERLAPPED* overlapped = NULL; + wxFSWatchEntryMSW* watch = nullptr; + OVERLAPPED* overlapped = nullptr; switch ( m_iocp->GetStatus(&count, &watch, &overlapped) ) { case wxIOCPService::Status_OK: diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index d5275f549a..ca398bf676 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -72,7 +72,7 @@ public: int desiredWidth, int desiredHeight) override; virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, wxBitmapType type, - const wxPalette *palette = NULL) const override; + const wxPalette *palette = nullptr) const override; private: wxDECLARE_DYNAMIC_CLASS(wxBMPFileHandler); @@ -275,7 +275,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name) node = node->GetNext(); } - return NULL; + return nullptr; } wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension, @@ -293,7 +293,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension, node = node->GetNext(); } - return NULL; + return nullptr; } wxGDIImageHandler *wxGDIImage::FindHandler(long type) @@ -308,7 +308,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(long type) node = node->GetNext(); } - return NULL; + return nullptr; } void wxGDIImage::CleanUpHandlers() @@ -394,7 +394,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, { // TODO: load colourmap. HBITMAP hbmp = ::LoadBitmap(wxGetInstance(), name.t_str()); - if ( hbmp == NULL ) + if ( hbmp == nullptr ) { // it's probably not found wxLogError(wxT("Can't load bitmap '%s' from resources! Check .rc file."), @@ -430,7 +430,7 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { - wxCHECK_MSG( bitmap, false, wxT("NULL bitmap in LoadFile") ); + wxCHECK_MSG( bitmap, false, wxT("null bitmap in LoadFile") ); #if wxUSE_WXDIB // Try loading using native Windows LoadImage() first. @@ -460,7 +460,7 @@ bool wxBMPFileHandler::SaveFile(const wxBitmap *bitmap, const wxPalette * WXUNUSED(pal)) const { #if wxUSE_WXDIB - wxCHECK_MSG( bitmap, false, wxT("NULL bitmap in SaveFile") ); + wxCHECK_MSG( bitmap, false, wxT("null bitmap in SaveFile") ); wxDIB dib(*bitmap); @@ -481,7 +481,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, { icon->UnRef(); - HICON hicon = NULL; + HICON hicon = nullptr; // Parse the filename: it may be of the form "filename;n" in order to // specify the nth icon in the file. @@ -508,11 +508,11 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, desiredHeight == -1) { // Try loading a large icon first - if ( ::ExtractIconEx(nameReal, iconIndex, &hicon, NULL, 1) == 1) + if ( ::ExtractIconEx(nameReal, iconIndex, &hicon, nullptr, 1) == 1) { } // Then try loading a small icon - else if ( ::ExtractIconEx(nameReal, iconIndex, NULL, &hicon, 1) == 1) + else if ( ::ExtractIconEx(nameReal, iconIndex, nullptr, &hicon, 1) == 1) { } } @@ -524,7 +524,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, desiredHeight == wxGetSystemMetrics(SM_CYICON, win) ) { // get the specified large icon from file - if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, &hicon, NULL, 1) ) + if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, &hicon, nullptr, 1) ) { // it is not an error, but it might still be useful to be informed // about it optionally @@ -537,7 +537,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, desiredHeight == wxGetSystemMetrics(SM_CYSMICON, win) ) { // get the specified small icon from file - if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, NULL, &hicon, 1) ) + if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, nullptr, &hicon, 1) ) { wxLogTrace(wxT("iconload"), wxT("No small icons found in the file '%s'."), @@ -628,7 +628,7 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, { if ( name == stdIcons[nIcon].name ) { - hicon = ::LoadIcon((HINSTANCE)NULL, stdIcons[nIcon].id); + hicon = ::LoadIcon((HINSTANCE)nullptr, stdIcons[nIcon].id); break; } } @@ -668,7 +668,7 @@ bool wxPNGResourceHandler::LoadFile(wxBitmap *bitmap, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { - const void* pngData = NULL; + const void* pngData = nullptr; size_t pngSize = 0; // Currently we hardcode RCDATA resource type as this is what is usually @@ -729,7 +729,7 @@ wxSize wxGetHiconSize(HICON hicon) } // For monochrome icon reported height is doubled // because it contains both AND and XOR masks. - if ( info.hbmColor == NULL ) + if ( info.hbmColor == nullptr ) { size.y /= 2; } diff --git a/src/msw/gdiplus.cpp b/src/msw/gdiplus.cpp index 675d389123..769aead0f0 100644 --- a/src/msw/gdiplus.cpp +++ b/src/msw/gdiplus.cpp @@ -743,7 +743,7 @@ wxFOR_ALL_GDIPLUS_STATUS_FUNCS(wxDECL_GDIPLUS_FUNC_TYPE) // is and if Cygwin headers are modified to not use it in the future, it's not // a big deal either, we'll just have an unused pointer. #if defined(__CYGWIN__) || defined(__MINGW32__) -void *_GdipStringFormatCachedGenericTypographic = NULL; +void *_GdipStringFormatCachedGenericTypographic = nullptr; #endif // __CYGWIN__ || __MINGW32__ } // extern "C" @@ -806,7 +806,7 @@ private: }; #define wxINIT_GDIPLUS_FUNC(name, params, args) \ - wxGDIPLUS_FUNC_T(name) wxGdiPlus::name = NULL; + wxGDIPLUS_FUNC_T(name) wxGdiPlus::name = nullptr; wxFOR_ALL_FUNCNAMES(wxINIT_GDIPLUS_FUNC) @@ -876,7 +876,7 @@ extern "C" void* WINGDIPAPI GdipAlloc(size_t size) { - return wxGdiPlus::Initialize() ? wxGdiPlus::Alloc(size) : NULL; + return wxGdiPlus::Initialize() ? wxGdiPlus::Alloc(size) : nullptr; } void WINGDIPAPI diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp index a28c20b6cd..0f419543c6 100644 --- a/src/msw/glcanvas.cpp +++ b/src/msw/glcanvas.cpp @@ -157,7 +157,7 @@ inline T wxWGLProcCast(PROC proc) } // 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) +// it with the pointer to WGL function "name" (which may be null) // // NB: type name_t must be defined by the code using the macro #define wxDEFINE_WGL_FUNC(name) \ @@ -546,9 +546,9 @@ wxIMPLEMENT_CLASS(wxGLContext, wxObject); wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other, const wxGLContextAttrs *ctxAttrs) - : m_glContext(NULL) + : m_glContext(nullptr) { - const int* contextAttribs = NULL; + const int* contextAttribs = nullptr; bool needsARB = false; if ( ctxAttrs ) @@ -577,7 +577,7 @@ wxGLContext::wxGLContext(wxGLCanvas *win, (HDC hDC, HGLRC hShareContext, const int *attribList); wxDEFINE_WGL_FUNC(wglCreateContextAttribsARB); - wglMakeCurrent(win->GetHDC(), NULL); + wglMakeCurrent(win->GetHDC(), nullptr); wglDeleteContext(tempContext); // The preferred way is using wglCreateContextAttribsARB, even for old context @@ -596,7 +596,7 @@ wxGLContext::wxGLContext(wxGLCanvas *win, // Some old hardware may accept the use of this ARB, but may fail. - // In case of NULL attributes we'll try creating the context old-way. + // In case of null attributes we'll try creating the context old-way. if ( !m_glContext && (!contextAttribs || !needsARB) ) { // Create legacy context @@ -650,7 +650,7 @@ wxEND_EVENT_TABLE() void wxGLCanvas::Init() { - m_hDC = NULL; + m_hDC = nullptr; } wxGLCanvas::wxGLCanvas(wxWindow *parent, @@ -713,7 +713,7 @@ bool wxGLCanvas::CreateWindow(wxWindow *parent, msflags |= MSWGetStyle(style, &exStyle); if ( !MSWCreate(wxApp::GetRegisteredClassName(wxT("wxGLCanvas"), -1, CS_OWNDC), - NULL, pos, size, msflags, exStyle) ) + nullptr, pos, size, msflags, exStyle) ) return false; m_hDC = ::GetDC(GetHwnd()); @@ -768,7 +768,7 @@ bool wxGLCanvas::Create(wxWindow *parent, // "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. + // Pass pfd just in case it's somehow needed. Passing nullptr also works here. if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) ) { wxLogLastError("SetPixelFormat"); @@ -825,7 +825,7 @@ bool wxGLCanvasBase::IsExtensionSupported(const char *extension) } else { - s_extensionsList = NULL; + s_extensionsList = nullptr; } } } @@ -844,10 +844,10 @@ public: wxGLdummyWin() { hdc = 0; - CreateBase(NULL, wxID_ANY); + CreateBase(nullptr, wxID_ANY); DWORD msflags = WS_CLIPSIBLINGS | WS_CLIPCHILDREN; if( MSWCreate(wxApp::GetRegisteredClassName(wxT("wxGLCanvas"), -1, CS_OWNDC), - NULL, wxDefaultPosition, wxDefaultSize, msflags, 0) ) + nullptr, wxDefaultPosition, wxDefaultSize, msflags, 0) ) { hdc = ::GetDC(GetHwnd()); } @@ -1084,7 +1084,7 @@ int wxGLCanvas::FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, { wxLogLastError("wglChoosePixelFormatARB unavailable"); // Delete the dummy objects - ::wglMakeCurrent(NULL, NULL); + ::wglMakeCurrent(nullptr, nullptr); ::wglDeleteContext(dumctx); dummyWin->Destroy(); return 0; @@ -1122,7 +1122,7 @@ int wxGLCanvas::FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, UINT numFormats = 0; // Get the first good match - if ( !wglChoosePixelFormatARB(dummyHDC, attrsListWGL, NULL, + if ( !wglChoosePixelFormatARB(dummyHDC, attrsListWGL, nullptr, 1, &pixelFormat, &numFormats) ) { wxLogLastError("wglChoosePixelFormatARB. Is the list zero-terminated?"); @@ -1139,7 +1139,7 @@ int wxGLCanvas::FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, } // Delete the dummy objects - ::wglMakeCurrent(NULL, NULL); + ::wglMakeCurrent(nullptr, nullptr); ::wglDeleteContext(dumctx); dummyWin->Destroy(); diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index a9e9231084..14a8b06dab 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -89,7 +89,7 @@ inline Color wxColourToColor(const wxColour& col) // Do not use this pointer directly, it's only used by // GetDrawTextStringFormat() and the cleanup code in wxGDIPlusRendererModule. -StringFormat* gs_drawTextStringFormat = NULL; +StringFormat* gs_drawTextStringFormat = nullptr; // Get the string format used for the text drawing and measuring functions: // notice that it must be the same one for all of them, otherwise the drawn @@ -135,7 +135,7 @@ class wxGDIPlusContext; class wxGDIPlusPathData : public wxGraphicsPathData { public : - wxGDIPlusPathData(wxGraphicsRenderer* renderer, GraphicsPath* path = NULL); + wxGDIPlusPathData(wxGraphicsRenderer* renderer, GraphicsPath* path = nullptr); ~wxGDIPlusPathData(); virtual wxGraphicsObjectRefData *Clone() const override; @@ -210,7 +210,7 @@ private : class wxGDIPlusMatrixData : public wxGraphicsMatrixData { public : - wxGDIPlusMatrixData(wxGraphicsRenderer* renderer, Matrix* matrix = NULL) ; + wxGDIPlusMatrixData(wxGraphicsRenderer* renderer, Matrix* matrix = nullptr) ; virtual ~wxGDIPlusMatrixData() ; virtual wxGraphicsObjectRefData* Clone() const override; @@ -223,8 +223,8 @@ public : wxDouble tx=0.0, wxDouble ty=0.0) override; // 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 override; + virtual void Get(wxDouble* a=nullptr, wxDouble* b=nullptr, wxDouble* c=nullptr, + wxDouble* d=nullptr, wxDouble* tx=nullptr, wxDouble* ty=nullptr) const override; // makes this the inverse matrix virtual void Invert() override; @@ -376,7 +376,7 @@ public: #if wxUSE_PRIVATE_FONTS return m_privateFontFamily; #else - return NULL; + return nullptr; #endif // wxUSE_PRIVATE_FONTS } @@ -409,7 +409,7 @@ class wxGDIPlusContext : public wxGraphicsContext public: wxGDIPlusContext( wxGraphicsRenderer* renderer, const wxDC& dc ); wxGDIPlusContext( wxGraphicsRenderer* renderer, HDC hdc, wxDouble width, wxDouble height ); - wxGDIPlusContext( wxGraphicsRenderer* renderer, HWND hwnd, wxWindow* window = NULL); + wxGDIPlusContext( wxGraphicsRenderer* renderer, HWND hwnd, wxWindow* window = nullptr); wxGDIPlusContext( wxGraphicsRenderer* renderer, Graphics* gr); wxGDIPlusContext(wxGraphicsRenderer* renderer); @@ -488,7 +488,7 @@ public: protected: // Used from ctors (including those in the derived classes) and takes - // ownership of the graphics pointer that must be non-NULL. + // ownership of the graphics pointer that must be non-null. void Init(Graphics* graphics, int width, int height); private: @@ -542,13 +542,13 @@ private: class wxGDIPlusMeasuringContext : public wxGDIPlusContext { public: - wxGDIPlusMeasuringContext( wxGraphicsRenderer* renderer ) : wxGDIPlusContext( renderer , m_hdc = GetDC(NULL), 1000, 1000 ) + wxGDIPlusMeasuringContext( wxGraphicsRenderer* renderer ) : wxGDIPlusContext( renderer , m_hdc = GetDC(nullptr), 1000, 1000 ) { } virtual ~wxGDIPlusMeasuringContext() { - ReleaseDC( NULL, m_hdc ); + ReleaseDC( nullptr, m_hdc ); } private: @@ -699,9 +699,9 @@ wxGDIPlusPenBrushBaseData::~wxGDIPlusPenBrushBaseData() void wxGDIPlusPenBrushBaseData::Init() { - m_brush = NULL; - m_brushPath = NULL; - m_image = NULL; + m_brush = nullptr; + m_brushPath = nullptr; + m_image = nullptr; } template @@ -821,7 +821,7 @@ wxGDIPlusPenData::~wxGDIPlusPenData() void wxGDIPlusPenData::Init() { - m_pen = NULL ; + m_pen = nullptr ; } wxGDIPlusPenData::wxGDIPlusPenData( wxGraphicsRenderer* renderer, @@ -904,7 +904,7 @@ wxGDIPlusPenData::wxGDIPlusPenData( wxGraphicsRenderer* renderer, dashStyle = DashStyleCustom; wxDash *dashes; int count = info.GetDashes( &dashes ); - if ((dashes != NULL) && (count > 0)) + if ((dashes != nullptr) && (count > 0)) { REAL *userLengths = new REAL[count]; for ( int i = 0; i < count; ++i ) @@ -925,7 +925,7 @@ wxGDIPlusPenData::wxGDIPlusPenData( wxGraphicsRenderer* renderer, #if wxUSE_PALETTE (HPALETTE)bmp.GetPalette()->GetHPALETTE() #else - NULL + nullptr #endif ); m_brush = new TextureBrush(m_image); @@ -1062,7 +1062,7 @@ wxGDIPlusBrushData::wxGDIPlusBrushData( wxGraphicsRenderer* renderer , const wxB #if wxUSE_PALETTE (HPALETTE)bmp->GetPalette()->GetHPALETTE() #else - NULL + nullptr #endif ); m_brush = new TextureBrush(m_image); @@ -1084,8 +1084,8 @@ wxGDIPlusBrushData::~wxGDIPlusBrushData() namespace { -Gdiplus::PrivateFontCollection* gs_privateFonts = NULL; -Gdiplus::FontFamily* gs_pFontFamily = NULL; +Gdiplus::PrivateFontCollection* gs_privateFonts = nullptr; +Gdiplus::FontFamily* gs_pFontFamily = nullptr; } // anonymous namespace @@ -1107,8 +1107,8 @@ wxGDIPlusFontData::Init(const wxString& name, #if wxUSE_PRIVATE_FONTS // If the user has registered any private fonts, they should be used in // preference to any system-wide ones. - m_font = NULL; - m_privateFontFamily = NULL; + m_font = nullptr; + m_privateFontFamily = nullptr; if ( gs_privateFonts ) { const int count = gs_privateFonts->GetFamilyCount(); @@ -1204,23 +1204,23 @@ wxGDIPlusFontData::~wxGDIPlusFontData() wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, Bitmap* bitmap ) : wxGraphicsBitmapData( renderer ), m_bitmap( bitmap ) { - m_helper = NULL; + m_helper = nullptr; } wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, const wxBitmap &bmp) : wxGraphicsBitmapData( renderer ) { - m_bitmap = NULL; - m_helper = NULL; + m_bitmap = nullptr; + m_helper = nullptr; - Bitmap* image = NULL; + Bitmap* image = nullptr; if ( bmp.GetMask() ) { Bitmap* interim = new Bitmap((HBITMAP)bmp.GetHBITMAP(), #if wxUSE_PALETTE (HPALETTE)bmp.GetPalette()->GetHPALETTE() #else - NULL + nullptr #endif ); size_t width = interim->GetWidth(); @@ -1243,7 +1243,7 @@ wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, // If there is a mask, set the alpha bytes in the target buffer to // fully transparent or retain original value - Bitmap interimMask((HBITMAP)bmp.GetMask()->GetMaskBitmap(),NULL); + Bitmap interimMask((HBITMAP)bmp.GetMask()->GetMaskBitmap(),nullptr); wxASSERT(interimMask.GetPixelFormat() == PixelFormat1bppIndexed); BitmapData dataMask ; @@ -1285,7 +1285,7 @@ wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, #if wxUSE_PALETTE (HPALETTE)bmp.GetPalette()->GetHPALETTE() #else - NULL + nullptr #endif ); if ( bmp.HasAlpha() && GetPixelFormatSize(image->GetPixelFormat()) == 32 ) @@ -1296,7 +1296,7 @@ wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, static BitmapData data ; m_helper = image ; - image = NULL ; + image = nullptr ; m_helper->LockBits(&bounds, ImageLockModeRead, m_helper->GetPixelFormat(),&data); @@ -1314,7 +1314,7 @@ wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, wxGDIPlusBitmapData::wxGDIPlusBitmapData(wxGraphicsRenderer* renderer, const wxImage& img) : wxGraphicsBitmapData(renderer) { - m_helper = NULL; + m_helper = nullptr; m_bitmap = new Bitmap(img.GetWidth(), img.GetHeight(), img.HasAlpha() || img.HasMask() ? PixelFormat32bppPARGB : PixelFormat32bppRGB); UINT w = m_bitmap->GetWidth(); @@ -1690,7 +1690,7 @@ void wxGDIPlusPathData::Transform( const wxGraphicsMatrixData* matrix ) void wxGDIPlusPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const { RectF bounds; - m_path->GetBounds( &bounds, NULL, NULL) ; + m_path->GetBounds( &bounds, nullptr, nullptr) ; *x = bounds.X; *y = bounds.Y; *w = bounds.Width; @@ -1884,7 +1884,7 @@ wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, const wxDC& dc ~TempSetViewportOrg() { - ::SetViewportOrgEx(m_hdc, m_originPrev.x, m_originPrev.y, NULL); + ::SetViewportOrgEx(m_hdc, m_originPrev.x, m_originPrev.y, nullptr); } private: @@ -1914,9 +1914,9 @@ wxGDIPlusContext::wxGDIPlusContext( wxGraphicsRenderer* renderer, Graphics* gr wxGDIPlusContext::wxGDIPlusContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer) { - // Derived class must call Init() later but just set m_context to NULL for + // Derived class must call Init() later but just set m_context to nullptr for // safety to avoid crashing in our dtor if Init() ends up not being called. - m_context = NULL; + m_context = nullptr; } void wxGDIPlusContext::Init(Graphics* graphics, int width, int height) @@ -1988,8 +1988,8 @@ void wxGDIPlusContext::DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDoub return; wxGDIPlusOffsetHelper helper(m_context, GetContentScaleFactor(), ShouldOffset()); - Brush *brush = m_brush.IsNull() ? NULL : ((wxGDIPlusBrushData*)m_brush.GetRefData())->GetGDIPlusBrush(); - Pen *pen = m_pen.IsNull() ? NULL : ((wxGDIPlusPenData*)m_pen.GetGraphicsData())->GetGDIPlusPen(); + Brush *brush = m_brush.IsNull() ? nullptr : ((wxGDIPlusBrushData*)m_brush.GetRefData())->GetGDIPlusBrush(); + Pen *pen = m_pen.IsNull() ? nullptr : ((wxGDIPlusPenData*)m_pen.GetGraphicsData())->GetGDIPlusPen(); if ( w < 0 ) { @@ -2269,9 +2269,9 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD if (!iconInfo.GetFrom(hIcon)) return; - Bitmap interim(iconInfo.hbmColor,NULL); + Bitmap interim(iconInfo.hbmColor,nullptr); - Bitmap* image = NULL ; + Bitmap* image = nullptr ; // if it's not 32 bit, it doesn't have an alpha channel, note that since the conversion doesn't // work correctly, asking IsAlphaPixelFormat at this point fails as well @@ -2598,7 +2598,7 @@ bool wxGDIPlusRenderer::EnsureIsLoaded() { // load gdiplus.dll if not yet loaded, but don't bother doing it again // if we already tried and failed (we don't want to spend lot of time - // returning NULL from wxGraphicsContext::Create(), which may be called + // returning nullptr from wxGraphicsContext::Create(), which may be called // relatively frequently): if ( m_loaded == -1 ) { @@ -2655,10 +2655,10 @@ void wxGDIPlusRenderer::Unload() if ( gs_privateFonts ) { delete gs_privateFonts; - gs_privateFonts = NULL; + gs_privateFonts = nullptr; delete[] gs_pFontFamily; - gs_pFontFamily = NULL; + gs_pFontFamily = nullptr; } #endif // wxUSE_PRIVATE_FONTS @@ -2670,7 +2670,7 @@ void wxGDIPlusRenderer::Unload() wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxWindowDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); wxGDIPlusContext* context = new wxGDIPlusContext(this, dc); context->EnableOffset(true); return context; @@ -2679,7 +2679,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxWindowDC& dc) #if wxUSE_PRINTING_ARCHITECTURE wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); wxGDIPlusContext* context = new wxGDIPlusPrintingContext(this, dc); return context; } @@ -2688,7 +2688,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) #if wxUSE_ENH_METAFILE wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); wxGDIPlusContext* context = new wxGDIPlusPrintingContext(this, dc); return context; } @@ -2696,7 +2696,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); #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 @@ -2768,7 +2768,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) #if wxUSE_IMAGE wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromImage(wxImage& image) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); wxGDIPlusContext* context = new wxGDIPlusImageContext(this, image); context->EnableOffset(true); return context; @@ -2778,32 +2778,32 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromImage(wxImage& image) wxGraphicsContext * wxGDIPlusRenderer::CreateMeasuringContext() { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxGDIPlusMeasuringContext(this); } wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeContext( void * context ) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxGDIPlusContext(this,(Graphics*) context); } wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeWindow( void * window ) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxGDIPlusContext(this,(HWND) window); } wxGraphicsContext * wxGDIPlusRenderer::CreateContextFromNativeHDC(WXHDC dc) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxGDIPlusContext(this, new Graphics((HDC)dc)); } wxGraphicsContext * wxGDIPlusRenderer::CreateContext( wxWindow* window ) { - ENSURE_LOADED_OR_RETURN(NULL); + ENSURE_LOADED_OR_RETURN(nullptr); return new wxGDIPlusContext(this, (HWND) window->GetHWND(), window ); } @@ -2979,7 +2979,7 @@ wxImage wxGDIPlusRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp) wxGraphicsBitmap wxGDIPlusRenderer::CreateBitmapFromNativeBitmap( void *bitmap ) { ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap); - if ( bitmap != NULL ) + if ( bitmap != nullptr ) { wxGraphicsBitmap p; p.SetRefData(new wxGDIPlusBitmapData( this , (Bitmap*) bitmap )); diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 129b48e612..de481d6f18 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -93,7 +93,7 @@ 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) +#define wxCHECK_HRESULT_RET_PTR(result) wxCHECK2_HRESULT_RET(result, nullptr) // Checks the precondition of wxManagedResourceHolder::AcquireResource, namely // that it is bound to a manager. @@ -107,7 +107,7 @@ // 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"); + wxCHECK_RET(m_nativeResource != nullptr, "Could not acquire native resource"); // Helper class used to check for direct2d availability at runtime and to @@ -230,15 +230,15 @@ wxDynamicLibrary wxDirect2D::m_dllDirect3d; #endif // define the (not yet imported) functions -wxDirect2D::D2D1CreateFactory_t wxDirect2D::D2D1CreateFactory = NULL; -wxDirect2D::D2D1MakeRotateMatrix_t wxDirect2D::D2D1MakeRotateMatrix = NULL; -wxDirect2D::D2D1MakeSkewMatrix_t wxDirect2D::D2D1MakeSkewMatrix = NULL; -wxDirect2D::D2D1IsMatrixInvertible_t wxDirect2D::D2D1IsMatrixInvertible = NULL; -wxDirect2D::D2D1InvertMatrix_t wxDirect2D::D2D1InvertMatrix = NULL; -wxDirect2D::DWriteCreateFactory_t wxDirect2D::DWriteCreateFactory = NULL; +wxDirect2D::D2D1CreateFactory_t wxDirect2D::D2D1CreateFactory = nullptr; +wxDirect2D::D2D1MakeRotateMatrix_t wxDirect2D::D2D1MakeRotateMatrix = nullptr; +wxDirect2D::D2D1MakeSkewMatrix_t wxDirect2D::D2D1MakeSkewMatrix = nullptr; +wxDirect2D::D2D1IsMatrixInvertible_t wxDirect2D::D2D1IsMatrixInvertible = nullptr; +wxDirect2D::D2D1InvertMatrix_t wxDirect2D::D2D1InvertMatrix = nullptr; +wxDirect2D::DWriteCreateFactory_t wxDirect2D::DWriteCreateFactory = nullptr; #if wxD2D_DEVICE_CONTEXT_SUPPORTED -wxDirect2D::D3D11CreateDevice_t wxDirect2D::D3D11CreateDevice = NULL; +wxDirect2D::D3D11CreateDevice_t wxDirect2D::D3D11CreateDevice = nullptr; #endif // define the interface GUIDs @@ -401,7 +401,7 @@ public: if ( m_nextIndex < m_filePaths.size() ) { - hr = m_factory->CreateFontFileReference(m_filePaths[m_nextIndex].wc_str(), NULL, &m_currentFile); + hr = m_factory->CreateFontFileReference(m_filePaths[m_nextIndex].wc_str(), nullptr, &m_currentFile); if ( SUCCEEDED(hr) ) { *pHasCurrentFile = TRUE; @@ -462,7 +462,7 @@ public: if ( !pFontFileEnumerator ) return E_INVALIDARG; - *pFontFileEnumerator = NULL; + *pFontFileEnumerator = nullptr; if ( collectionKeySize != sizeof(wxDirect2DFontKey) ) return E_INVALIDARG; @@ -534,14 +534,14 @@ wxDirect2DFontKey wxDirect2DFontCollectionLoader::ms_key(0); #endif // wxUSE_PRIVATE_FONTS -static IWICImagingFactory* gs_WICImagingFactory = NULL; +static IWICImagingFactory* gs_WICImagingFactory = nullptr; IWICImagingFactory* wxWICImagingFactory() { - if (gs_WICImagingFactory == NULL) { + if (gs_WICImagingFactory == nullptr) { HRESULT hr = CoCreateInstance( CLSID_WICImagingFactory, - NULL, + nullptr, CLSCTX_INPROC_SERVER, wxIID_IWICImagingFactory, (LPVOID*)&gs_WICImagingFactory); @@ -550,14 +550,14 @@ IWICImagingFactory* wxWICImagingFactory() return gs_WICImagingFactory; } -static ID2D1Factory* gs_ID2D1Factory = NULL; +static ID2D1Factory* gs_ID2D1Factory = nullptr; ID2D1Factory* wxD2D1Factory() { if (!wxDirect2D::Initialize()) - return NULL; + return nullptr; - if (gs_ID2D1Factory == NULL) + if (gs_ID2D1Factory == nullptr) { D2D1_FACTORY_OPTIONS factoryOptions = {D2D1_DEBUG_LEVEL_NONE}; @@ -583,14 +583,14 @@ ID2D1Factory* wxD2D1Factory() return gs_ID2D1Factory; } -static IDWriteFactory* gs_IDWriteFactory = NULL; +static IDWriteFactory* gs_IDWriteFactory = nullptr; IDWriteFactory* wxDWriteFactory() { if (!wxDirect2D::Initialize()) - return NULL; + return nullptr; - if (gs_IDWriteFactory == NULL) + if (gs_IDWriteFactory == nullptr) { wxDirect2D::DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, @@ -641,7 +641,7 @@ public: // Checks if the resources was previously acquired virtual bool IsResourceAcquired() = 0; - // Returns the managed resource or NULL if the resources + // Returns the managed resource or nullptr if the resources // was not previously acquired virtual void* GetResource() = 0; @@ -724,7 +724,7 @@ template class wxD2DResourceHolder: public wxManagedResourceHolder { public: - wxD2DResourceHolder() : m_resourceManager(NULL) + wxD2DResourceHolder() : m_resourceManager(nullptr) { } @@ -736,7 +736,7 @@ public: bool IsResourceAcquired() override { - return m_nativeResource != NULL; + return m_nativeResource != nullptr; } void* GetResource() override @@ -788,12 +788,12 @@ public: return; m_resourceManager->UnregisterResourceHolder(this); - m_resourceManager = NULL; + m_resourceManager = nullptr; } bool IsBound() override { - return m_resourceManager != NULL; + return m_resourceManager != nullptr; } wxD2DResourceManager* GetManager() override @@ -1048,7 +1048,7 @@ wxCOMPtr wxD2DConvertRegionToGeometry(ID2D1Factory* direct2dFacto rectCount = 1; geometries = new ID2D1Geometry*[rectCount]; - geometries[0] = NULL; + geometries[0] = nullptr; hr = direct2dFactory->CreateRectangleGeometry( D2D1::RectF(0.0F, 0.0F, 0.0F, 0.0F), (ID2D1RectangleGeometry**)(&geometries[0])); @@ -1068,7 +1068,7 @@ wxCOMPtr wxD2DConvertRegionToGeometry(ID2D1Factory* direct2dFacto i = 0; while(regionIterator) { - geometries[i] = NULL; + geometries[i] = nullptr; wxRect rect = regionIterator.GetRect(); rect.SetWidth(rect.GetWidth() + 1); @@ -1159,8 +1159,8 @@ public: 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) override; - void Get(wxDouble* a = NULL, wxDouble* b = NULL, wxDouble* c = NULL, - wxDouble* d = NULL, wxDouble* tx = NULL, wxDouble* ty = NULL) const override; + void Get(wxDouble* a = nullptr, wxDouble* b = nullptr, wxDouble* c = nullptr, + wxDouble* d = nullptr, wxDouble* tx = nullptr, wxDouble* ty = nullptr) const override; void Invert() override; @@ -1480,14 +1480,14 @@ wxD2DPathData::wxGraphicsObjectRefData* wxD2DPathData::Clone() const if ( FAILED(hr) ) { delete newPathData; - return NULL; + return nullptr; } // Copy the collection of transformed geometries. ID2D1TransformedGeometry* pTransformedGeometry; for ( size_t i = 0; i < m_pTransformedGeometries.size(); i++ ) { - pTransformedGeometry = NULL; + pTransformedGeometry = nullptr; hr = m_direct2dfactory->CreateTransformedGeometry( m_pTransformedGeometries[i], D2D1::Matrix3x2F::Identity(), &pTransformedGeometry); @@ -1505,7 +1505,7 @@ wxD2DPathData::wxGraphicsObjectRefData* wxD2DPathData::Clone() const void wxD2DPathData::Flush() { - if (m_geometrySink != NULL) + if (m_geometrySink != nullptr) { if ( m_figureOpened ) { @@ -1535,7 +1535,7 @@ void wxD2DPathData::EnsureGeometryOpen() hr = newPathGeometry->Open(&m_geometrySink); wxCHECK_HRESULT_RET(hr); - if (m_pathGeometry != NULL) + if (m_pathGeometry != nullptr) { hr = m_pathGeometry->Stream(m_geometrySink); wxCHECK_HRESULT_RET(hr); @@ -1550,7 +1550,7 @@ void wxD2DPathData::EnsureSinkOpen() { EnsureGeometryOpen(); - if (m_geometrySink == NULL) + if (m_geometrySink == nullptr) { HRESULT hr = m_pathGeometry->Open(&m_geometrySink); wxCHECK_HRESULT_RET(hr); @@ -1908,8 +1908,8 @@ void wxD2DPathData::AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) // gets the last point of the current path, (0,0) if not yet set void wxD2DPathData::GetCurrentPoint(wxDouble* x, wxDouble* y) const { - if (x != NULL) *x = m_currentPoint.x; - if (y != NULL) *y = m_currentPoint.y; + if (x != nullptr) *x = m_currentPoint.x; + if (y != nullptr) *y = m_currentPoint.y; } // adds another path @@ -1919,7 +1919,7 @@ void wxD2DPathData::AddPath(const wxGraphicsPathData* path) const_cast(static_cast(path)); // Nothing to do if geometry of appended path is not initialized. - if ( pathSrc->m_pathGeometry == NULL || pathSrc->m_geometrySink == NULL ) + if ( pathSrc->m_pathGeometry == nullptr || pathSrc->m_geometrySink == nullptr ) return; // Because only closed geometry (with closed sink) @@ -1954,7 +1954,7 @@ void wxD2DPathData::AddPath(const wxGraphicsPathData* path) Flush(); HRESULT hr; - ID2D1TransformedGeometry* pTransformedGeometry = NULL; + ID2D1TransformedGeometry* pTransformedGeometry = nullptr; // Add current geometry to the collection transformed geometries. hr = m_direct2dfactory->CreateTransformedGeometry(m_pathGeometry, D2D1::Matrix3x2F::Identity(), &pTransformedGeometry); @@ -1964,7 +1964,7 @@ void wxD2DPathData::AddPath(const wxGraphicsPathData* path) // Add to the collection transformed geometries from the appended path. for ( size_t i = 0; i < pathSrc->m_pTransformedGeometries.size(); i++ ) { - pTransformedGeometry = NULL; + pTransformedGeometry = nullptr; hr = m_direct2dfactory->CreateTransformedGeometry( pathSrc->m_pTransformedGeometries[i], D2D1::Matrix3x2F::Identity(), &pTransformedGeometry); @@ -2074,7 +2074,7 @@ void wxD2DPathData::Transform(const wxGraphicsMatrixData* matrix) // Apply given transformation to all previously stored geometries too. for( size_t i = 0; i < m_pTransformedGeometries.size(); i++ ) { - pTransformedGeometry = NULL; + pTransformedGeometry = nullptr; hr = m_direct2dfactory->CreateTransformedGeometry(m_pTransformedGeometries[i], m, &pTransformedGeometry); wxCHECK_HRESULT_RET(hr); @@ -2084,7 +2084,7 @@ void wxD2DPathData::Transform(const wxGraphicsMatrixData* matrix) // Transform current geometry and add the result // to the collection of transformed geometries. - pTransformedGeometry = NULL; + pTransformedGeometry = nullptr; hr = m_direct2dfactory->CreateTransformedGeometry(m_pathGeometry, m, &pTransformedGeometry); wxCHECK_HRESULT_RET(hr); m_pTransformedGeometries.push_back(pTransformedGeometry); @@ -2166,21 +2166,21 @@ wxCOMPtr wxCreateWICBitmap(const WXHBITMAP sourceBitmap, bool HRESULT hr; wxCOMPtr wicBitmap; - hr = wxWICImagingFactory()->CreateBitmapFromHBITMAP(sourceBitmap, NULL, hasAlpha ? WICBitmapUsePremultipliedAlpha : WICBitmapIgnoreAlpha, &wicBitmap); - wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + hr = wxWICImagingFactory()->CreateBitmapFromHBITMAP(sourceBitmap, nullptr, hasAlpha ? WICBitmapUsePremultipliedAlpha : WICBitmapIgnoreAlpha, &wicBitmap); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(nullptr)); wxCOMPtr converter; hr = wxWICImagingFactory()->CreateFormatConverter(&converter); - wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(nullptr)); WICPixelFormatGUID pixelFormat = hasAlpha || forceAlpha ? GUID_WICPixelFormat32bppPBGRA : GUID_WICPixelFormat32bppBGR; hr = converter->Initialize( wicBitmap, pixelFormat, - WICBitmapDitherTypeNone, NULL, 0.f, + WICBitmapDitherTypeNone, nullptr, 0.f, WICBitmapPaletteTypeMedianCut); - wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(nullptr)); return wxCOMPtr(converter); } @@ -2211,7 +2211,7 @@ void CreateWICBitmapFromImage(const wxImage& img, bool forceAlpha, IWICBitmap** wxCHECK_HRESULT_RET(hr); UINT bufferSize = 0; - BYTE* pBuffer = NULL; + BYTE* pBuffer = nullptr; hr = pLock->GetDataPointer(&bufferSize, &pBuffer); wxCHECK_HRESULT_RET(hr); @@ -2290,7 +2290,7 @@ void CreateImageFromWICBitmap(IWICBitmap* pBmp, wxImage* pImg) wxCHECK_HRESULT_RET(hr); UINT bufferSize = 0; - BYTE* pBmpBuffer = NULL; + BYTE* pBmpBuffer = nullptr; hr = pLock->GetDataPointer(&bufferSize, &pBmpBuffer); wxCHECK_HRESULT_RET(hr); @@ -2358,21 +2358,21 @@ public: HRESULT STDMETHODCALLTYPE GetSize(__RPC__out UINT *width, __RPC__out UINT *height) override { - if (width != NULL) *width = 8; - if (height != NULL) *height = 8; + if (width != nullptr) *width = 8; + if (height != nullptr) *height = 8; return S_OK; } HRESULT STDMETHODCALLTYPE GetPixelFormat(__RPC__out WICPixelFormatGUID *pixelFormat) override { - if (pixelFormat != NULL) *pixelFormat = GUID_WICPixelFormat32bppPBGRA; + if (pixelFormat != nullptr) *pixelFormat = GUID_WICPixelFormat32bppPBGRA; return S_OK; } HRESULT STDMETHODCALLTYPE GetResolution(__RPC__out double *dpiX, __RPC__out double *dpiY) override { - if (dpiX != NULL) *dpiX = 96.0; - if (dpiY != NULL) *dpiY = 96.0; + if (dpiX != nullptr) *dpiX = 96.0; + if (dpiY != nullptr) *dpiY = 96.0; return S_OK; } @@ -2432,7 +2432,7 @@ public: return E_INVALIDARG; } - *object = NULL; + *object = nullptr; if (referenceId == IID_IUnknown || referenceId == wxIID_IWICBitmapSource) { @@ -2536,9 +2536,9 @@ public: BYTE* maskBuffer = new BYTE[4 * w * h]; BYTE* resultBuffer; - hr = colorBitmap->CopyPixels(NULL, w * 4, 4 * w * h, colorBuffer); + hr = colorBitmap->CopyPixels(nullptr, w * 4, 4 * w * h, colorBuffer); wxCHECK_HRESULT_RET(hr); - hr = maskBitmap->CopyPixels(NULL, w * 4, 4 * w * h, maskBuffer); + hr = maskBitmap->CopyPixels(nullptr, w * 4, 4 * w * h, maskBuffer); wxCHECK_HRESULT_RET(hr); { @@ -2610,15 +2610,15 @@ public: { wxCOMPtr clipper; HRESULT hr = wxWICImagingFactory()->CreateBitmapClipper(&clipper); - wxCHECK2_HRESULT_RET(hr, NULL); + wxCHECK2_HRESULT_RET(hr, nullptr); WICRect r = { (INT)x, (INT)y, (INT)w, (INT)h }; hr = clipper->Initialize(m_srcBitmap, &r); - wxCHECK2_HRESULT_RET(hr, NULL); + wxCHECK2_HRESULT_RET(hr, nullptr); wxCOMPtr subBmp; hr = wxWICImagingFactory()->CreateBitmapFromSource(clipper, WICBitmapNoCache, &subBmp); - wxCHECK2_HRESULT_RET(hr, NULL); + wxCHECK2_HRESULT_RET(hr, nullptr); return new wxD2DBitmapResourceHolder(subBmp); } @@ -2949,7 +2949,7 @@ private: //----------------------------------------------------------------------------- wxD2DBrushData::wxD2DBrushData(wxGraphicsRenderer* renderer, const wxBrush brush) - : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(NULL) + : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(nullptr) { if (brush.GetStyle() == wxBRUSHSTYLE_SOLID) { @@ -2966,7 +2966,7 @@ wxD2DBrushData::wxD2DBrushData(wxGraphicsRenderer* renderer, const wxBrush brush } wxD2DBrushData::wxD2DBrushData(wxGraphicsRenderer* renderer) - : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(NULL) + : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(nullptr) { } @@ -3133,7 +3133,7 @@ void wxD2DPenData::CreateStrokeStyle(ID2D1Factory* const direct2dfactory) D2D1_DASH_STYLE dashStyle = wxD2DConvertPenStyle(m_penInfo.GetStyle()); int dashCount = 0; - FLOAT* dashes = NULL; + FLOAT* dashes = nullptr; if (dashStyle == D2D1_DASH_STYLE_CUSTOM) { @@ -3237,7 +3237,7 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, const wxFont& font, c if (logfont.lfFaceName[0] == L'\0') { // The length of the font name must not exceed LF_FACESIZE TCHARs, - // including the terminating NULL. + // including the terminating nullptr. wxString name = font.GetFaceName().Mid(0, WXSIZEOF(logfont.lfFaceName)-1); for (unsigned int i = 0; i < name.length(); ++i) { @@ -3247,7 +3247,7 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, const wxFont& font, c } wxCOMPtr fontFamily; - wxCOMPtr fontCollection; // NULL if font is taken from the system collection + wxCOMPtr fontCollection; // nullptr if font is taken from the system collection hr = gdiInterop->CreateFontFromLOGFONT(&logfont, &m_font); if ( hr == DWRITE_E_NOFONT ) @@ -3274,7 +3274,7 @@ wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, const wxFont& font, c &gs_pPrivateFontCollection); wxCHECK_HRESULT_RET(hr); } - wxCHECK_RET(gs_pPrivateFontCollection != NULL, "No custom font collection created"); + wxCHECK_RET(gs_pPrivateFontCollection != nullptr, "No custom font collection created"); UINT32 fontIdx = ~0U; BOOL fontFound = FALSE; @@ -3365,7 +3365,7 @@ wxCOMPtr wxD2DFontData::CreateTextLayout(const wxString& text MAX_WIDTH, MAX_HEIGHT, &textLayout); - wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(nullptr)); DWRITE_TEXT_RANGE textRange = { 0, (UINT32) text.length() }; @@ -3630,7 +3630,7 @@ protected: wxCOMPtr context; hr = D3D11CreateDevice( - NULL, // specify null to use the default adapter + nullptr, // specify null to use the default adapter D3D_DRIVER_TYPE_HARDWARE, 0, creationFlags, // optionally set debug and Direct2D compatibility flags @@ -3695,8 +3695,8 @@ private: m_dxgiDevice, m_hwnd, &swapChainDesc, - NULL, // allow on all displays - NULL, + nullptr, // allow on all displays + nullptr, &m_swapChain); wxCHECK_HRESULT_RET(hr); @@ -3816,7 +3816,7 @@ public: void Clip(wxDouble, wxDouble, wxDouble, wxDouble) override {} void ResetClip() override {} void GetClipBox(wxDouble*, wxDouble*, wxDouble*, wxDouble*) override {} - void* GetNativeContext() override { return NULL; } + void* GetNativeContext() override { return nullptr; } bool SetAntialiasMode(wxAntialiasMode) override { return false; } bool SetInterpolationQuality(wxInterpolationQuality) override { return false; } bool SetCompositionMode(wxCompositionMode) override { return false; } @@ -3836,7 +3836,7 @@ public: void PushState() override {} void PopState() override {} void Flush() override {} - WXHDC GetNativeHDC() override { return NULL; }; + WXHDC GetNativeHDC() override { return nullptr; }; void ReleaseNativeHDC(WXHDC WXUNUSED(hdc)) override {}; protected: @@ -3863,7 +3863,7 @@ public: for (unsigned int i = 0; i < text.length(); ++i) { wxDouble width; - GetTextExtent(fontData, text.SubString(0, i), &width, NULL, NULL, NULL); + GetTextExtent(fontData, text.SubString(0, i), &width, nullptr, nullptr, nullptr); widths.push_back(width); } } @@ -3881,11 +3881,11 @@ public: FLOAT ratio = fontData->GetTextFormat()->GetFontSize() / (FLOAT)fontMetrics.designUnitsPerEm; - if (width != NULL) *width = textMetrics.widthIncludingTrailingWhitespace; - if (height != NULL) *height = textMetrics.height; + if (width != nullptr) *width = textMetrics.widthIncludingTrailingWhitespace; + if (height != nullptr) *height = textMetrics.height; - if (descent != NULL) *descent = fontMetrics.descent * ratio; - if (externalLeading != NULL) *externalLeading = wxMax(0.0f, (fontMetrics.ascent + fontMetrics.descent) * ratio - textMetrics.height); + if (descent != nullptr) *descent = fontMetrics.descent * ratio; + if (externalLeading != nullptr) *externalLeading = wxMax(0.0f, (fontMetrics.ascent + fontMetrics.descent) * ratio - textMetrics.height); } }; @@ -3901,14 +3901,14 @@ public: wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HWND hwnd, - wxWindow* window = NULL); + wxWindow* window = nullptr); // Create the context for the given HDC which may be associated (if it's // non-null) with the given wxDC. wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HDC hdc, - const wxDC* dc = NULL, + const wxDC* dc = nullptr, D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE_IGNORE); #if wxUSE_IMAGE @@ -4117,7 +4117,7 @@ wxD2DContext::wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dF void wxD2DContext::Init() { - m_cachedRenderTarget = NULL; + m_cachedRenderTarget = nullptr; m_composition = wxCOMPOSITION_OVER; m_renderTargetHolder->Bind(this); m_enableOffset = true; @@ -4459,7 +4459,7 @@ void wxD2DContext::BeginLayer(wxDouble opacity) LayerData ld; ld.type = OTHER_LAYER; ld.params = D2D1::LayerParameters(D2D1::InfiniteRect(), - NULL, + nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), opacity); ld.layer = layer; @@ -4579,7 +4579,7 @@ wxGraphicsMatrix wxD2DContext::GetTransform() const { D2D1::Matrix3x2F transformMatrix; - if (GetRenderTarget() != NULL) + if (GetRenderTarget() != nullptr) { GetRenderTarget()->GetTransform(&transformMatrix); @@ -4978,14 +4978,14 @@ WXHDC wxD2DContext::GetNativeHDC() wxASSERT(m_gdiRenderTarget); HDC hdc; HRESULT hr = m_gdiRenderTarget->GetDC(D2D1_DC_INITIALIZE_MODE_COPY, &hdc); - wxCHECK_MSG(SUCCEEDED(hr), NULL, wxString::Format("Can't get HDC from Direct2D context (hr=%x)", hr)); + wxCHECK_MSG(SUCCEEDED(hr), nullptr, wxString::Format("Can't get HDC from Direct2D context (hr=%x)", hr)); return hdc; }; void wxD2DContext::ReleaseNativeHDC(WXHDC WXUNUSED(hdc)) { wxCHECK_RET(m_gdiRenderTarget, "Can't release HDC for Direct2D context"); - HRESULT hr = m_gdiRenderTarget->ReleaseDC(NULL); + HRESULT hr = m_gdiRenderTarget->ReleaseDC(nullptr); wxCHECK_HRESULT_RET(hr); }; @@ -5092,12 +5092,12 @@ private : wxIMPLEMENT_DYNAMIC_CLASS(wxD2DRenderer,wxGraphicsRenderer); -static wxD2DRenderer *gs_D2DRenderer = NULL; +static wxD2DRenderer *gs_D2DRenderer = nullptr; wxGraphicsRenderer* wxGraphicsRenderer::GetDirect2DRenderer() { if (!wxDirect2D::Initialize()) - return NULL; + return nullptr; if (!gs_D2DRenderer) { @@ -5110,7 +5110,7 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDirect2DRenderer() wxD2DRenderer::wxD2DRenderer() : m_direct2dFactory(wxD2D1Factory()) { - if ( m_direct2dFactory.get() == NULL ) + if ( m_direct2dFactory.get() == nullptr ) { wxFAIL_MSG("Could not create Direct2D Factory."); } @@ -5141,7 +5141,7 @@ wxGraphicsContext* wxD2DRenderer::CreateContext(const wxMemoryDC& dc) wxGraphicsContext* wxD2DRenderer::CreateContext(const wxPrinterDC& WXUNUSED(dc)) { wxFAIL_MSG("not implemented"); - return NULL; + return nullptr; } #endif @@ -5149,7 +5149,7 @@ wxGraphicsContext* wxD2DRenderer::CreateContext(const wxPrinterDC& WXUNUSED(dc)) wxGraphicsContext* wxD2DRenderer::CreateContext(const wxEnhMetaFileDC& WXUNUSED(dc)) { wxFAIL_MSG("not implemented"); - return NULL; + return nullptr; } #endif @@ -5425,7 +5425,7 @@ public: if ( gs_WICImagingFactory ) { gs_WICImagingFactory->Release(); - gs_WICImagingFactory = NULL; + gs_WICImagingFactory = nullptr; } if ( gs_IDWriteFactory ) @@ -5438,19 +5438,19 @@ public: } #endif // wxUSE_PRIVATE_FONTS gs_IDWriteFactory->Release(); - gs_IDWriteFactory = NULL; + gs_IDWriteFactory = nullptr; } if ( gs_D2DRenderer ) { delete gs_D2DRenderer; - gs_D2DRenderer = NULL; + gs_D2DRenderer = nullptr; } if ( gs_ID2D1Factory ) { gs_ID2D1Factory->Release(); - gs_ID2D1Factory = NULL; + gs_ID2D1Factory = nullptr; } } diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 1fa8e03212..5d5c73ded8 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -190,7 +190,7 @@ private: // doesn't know about them and so we can't use Header_GetOrderArray() wxArrayInt m_colIndices; - // the image list: initially NULL, created on demand + // the image list: initially nullptr, created on demand wxImageList *m_imageList; // the offset of the window used to emulate scrolling it @@ -202,7 +202,7 @@ private: // a column is currently being resized bool m_isColBeingResized; - // the custom draw helper: initially NULL, created on demand, use + // the custom draw helper: initially nullptr, created on demand, use // GetCustomDraw() to do it wxMSWHeaderCtrlCustomDraw *m_customDraw; }; @@ -220,11 +220,11 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxMSWHeaderCtrlNameStr[] = "wxMSWHeader void wxMSWHeaderCtrl::Init() { m_numColumns = 0; - m_imageList = NULL; + m_imageList = nullptr; m_scrollOffset = 0; m_colBeingDragged = -1; m_isColBeingResized = false; - m_customDraw = NULL; + m_customDraw = nullptr; Bind(wxEVT_DPI_CHANGED, &wxMSWHeaderCtrl::WXHandleDPIChanged, this); } @@ -340,7 +340,7 @@ void wxMSWHeaderCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI) void wxMSWHeaderCtrl::WXHandleDPIChanged(wxDPIChangedEvent& event) { delete m_imageList; - m_imageList = NULL; + m_imageList = nullptr; for (unsigned int i = 0; i < m_numColumns; ++i) { UpdateHeader(i); @@ -679,10 +679,10 @@ wxMSWHeaderCtrlCustomDraw* wxMSWHeaderCtrl::GetCustomDraw() if ( m_customDraw ) { delete m_customDraw; - m_customDraw = NULL; + m_customDraw = nullptr; } - return NULL; + return nullptr; } // We do have at least one custom colour, so enable custom drawing. @@ -1037,7 +1037,7 @@ bool wxMSWHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) void wxHeaderCtrl::Init() { - m_nativeControl = NULL; + m_nativeControl = nullptr; } bool wxHeaderCtrl::Create(wxWindow *parent, @@ -1073,7 +1073,7 @@ bool wxHeaderCtrl::Create(wxWindow *parent, void wxHeaderCtrl::OnSize(wxSizeEvent& WXUNUSED(event)) { - if (m_nativeControl != NULL) // check whether initialisation has been done + if (m_nativeControl != nullptr) // check whether initialisation has been done { int cw, ch; GetClientSize(&cw, &ch); diff --git a/src/msw/helpbest.cpp b/src/msw/helpbest.cpp index f41b8a1afb..fb75d546e6 100644 --- a/src/msw/helpbest.cpp +++ b/src/msw/helpbest.cpp @@ -38,7 +38,7 @@ bool wxBestHelpController::Initialize( const wxString& filename ) if( chm->Initialize( GetValidFilename( filename ) ) ) { m_helpController = chm; - m_parentWindow = NULL; + m_parentWindow = nullptr; return true; } @@ -53,7 +53,7 @@ bool wxBestHelpController::Initialize( const wxString& filename ) if( html->Initialize( GetValidFilename( filename ) ) ) { m_helpController = html; - m_parentWindow = NULL; + m_parentWindow = nullptr; return true; } diff --git a/src/msw/helpchm.cpp b/src/msw/helpchm.cpp index b998d061a4..1dcfa83202 100644 --- a/src/msw/helpchm.cpp +++ b/src/msw/helpchm.cpp @@ -42,7 +42,7 @@ HTMLHELP GetHtmlHelpFunction() { - static HTMLHELP s_htmlHelp = NULL; + static HTMLHELP s_htmlHelp = nullptr; if ( !s_htmlHelp ) { @@ -66,7 +66,7 @@ HTMLHELP GetHtmlHelpFunction() } // find the window to use in HtmlHelp() call: use the given one by default but -// fall back to the top level app window and then the desktop if it's NULL +// fall back to the top level app window and then the desktop if it's null static HWND GetSuitableHWND(wxWindow *win) { if ( !win ) @@ -164,14 +164,14 @@ wxCHMHelpController::DoDisplayTextPopup(const wxChar *text, popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1; - popup.pszFont = NULL; + popup.pszFont = nullptr; - return CallHtmlHelp(window, NULL, HH_DISPLAY_TEXT_POPUP, &popup); + return CallHtmlHelp(window, nullptr, HH_DISPLAY_TEXT_POPUP, &popup); } bool wxCHMHelpController::DisplayContextPopup(int contextId) { - return DoDisplayTextPopup(NULL, wxGetMousePosition(), contextId, + return DoDisplayTextPopup(nullptr, wxGetMousePosition(), contextId, GetParentWindow()); } @@ -220,10 +220,10 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k, link.cbStruct = sizeof(HH_AKLINK); link.fReserved = FALSE; link.pszKeywords = k.t_str(); - link.pszUrl = NULL; - link.pszMsgText = NULL; - link.pszMsgTitle = NULL; - link.pszWindow = NULL; + link.pszUrl = nullptr; + link.pszMsgText = nullptr; + link.pszMsgTitle = nullptr; + link.pszWindow = nullptr; link.fIndexOnFail = TRUE; return CallHtmlHelp(HH_KEYWORD_LOOKUP, &link); @@ -232,7 +232,7 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k, bool wxCHMHelpController::Quit() { - return CallHtmlHelp(NULL, NULL, HH_CLOSE_ALL); + return CallHtmlHelp(nullptr, nullptr, HH_CLOSE_ALL); } wxString wxCHMHelpController::GetValidFilename() const diff --git a/src/msw/icon.cpp b/src/msw/icon.cpp index 7bd95cba8b..6dac235d34 100644 --- a/src/msw/icon.cpp +++ b/src/msw/icon.cpp @@ -96,7 +96,7 @@ wxObjectRefData *wxIcon::CloneRefData(const wxObjectRefData *dataOrig) const const wxIconRefData * data = static_cast(dataOrig); if ( !data ) - return NULL; + return nullptr; // we don't have to copy m_hIcon because we're only called from SetHICON() // which overwrites m_hIcon anyhow currently @@ -158,7 +158,7 @@ bool wxIcon::CreateFromHICON(WXHICON icon) bool wxIcon::InitFromHICON(WXHICON icon, int width, int height, double scale) { #if wxDEBUG_LEVEL >= 2 - if ( icon != NULL ) + if ( icon != nullptr ) { wxSize size = wxGetHiconSize(icon); wxASSERT_MSG(size.GetWidth() == width && size.GetHeight() == height, diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index 7efb600556..d326621bec 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -66,7 +66,7 @@ static wxColour GetDefaultMaskColour(); // Creates an image list bool wxImageList::Create(int width, int height, bool mask, int initial) { - wxASSERT_MSG( m_hImageList == NULL, "Recreating existing wxImageList?" ); + wxASSERT_MSG( m_hImageList == nullptr, "Recreating existing wxImageList?" ); // Prevent from storing negative dimensions m_size = wxSize(wxMax(width, 0), wxMax(height, 0)); @@ -142,7 +142,7 @@ bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const class wxImageList::wxMSWBitmaps { public: - wxMSWBitmaps() : hbmp(NULL) { } + wxMSWBitmaps() : hbmp(nullptr) { } #if wxUSE_WXDIB && wxUSE_IMAGE void InitFromImageWithAlpha(const wxImage& img) @@ -247,7 +247,7 @@ wxImageList::GetImageListBitmaps(wxMSWBitmaps& bitmaps, { wxMask maskToUse; - HBITMAP hbmpMask = NULL; + HBITMAP hbmpMask = nullptr; // Always use mask if it is specified. if ( mask.IsOk() ) diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp index dbaa82d7c9..37baa87135 100644 --- a/src/msw/iniconf.cpp +++ b/src/msw/iniconf.cpp @@ -253,13 +253,13 @@ bool wxIniConfig::IsEmpty() const { wxChar szBuf[1024]; - GetPrivateProfileString(m_strGroup.t_str(), NULL, wxT(""), + GetPrivateProfileString(m_strGroup.t_str(), nullptr, wxT(""), szBuf, WXSIZEOF(szBuf), m_strLocalFilename.t_str()); if ( !wxIsEmpty(szBuf) ) return false; - GetProfileString(m_strGroup.t_str(), NULL, wxT(""), szBuf, WXSIZEOF(szBuf)); + GetProfileString(m_strGroup.t_str(), nullptr, wxT(""), szBuf, WXSIZEOF(szBuf)); if ( !wxIsEmpty(szBuf) ) return false; @@ -279,7 +279,7 @@ bool wxIniConfig::DoReadString(const wxString& szKey, wxString *pstr) const // first look in the private INI file - // NB: the lpDefault param to GetPrivateProfileString can't be NULL + // NB: the lpDefault param to GetPrivateProfileString can't be null GetPrivateProfileString(m_strGroup.t_str(), strKey.t_str(), wxT(""), szBuf, WXSIZEOF(szBuf), m_strLocalFilename.t_str()); @@ -381,7 +381,7 @@ bool wxIniConfig::DoWriteBinary(const wxString& WXUNUSED(key), bool wxIniConfig::Flush(bool /* bCurrentOnly */) { // this is just the way it works - return WritePrivateProfileString(NULL, NULL, NULL, + return WritePrivateProfileString(nullptr, nullptr, nullptr, m_strLocalFilename.t_str()) != 0; } @@ -391,20 +391,20 @@ bool wxIniConfig::Flush(bool /* bCurrentOnly */) bool wxIniConfig::DeleteEntry(const wxString& szKey, bool bGroupIfEmptyAlso) { - // passing NULL as value to WritePrivateProfileString deletes the key + // passing nullptr as value to WritePrivateProfileString deletes the key wxConfigPathChanger path(this, szKey); wxString strKey = GetPrivateKeyName(path.Name()); if (WritePrivateProfileString(m_strGroup.t_str(), strKey.t_str(), - NULL, m_strLocalFilename.t_str()) == 0) + nullptr, m_strLocalFilename.t_str()) == 0) return false; if ( !bGroupIfEmptyAlso || !IsEmpty() ) return true; // delete the current group too - bool bOk = WritePrivateProfileString(m_strGroup.t_str(), NULL, - NULL, m_strLocalFilename.t_str()) != 0; + bool bOk = WritePrivateProfileString(m_strGroup.t_str(), nullptr, + nullptr, m_strLocalFilename.t_str()) != 0; if ( !bOk ) { @@ -418,10 +418,10 @@ bool wxIniConfig::DeleteGroup(const wxString& szKey) { wxConfigPathChanger path(this, szKey); - // passing NULL as section name to WritePrivateProfileString deletes the + // passing nullptr as section name to WritePrivateProfileString deletes the // whole section according to the docs - bool bOk = WritePrivateProfileString(path.Name().t_str(), NULL, - NULL, m_strLocalFilename.t_str()) != 0; + bool bOk = WritePrivateProfileString(path.Name().t_str(), nullptr, + nullptr, m_strLocalFilename.t_str()) != 0; if ( !bOk ) { @@ -438,7 +438,7 @@ bool wxIniConfig::DeleteGroup(const wxString& szKey) bool wxIniConfig::DeleteAll() { // first delete our group in win.ini - WriteProfileString(GetVendorName().t_str(), NULL, NULL); + WriteProfileString(GetVendorName().t_str(), nullptr, nullptr); // then delete our own ini file wxChar szBuf[MAX_PATH]; diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 3e3cae3e26..9534d4352d 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -76,7 +76,7 @@ private: wxJoystickThread::wxJoystickThread(int joystick) : m_joystick(joystick), m_buttons(0), - m_catchwin(NULL), + m_catchwin(nullptr), m_polling(0), m_joyInfo(), m_lastJoyInfo() @@ -130,7 +130,7 @@ void* wxJoystickThread::Entry() m_lastJoyInfo = m_joyInfo; } - return NULL; + return nullptr; } @@ -149,7 +149,7 @@ wxJoystick::wxJoystick(int joystick) JOYINFO joyInfo; int i, maxsticks; - m_thread = NULL; + m_thread = nullptr; maxsticks = joyGetNumDevs(); for( i=0; iSetPolling(NULL, 0); + m_thread->SetPolling(nullptr, 0); return true; } return false; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index ac2112528e..a2dfaf4dff 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -376,7 +376,7 @@ void *wxListBox::DoGetItemClientData(unsigned int n) const { wxLogLastError(wxT("LB_GETITEMDATA")); - return NULL; + return nullptr; } return (void *)rc; @@ -524,8 +524,8 @@ void wxListBox::SetString(unsigned int n, const wxString& s) // remember the state of the item bool wasSelected = IsSelected(n); - void *oldData = NULL; - wxClientData *oldObjData = NULL; + void *oldData = nullptr; + wxClientData *oldObjData = nullptr; if ( HasClientUntypedData() ) oldData = GetClientData(n); else if ( HasClientObjectData() ) @@ -614,7 +614,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s) bool wxListBox::MSWSetTabStops(const wxVector& tabStops) { return SendMessage(GetHwnd(), LB_SETTABSTOPS, (WPARAM)tabStops.size(), - (LPARAM)(tabStops.empty() ? NULL : &tabStops[0])) == TRUE; + (LPARAM)(tabStops.empty() ? nullptr : &tabStops[0])) == TRUE; } wxSize wxListBox::DoGetBestClientSize() const @@ -625,7 +625,7 @@ wxSize wxListBox::DoGetBestClientSize() const for (unsigned int i = 0; i < m_noItems; i++) { wxString str(GetString(i)); - GetTextExtent(str, &wLine, NULL); + GetTextExtent(str, &wLine, nullptr); if ( wLine > wListbox ) wListbox = wLine; } @@ -775,7 +775,7 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; - HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0); + HDC hdc = CreateIC(wxT("DISPLAY"), nullptr, nullptr, 0); { wxDCTemp dc((WXHDC)hdc); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 1fbf0a11a2..64e07262c2 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -144,7 +144,7 @@ class wxLV_ITEM { public: // default ctor, use Init() later - wxLV_ITEM() { m_buf = NULL; m_pItem = NULL; } + wxLV_ITEM() { m_buf = nullptr; m_pItem = nullptr; } // init without conversion void Init(LV_ITEM_NATIVE& item) @@ -175,10 +175,10 @@ public: } // ctor without conversion - wxLV_ITEM(LV_ITEM_NATIVE& item) : m_buf(NULL), m_pItem(&item) { } + wxLV_ITEM(LV_ITEM_NATIVE& item) : m_buf(nullptr), m_pItem(&item) { } // ctor with conversion - wxLV_ITEM(LV_ITEM_OTHER& item) : m_buf(NULL) + wxLV_ITEM(LV_ITEM_OTHER& item) : m_buf(nullptr) { Init(item); } @@ -222,7 +222,7 @@ private: class wxMSWListItemData { public: - wxMSWListItemData() : attr(NULL), lParam(0) {} + wxMSWListItemData() : attr(nullptr), lParam(0) {} ~wxMSWListItemData() { delete attr; } wxItemAttr *attr; @@ -276,14 +276,14 @@ wxEND_EVENT_TABLE() void wxListCtrl::Init() { m_colCount = 0; - m_textCtrl = NULL; + m_textCtrl = nullptr; m_sortAsc = true; m_sortCol = -1; m_hasAnyAttr = false; - m_headerCustomDraw = NULL; + m_headerCustomDraw = nullptr; } bool wxListCtrl::Create(wxWindow *parent, @@ -489,7 +489,7 @@ void wxListCtrl::UpdateStyle() if ( GetHwnd() ) { // The new window view style - DWORD dwStyleNew = MSWGetStyle(m_windowStyle, NULL); + DWORD dwStyleNew = MSWGetStyle(m_windowStyle, nullptr); // some styles are not returned by MSWGetStyle() if ( IsShown() ) @@ -661,7 +661,7 @@ bool wxListCtrl::SetHeaderAttr(const wxItemAttr& attr) fontChanged = m_headerCustomDraw->m_attr.HasFont(); delete m_headerCustomDraw; - m_headerCustomDraw = NULL; + m_headerCustomDraw = nullptr; } else // We do have custom attributes. { @@ -924,7 +924,7 @@ bool wxListCtrl::GetItem(wxListItem& info) const } else { - lvItem.pszText = NULL; + lvItem.pszText = nullptr; } if ( mask & wxLIST_MASK_DATA ) @@ -947,8 +947,8 @@ bool wxListCtrl::GetItem(wxListItem& info) const } else { - // give NULL as hwnd as we already have everything we need - wxConvertFromMSWListItem(NULL, info, lvItem); + // give nullptr as hwnd as we already have everything we need + wxConvertFromMSWListItem(nullptr, info, lvItem); } if (lvItem.pszText) @@ -1203,7 +1203,7 @@ wxMSWListItemData *wxListCtrl::MSWGetItemData(long itemId) const it.iItem = itemId; if ( !ListView_GetItem(GetHwnd(), &it) ) - return NULL; + return nullptr; return (wxMSWListItemData *) it.lParam; } @@ -1752,7 +1752,7 @@ void wxListCtrl::InitEditControl(WXHWND hWnd) wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) { - wxCHECK_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)), NULL, + wxCHECK_MSG( textControlClass->IsKindOf(wxCLASSINFO(wxTextCtrl)), nullptr, "control used for label editing must be a wxTextCtrl" ); // ListView_EditLabel requires that the list has focus. @@ -1772,7 +1772,7 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) // failed to start editing wxDELETE(m_textCtrl); - return NULL; + return nullptr; } // if GetEditControl() hasn't been called, we need to initialize the edit @@ -2131,8 +2131,8 @@ int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM l wxMSWListItemData *data1 = (wxMSWListItemData *) lParam1; wxMSWListItemData *data2 = (wxMSWListItemData *) lParam2; - wxIntPtr d1 = (data1 == NULL ? 0 : data1->lParam); - wxIntPtr d2 = (data2 == NULL ? 0 : data2->lParam); + wxIntPtr d1 = (data1 == nullptr ? 0 : data1->lParam); + wxIntPtr d2 = (data2 == nullptr ? 0 : data2->lParam); return internalData->user_fn(d1, d2, internalData->data); @@ -2453,7 +2453,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } eventType = wxEVT_LIST_END_LABEL_EDIT; - wxConvertFromMSWListItem(NULL, event.m_item, item); + wxConvertFromMSWListItem(nullptr, event.m_item, item); event.m_itemIndex = event.m_item.m_itemId; } break; @@ -3222,7 +3222,7 @@ static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl, if ( listctrl->IsSystemThemeDisabled() && pLVCD->clrTextBk == ::GetSysColor(COLOR_BTNFACE) ) { - HandleItemPaint(pLVCD, NULL); + HandleItemPaint(pLVCD, nullptr); return CDRF_SKIPDEFAULT; } @@ -3468,7 +3468,7 @@ wxItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const return OnGetItemColumnAttr(item, column); wxMSWListItemData * const data = MSWGetItemData(item); - return data ? data->attr : NULL; + return data ? data->attr : nullptr; } void wxListCtrl::SetItemCount(long count) diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 7a1b0d9433..17feaa7eed 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -60,7 +60,7 @@ extern int wxEntryCleanupReal(int& argc, wxChar **argv); // global pointer to exception information, only valid inside OnFatalException, // used by wxStackWalker and wxCrashReport -extern EXCEPTION_POINTERS *wxGlobalSEInformation = NULL; +extern EXCEPTION_POINTERS *wxGlobalSEInformation = nullptr; // flag telling us whether the application wants to handle exceptions at all static bool gs_handleExceptions = false; @@ -85,7 +85,7 @@ unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs) } wxSEH_IGNORE // ignore any exceptions inside the exception handler - wxGlobalSEInformation = NULL; + wxGlobalSEInformation = nullptr; // this will execute our handler and terminate the process return EXCEPTION_EXECUTE_HANDLER; @@ -194,7 +194,7 @@ int wxEntry(int& argc, wxChar **argv) struct wxMSWCommandLineArguments { - wxMSWCommandLineArguments() { argc = 0; argv = NULL; } + wxMSWCommandLineArguments() { argc = 0; argv = nullptr; } // Initialize this object from the current process command line. // @@ -225,15 +225,15 @@ struct wxMSWCommandLineArguments argc = args.size(); - // +1 here for the terminating NULL + // +1 here for the terminating null pointer argv = new wxChar *[argc + 1]; for ( int i = 0; i < argc; i++ ) { argv[i] = wxStrdup(args[i].t_str()); } - // argv[] must be NULL-terminated - argv[argc] = NULL; + // argv[] must be null-terminated + argv[argc] = nullptr; } ~wxMSWCommandLineArguments() diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 408ca6a3c6..470223944e 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -146,7 +146,7 @@ void wxMDIParentFrame::Init() { #if wxUSE_MENUS && wxUSE_ACCEL // the default menu doesn't have any accelerators (even if we have it) - m_accelWindowMenu = NULL; + m_accelWindowMenu = nullptr; #endif // wxUSE_MENUS && wxUSE_ACCEL m_activationNotHandled = false; @@ -220,10 +220,10 @@ wxMDIParentFrame::~wxMDIParentFrame() { // see comment in ~wxMDIChildFrame #if wxUSE_TOOLBAR - m_frameToolBar = NULL; + m_frameToolBar = nullptr; #endif #if wxUSE_STATUSBAR - m_frameStatusBar = NULL; + m_frameStatusBar = nullptr; #endif // wxUSE_STATUSBAR #if wxUSE_MENUS && wxUSE_ACCEL @@ -256,7 +256,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIGETACTIVE, 0, 0L); if ( !hWnd ) - return NULL; + return nullptr; return static_cast(wxFindWinFromHandle(hWnd)); } @@ -373,7 +373,7 @@ void wxMDIParentFrame::InternalSetMenuBar() { // wait until we do to add the window menu but do set the main menu for // now (this is done by AddWindowMenu() as a side effect) - MDISetMenu(GetClientWindow(), (HMENU)m_hMenu, NULL); + MDISetMenu(GetClientWindow(), (HMENU)m_hMenu, nullptr); } } @@ -385,7 +385,7 @@ void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) { // We may not be showing the window menu currently if we don't have any // children, and in this case we shouldn't remove/add it back right now. - const bool hasWindowMenu = GetActiveChild() != NULL; + const bool hasWindowMenu = GetActiveChild() != nullptr; if ( hasWindowMenu ) RemoveWindowMenu(); @@ -423,7 +423,7 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) } else { - if ( bar != NULL ) + if ( bar != nullptr ) { int nCount = bar->GetMenuCount(); for (int n = 0; n < nCount; n++) @@ -444,7 +444,7 @@ wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const // whether it's currently enabled. wxMenuItem *item = GetActiveChild() ? GetActiveChild()->FindItemInMenuBar(menuId) - : NULL; + : nullptr; if ( !item ) item = wxFrame::FindItemInMenuBar(menuId); @@ -458,7 +458,7 @@ wxMenu* wxMDIParentFrame::MSWFindMenuFromHMENU(WXHMENU hMenu) { wxMenu* menu = GetActiveChild() ? GetActiveChild()->MSWFindMenuFromHMENU(hMenu) - : NULL; + : nullptr; if ( !menu ) menu = wxFrame::MSWFindMenuFromHMENU(hMenu); @@ -923,17 +923,17 @@ wxMDIChildFrame::~wxMDIChildFrame() // will be destroyed by DestroyChildren() but reset them before calling it // to avoid using dangling pointers if a callback comes in the meanwhile #if wxUSE_TOOLBAR - m_frameToolBar = NULL; + m_frameToolBar = nullptr; #endif #if wxUSE_STATUSBAR - m_frameStatusBar = NULL; + m_frameStatusBar = nullptr; #endif // wxUSE_STATUSBAR DestroyChildren(); - MDIRemoveWindowMenu(NULL, m_hMenu, parent->MSWGetCurrentWindowMenuLabel()); + MDIRemoveWindowMenu(nullptr, m_hMenu, parent->MSWGetCurrentWindowMenuLabel()); - // MDIRemoveWindowMenu() doesn't update the MDI menu when called with NULL + // MDIRemoveWindowMenu() doesn't update the MDI menu when called with null // window, so do it ourselves. MDISetMenu(parent->GetClientWindow(), (HMENU)parent->MSWGetActiveMenu(), @@ -956,7 +956,7 @@ bool wxMDIChildFrame::Show(bool show) // we need to refresh the MDI frame window menu to include (or exclude if // we've been hidden) this frame wxMDIParentFrame * const parent = GetMDIParent(); - MDISetMenu(parent->GetClientWindow(), NULL, NULL); + MDISetMenu(parent->GetClientWindow(), nullptr, nullptr); return true; } @@ -1060,7 +1060,7 @@ void wxMDIChildFrame::DetachMenuBar() { wxMDIParentFrame * const parent = GetMDIParent(); - MDIRemoveWindowMenu(NULL, m_hMenu, parent->MSWGetCurrentWindowMenuLabel()); + MDIRemoveWindowMenu(nullptr, m_hMenu, parent->MSWGetCurrentWindowMenuLabel()); wxFrame::DetachMenuBar(); } @@ -1204,7 +1204,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), wxT("can't deactivate MDI child which wasn't active!") ); activated = false; - parent->SetActiveChild(NULL); + parent->SetActiveChild(nullptr); WXHMENU hMenuParent = parent->m_hMenu; @@ -1228,7 +1228,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), wxActivateEvent event(wxEVT_ACTIVATE, activated, m_windowId); event.SetEventObject( this ); - ResetWindowStyle(NULL); + ResetWindowStyle(nullptr); return HandleWindowEvent(event); } @@ -1291,7 +1291,7 @@ void wxMDIChildFrame::MSWDestroyWindow() { wxMDIParentFrame * const parent = GetMDIParent(); - // Must make sure this handle is invalidated (set to NULL) since all sorts + // Must make sure this handle is invalidated (set to nullptr) since all sorts // of things could happen after the child client is destroyed, but before // the wxFrame is destroyed. @@ -1299,8 +1299,8 @@ void wxMDIChildFrame::MSWDestroyWindow() SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY, (WPARAM)oldHandle, 0); - if (parent->GetActiveChild() == NULL) - ResetWindowStyle(NULL); + if (parent->GetActiveChild() == nullptr) + ResetWindowStyle(nullptr); if (m_hMenu) { @@ -1334,9 +1334,9 @@ bool wxMDIChildFrame::ResetWindowStyle(void *vrect) if ( updateStyle.Apply() ) { // force update of everything - ::RedrawWindow(hwndClient, NULL, NULL, + ::RedrawWindow(hwndClient, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN); - ::SetWindowPos(hwndClient, NULL, 0, 0, 0, 0, + ::SetWindowPos(hwndClient, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOCOPYBITS); @@ -1381,11 +1381,11 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) ( exStyle, wxT("MDICLIENT"), - NULL, + nullptr, msStyle, 0, 0, 0, 0, GetWinHwnd(parent), - NULL, + nullptr, wxGetInstance(), (LPSTR)(LPCLIENTCREATESTRUCT)&ccs); if ( !m_hWnd ) @@ -1441,8 +1441,8 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF if (wxDynamicCast(child, wxMDIChildFrame)) { ::RedrawWindow(GetHwndOf(child), - NULL, - NULL, + nullptr, + nullptr, RDW_FRAME | RDW_ALLCHILDREN | RDW_INVALIDATE); @@ -1620,7 +1620,7 @@ void MDIRemoveWindowMenu(wxWindow *win, WXHMENU hMenu, const wxString& windowMen if ( win ) { // we don't change the windows menu, but we update the main one - MDISetMenu(win, hmenu, NULL); + MDISetMenu(win, hmenu, nullptr); } } diff --git a/src/msw/mediactrl_am.cpp b/src/msw/mediactrl_am.cpp index e665403f1b..19495debe0 100644 --- a/src/msw/mediactrl_am.cpp +++ b/src/msw/mediactrl_am.cpp @@ -930,7 +930,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend); wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) { wxChar szError[MAX_ERROR_TEXT_LEN]; - if( m_lpAMGetErrorText != NULL && + if( m_lpAMGetErrorText != nullptr && (*m_lpAMGetErrorText)(hrdsv, szError, MAX_ERROR_TEXT_LEN) == 0) { return wxString::Format(wxT("DirectShow error \"%s\" \n") @@ -961,12 +961,12 @@ wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) // wxAMMediaBackend Constructor //--------------------------------------------------------------------------- wxAMMediaBackend::wxAMMediaBackend() - :m_pAX(NULL), - m_pAM(NULL), - m_pMP(NULL), + :m_pAX(nullptr), + m_pAM(nullptr), + m_pMP(nullptr), m_bestSize(wxDefaultSize) { - m_evthandler = NULL; + m_evthandler = nullptr; } //--------------------------------------------------------------------------- @@ -1016,11 +1016,11 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // Now determine which (if any) media player interface is // available - IMediaPlayer or IActiveMovie - if( ::CoCreateInstance(CLSID_MediaPlayer, NULL, + if( ::CoCreateInstance(CLSID_MediaPlayer, nullptr, CLSCTX_INPROC_SERVER, IID_IMediaPlayer, (void**)&m_pMP) != 0 ) { - if( ::CoCreateInstance(CLSID_ActiveMovie, NULL, + if( ::CoCreateInstance(CLSID_ActiveMovie, nullptr, CLSCTX_INPROC_SERVER, IID_IActiveMovie, (void**)&m_pAM) != 0 ) return false; @@ -1103,7 +1103,7 @@ bool wxAMMediaBackend::Load(const wxURI& location) { // Turn off loading from a proxy as user // may have set it previously - INSPlay* pPlay = NULL; + INSPlay* pPlay = nullptr; GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); if(pPlay) { @@ -1120,7 +1120,7 @@ bool wxAMMediaBackend::Load(const wxURI& location) bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy) { // Set the proxy of the NETSHOW interface - INSPlay* pPlay = NULL; + INSPlay* pPlay = nullptr; GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay); if(pPlay) @@ -1451,14 +1451,14 @@ bool wxAMMediaBackend::SetPlaybackRate(double dRate) void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, wxLongLong* pLoadTotal) { - IUnknown* pFG = NULL; + IUnknown* pFG = nullptr; HRESULT hr = m_pAM->get_FilterGraph(&pFG); - // notice that the call above may return S_FALSE and leave pFG NULL + // notice that the call above may return S_FALSE and leave pFG null if(SUCCEEDED(hr) && pFG) { - IAMOpenProgress* pOP = NULL; + IAMOpenProgress* pOP = nullptr; hr = pFG->QueryInterface(IID_IAMOpenProgress, (void**)&pOP); if(SUCCEEDED(hr) && pOP) { diff --git a/src/msw/mediactrl_qt.cpp b/src/msw/mediactrl_qt.cpp index d69dfe957c..06773ad699 100644 --- a/src/msw/mediactrl_qt.cpp +++ b/src/msw/mediactrl_qt.cpp @@ -215,7 +215,7 @@ public: wxDL_VOIDMETHOD_DEFINE( MoviesTask, (Movie m, long maxms), (m, maxms) ) wxDL_VOIDMETHOD_DEFINE( BlockMove, (const char* p1, const char* p2, long s), (p1,p2,s) ) - wxDL_METHOD_DEFINE( Handle, NewHandleClear, (long s), (s), NULL ) + wxDL_METHOD_DEFINE( Handle, NewHandleClear, (long s), (s), nullptr ) wxDL_METHOD_DEFINE( OSErr, NewMovieFromDataRef, (Movie * m, short flags, short * id, @@ -226,10 +226,10 @@ public: wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect, (Movie m, Rect* r), (m,r) ) wxDL_METHOD_DEFINE( void*, GetMovieIndTrackType, (Movie m, long index, OSType type, long flags), - (m,index,type,flags), NULL ) + (m,index,type,flags), nullptr ) wxDL_VOIDMETHOD_DEFINE( CreatePortAssociation, (void* hWnd, void* junk, long morejunk), (hWnd, junk, morejunk) ) - wxDL_METHOD_DEFINE(void*, GetNativeWindowPort, (void* hWnd), (hWnd), NULL) + wxDL_METHOD_DEFINE(void*, GetNativeWindowPort, (void* hWnd), (hWnd), nullptr) wxDL_VOIDMETHOD_DEFINE(SetMovieGWorld, (Movie m, CGrafPtr port, void* whatever), (m, port, whatever) ) wxDL_VOIDMETHOD_DEFINE(DisposeMovie, (Movie m), (m) ) @@ -572,12 +572,12 @@ LRESULT CALLBACK wxQTMediaBackend::QTWndProc(HWND hWnd, UINT nMsg, //--------------------------------------------------------------------------- // wxQTMediaBackend Destructor // -// Sets m_timer to NULL signifying we havn't loaded anything yet +// Sets m_timer to nullptr signifying we havn't loaded anything yet //--------------------------------------------------------------------------- wxQTMediaBackend::wxQTMediaBackend() -: m_movie(NULL), m_bPlaying(false), m_timer(NULL), m_pMC(NULL) +: m_movie(nullptr), m_bPlaying(false), m_timer(nullptr), m_pMC(nullptr) { - m_evthandler = NULL; + m_evthandler = nullptr; } //--------------------------------------------------------------------------- @@ -599,7 +599,7 @@ wxQTMediaBackend::~wxQTMediaBackend() if (m_pMC) { m_lib.DisposeMovieController(m_pMC); - // m_pMC = NULL; + // m_pMC = nullptr; } // destroy wxQTMediaEvtHandler we pushed on it @@ -662,7 +662,7 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // Create a port association for our window so we // can use it as a WindowRef - m_lib.CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L); + m_lib.CreatePortAssociation(m_ctrl->GetHWND(), nullptr, 0L); // Part of a suggestion from Greg Hazel // to repaint movie when idle @@ -712,7 +712,7 @@ bool wxQTMediaBackend::Load(const wxString& fileName) &movieResID, movieName, newMovieActive, - NULL ); // wasChanged + nullptr ); // wasChanged result = (err == noErr /*&& m_lib.GetMoviesStickyError() == noErr*/); // check m_lib.GetMoviesStickyError() because it may not find the @@ -746,7 +746,7 @@ void wxQTMediaBackend::PPRMProc (Movie theMovie, wxQTMediaBackend* pBE = (wxQTMediaBackend*) theRefCon; - long lTime = pBE->m_lib.GetMovieTime(theMovie,NULL); + long lTime = pBE->m_lib.GetMovieTime(theMovie,nullptr); Fixed rate = pBE->m_lib.GetMoviePreferredRate(theMovie); pBE->m_lib.PrerollMovie(theMovie, lTime, rate); pBE->m_timer = new wxQTLoadTimer(pBE->m_movie, pBE, &pBE->m_lib); @@ -780,7 +780,7 @@ bool wxQTMediaBackend::Load(const wxURI& location) OSErr err = m_lib.NewMovieFromDataRef(&m_movie, newMovieActive | newMovieAsyncOK /* | newMovieIdleImportOK */, - NULL, theHandle, + nullptr, theHandle, URLDataHandlerSubType); m_lib.DisposeHandle(theHandle); @@ -790,7 +790,7 @@ bool wxQTMediaBackend::Load(const wxURI& location) long timeNow; Fixed playRate; - timeNow = m_lib.GetMovieTime(m_movie, NULL); + timeNow = m_lib.GetMovieTime(m_movie, nullptr); wxASSERT(m_lib.GetMoviesError() == noErr); playRate = m_lib.GetMoviePreferredRate(m_movie); @@ -857,7 +857,7 @@ void wxQTMediaBackend::FinishLoad() { m_lib.SetMovieGWorld(m_movie, (CGrafPtr) m_lib.GetNativeWindowPort(m_ctrl->GetHWND()), - NULL); + nullptr); } // Set the movie to millisecond precision @@ -977,7 +977,7 @@ bool wxQTMediaBackend::SetPosition(wxLongLong where) //--------------------------------------------------------------------------- wxLongLong wxQTMediaBackend::GetPosition() { - return m_lib.GetMovieTime(m_movie, NULL); + return m_lib.GetMovieTime(m_movie, nullptr); } //--------------------------------------------------------------------------- @@ -1073,11 +1073,11 @@ void wxQTMediaBackend::Cleanup() Point thePoint; thePoint.h = thePoint.v = 0; m_lib.MCSetVisible(m_pMC, false); - m_lib.MCSetMovie(m_pMC, NULL, NULL, thePoint); + m_lib.MCSetMovie(m_pMC, nullptr, nullptr, thePoint); } m_lib.DisposeMovie(m_movie); - m_movie = NULL; + m_movie = nullptr; } //--------------------------------------------------------------------------- @@ -1092,7 +1092,7 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) // restore old wndproc wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxWndProc); m_lib.DisposeMovieController(m_pMC); - m_pMC = NULL; + m_pMC = nullptr; // movie controller height m_bestSize.y -= 16; diff --git a/src/msw/mediactrl_wmp10.cpp b/src/msw/mediactrl_wmp10.cpp index a5947d3977..4fcb3b40ee 100644 --- a/src/msw/mediactrl_wmp10.cpp +++ b/src/msw/mediactrl_wmp10.cpp @@ -720,15 +720,15 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWMP10MediaBackend, wxMediaBackend); wxWMP10MediaBackend::wxWMP10MediaBackend() : #ifndef WXTEST_ATL - m_pAX(NULL), + m_pAX(nullptr), #endif - m_pWMPPlayer(NULL), - m_pWMPSettings(NULL), - m_pWMPControls(NULL), - m_pWMPControls2(NULL) + m_pWMPPlayer(nullptr), + m_pWMPSettings(nullptr), + m_pWMPControls(nullptr), + m_pWMPControls2(nullptr) { - m_evthandler = NULL; + m_evthandler = nullptr; } //--------------------------------------------------------------------------- @@ -774,11 +774,11 @@ bool wxWMP10MediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, const wxString& name) { #ifndef WXTEST_ATL - if( ::CoCreateInstance(CLSID_WMP10, NULL, + if( ::CoCreateInstance(CLSID_WMP10, nullptr, CLSCTX_INPROC_SERVER, IID_IWMPPlayer, (void**)&m_pWMPPlayer) != 0 ) { - if( ::CoCreateInstance(CLSID_WMP10ALT, NULL, + if( ::CoCreateInstance(CLSID_WMP10ALT, nullptr, CLSCTX_INPROC_SERVER, IID_IWMPPlayer, (void**)&m_pWMPPlayer) != 0 ) return false; @@ -828,14 +828,14 @@ bool wxWMP10MediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, m_evthandler = new wxWMP10MediaEvtHandler(this); m_ctrl->PushEventHandler(m_evthandler); #else - _Module.Init(NULL, ::GetModuleHandle(NULL)); + _Module.Init(nullptr, ::GetModuleHandle(nullptr)); AtlAxWinInit(); CComPtr spHost; HRESULT hr; RECT rcClient; ::GetClientRect((HWND)ctrl->GetHandle(), &rcClient); - m_wndView.Create((HWND)ctrl->GetHandle(), rcClient, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); + m_wndView.Create((HWND)ctrl->GetHandle(), rcClient, nullptr, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE); hr = m_wndView.QueryHost(&spHost); hr = spHost->CreateControl(CComBSTR(wxT("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0); hr = m_wndView.QueryControl(&m_pWMPPlayer); @@ -1045,7 +1045,7 @@ void wxWMP10MediaBackend::FinishLoad() // THIS WILL NOT WORK UNLESS THE MEDIA IS ABOUT TO PLAY // See the "introduction" - also get_currentMedia will return // "1" which is a VALID HRESULT value - // and a NULL pWMPMedia if the media isn't the "current" one + // and a null pWMPMedia if the media isn't the "current" one // which is rather unintuitive in the sense that it uses it // (i.e. basically not currently playing)... IWMPMedia* pWMPMedia; diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 49be7d433f..d5d075d7d3 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -110,7 +110,7 @@ void SetOwnerDrawnMenuItem(HMENU hmenu, // Construct a menu with optional title (then use append) void wxMenu::InitNoCreate() { - m_radioData = NULL; + m_radioData = nullptr; m_doBreak = false; #if wxUSE_OWNER_DRAWN @@ -349,7 +349,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // required by ::AppendMenu() API UINT_PTR id; wxMenu *submenu = pItem->GetSubMenu(); - if ( submenu != NULL ) { + if ( submenu != nullptr ) { wxASSERT_MSG( submenu->GetHMenu(), wxT("invalid submenu") ); submenu->SetParent(this); @@ -365,7 +365,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // prepare to insert the item in the menu wxString itemText = pItem->GetItemLabel(); - LPCTSTR pData = NULL; + LPCTSTR pData = nullptr; if ( pos == (size_t)-1 ) { // append at the end (note that the item is already appended to @@ -606,7 +606,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) { - return wxMenuBase::DoAppend(item) && DoInsertOrAppend(item) ? item : NULL; + return wxMenuBase::DoAppend(item) && DoInsertOrAppend(item) ? item : nullptr; } wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) @@ -614,7 +614,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos)) return item; else - return NULL; + return nullptr; } wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) @@ -736,7 +736,7 @@ void wxMenu::SetTitle(const wxString& label) { if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING, (UINT_PTR)idMenuTitle, m_title.t_str()) || - !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) ) + !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, nullptr) ) { wxLogLastError(wxT("InsertMenu")); } @@ -838,7 +838,7 @@ wxMenu* wxMenu::MSWGetMenu(WXHMENU hMenu) } // unknown hMenu - return NULL; + return nullptr; } // --------------------------------------------------------------------------- @@ -884,7 +884,7 @@ wxMenuBar::~wxMenuBar() if (m_hMenu && !IsAttached()) { ::DestroyMenu((HMENU)m_hMenu); - m_hMenu = (WXHMENU)NULL; + m_hMenu = (WXHMENU)nullptr; } } @@ -1045,7 +1045,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) { wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title); if ( !menuOld ) - return NULL; + return nullptr; menu->wxMenuBase::SetTitle(title); @@ -1179,7 +1179,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) - return NULL; + return nullptr; if (GetHmenu()) { @@ -1269,7 +1269,7 @@ 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; + return nullptr; // query all menus for ( size_t n = 0 ; n < GetMenuCount(); ++n ) @@ -1280,7 +1280,7 @@ wxMenu* wxMenuBar::MSWGetMenu(WXHMENU hMenu) const } // unknown hMenu - return NULL; + return nullptr; } #endif // wxUSE_MENUS diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index bf33aba00b..c1258631ab 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -269,7 +269,7 @@ public: } - // get the theme engine or NULL if themes + // get the theme engine or nullptr if themes // are not available or not supported on menu static bool IsUxThemeActive() { @@ -310,7 +310,7 @@ private: static MenuDrawData* ms_instance; }; -MenuDrawData* MenuDrawData::ms_instance = NULL; +MenuDrawData* MenuDrawData::ms_instance = nullptr; void MenuDrawData::Init(wxWindow const* window) { @@ -319,33 +319,33 @@ void MenuDrawData::Init(wxWindow const* window) { wxUxThemeHandle hTheme(window, L"MENU"); - ::GetThemeMargins(hTheme, NULL, MENU_POPUPITEM, 0, - TMT_CONTENTMARGINS, NULL, + ::GetThemeMargins(hTheme, nullptr, MENU_POPUPITEM, 0, + TMT_CONTENTMARGINS, nullptr, &ItemMargin); - ::GetThemeMargins(hTheme, NULL, MENU_POPUPCHECK, 0, - TMT_CONTENTMARGINS, NULL, + ::GetThemeMargins(hTheme, nullptr, MENU_POPUPCHECK, 0, + TMT_CONTENTMARGINS, nullptr, &CheckMargin); - ::GetThemeMargins(hTheme, NULL, MENU_POPUPCHECKBACKGROUND, 0, - TMT_CONTENTMARGINS, NULL, + ::GetThemeMargins(hTheme, nullptr, MENU_POPUPCHECKBACKGROUND, 0, + TMT_CONTENTMARGINS, nullptr, &CheckBgMargin); - ::GetThemeMargins(hTheme, NULL, MENU_POPUPSUBMENU, 0, - TMT_CONTENTMARGINS, NULL, + ::GetThemeMargins(hTheme, nullptr, MENU_POPUPSUBMENU, 0, + TMT_CONTENTMARGINS, nullptr, &ArrowMargin); - ::GetThemeMargins(hTheme, NULL, MENU_POPUPSEPARATOR, 0, - TMT_SIZINGMARGINS, NULL, + ::GetThemeMargins(hTheme, nullptr, MENU_POPUPSEPARATOR, 0, + TMT_SIZINGMARGINS, nullptr, &SeparatorMargin); - ::GetThemePartSize(hTheme, NULL, MENU_POPUPCHECK, 0, - NULL, TS_TRUE, &CheckSize); + ::GetThemePartSize(hTheme, nullptr, MENU_POPUPCHECK, 0, + nullptr, TS_TRUE, &CheckSize); - ::GetThemePartSize(hTheme, NULL, MENU_POPUPSUBMENU, 0, - NULL, TS_TRUE, &ArrowSize); + ::GetThemePartSize(hTheme, nullptr, MENU_POPUPSUBMENU, 0, + nullptr, TS_TRUE, &ArrowSize); - ::GetThemePartSize(hTheme, NULL, MENU_POPUPSEPARATOR, 0, - NULL, TS_TRUE, &SeparatorSize); + ::GetThemePartSize(hTheme, nullptr, MENU_POPUPSEPARATOR, 0, + nullptr, TS_TRUE, &SeparatorSize); ::GetThemeInt(hTheme, MENU_POPUPBACKGROUND, 0, TMT_BORDERSIZE, &TextBorder); @@ -356,8 +356,8 @@ void MenuDrawData::Init(wxWindow const* window) wxUxThemeFont themeFont; ::GetThemeSysFont(hTheme, TMT_MENUFONT, themeFont.GetPtr()); - // Use NULL window for wxNativeFontInfo, height it is already at the correct ppi - Font = wxFont(wxNativeFontInfo(themeFont.GetLOGFONT(), NULL)); + // Use null window for wxNativeFontInfo, height it is already at the correct ppi + Font = wxFont(wxNativeFontInfo(themeFont.GetLOGFONT(), nullptr)); Theme = true; @@ -788,7 +788,7 @@ int wxMenuItem::MeasureAccelWidth() const dc.SetFont(font); wxCoord w; - dc.GetTextExtent(accel, &w, NULL); + dc.GetTextExtent(accel, &w, nullptr); return w; } @@ -964,22 +964,22 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, { ::DrawThemeBackground(hTheme, hdc, MENU_POPUPBACKGROUND, - 0, &rect, NULL); + 0, &rect, nullptr); } ::DrawThemeBackground(hTheme, hdc, MENU_POPUPGUTTER, - 0, &rcGutter, NULL); + 0, &rcGutter, nullptr); if ( IsSeparator() ) { rcSeparator.left = rcGutter.right; ::DrawThemeBackground(hTheme, hdc, MENU_POPUPSEPARATOR, - 0, &rcSeparator, NULL); + 0, &rcSeparator, nullptr); return true; } ::DrawThemeBackground(hTheme, hdc, MENU_POPUPITEM, - state, &rcSelection, NULL); + state, &rcSelection, nullptr); } else @@ -1028,7 +1028,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, int x = rcText.left; int y = rcText.top + (rcText.bottom - rcText.top - textSize.cy) / 2; - ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text), + ::DrawState(hdc, nullptr, nullptr, wxMSW_CONV_LPARAM(text), text.length(), x, y, 0, 0, flags); // ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO @@ -1058,7 +1058,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; - ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel), + ::DrawState(hdc, nullptr, nullptr, wxMSW_CONV_LPARAM(accel), accel.length(), x, y, 0, 0, flags); } } @@ -1197,7 +1197,7 @@ void wxMenuItem::DrawStdCheckMark(WXHDC hdc_, const RECT* rc, wxODStatus stat) : MCB_NORMAL; ::DrawThemeBackground(hTheme, hdc, MENU_POPUPCHECKBACKGROUND, - stateCheckBg, &rcBg, NULL); + stateCheckBg, &rcBg, nullptr); POPUPCHECKSTATES stateCheck; if ( GetKind() == wxITEM_CHECK ) @@ -1212,7 +1212,7 @@ void wxMenuItem::DrawStdCheckMark(WXHDC hdc_, const RECT* rc, wxODStatus stat) } ::DrawThemeBackground(hTheme, hdc, MENU_POPUPCHECK, - stateCheck, rc, NULL); + stateCheck, rc, nullptr); } else #endif // wxUSE_UXTHEME @@ -1313,7 +1313,7 @@ bool wxMenuItem::MSWMustUseOwnerDrawn() const wxBitmap& bmpUnchecked = GetBitmap(false), bmpChecked = GetBitmap(true); - const wxWindow* win = m_parentMenu ? m_parentMenu->GetWindow() : NULL; + const wxWindow* win = m_parentMenu ? m_parentMenu->GetWindow() : nullptr; if ( (bmpUnchecked.IsOk() && IsGreaterThanStdSize(bmpUnchecked, win)) || (bmpChecked.IsOk() && IsGreaterThanStdSize(bmpChecked, win)) || (bmpChecked.IsOk() && IsCheckable()) ) @@ -1339,7 +1339,7 @@ HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const // // 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 + // nullptr for checkable menu items as hbmpChecked/hBmpUnchecked does not // support HBMMENU_CALLBACK. // // However under Vista using HBMMENU_CALLBACK causes the entire menu to be @@ -1359,11 +1359,11 @@ HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const return GetHbitmapOf(bmp); } //else: bitmap is not set - return NULL; + return nullptr; } #endif // wxUSE_IMAGE - return (kind == Normal) ? HBMMENU_CALLBACK : NULL; + return (kind == Normal) ? HBMMENU_CALLBACK : nullptr; } int wxMenuItem::MSGetMenuItemPos() const diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 1a941c3f92..654700ce08 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -166,18 +166,18 @@ void wxMetafile::SetWindowsMappingMode(int mm) wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file) : wxMSWDCImpl(owner) { - m_metaFile = NULL; + m_metaFile = nullptr; m_minX = 10000; m_minY = 10000; m_maxX = -10000; m_maxY = -10000; - // m_title = NULL; + // m_title = nullptr; if ( wxFileExists(file) ) wxRemoveFile(file); if ( file.empty() ) - m_hDC = (WXHDC) CreateMetaFile(NULL); + m_hDC = (WXHDC) CreateMetaFile(nullptr); else m_hDC = (WXHDC) CreateMetaFile(file); @@ -201,12 +201,12 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file, m_maxY = -10000; if ( !file.empty() && wxFileExists(file) ) wxRemoveFile(file); - m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : wxMSW_CONV_LPCTSTR(file)); + m_hDC = (WXHDC) CreateMetaFile(file.empty() ? nullptr : wxMSW_CONV_LPCTSTR(file)); m_ok = true; - ::SetWindowOrgEx((HDC) m_hDC,xorg,yorg, NULL); - ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL); + ::SetWindowOrgEx((HDC) m_hDC,xorg,yorg, nullptr); + ::SetWindowExtEx((HDC) m_hDC,xext,yext, nullptr); // Actual Windows mapping mode, for future reference. m_windowsMappingMode = MM_ANISOTROPIC; @@ -268,7 +268,7 @@ wxMetafile *wxMetafileDCImpl::Close() wx_mf->SetWindowsMappingMode(m_windowsMappingMode); return wx_mf; } - return NULL; + return nullptr; } void wxMetafileDCImpl::SetMapMode(wxMappingMode mode) @@ -480,7 +480,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const // what DC the picture will be rendered to, use the default display one PixelToHIMETRIC(&mfpict->xExt, &mfpict->yExt); - mfpict->hMF = CopyMetaFile((HMETAFILE)mf.GetHMETAFILE(), NULL); + mfpict->hMF = CopyMetaFile((HMETAFILE)mf.GetHMETAFILE(), nullptr); return true; } diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index 9bed571e84..61bbc8edf5 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -213,7 +213,7 @@ size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs, void wxFileTypeImpl::MSWNotifyShell() { if (!m_suppressNotify) - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, NULL); + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, nullptr, nullptr); } void wxFileTypeImpl::MSWSuppressNotifications(bool supress) @@ -266,7 +266,7 @@ wxString wxAssocQueryString(ASSOCSTR assoc, 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 + verb.empty() ? nullptr : static_cast(verb.t_str()), bufOut, // The buffer for output value. &dwSize // And its size @@ -492,7 +492,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) if ( !knownExtension ) { // unknown extension - return NULL; + return nullptr; } return CreateFileType(wxEmptyString, ext); @@ -517,7 +517,7 @@ wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) } // unknown MIME type - return NULL; + return nullptr; } size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) @@ -544,7 +544,7 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) { - wxCHECK_MSG( !ftInfo.GetExtensions().empty(), NULL, + wxCHECK_MSG( !ftInfo.GetExtensions().empty(), nullptr, wxT("Associate() needs extension") ); bool ok; @@ -554,7 +554,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) wxString ext = ftInfo.GetExtensions()[iExtCount]; - wxCHECK_MSG( !ext.empty(), NULL, + wxCHECK_MSG( !ext.empty(), nullptr, wxT("Associate() needs non empty extension") ); if ( ext[0u] != wxT('.') ) diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index 77cf072ada..4fa5ab754f 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -131,7 +131,7 @@ wxMessageDialog::HookFunction(int code, WXWPARAM wParam, WXLPARAM lParam) { // we won't need this hook any longer ::UnhookWindowsHookEx(hhook); - wnd->m_hook = NULL; + wnd->m_hook = nullptr; HookMap().erase(tid); TempHWNDSetter set(wnd, (WXHWND)wParam); @@ -169,9 +169,9 @@ void wxMessageDialog::ReplaceStaticWithEdit() // find the static control to replace: normally there are two of them, the // icon and the text itself so search for all of them and ignore the icon // ones - HWND hwndStatic = ::FindWindowEx(GetHwnd(), NULL, wxT("STATIC"), NULL); + HWND hwndStatic = ::FindWindowEx(GetHwnd(), nullptr, wxT("STATIC"), nullptr); if ( ::GetWindowLong(hwndStatic, GWL_STYLE) & SS_ICON ) - hwndStatic = ::FindWindowEx(GetHwnd(), hwndStatic, wxT("STATIC"), NULL); + hwndStatic = ::FindWindowEx(GetHwnd(), hwndStatic, wxT("STATIC"), nullptr); if ( !hwndStatic ) { @@ -236,9 +236,9 @@ void wxMessageDialog::ReplaceStaticWithEdit() rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, GetHwnd(), - NULL, + nullptr, wxGetInstance(), - NULL + nullptr ); if ( !hwndEdit ) @@ -415,7 +415,7 @@ int wxMessageDialog::ShowMessageBox() // use the top level window as parent if none specified m_parent = GetParentForModalDialog(); - HWND hWnd = m_parent ? GetHwndOf(m_parent) : NULL; + HWND hWnd = m_parent ? GetHwndOf(m_parent) : nullptr; #if wxUSE_INTL // native message box always uses the current user locale but the program @@ -521,7 +521,7 @@ int wxMessageDialog::ShowMessageBox() // control with an edit one) const DWORD tid = ::GetCurrentThreadId(); m_hook = ::SetWindowsHookEx(WH_CBT, - &wxMessageDialog::HookFunction, NULL, tid); + &wxMessageDialog::HookFunction, nullptr, tid); HookMap()[tid] = this; // do show the dialog @@ -553,7 +553,7 @@ int wxMessageDialog::ShowModal() wxTdc.MSWCommonTaskDialogInit( tdc ); int msAns; - HRESULT hr = taskDialogIndirect( &tdc, &msAns, NULL, NULL ); + HRESULT hr = taskDialogIndirect( &tdc, &msAns, nullptr, nullptr ); if ( FAILED(hr) ) { wxLogApiError( "TaskDialogIndirect", hr ); @@ -662,7 +662,7 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc) tdc.pszWindowTitle = caption.t_str(); // use the top level window as parent if none specified - tdc.hwndParent = parent ? GetHwndOf(parent) : NULL; + tdc.hwndParent = parent ? GetHwndOf(parent) : nullptr; if ( wxApp::MSWGetDefaultLayout(parent) == wxLayout_RightToLeft ) tdc.dwFlags |= TDF_RTL_LAYOUT; @@ -789,7 +789,7 @@ wxCRIT_SECT_DECLARE(gs_csTaskDialogIndirect); TaskDialogIndirect_t wxMSWMessageDialog::GetTaskDialogIndirectFunc() { - // Initialize the function pointer to an invalid value different from NULL + // Initialize the function pointer to an invalid value different from nullptr // to avoid reloading comctl32.dll and trying to resolve it every time // we're called if task dialog is not available (notice that this may // happen even under Vista+ if we don't use comctl32.dll v6). diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index fda36ec0b7..4b2f54b537 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -67,7 +67,7 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID id) if (hWndNext) CreateWindowFromHWND(this, (WXHWND) hWndNext); - while (hWndNext != (HWND) NULL) + while (hWndNext != (HWND) nullptr) { hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); if (hWndNext) @@ -104,7 +104,7 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) if (hWndNext) CreateWindowFromHWND(this, (WXHWND) hWndNext); - while (hWndNext != (HWND) NULL) + while (hWndNext != (HWND) nullptr) { hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); if (hWndNext) @@ -134,7 +134,7 @@ wxWindow* wxWindow::GetWindowChild1(wxWindowID id) node = node->GetNext(); } - return NULL; + return nullptr; } wxWindow* wxWindow::GetWindowChild(wxWindowID id) @@ -158,7 +158,7 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id) wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { - wxCHECK_MSG( parent, NULL, wxT("must have valid parent for a control") ); + wxCHECK_MSG( parent, nullptr, wxT("must have valid parent for a control") ); wxString str(wxGetWindowClass(hWnd)); str.MakeUpper(); @@ -166,7 +166,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) long id = wxGetWindowId(hWnd); long style = GetWindowLong((HWND) hWnd, GWL_STYLE); - wxWindow* win = NULL; + wxWindow* win = nullptr; if (str == wxT("BUTTON")) { diff --git a/src/msw/nonownedwnd.cpp b/src/msw/nonownedwnd.cpp index cdeee88d54..e7492c0994 100644 --- a/src/msw/nonownedwnd.cpp +++ b/src/msw/nonownedwnd.cpp @@ -43,7 +43,7 @@ bool wxNonOwnedWindow::DoClearShape() { - if (::SetWindowRgn(GetHwnd(), NULL, TRUE) == 0) + if (::SetWindowRgn(GetHwnd(), nullptr, TRUE) == 0) { wxLogLastError(wxT("SetWindowRgn")); return false; @@ -56,10 +56,10 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region) { // Windows takes ownership of the region, so // we'll have to make a copy of the region to give to it. - DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL); + DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, nullptr); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(GetHrgnOf(region), noBytes, rgnData); - HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData); + HRGN hrgn = ::ExtCreateRegion(nullptr, noBytes, rgnData); delete[] (char*) rgnData; // SetWindowRgn expects the region to be in coordinates @@ -140,7 +140,7 @@ bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path) wxNonOwnedWindow::wxNonOwnedWindow() { #if wxUSE_GRAPHICS_CONTEXT - m_shapeImpl = NULL; + m_shapeImpl = nullptr; #endif // wxUSE_GRAPHICS_CONTEXT m_activeDPI = wxDefaultSize; @@ -185,8 +185,8 @@ static bool IsPerMonitorDPIAware(HWND hwnd) #define WXDPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((WXDPI_AWARENESS_CONTEXT)-4) typedef WXDPI_AWARENESS_CONTEXT(WINAPI * GetWindowDpiAwarenessContext_t)(HWND hwnd); typedef BOOL(WINAPI * AreDpiAwarenessContextsEqual_t)(WXDPI_AWARENESS_CONTEXT dpiContextA, WXDPI_AWARENESS_CONTEXT dpiContextB); - static GetWindowDpiAwarenessContext_t s_pfnGetWindowDpiAwarenessContext = NULL; - static AreDpiAwarenessContextsEqual_t s_pfnAreDpiAwarenessContextsEqual = NULL; + static GetWindowDpiAwarenessContext_t s_pfnGetWindowDpiAwarenessContext = nullptr; + static AreDpiAwarenessContextsEqual_t s_pfnAreDpiAwarenessContextsEqual = nullptr; static bool s_initDone = false; if ( !s_initDone ) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index f91161c93e..760cd7e99f 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -78,10 +78,10 @@ #if USE_NOTEBOOK_ANTIFLICKER // the pointer to standard spin button wnd proc -static WXWNDPROC gs_wndprocNotebookSpinBtn = NULL; +static WXWNDPROC gs_wndprocNotebookSpinBtn = nullptr; // the pointer to standard tab control wnd proc -static WXWNDPROC gs_wndprocNotebook = NULL; +static WXWNDPROC gs_wndprocNotebook = nullptr; LRESULT APIENTRY wxNotebookWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -123,7 +123,7 @@ wxEND_EVENT_TABLE() void wxNotebook::Init() { #if wxUSE_UXTHEME - m_hbrBackground = NULL; + m_hbrBackground = nullptr; #endif // wxUSE_UXTHEME #if USE_NOTEBOOK_ANTIFLICKER @@ -192,7 +192,7 @@ bool wxNotebook::Create(wxWindow *parent, // get a copy of standard class and modify it WNDCLASS wc; - if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) ) + if ( ::GetClassInfo(nullptr, WC_TABCONTROL, &wc) ) { gs_wndprocNotebook = wc.lpfnWndProc; wc.lpszClassName = wxT("_wx_SysTabCtl32"); @@ -446,7 +446,7 @@ void wxNotebook::OnImagesChanged() { wxImageList* const iml = GetUpdatedImageListFor(this); - (void) TabCtrl_SetImageList(GetHwnd(), iml ? GetHimagelistOf(iml) : NULL); + (void) TabCtrl_SetImageList(GetHwnd(), iml ? GetHimagelistOf(iml) : nullptr); } // ---------------------------------------------------------------------------- @@ -539,7 +539,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const void wxNotebook::AdjustPageSize(wxNotebookPage *page) { - wxCHECK_RET( page, wxT("NULL page in wxNotebook::AdjustPageSize") ); + wxCHECK_RET( page, wxT("null page in wxNotebook::AdjustPageSize") ); const wxRect r = GetPageSize(); if ( !r.IsEmpty() ) @@ -557,7 +557,7 @@ wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage) { wxNotebookPage *pageRemoved = wxNotebookBase::DoRemovePage(nPage); if ( !pageRemoved ) - return NULL; + return nullptr; // hide the removed page to maintain the invariant that only the // selected page is visible and others are hidden: @@ -625,7 +625,7 @@ bool wxNotebook::InsertPage(size_t nPage, bool bSelect, int imageId) { - wxCHECK_MSG( pPage != NULL, false, wxT("NULL page in wxNotebook::InsertPage") ); + wxCHECK_MSG( pPage != nullptr, false, wxT("null page in wxNotebook::InsertPage") ); wxCHECK_MSG( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false, wxT("invalid index in wxNotebook::InsertPage") ); @@ -1146,7 +1146,7 @@ WXHBRUSH wxNotebook::QueryBgBitmap() 9 /* TABP_PANE */, 0, &rc, - NULL + nullptr ); } // deselect bitmap from the memory HDC before using it @@ -1164,7 +1164,7 @@ void wxNotebook::UpdateBgBrush() } else // no themes or we've got user-defined solid colour { - m_hbrBackground = NULL; + m_hbrBackground = nullptr; } } @@ -1215,7 +1215,7 @@ bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child) 9 /* TABP_PANE */, 0, &rc, - NULL + nullptr ); return true; } @@ -1278,7 +1278,7 @@ wxColour wxNotebook::GetThemeBackgroundColour() const { WCHAR szwThemeFile[1024]; WCHAR szwThemeColor[256]; - if (S_OK == ::GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0)) + if (S_OK == ::GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, nullptr, 0)) { wxString themeFile(szwThemeFile); if (themeFile.Find(wxT("Aero")) != -1 && wxString(szwThemeColor) == wxT("NormalColor")) diff --git a/src/msw/notifmsg.cpp b/src/msw/notifmsg.cpp index 2e79ae0f37..483d9ac6e7 100644 --- a/src/msw/notifmsg.cpp +++ b/src/msw/notifmsg.cpp @@ -53,7 +53,7 @@ public: wxBalloonNotifMsgImpl(wxNotificationMessageBase* notification) : wxNotificationMessageImpl(notification), m_flags(wxICON_INFORMATION), - m_parent(NULL) + m_parent(nullptr) { } @@ -119,7 +119,7 @@ public: if ( ms_refCountIcon > 0 && !--ms_refCountIcon ) { delete ms_icon; - ms_icon = NULL; + ms_icon = nullptr; } } @@ -167,7 +167,7 @@ private: // wxBalloonNotifMsgImpl // ---------------------------------------------------------------------------- -wxTaskBarIcon *wxBalloonNotifMsgImpl::ms_icon = NULL; +wxTaskBarIcon *wxBalloonNotifMsgImpl::ms_icon = nullptr; int wxBalloonNotifMsgImpl::ms_refCountIcon = 0; /* static */ @@ -276,7 +276,7 @@ wxBalloonNotifMsgImpl::Show(int timeout) // disappearance from the system if we failed to install it in the // first place. delete ms_icon; - ms_icon = NULL; + ms_icon = nullptr; ms_refCountIcon = 0; return false; diff --git a/src/msw/ole/access.cpp b/src/msw/ole/access.cpp index 81c6d6d3d0..5812d04f96 100644 --- a/src/msw/ole/access.cpp +++ b/src/msw/ole/access.cpp @@ -317,11 +317,11 @@ public: // Helpers // Gets the standard IAccessible interface for the given child or object. - // Call Release if this is non-NULL. + // Call Release if this is non-null. IAccessible* GetChildStdAccessible(int id); // Gets the IAccessible interface for the given child or object. - // Call Release if this is non-NULL. + // Call Release if this is non-null. IAccessible* GetChildAccessible(int id); private: @@ -348,7 +348,7 @@ IMPLEMENT_IUNKNOWN_METHODS(wxIAccessible) wxIAccessible::wxIAccessible(wxAccessible *pAccessible) { - wxASSERT( pAccessible != NULL ); + wxASSERT( pAccessible != nullptr ); m_pAccessible = pAccessible; m_bQuiescing = false; @@ -359,7 +359,7 @@ wxIAccessible::wxIAccessible(wxAccessible *pAccessible) void wxIAccessible::Quiesce() { m_bQuiescing = true; - m_pAccessible = NULL; + m_pAccessible = nullptr; } // Retrieves the child element or child object at a given point on the screen. @@ -368,11 +368,11 @@ void wxIAccessible::Quiesce() STDMETHODIMP wxIAccessible::accHitTest(LONG xLeft, LONG yLeft, VARIANT* pVarID) { wxLogTrace(wxT("access"), wxT("accHitTest")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; - wxAccessible* childObject = NULL; + wxAccessible* childObject = nullptr; int childId = 0; VariantInit(pVarID); @@ -441,7 +441,7 @@ STDMETHODIMP wxIAccessible::accHitTest(LONG xLeft, LONG yLeft, VARIANT* pVarID) STDMETHODIMP wxIAccessible::accLocation ( LONG* pxLeft, LONG* pyTop, LONG* pcxWidth, LONG* pcyHeight, VARIANT varID) { wxLogTrace(wxT("access"), wxT("accLocation")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -491,7 +491,7 @@ STDMETHODIMP wxIAccessible::accLocation ( LONG* pxLeft, LONG* pyTop, LONG* pcxWi STDMETHODIMP wxIAccessible::accNavigate ( LONG navDir, VARIANT varStart, VARIANT* pVarEnd) { - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; wxLogTrace(wxT("access"), wxString(wxT("accNavigate for ")) + m_pAccessible->GetWindow()->GetClassInfo()->GetClassName()); @@ -502,7 +502,7 @@ STDMETHODIMP wxIAccessible::accNavigate ( LONG navDir, VARIANT varStart, VARIANT return E_INVALIDARG; } - wxAccessible* elementObject = NULL; + wxAccessible* elementObject = nullptr; int elementId = 0; VariantInit(pVarEnd); wxNavDir navDirWX = wxNAVDIR_FIRSTCHILD; @@ -648,7 +648,7 @@ STDMETHODIMP wxIAccessible::accNavigate ( LONG navDir, VARIANT varStart, VARIANT STDMETHODIMP wxIAccessible::get_accChild ( VARIANT varChildID, IDispatch** ppDispChild) { wxLogTrace(wxT("access"), wxT("get_accChild")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -665,7 +665,7 @@ STDMETHODIMP wxIAccessible::get_accChild ( VARIANT varChildID, IDispatch** ppDis return S_OK; } - wxAccessible* child = NULL; + wxAccessible* child = nullptr; wxAccStatus status = m_pAccessible->GetChild(varChildID.lVal, & child); if (status == wxACC_FAIL) @@ -727,7 +727,7 @@ STDMETHODIMP wxIAccessible::get_accChild ( VARIANT varChildID, IDispatch** ppDis STDMETHODIMP wxIAccessible::get_accChildCount ( LONG* pCountChildren) { wxLogTrace(wxT("access"), wxT("get_accChildCount")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -771,17 +771,17 @@ STDMETHODIMP wxIAccessible::get_accChildCount ( LONG* pCountChildren) STDMETHODIMP wxIAccessible::get_accParent ( IDispatch** ppDispParent) { wxLogTrace(wxT("access"), wxT("get_accParent")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; - wxAccessible* parent = NULL; + wxAccessible* parent = nullptr; wxAccStatus status = m_pAccessible->GetParent(& parent); if (status == wxACC_FAIL) return E_FAIL; - // It doesn't seem acceptable to return S_FALSE with a NULL + // It doesn't seem acceptable to return S_FALSE with a null // ppDispParent, so if we have no wxWidgets parent, we leave // it to the standard interface. if (status == wxACC_NOT_IMPLEMENTED || !parent) @@ -816,8 +816,8 @@ STDMETHODIMP wxIAccessible::get_accParent ( IDispatch** ppDispParent) { // This doesn't seem to be allowed, despite the documentation, // so we handle it higher up by using the standard interface. - wxLogTrace(wxT("access"), wxT("Returning NULL parent because there was none")); - *ppDispParent = NULL; + wxLogTrace(wxT("access"), wxT("Returning null parent because there was none")); + *ppDispParent = nullptr; return S_FALSE; } } @@ -835,7 +835,7 @@ STDMETHODIMP wxIAccessible::get_accParent ( IDispatch** ppDispParent) STDMETHODIMP wxIAccessible::accDoDefaultAction(VARIANT varID) { wxLogTrace(wxT("access"), wxT("accDoDefaultAction")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -886,7 +886,7 @@ STDMETHODIMP wxIAccessible::accDoDefaultAction(VARIANT varID) STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefaultAction) { wxLogTrace(wxT("access"), wxT("get_accDefaultAction")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -930,7 +930,7 @@ STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefau { if (defaultAction.IsEmpty()) { - * pszDefaultAction = NULL; + * pszDefaultAction = nullptr; return S_FALSE; } else @@ -948,7 +948,7 @@ STDMETHODIMP wxIAccessible::get_accDefaultAction ( VARIANT varID, BSTR* pszDefau STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescription) { wxLogTrace(wxT("access"), wxT("get_accDescription")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -990,7 +990,7 @@ STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescrip { if (description.empty()) { - * pszDescription = NULL; + * pszDescription = nullptr; return S_FALSE; } else @@ -1008,7 +1008,7 @@ STDMETHODIMP wxIAccessible::get_accDescription ( VARIANT varID, BSTR* pszDescrip STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp) { wxLogTrace(wxT("access"), wxT("get_accHelp")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1050,7 +1050,7 @@ STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp) { if (helpString.empty()) { - * pszHelp = NULL; + * pszHelp = nullptr; return S_FALSE; } else @@ -1071,7 +1071,7 @@ STDMETHODIMP wxIAccessible::get_accHelp ( VARIANT varID, BSTR* pszHelp) STDMETHODIMP wxIAccessible::get_accHelpTopic ( BSTR* pszHelpFile, VARIANT varChild, LONG* pidTopic) { wxLogTrace(wxT("access"), wxT("get_accHelpTopic")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1116,9 +1116,9 @@ STDMETHODIMP wxIAccessible::get_accHelpTopic ( BSTR* pszHelpFile, VARIANT varChi STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKeyboardShortcut) { wxLogTrace(wxT("access"), wxT("get_accKeyboardShortcut")); - *pszKeyboardShortcut = NULL; + *pszKeyboardShortcut = nullptr; - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1160,7 +1160,7 @@ STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKe { if (keyboardShortcut.empty()) { - * pszKeyboardShortcut = NULL; + * pszKeyboardShortcut = nullptr; return S_FALSE; } else @@ -1178,9 +1178,9 @@ STDMETHODIMP wxIAccessible::get_accKeyboardShortcut ( VARIANT varID, BSTR* pszKe STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName) { wxLogTrace(wxT("access"), wxT("get_accName")); - *pszName = NULL; + *pszName = nullptr; - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1223,7 +1223,7 @@ STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName) { if ( name.empty() ) { - *pszName = NULL; + *pszName = nullptr; return S_FALSE; } else @@ -1241,7 +1241,7 @@ STDMETHODIMP wxIAccessible::get_accName ( VARIANT varID, BSTR* pszName) STDMETHODIMP wxIAccessible::get_accRole ( VARIANT varID, VARIANT* pVarRole) { wxLogTrace(wxT("access"), wxT("get_accRole")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1304,7 +1304,7 @@ STDMETHODIMP wxIAccessible::get_accRole ( VARIANT varID, VARIANT* pVarRole) STDMETHODIMP wxIAccessible::get_accState ( VARIANT varID, VARIANT* pVarState) { wxLogTrace(wxT("access"), wxT("get_accState")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1357,7 +1357,7 @@ STDMETHODIMP wxIAccessible::get_accState ( VARIANT varID, VARIANT* pVarState) STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue) { wxLogTrace(wxT("access"), wxT("get_accValue")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1403,7 +1403,7 @@ STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue) { if ( strValue.empty() ) { - *pszValue = NULL; + *pszValue = nullptr; return S_FALSE; } else @@ -1422,7 +1422,7 @@ STDMETHODIMP wxIAccessible::get_accValue ( VARIANT varID, BSTR* pszValue) STDMETHODIMP wxIAccessible::accSelect ( LONG flagsSelect, VARIANT varID ) { wxLogTrace(wxT("access"), wxT("get_accSelect")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1473,11 +1473,11 @@ STDMETHODIMP wxIAccessible::accSelect ( LONG flagsSelect, VARIANT varID ) STDMETHODIMP wxIAccessible::get_accFocus ( VARIANT* pVarID) { wxLogTrace(wxT("access"), wxT("get_accFocus")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; - wxAccessible* childObject = NULL; + wxAccessible* childObject = nullptr; int childId = 0; VariantInit(pVarID); @@ -1543,7 +1543,7 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren) { #if wxUSE_VARIANT wxLogTrace(wxT("access"), wxT("get_accSelection")); - wxASSERT( ( m_pAccessible != NULL ) || ( m_bQuiescing == true ) ); + wxASSERT( ( m_pAccessible != nullptr ) || ( m_bQuiescing == true ) ); if (!m_pAccessible) return E_FAIL; @@ -1620,7 +1620,7 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren) STDMETHODIMP wxIAccessible::GetTypeInfo(unsigned int WXUNUSED(typeInfo), LCID WXUNUSED(lcid), ITypeInfo** ppTypeInfo) { - *ppTypeInfo = NULL; + *ppTypeInfo = nullptr; return E_NOTIMPL; } @@ -1651,7 +1651,7 @@ STDMETHODIMP wxIAccessible::Invoke(DISPID WXUNUSED(dispIdMember), REFIID WXUNUSE } // Gets the standard IAccessible interface for the given child or object. -// Call Release if this is non-NULL. +// Call Release if this is non-null. IAccessible* wxIAccessible::GetChildStdAccessible(int id) { if (id == 0) @@ -1667,10 +1667,10 @@ IAccessible* wxIAccessible::GetChildStdAccessible(int id) VariantInit(& var); var.vt = VT_I4; var.lVal = id; - IDispatch* pDispatch = NULL; + IDispatch* pDispatch = nullptr; if (S_OK == get_accChild ( var, & pDispatch)) { - IAccessible* childAccessible = NULL; + IAccessible* childAccessible = nullptr; if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK) { pDispatch->Release(); @@ -1708,7 +1708,7 @@ IAccessible* wxIAccessible::GetChildStdAccessible(int id) var.vt = VT_DISPATCH; if (S_OK == AccessibleChildren(this, i, 1, & var, &obtained)) { - IAccessible* childAccessible = NULL; + IAccessible* childAccessible = nullptr; if (var.pdispVal->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK) { var.pdispVal->Release(); @@ -1725,11 +1725,11 @@ IAccessible* wxIAccessible::GetChildStdAccessible(int id) } } #endif - return NULL; + return nullptr; } // Gets the IAccessible interface for the given child or object. -// Call Release if this is non-NULL. +// Call Release if this is non-null. IAccessible* wxIAccessible::GetChildAccessible(int id) { if (id == 0) @@ -1745,10 +1745,10 @@ IAccessible* wxIAccessible::GetChildAccessible(int id) VariantInit(& var); var.vt = VT_I4; var.lVal = id; - IDispatch* pDispatch = NULL; + IDispatch* pDispatch = nullptr; if (S_OK == get_accChild ( var, & pDispatch)) { - IAccessible* childAccessible = NULL; + IAccessible* childAccessible = nullptr; if (pDispatch->QueryInterface(IID_IAccessible, (LPVOID*) & childAccessible) == S_OK) { pDispatch->Release(); @@ -1760,7 +1760,7 @@ IAccessible* wxIAccessible::GetChildAccessible(int id) } } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -1772,7 +1772,7 @@ IAccessible* wxIAccessible::GetChildAccessible(int id) // common part of all ctors void wxAccessible::Init() { - m_pIAccessibleStd = NULL; + m_pIAccessibleStd = nullptr; m_pIAccessible = new wxIAccessible(this); m_pIAccessible->AddRef(); } @@ -1805,11 +1805,11 @@ IAccessible *wxAccessible::GetIAccessibleStd() return m_pIAccessibleStd; else { - m_pIAccessibleStd = NULL; - return NULL; + m_pIAccessibleStd = nullptr; + return nullptr; } } - return NULL; + return nullptr; } namespace diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index 3a54273e1a..763354c460 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -70,7 +70,7 @@ wxDEFINE_EVENT( wxEVT_ACTIVEX, wxActiveXEvent ); {\ return E_FAIL;\ }\ - const char *desc = NULL;\ + const char *desc = nullptr;\ cls::_GetInterface(this, iid, ppvObject, desc);\ if (! *ppvObject)\ {\ @@ -119,8 +119,8 @@ wxDEFINE_EVENT( wxEVT_ACTIVEX, wxActiveXEvent ); #define DEFINE_OLE_BASE(cls)\ void cls::_GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc)\ {\ - *_interface = NULL;\ - desc = NULL; + *_interface = nullptr;\ + desc = nullptr; #define OLE_INTERFACE(_iid, _type)\ if (IsEqualIID(iid, _iid))\ @@ -205,7 +205,7 @@ public: m_bAmbientShowGrabHandles = true; m_bAmbientAppearance = true; - m_hDCBuffer = NULL; + m_hDCBuffer = nullptr; m_hWndParent = (HWND)win->GetHWND(); } virtual ~FrameSite(){} @@ -226,7 +226,7 @@ public: if (!(wFlags & DISPATCH_PROPERTYGET)) return S_OK; - if (pVarResult == NULL) + if (pVarResult == nullptr) return E_INVALIDARG; //The most common case is boolean, use as an initial type @@ -295,7 +295,7 @@ public: //**************************IOleWindow*************************** HRESULT STDMETHODCALLTYPE GetWindow(HWND * phwnd) override { - if (phwnd == NULL) + if (phwnd == nullptr) return E_INVALIDARG; (*phwnd) = m_hWndParent; return S_OK; @@ -305,13 +305,13 @@ public: //**************************IOleInPlaceUIWindow***************** HRESULT STDMETHODCALLTYPE GetBorder(LPRECT lprectBorder) override { - if (lprectBorder == NULL) + if (lprectBorder == nullptr) return E_INVALIDARG; return INPLACE_E_NOTOOLSPACE; } HRESULT STDMETHODCALLTYPE RequestBorderSpace(LPCBORDERWIDTHS pborderwidths) override { - if (pborderwidths == NULL) + if (pborderwidths == nullptr) return E_INVALIDARG; return INPLACE_E_NOTOOLSPACE; } @@ -354,13 +354,13 @@ public: LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo) override { - if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL || - lprcClipRect == NULL || lpFrameInfo == NULL) + if (ppFrame == nullptr || ppDoc == nullptr || lprcPosRect == nullptr || + lprcClipRect == nullptr || lpFrameInfo == nullptr) { - if (ppFrame != NULL) - (*ppFrame) = NULL; - if (ppDoc != NULL) - (*ppDoc) = NULL; + if (ppFrame != nullptr) + (*ppFrame) = nullptr; + if (ppDoc != nullptr) + (*ppDoc) = nullptr; return E_INVALIDARG; } @@ -374,7 +374,7 @@ public: if (! SUCCEEDED(hr)) { (*ppFrame)->Release(); - *ppFrame = NULL; + *ppFrame = nullptr; return E_UNEXPECTED; } @@ -467,7 +467,7 @@ public: STDMETHOD(GetMoniker)(DWORD, DWORD, IMoniker **) override {return E_FAIL;} HRESULT STDMETHODCALLTYPE GetContainer(LPOLECONTAINER * ppContainer) override { - if (ppContainer == NULL) + if (ppContainer == nullptr) return E_INVALIDARG; HRESULT hr = QueryInterface( IID_IOleContainer, (void**)(ppContainer)); @@ -497,22 +497,22 @@ public: #endif (LPOLESTR pszItem, DWORD, IBindCtx *, REFIID, void ** ppvObject) override { - if (pszItem == NULL || ppvObject == NULL) + if (pszItem == nullptr || ppvObject == nullptr) return E_INVALIDARG; - *ppvObject = NULL; + *ppvObject = nullptr; return MK_E_NOOBJECT; } HRESULT STDMETHODCALLTYPE GetObjectStorage( LPOLESTR pszItem, IBindCtx * , REFIID, void ** ppvStorage) override { - if (pszItem == NULL || ppvStorage == NULL) + if (pszItem == nullptr || ppvStorage == nullptr) return E_INVALIDARG; - *ppvStorage = NULL; + *ppvStorage = nullptr; return MK_E_NOOBJECT; } HRESULT STDMETHODCALLTYPE IsRunning(LPOLESTR pszItem) override { - if (pszItem == NULL) + if (pszItem == nullptr) return E_INVALIDARG; return MK_E_NOOBJECT; } @@ -529,7 +529,7 @@ public: HRESULT STDMETHODCALLTYPE TransformCoords( POINTL * pPtlHimetric, POINTF * pPtfContainer, DWORD) override { - if (pPtlHimetric == NULL || pPtfContainer == NULL) + if (pPtlHimetric == nullptr || pPtfContainer == nullptr) return E_INVALIDARG; return E_NOTIMPL; } @@ -541,7 +541,7 @@ public: HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *) override { - if (prgCmds == NULL) return E_INVALIDARG; + if (prgCmds == nullptr) return E_INVALIDARG; for (ULONG nCmd = 0; nCmd < cCmds; nCmd++) { // unsupported by default @@ -582,7 +582,7 @@ public: if (! oleDoc.IsOk()) return E_FAIL; - HRESULT hr = oleDoc->CreateView(inPlaceSite, NULL, + HRESULT hr = oleDoc->CreateView(inPlaceSite, nullptr, 0, m_window->m_docView.GetRef()); if (hr != S_OK) return E_FAIL; @@ -856,9 +856,9 @@ wxActiveXContainer::~wxActiveXContainer() m_oleObject->Unadvise(m_docAdviseCookie); m_oleObject->DoVerb( - OLEIVERB_HIDE, NULL, m_clientSite, 0, (HWND) GetHWND(), NULL); + OLEIVERB_HIDE, nullptr, m_clientSite, 0, (HWND) GetHWND(), nullptr); m_oleObject->Close(OLECLOSE_NOSAVE); - m_oleObject->SetClientSite(NULL); + m_oleObject->SetClientSite(nullptr); } // m_clientSite uses m_frameSite so destroy it first @@ -866,7 +866,7 @@ wxActiveXContainer::~wxActiveXContainer() delete m_frameSite; // our window doesn't belong to us, don't destroy it - m_hWnd = NULL; + m_hWnd = nullptr; } // VZ: we might want to really report an error instead of just asserting here @@ -921,7 +921,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) wxASSERT(typeInfo.IsOk()); // TYPEATTR - TYPEATTR *ta = NULL; + TYPEATTR *ta = nullptr; hret = typeInfo->GetTypeAttr(&ta); CHECK_HR(hret); @@ -969,7 +969,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) // wxAutoOleInterface<> assumes a ref has already been added // TYPEATTR - TYPEATTR *ta2 = NULL; + TYPEATTR *ta2 = nullptr; hret = ti->GetTypeAttr(&ta2); CHECK_HR(hret); @@ -1034,7 +1034,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) // TODO:Needed? // hret = m_viewObject->SetAdvise(DVASPECT_CONTENT, 0, adviseSink); - m_oleObject->SetHostNames(L"wxActiveXContainer", NULL); + m_oleObject->SetHostNames(L"wxActiveXContainer", nullptr); OleSetContainedObject(m_oleObject, TRUE); OleRun(m_oleObject); @@ -1076,7 +1076,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) RECT posRect; wxCopyRectToRECT(m_realparent->GetClientSize(), posRect); - hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, + hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, nullptr, m_clientSite, 0, (HWND)m_realparent->GetHWND(), &posRect); CHECK_HR(hret); @@ -1181,11 +1181,11 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event)) posRect.right = w; posRect.bottom = h; - ::RedrawWindow(m_oleObjectHWND, NULL, NULL, RDW_INTERNALPAINT); + ::RedrawWindow(m_oleObjectHWND, nullptr, nullptr, RDW_INTERNALPAINT); RECTL *prcBounds = (RECTL *) &posRect; wxMSWDCImpl *msw = wxDynamicCast( dc.GetImpl() , wxMSWDCImpl ); - m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, - (HDC)msw->GetHDC(), prcBounds, NULL, NULL, 0); + m_viewObject->Draw(DVASPECT_CONTENT, -1, nullptr, nullptr, nullptr, + (HDC)msw->GetHDC(), prcBounds, nullptr, nullptr, 0); } } diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 0dab31b237..6f7c9996d4 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -49,7 +49,7 @@ static void ShowException(const wxString& member, HRESULT hr, - EXCEPINFO *pexcep = NULL, + EXCEPINFO *pexcep = nullptr, unsigned int uiArgErr = 0); // wxAutomationObject @@ -66,7 +66,7 @@ wxAutomationObject::~wxAutomationObject() if (m_dispatchPtr) { ((IDispatch*)m_dispatchPtr)->Release(); - m_dispatchPtr = NULL; + m_dispatchPtr = nullptr; } } @@ -163,7 +163,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, { namedArgCount = 1; dispIds[1] = DISPID_PROPERTYPUT; - vReturnPtr = NULL; + vReturnPtr = nullptr; } // Convert the wxVariants to VARIANTARGs @@ -176,7 +176,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, } dispparams.rgdispidNamedArgs = &dispIds[0] + 1; - dispparams.rgvarg = oleArgs.empty() ? NULL : &oleArgs[0]; + dispparams.rgvarg = oleArgs.empty() ? nullptr : &oleArgs[0]; dispparams.cArgs = noArgs; dispparams.cNamedArgs = namedArgCount; @@ -208,13 +208,13 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, // Mustn't release the dispatch pointer if (vReturn.vt == VT_DISPATCH) { - vReturn.pdispVal = NULL; + vReturn.pdispVal = nullptr; } // Mustn't free the SAFEARRAY if it is contained in the retValue if ((vReturn.vt & VT_ARRAY) && retValue.GetType() == wxS("safearray")) { - vReturn.parray = NULL; + vReturn.parray = nullptr; } } } @@ -235,7 +235,7 @@ wxVariant wxAutomationObject::CallMethod(const wxString& member, int noArgs, wxV wxVariant wxAutomationObject::CallMethodArray(const wxString& member, int noArgs, const wxVariant **args) { wxVariant retVariant; - if (!Invoke(member, DISPATCH_METHOD, retVariant, noArgs, NULL, args)) + if (!Invoke(member, DISPATCH_METHOD, retVariant, noArgs, nullptr, args)) { retVariant.MakeNull(); } @@ -280,7 +280,7 @@ wxVariant wxAutomationObject::CallMethod(const wxString& member, i ++; } wxVariant retVariant; - if (!Invoke(member, DISPATCH_METHOD, retVariant, i, NULL, args)) + if (!Invoke(member, DISPATCH_METHOD, retVariant, i, nullptr, args)) { retVariant.MakeNull(); } @@ -292,7 +292,7 @@ wxVariant wxAutomationObject::CallMethod(const wxString& member, wxVariant wxAutomationObject::GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const { wxVariant retVariant; - if (!Invoke(property, DISPATCH_PROPERTYGET, retVariant, noArgs, NULL, args)) + if (!Invoke(property, DISPATCH_PROPERTYGET, retVariant, noArgs, nullptr, args)) { retVariant.MakeNull(); } @@ -346,7 +346,7 @@ wxVariant wxAutomationObject::GetProperty(const wxString& property, i ++; } wxVariant retVariant; - if (!Invoke(property, DISPATCH_PROPERTYGET, retVariant, i, NULL, args)) + if (!Invoke(property, DISPATCH_PROPERTYGET, retVariant, i, nullptr, args)) { retVariant.MakeNull(); } @@ -367,7 +367,7 @@ bool wxAutomationObject::PutProperty(const wxString& property, int noArgs, wxVar bool wxAutomationObject::PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args) { wxVariant retVariant; - if (!Invoke(property, DISPATCH_PROPERTYPUT, retVariant, noArgs, NULL, args)) + if (!Invoke(property, DISPATCH_PROPERTYPUT, retVariant, noArgs, nullptr, args)) { return false; } @@ -412,7 +412,7 @@ bool wxAutomationObject::PutProperty(const wxString& property, i ++; } wxVariant retVariant; - bool ret = Invoke(property, DISPATCH_PROPERTYPUT, retVariant, i, NULL, args); + bool ret = Invoke(property, DISPATCH_PROPERTYPUT, retVariant, i, nullptr, args); delete[] args; return ret; } @@ -433,7 +433,7 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i } } - return NULL; + return nullptr; } // Uses DISPATCH_PROPERTYGET @@ -443,7 +443,7 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const { wxVariant retVariant; - if (Invoke(property, DISPATCH_PROPERTYGET, retVariant, noArgs, NULL, args)) + if (Invoke(property, DISPATCH_PROPERTYGET, retVariant, noArgs, nullptr, args)) { if (retVariant.GetType() == wxT("void*")) { @@ -451,7 +451,7 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i } } - return NULL; + return nullptr; } @@ -505,13 +505,13 @@ void *DoCreateInstance(const wxString& progId, const CLSID& clsId) // NB: using CLSCTX_INPROC_HANDLER results in failure when getting // Automation interface for Microsoft Office applications so don't use // CLSCTX_ALL which includes it - void *pDispatch = NULL; - HRESULT hr = CoCreateInstance(clsId, NULL, CLSCTX_SERVER, + void *pDispatch = nullptr; + HRESULT hr = CoCreateInstance(clsId, nullptr, CLSCTX_SERVER, IID_IDispatch, &pDispatch); if (FAILED(hr)) { wxLogSysError(hr, _("Failed to create an instance of \"%s\""), progId); - return NULL; + return nullptr; } return pDispatch; @@ -531,8 +531,8 @@ bool wxAutomationObject::GetInstance(const wxString& progId, int flags) const if (FAILED(hr)) return false; - IUnknown *pUnk = NULL; - hr = GetActiveObject(clsId, NULL, &pUnk); + IUnknown *pUnk = nullptr; + hr = GetActiveObject(clsId, nullptr, &pUnk); if (FAILED(hr)) { if ( flags & wxAutomationInstance_CreateIfNeeded ) @@ -585,7 +585,7 @@ bool wxAutomationObject::CreateInstance(const wxString& progId) const const_cast(this)-> m_dispatchPtr = DoCreateInstance(progId, clsId); - return m_dispatchPtr != NULL; + return m_dispatchPtr != nullptr; } WXLCID wxAutomationObject::GetLCID() const diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index 721a9a4f5b..8cfbfae1ef 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -92,7 +92,7 @@ wxDataFormat NonStandardFormatsFixup(wxDataFormat format) // helper function for wxCopyStgMedium() HGLOBAL wxGlobalClone(HGLOBAL hglobIn) { - HGLOBAL hglobOut = NULL; + HGLOBAL hglobOut = nullptr; GlobalPtrLock ptrIn(hglobIn); if (ptrIn) @@ -118,7 +118,7 @@ HRESULT wxCopyStgMedium(const STGMEDIUM *pmediumIn, STGMEDIUM *pmediumOut) HRESULT hres = S_OK; STGMEDIUM stgmOut = *pmediumIn; - if (pmediumIn->pUnkForRelease == NULL && + if (pmediumIn->pUnkForRelease == nullptr && !(pmediumIn->tymed & (TYMED_ISTREAM | TYMED_ISTORAGE))) { // Object needs to be cloned. @@ -298,7 +298,7 @@ wxIDataObject::SaveSystemData(FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease) { - if ( pformatetc == NULL || pmedium == NULL ) + if ( pformatetc == nullptr || pmedium == nullptr ) return E_INVALIDARG; // remove entry if already available @@ -443,7 +443,7 @@ STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt, while (m_nCurrent < m_nCount && numFetched < celt) { FORMATETC format; format.cfFormat = m_formats[m_nCurrent++]; - format.ptd = NULL; + format.ptd = nullptr; format.dwAspect = DVASPECT_CONTENT; format.lindex = -1; format.tymed = TYMED_HGLOBAL; @@ -486,7 +486,7 @@ STDMETHODIMP wxIEnumFORMATETC::Clone(IEnumFORMATETC **ppenum) wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumFORMATETC::Clone")); // unfortunately, we can't reuse the code in ctor - types are different - wxIEnumFORMATETC *pNew = new wxIEnumFORMATETC(NULL, 0); + wxIEnumFORMATETC *pNew = new wxIEnumFORMATETC(nullptr, 0); pNew->m_nCount = m_nCount; pNew->m_formats = new CLIPFORMAT[m_nCount]; for ( ULONG n = 0; n < m_nCount; n++ ) { @@ -586,7 +586,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) size += m_pDataObject->GetBufferOffset( format ); HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, size); - if ( hGlobal == NULL ) { + if ( hGlobal == nullptr ) { wxLogLastError(wxT("GlobalAlloc")); return E_OUTOFMEMORY; } @@ -596,7 +596,7 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) pmedium->hGlobal = hGlobal; } - pmedium->pUnkForRelease = NULL; + pmedium->pUnkForRelease = nullptr; // do copy the data hr = GetDataHere(pformatetcIn, pmedium); @@ -796,7 +796,7 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, STDMETHODIMP wxIDataObject::QueryGetData(FORMATETC *pformatetc) { // do we accept data in this format? - if ( pformatetc == NULL ) { + if ( pformatetc == nullptr ) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: invalid ptr.")); @@ -867,8 +867,8 @@ STDMETHODIMP wxIDataObject::GetCanonicalFormatEtc(FORMATETC *WXUNUSED(pFormatetc wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::GetCanonicalFormatEtc")); // TODO we might want something better than this trivial implementation here - if ( pFormatetcOut != NULL ) - pFormatetcOut->ptd = NULL; + if ( pFormatetcOut != nullptr ) + pFormatetcOut->ptd = nullptr; return DATA_S_SAMEFORMATETC; } @@ -952,7 +952,7 @@ void wxDataObject::SetAutoDelete() m_pIDataObject->Release(); // so that the dtor doesn't crash - m_pIDataObject = NULL; + m_pIDataObject = nullptr; } size_t wxDataObject::GetBufferOffset(const wxDataFormat& format ) @@ -969,7 +969,7 @@ const void *wxDataObject::GetSizeFromBuffer(const void *buffer, if ( !realsz ) { wxLogLastError(wxT("GlobalSize")); - return NULL; + return nullptr; } *size = realsz; @@ -1044,7 +1044,7 @@ const wxChar *wxDataObject::GetFormatName(wxDataFormat format) size_t wxBitmapDataObject::GetDataSize() const { #if wxUSE_WXDIB - return wxDIB::ConvertFromBitmap(NULL, GetHbitmapOf(GetBitmap())); + return wxDIB::ConvertFromBitmap(nullptr, GetHbitmapOf(GetBitmap())); #else return 0; #endif @@ -1147,9 +1147,9 @@ size_t wxBitmapDataObject::GetDataSize(const wxDataFormat& format) const // first get the info BITMAPINFO bi; if ( !GetDIBits(hdc, (HBITMAP)m_bitmap.GetHBITMAP(), 0, 0, - NULL, &bi, DIB_RGB_COLORS) ) + nullptr, &bi, DIB_RGB_COLORS) ) { - wxLogLastError(wxT("GetDIBits(NULL)")); + wxLogLastError(wxT("GetDIBits(nullptr)")); return 0; } @@ -1180,9 +1180,9 @@ bool wxBitmapDataObject::GetDataHere(const wxDataFormat& format, // first get the info BITMAPINFO *pbi = (BITMAPINFO *)pBuf; - if ( !GetDIBits(hdc, hbmp, 0, 0, NULL, pbi, DIB_RGB_COLORS) ) + if ( !GetDIBits(hdc, hbmp, 0, 0, nullptr, pbi, DIB_RGB_COLORS) ) { - wxLogLastError(wxT("GetDIBits(NULL)")); + wxLogLastError(wxT("GetDIBits(nullptr)")); return 0; } @@ -1272,7 +1272,7 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), HDROP hdrop = static_cast(const_cast(pData)); // NB: it works, but I'm not sure about it // get number of files (magic value -1) - UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u); + UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, nullptr, 0u); wxCHECK_MSG ( nFiles != (UINT)-1, FALSE, wxT("wrong HDROP handle") ); @@ -1281,7 +1281,7 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), UINT len, n; for ( n = 0; n < nFiles; n++ ) { // +1 for terminating NUL - len = ::DragQueryFile(hdrop, n, NULL, 0) + 1; + len = ::DragQueryFile(hdrop, n, nullptr, 0) + 1; UINT len2 = ::DragQueryFile(hdrop, n, wxStringBuffer(str, len), len); m_filenames.Add(str); @@ -1334,7 +1334,7 @@ bool wxFileDataObject::GetDataHere(void *pData) const // pData points to an externally allocated memory block // created using the size returned by GetDataSize() - // if pData is NULL, or there are no files, return + // if pData is null, or there are no files, return if ( !pData || m_filenames.empty() ) return false; @@ -1419,7 +1419,7 @@ wxURLDataObject::wxURLDataObject(const wxString& url) Add(new CFSTR_SHELLURLDataObject()); // we don't have any data yet - m_dataObjectLast = NULL; + m_dataObjectLast = nullptr; if ( !url.empty() ) SetURL(url); @@ -1538,14 +1538,14 @@ void wxDataObject::SetAutoDelete() const wxChar *wxDataObject::GetFormatName(wxDataFormat WXUNUSED(format)) { - return NULL; + return nullptr; } const void* wxDataObject::GetSizeFromBuffer(const void* WXUNUSED(buffer), size_t* size, const wxDataFormat& WXUNUSED(format)) { *size = 0; - return NULL; + return nullptr; } void* wxDataObject::SetSizeInBuffer(void* buffer, size_t WXUNUSED(size), diff --git a/src/msw/ole/dropsrc.cpp b/src/msw/ole/dropsrc.cpp index dba949d774..1d4cd630d5 100644 --- a/src/msw/ole/dropsrc.cpp +++ b/src/msw/ole/dropsrc.cpp @@ -74,7 +74,7 @@ IMPLEMENT_IUNKNOWN_METHODS(wxIDropSource) wxIDropSource::wxIDropSource(wxDropSource *pDropSource) { - wxASSERT( pDropSource != NULL ); + wxASSERT( pDropSource != nullptr ); m_pDropSource = pDropSource; m_grfInitKeyState = 0; @@ -175,7 +175,7 @@ wxDropSource::~wxDropSource() // Notes : you must call SetData() before if you had used def ctor wxDragResult wxDropSource::DoDragDrop(int flags) { - wxCHECK_MSG( m_data != NULL, wxDragNone, wxT("No data in wxDropSource!") ); + wxCHECK_MSG( m_data != nullptr, wxDragNone, wxT("No data in wxDropSource!") ); DWORD dwEffect; HRESULT hr = ::DoDragDrop(m_data->GetInterface(), diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp index e4dd24aae4..3c4a056834 100644 --- a/src/msw/ole/droptgt.cpp +++ b/src/msw/ole/droptgt.cpp @@ -88,7 +88,7 @@ public: DECLARE_IUNKNOWN_METHODS; protected: - // This pointer is !NULL between the calls to DragEnter and DragLeave/Drop + // This pointer is not null between the calls to DragEnter and DragLeave/Drop wxCOMPtr m_pIDataObject; wxDropTarget *m_pTarget; // the real target (we're just a proxy) @@ -210,7 +210,7 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource, if ( SUCCEEDED(pIDataSource->EnumFormatEtc(DATADIR_GET, &penumFmt)) ) { FORMATETC fmt; - while ( penumFmt->Next(1, &fmt, NULL) == S_OK ) + while ( penumFmt->Next(1, &fmt, nullptr) == S_OK ) { wxLogDebug(wxT("Drop source supports format %s"), wxDataObject::GetFormatName(fmt.cfFormat)); @@ -446,7 +446,7 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource, wxDropTarget::wxDropTarget(wxDataObject *dataObj) : wxDropTargetBase(dataObj), - m_dropTargetHelper(NULL) + m_dropTargetHelper(nullptr) { // create an IDropTarget implementation which will notify us about d&d // operations. @@ -526,7 +526,7 @@ bool wxDropTarget::GetData() STGMEDIUM stm; FORMATETC fmtMemory; fmtMemory.cfFormat = format; - fmtMemory.ptd = NULL; + fmtMemory.ptd = nullptr; fmtMemory.dwAspect = DVASPECT_CONTENT; fmtMemory.lindex = -1; fmtMemory.tymed = TYMED_HGLOBAL; // TODO to add other media @@ -583,7 +583,7 @@ wxDataFormat wxDropTarget::MSWGetSupportedFormat(IDataObject *pIDataSource) cons // changing) being passed through global memory block. static FORMATETC s_fmtMemory = { 0, - NULL, + nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL // TODO is it worth supporting other tymeds here? @@ -627,10 +627,10 @@ void wxDropTarget::MSWEndDragImageSupport() { // release drop target helper - if ( m_dropTargetHelper != NULL ) + if ( m_dropTargetHelper != nullptr ) { m_dropTargetHelper->Release(); - m_dropTargetHelper = NULL; + m_dropTargetHelper = nullptr; } } @@ -638,7 +638,7 @@ void wxDropTarget::MSWInitDragImageSupport() { // Use the default drop target helper to show shell drag images - CoCreateInstance(wxCLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, + CoCreateInstance(wxCLSID_DragDropHelper, nullptr, CLSCTX_INPROC_SERVER, wxIID_IDropTargetHelper, (LPVOID*)&m_dropTargetHelper); } @@ -648,7 +648,7 @@ wxDropTarget::MSWUpdateDragImageOnData(wxCoord x, wxDragResult dragResult) { // call corresponding event on drop target helper - if ( m_dropTargetHelper != NULL ) + if ( m_dropTargetHelper != nullptr ) { POINT pt = {x, y}; DWORD dwEffect = ConvertDragResultToEffect(dragResult); @@ -662,7 +662,7 @@ wxDropTarget::MSWUpdateDragImageOnDragOver(wxCoord x, wxDragResult dragResult) { // call corresponding event on drop target helper - if ( m_dropTargetHelper != NULL ) + if ( m_dropTargetHelper != nullptr ) { POINT pt = {x, y}; DWORD dwEffect = ConvertDragResultToEffect(dragResult); @@ -676,7 +676,7 @@ wxDropTarget::MSWUpdateDragImageOnEnter(wxCoord x, wxDragResult dragResult) { // call corresponding event on drop target helper - if ( m_dropTargetHelper != NULL ) + if ( m_dropTargetHelper != nullptr ) { POINT pt = {x, y}; DWORD dwEffect = ConvertDragResultToEffect(dragResult); @@ -688,7 +688,7 @@ void wxDropTarget::MSWUpdateDragImageOnLeave() { // call corresponding event on drop target helper - if ( m_dropTargetHelper != NULL ) + if ( m_dropTargetHelper != nullptr ) { m_dropTargetHelper->DragLeave(); } diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp index a5583b66d7..7942f689dd 100644 --- a/src/msw/ole/oleutils.cpp +++ b/src/msw/ole/oleutils.cpp @@ -40,7 +40,7 @@ WXDLLEXPORT BSTR wxConvertStringToOle(const wxString& str) WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr) { - // NULL BSTR is equivalent to an empty string (this is the convention used + // null BSTR is equivalent to an empty string (this is the convention used // by VB and hence we must follow it) if ( !bStr ) return wxString(); @@ -57,7 +57,7 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr) buf.SetLength(WideCharToMultiByte(CP_ACP, 0 /* no flags */, bStr, len /* not necessarily NUL-terminated */, buf, len, - NULL, NULL /* no default char */)); + nullptr, nullptr /* no default char */)); } #endif @@ -77,7 +77,7 @@ BSTR wxBasicString::Detach() { BSTR bstr = m_bstrBuf; - m_bstrBuf = NULL; + m_bstrBuf = nullptr; return bstr; } @@ -93,7 +93,7 @@ wxBasicString& wxBasicString::operator=(const wxBasicString& src) { if ( this != &src ) { - wxCHECK_MSG(m_bstrBuf == NULL || m_bstrBuf != src.m_bstrBuf, + wxCHECK_MSG(m_bstrBuf == nullptr || m_bstrBuf != src.m_bstrBuf, *this, wxS("Attempting to assign already owned BSTR")); SysFreeString(m_bstrBuf); m_bstrBuf = src.Copy(); @@ -152,7 +152,7 @@ bool wxVariantDataCurrency::Write(wxSTD ostream& str) const bool wxVariantDataCurrency::Write(wxString& str) const { - BSTR bStr = NULL; + BSTR bStr = nullptr; if ( SUCCEEDED(VarBstrFromCy(m_value, LOCALE_USER_DEFAULT, 0, &bStr)) ) { str = wxConvertStringFromOle(bStr); diff --git a/src/msw/ole/safearray.cpp b/src/msw/ole/safearray.cpp index 6deb68eed7..c4c5d5ef20 100644 --- a/src/msw/ole/safearray.cpp +++ b/src/msw/ole/safearray.cpp @@ -45,17 +45,17 @@ void wxSafeArrayBase::Destroy() { wxLogApiError(wxS("SafeArrayDestroy()"), hr); } - m_array = NULL; + m_array = nullptr; } } SAFEARRAY* wxSafeArrayBase::Detach() { - wxCHECK_MSG( m_array, NULL, wxS("Uninitialized safe array") ); + wxCHECK_MSG( m_array, nullptr, wxS("Uninitialized safe array") ); Unlock(); SAFEARRAY* array = m_array; - m_array = NULL; + m_array = nullptr; return array; } diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index 16795c8bb9..437152baf4 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -161,7 +161,7 @@ bool Uuid::Set(const wxChar *pc) // 6aadc650-67b0-11d0-bac8-0000c018ba27 void Uuid::UuidToCForm() { - if ( m_pszCForm == NULL ) + if ( m_pszCForm == nullptr ) m_pszCForm = new wxChar[UUID_CSTRLEN]; wsprintf(m_pszCForm, wxT("0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X"), diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index c0673f95a9..2500dcefca 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -82,7 +82,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc, const wxRect& rc, int cx = rc.GetWidth() - GetMarginWidth(); int cy = sizeRect.cy; - ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text), + ::DrawState(hdc, nullptr, nullptr, wxMSW_CONV_LPARAM(text), text.length(), x, y, cx, cy, flags); } // reset to default the font, colors and brush @@ -118,7 +118,7 @@ BOOL wxDrawStateBitmap(HDC hDC, HBITMAP hBitmap, int x, int y, UINT uState) // (like default selected items) HIMAGELIST hIml = ::ImageList_Create(bmp.bmWidth, bmp.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 1); - ::ImageList_Add(hIml, hBitmap, NULL); + ::ImageList_Add(hIml, hBitmap, nullptr); UINT fStyle = uState == wxDSB_SELECTED ? ILD_SELECTED : ILD_NORMAL; result = ::ImageList_Draw(hIml, 0, hDC, x, y, fStyle); ::ImageList_Destroy(hIml); @@ -126,7 +126,7 @@ BOOL wxDrawStateBitmap(HDC hDC, HBITMAP hBitmap, int x, int y, UINT uState) break; case wxDSB_DISABLED: - result = ::DrawState(hDC, NULL, NULL, (LPARAM)hBitmap, 0, x, y, + result = ::DrawState(hDC, nullptr, nullptr, (LPARAM)hBitmap, 0, x, y, bmp.bmWidth, bmp.bmHeight, DST_BITMAP | DSS_DISABLED); break; diff --git a/src/msw/palette.cpp b/src/msw/palette.cpp index a105ea4755..18cfd5651b 100644 --- a/src/msw/palette.cpp +++ b/src/msw/palette.cpp @@ -79,7 +79,7 @@ public: UINT GetEntries() const { - return ::GetPaletteEntries(m_hPalette, 0, 0, NULL); + return ::GetPaletteEntries(m_hPalette, 0, 0, nullptr); } private: diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index 42e833e2ab..b45d851336 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -124,7 +124,7 @@ private: m_cap = wxCAP_ROUND; m_quality = wxPEN_QUALITY_DEFAULT; m_nbDash = 0; - m_dash = NULL; + m_dash = nullptr; m_hPen = 0; } @@ -401,7 +401,7 @@ bool wxPenRefData::Alloc() } else { - dash = NULL; + dash = nullptr; } // Note that width can't be 0 for ExtCreatePen(), unlike for CreatePen(). @@ -615,9 +615,9 @@ int wxPen::GetDashes(wxDash** ptr) const wxDash* wxPen::GetDash() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid pen") ); - return m_refData ? M_PENDATA->GetDash() : NULL; + return m_refData ? M_PENDATA->GetDash() : nullptr; } int wxPen::GetDashCount() const @@ -629,7 +629,7 @@ int wxPen::GetDashCount() const wxBitmap* wxPen::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid pen") ); - return m_refData ? M_PENDATA->GetStipple() : NULL; + return m_refData ? M_PENDATA->GetStipple() : nullptr; } diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index cdefbdb552..e7606142ae 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -33,7 +33,7 @@ // // Note that this global variable is used in src/msw/window.cpp and so must be // extern. -wxPopupWindow* wxCurrentPopupWindow = NULL; +wxPopupWindow* wxCurrentPopupWindow = nullptr; // ============================================================================ // implementation @@ -61,7 +61,7 @@ wxPopupWindow::~wxPopupWindow() // If the popup is destroyed without being hidden first, ensure that we are // not left with a dangling pointer. if ( wxCurrentPopupWindow == this ) - wxCurrentPopupWindow = NULL; + wxCurrentPopupWindow = nullptr; } WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const @@ -140,7 +140,7 @@ bool wxPopupWindow::Show(bool show) // There could have been a previous popup window which hasn't been // hidden yet. This will happen now, when we show this one, as it will // result in activation loss for the other one, so it's ok to overwrite - // the old pointer, even if it's non-NULL. + // the old pointer, even if it's non-null. wxCurrentPopupWindow = this; } else @@ -148,7 +148,7 @@ bool wxPopupWindow::Show(bool show) // Only reset the pointer if it points to this window, otherwise we // would lose the correct value in the situation described above. if ( wxCurrentPopupWindow == this ) - wxCurrentPopupWindow = NULL; + wxCurrentPopupWindow = nullptr; } if ( HasFlag(wxPU_CONTAINS_CONTROLS) ) diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index 96bd844f24..4b446e73b1 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -47,7 +47,7 @@ public: // default ctor WinPrinter() { - m_hPrinter = (HANDLE)NULL; + m_hPrinter = nullptr; } WinPrinter( const wxString& printerName ) @@ -60,7 +60,7 @@ public: Close(); } - BOOL Open( const wxString& printerName, LPPRINTER_DEFAULTS pDefault=(LPPRINTER_DEFAULTS)NULL ) + BOOL Open( const wxString& printerName, LPPRINTER_DEFAULTS pDefault=nullptr ) { Close(); return OpenPrinter( wxMSW_CONV_LPTSTR(printerName), &m_hPrinter, pDefault ); @@ -72,7 +72,7 @@ public: if( m_hPrinter ) { result = ClosePrinter( m_hPrinter ); - m_hPrinter = (HANDLE)NULL; + m_hPrinter = nullptr; } return result; } @@ -87,7 +87,7 @@ public: return false; DWORD bufSize = 0; - if ( !::GetPrinter(m_hPrinter, level, NULL, 0, &bufSize) || !bufSize ) + if ( !::GetPrinter(m_hPrinter, level, nullptr, 0, &bufSize) || !bufSize ) return false; if ( !::GetPrinter(m_hPrinter, @@ -103,7 +103,7 @@ public: } operator HANDLE() { return m_hPrinter; } - operator bool() { return m_hPrinter != (HANDLE)NULL; } + operator bool() { return m_hPrinter != nullptr; } private: HANDLE m_hPrinter; @@ -159,7 +159,7 @@ wxCreateDevNames(const wxString& driverName, const wxString& printerName, const wxString& portName) { - HGLOBAL hDev = NULL; + HGLOBAL hDev = nullptr; // if (!driverName.empty() && !printerName.empty() && !portName.empty()) if (driverName.empty() && printerName.empty() && portName.empty()) { @@ -194,8 +194,8 @@ wxIMPLEMENT_CLASS(wxWindowsPrintNativeData, wxPrintNativeDataBase); wxWindowsPrintNativeData::wxWindowsPrintNativeData() { - m_devMode = NULL; - m_devNames = NULL; + m_devMode = nullptr; + m_devNames = nullptr; m_customWindowsPaperId = 0; } @@ -210,7 +210,7 @@ wxWindowsPrintNativeData::~wxWindowsPrintNativeData() bool wxWindowsPrintNativeData::IsOk() const { - return (m_devMode != NULL) ; + return (m_devMode != nullptr) ; } bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data ) @@ -383,7 +383,7 @@ bool wxWindowsPrintNativeData::TransferTo( wxPrintData &data ) if (devMode->dmDriverExtra > 0) data.SetPrivData( (char *)devMode+devMode->dmSize, devMode->dmDriverExtra ); else - data.SetPrivData( NULL, 0 ); + data.SetPrivData( nullptr, 0 ); if ( m_devNames ) { @@ -429,11 +429,11 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi // Step 1: // Allocate a buffer of the correct size. - dwNeeded = DocumentProperties( NULL, + dwNeeded = DocumentProperties( nullptr, *printer, // Handle to our printer. szPrinterName, // Name of the printer. - NULL, // Asking for size, so - NULL, // these are not used. + nullptr, // Asking for size, so + nullptr, // these are not used. 0 ); // Zero returns buffer size. // Some buggy printer drivers (see #16274 which claims that Kyocera @@ -448,11 +448,11 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi // Step 2: // Get the default DevMode for the printer - dwRet = DocumentProperties( NULL, + dwRet = DocumentProperties( nullptr, *printer, szPrinterName, static_cast(hDevMode), // The buffer to fill. - NULL, // Not using the input buffer. + nullptr, // Not using the input buffer. DM_OUT_BUFFER ); // Have the output buffer filled. if ( dwRet != IDOK ) @@ -475,9 +475,9 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi memset(&pd, 0, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); - pd.hwndOwner = NULL; - pd.hDevMode = NULL; // Will be created by PrintDlg - pd.hDevNames = NULL; // Ditto + pd.hwndOwner = nullptr; + pd.hDevMode = nullptr; // Will be created by PrintDlg + pd.hDevNames = nullptr; // Ditto pd.Flags = PD_RETURNDEFAULT; pd.nCopies = 1; @@ -490,8 +490,8 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi GlobalFree(pd.hDevMode); if ( pd.hDevNames ) GlobalFree(pd.hDevNames); - pd.hDevMode = NULL; - pd.hDevNames = NULL; + pd.hDevMode = nullptr; + pd.hDevNames = nullptr; #if wxDEBUG_LEVEL wxLogDebug(wxT("Printing error: ") + wxGetPrintDlgError()); @@ -500,16 +500,16 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi else { m_devMode = pd.hDevMode; - pd.hDevMode = NULL; + pd.hDevMode = nullptr; // We'll create a new DEVNAMEs structure below. if ( pd.hDevNames ) GlobalFree(pd.hDevNames); - pd.hDevNames = NULL; + pd.hDevNames = nullptr; // hDevNames = pd->hDevNames; // m_devNames = (void*)(long) hDevNames; - // pd->hDevnames = NULL; + // pd->hDevnames = nullptr; } } @@ -524,7 +524,7 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi WinPrinter winPrinter; if (winPrinter.Open(tempDevMode->dmDeviceName)) { - DEVMODE* pDevMode = NULL; + DEVMODE* pDevMode = nullptr; wxMemoryBuffer buffer; @@ -606,7 +606,7 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) // Paper id has priority over paper size. If id is specified, then size // is ignored (as it can be filled in even for standard paper sizes) - wxPrintPaperType *paperType = NULL; + wxPrintPaperType *paperType = nullptr; const wxPaperSize paperId = data.GetPaperId(); if ( paperId != wxPAPER_NONE && wxThePrintPaperDatabase ) @@ -734,7 +734,7 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) // Merge the new settings with the old. // This gives the driver an opportunity to update any private // portions of the DevMode structure. - DocumentProperties( NULL, + DocumentProperties( nullptr, printer, szPrinterName, (LPDEVMODE)hDevMode, // Reuse our buffer for output. @@ -778,11 +778,11 @@ wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintData* data) bool wxWindowsPrintDialog::Create(wxWindow *p, wxPrintDialogData* data) { m_dialogParent = p; - m_printerDC = NULL; + m_printerDC = nullptr; m_destroyDC = true; // MSW handle - m_printDlg = NULL; + m_printDlg = nullptr; if ( data ) m_printDialogData = *data; @@ -807,7 +807,7 @@ int wxWindowsPrintDialog::ShowModal() WX_HOOK_MODAL_DIALOG(); wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); - WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + WXHWND hWndParent = parent ? GetHwndOf(parent) : nullptr; wxWindowDisabler disableOthers(this, parent); @@ -842,7 +842,7 @@ wxDC *wxWindowsPrintDialog::GetPrintDC() return m_printerDC; } else - return NULL; + return nullptr; } bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data ) @@ -862,16 +862,16 @@ bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data ) m_printDlg = (void*) pd; pd->hDevMode = static_cast(native_data->GetDevMode()); - native_data->SetDevMode(NULL); + native_data->SetDevMode(nullptr); // Shouldn't assert; we should be able to test Ok-ness at a higher level - //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); + //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-null in ConvertToNative!")); pd->hDevNames = static_cast(native_data->GetDevNames()); - native_data->SetDevNames(NULL); + native_data->SetDevNames(nullptr); - pd->hDC = NULL; + pd->hDC = nullptr; pd->nFromPage = (WORD)data.GetFromPage(); pd->nToPage = (WORD)data.GetToPage(); pd->nMinPage = (WORD)data.GetMinPage(); @@ -881,15 +881,15 @@ bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data ) pd->Flags = PD_RETURNDC; pd->lStructSize = sizeof( PRINTDLG ); - pd->hwndOwner = NULL; - pd->hInstance = NULL; + pd->hwndOwner = nullptr; + pd->hInstance = nullptr; pd->lCustData = 0; - pd->lpfnPrintHook = NULL; - pd->lpfnSetupHook = NULL; - pd->lpPrintTemplateName = NULL; - pd->lpSetupTemplateName = NULL; - pd->hPrintTemplate = NULL; - pd->hSetupTemplate = NULL; + pd->lpfnPrintHook = nullptr; + pd->lpfnSetupHook = nullptr; + pd->lpPrintTemplateName = nullptr; + pd->lpSetupTemplateName = nullptr; + pd->hPrintTemplate = nullptr; + pd->hSetupTemplate = nullptr; if ( data.GetAllPages() ) pd->Flags |= PD_ALLPAGES; @@ -916,7 +916,7 @@ bool wxWindowsPrintDialog::ConvertToNative( wxPrintDialogData &data ) bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data ) { PRINTDLG *pd = (PRINTDLG*) m_printDlg; - if ( pd == NULL ) + if ( pd == nullptr ) return false; wxWindowsPrintNativeData *native_data = @@ -930,7 +930,7 @@ bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data ) ::GlobalFree(static_cast(native_data->GetDevMode())); } native_data->SetDevMode(pd->hDevMode); - pd->hDevMode = NULL; + pd->hDevMode = nullptr; } // Pass the devnames data back to the wxPrintData structure where it really belongs. @@ -941,7 +941,7 @@ bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data ) ::GlobalFree(static_cast(native_data->GetDevNames())); } native_data->SetDevNames(pd->hDevNames); - pd->hDevNames = NULL; + pd->hDevNames = nullptr; } // Now convert the DEVMODE object, passed down from the PRINTDLG object, @@ -974,8 +974,8 @@ wxIMPLEMENT_CLASS(wxWindowsPageSetupDialog, wxPageSetupDialogBase); wxWindowsPageSetupDialog::wxWindowsPageSetupDialog() { - m_dialogParent = NULL; - m_pageDlg = NULL; + m_dialogParent = nullptr; + m_pageDlg = nullptr; } wxWindowsPageSetupDialog::wxWindowsPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) @@ -986,7 +986,7 @@ wxWindowsPageSetupDialog::wxWindowsPageSetupDialog(wxWindow *p, wxPageSetupDialo bool wxWindowsPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data) { m_dialogParent = p; - m_pageDlg = NULL; + m_pageDlg = nullptr; if (data) m_pageSetupData = (*data); @@ -1048,8 +1048,8 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data ) // otherwise the call to PageSetupDlg() would fail. if ( data.GetDefaultInfo() ) { - pd->hDevMode = NULL; - pd->hDevNames = NULL; + pd->hDevMode = nullptr; + pd->hDevNames = nullptr; } else { @@ -1058,17 +1058,17 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data ) // be needed when PrintDlg is called. pd->hDevMode = (HGLOBAL) native_data->GetDevMode(); - native_data->SetDevMode(NULL); + native_data->SetDevMode(nullptr); // Shouldn't assert; we should be able to test Ok-ness at a higher level - //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-NULL in ConvertToNative!")); + //wxASSERT_MSG( (pd->hDevMode), wxT("hDevMode must be non-null in ConvertToNative!")); // Pass the devnames data (created in m_printData.ConvertToNative) // to the PRINTDLG structure, since it'll // be needed when PrintDlg is called. pd->hDevNames = (HGLOBAL) native_data->GetDevNames(); - native_data->SetDevNames(NULL); + native_data->SetDevNames(nullptr); } pd->Flags = PSD_MARGINS|PSD_MINMARGINS; @@ -1092,8 +1092,8 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data ) pd->Flags |= PSD_INHUNDREDTHSOFMILLIMETERS; pd->lStructSize = sizeof( PAGESETUPDLG ); - pd->hwndOwner = NULL; - pd->hInstance = NULL; + pd->hwndOwner = nullptr; + pd->hInstance = nullptr; // PAGESETUPDLG is in hundreds of a mm pd->ptPaperSize.x = data.GetPaperSize().x * 100; pd->ptPaperSize.y = data.GetPaperSize().y * 100; @@ -1109,10 +1109,10 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data ) pd->rtMargin.bottom = data.GetMarginBottomRight().y * 100; pd->lCustData = 0; - pd->lpfnPageSetupHook = NULL; - pd->lpfnPagePaintHook = NULL; - pd->hPageSetupTemplate = NULL; - pd->lpPageSetupTemplateName = NULL; + pd->lpfnPageSetupHook = nullptr; + pd->lpfnPagePaintHook = nullptr; + pd->hPageSetupTemplate = nullptr; + pd->lpPageSetupTemplateName = nullptr; return true; } @@ -1135,7 +1135,7 @@ bool wxWindowsPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data ) GlobalFree((HGLOBAL) native_data->GetDevMode()); } native_data->SetDevMode( (void*) pd->hDevMode ); - pd->hDevMode = NULL; + pd->hDevMode = nullptr; } // Isn't this superfluous? It's called again below. @@ -1150,7 +1150,7 @@ bool wxWindowsPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data ) GlobalFree((HGLOBAL) native_data->GetDevNames()); } native_data->SetDevNames((void*) pd->hDevNames); - pd->hDevNames = NULL; + pd->hDevNames = nullptr; } data.GetPrintData().ConvertFromNative(); diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index cf644d3a8f..b3e529bcd5 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -79,7 +79,7 @@ wxWindowsPrinter::wxWindowsPrinter(wxPrintDialogData *data) bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; - sm_abortWindow = NULL; + sm_abortWindow = nullptr; if (!printout) { @@ -93,7 +93,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt m_printDialogData.SetMaxPage(9999); // Create a suitable device context - wxPrinterDC *dc wxDUMMY_INITIALIZE(NULL); + wxPrinterDC *dc wxDUMMY_INITIALIZE(nullptr); if (prompt) { dc = wxDynamicCast(PrintDialog(parent), wxPrinterDC); @@ -237,7 +237,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt wxDC *wxWindowsPrinter::PrintDialog(wxWindow *parent) { - wxDC *dc = NULL; + wxDC *dc = nullptr; wxWindowsPrintDialog dialog(parent, & m_printDialogData); int ret = dialog.ShowModal(); @@ -246,7 +246,7 @@ wxDC *wxWindowsPrinter::PrintDialog(wxWindow *parent) { dc = dialog.GetPrintDC(); m_printDialogData = dialog.GetPrintDialogData(); - if (dc == NULL) + if (dc == nullptr) sm_lastError = wxPRINTER_ERROR; else sm_lastError = wxPRINTER_NO_ERROR; diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 97c8ce840c..9b3aba2b8e 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -79,7 +79,7 @@ public: m_skipped = false; m_msgChangeElementText = TDM_UPDATE_ELEMENT_TEXT; m_notifications = 0; - m_parent = NULL; + m_parent = nullptr; } wxCriticalSection m_cs; @@ -299,7 +299,7 @@ void PerformNotificationUpdates(HWND hwnd, if ( sharedData->m_notifications & wxSPDD_WINDOW_MOVED ) { - ::SetWindowPos(hwnd, NULL, sharedData->m_winPosition.x, sharedData->m_winPosition.y, + ::SetWindowPos(hwnd, nullptr, sharedData->m_winPosition.x, sharedData->m_winPosition.y, -1, -1, // ignored SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); } @@ -394,8 +394,8 @@ wxProgressDialog::wxProgressDialog( const wxString& title, wxWindow *parent, int style ) : wxGenericProgressDialog(), - m_taskDialogRunner(NULL), - m_sharedData(NULL), + m_taskDialogRunner(nullptr), + m_sharedData(nullptr), m_message(message), m_title(title) { @@ -1105,10 +1105,10 @@ void* wxProgressDialogTaskRunner::Entry() TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc(); if ( !taskDialogIndirect ) - return NULL; + return nullptr; int msAns; - HRESULT hr = taskDialogIndirect(&tdc, &msAns, NULL, NULL); + HRESULT hr = taskDialogIndirect(&tdc, &msAns, nullptr, nullptr); if ( FAILED(hr) ) wxLogApiError( "TaskDialogIndirect", hr ); @@ -1116,7 +1116,7 @@ void* wxProgressDialogTaskRunner::Entry() // Update(), wake it up so that it checks our status again. wxWakeUpIdle(); - return NULL; + return nullptr; } // static diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index a89c513c44..69a1627cc0 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -110,7 +110,7 @@ namespace { // the pointer to standard radio button wnd proc -WXWNDPROC s_wndprocRadioBtn = NULL; +WXWNDPROC s_wndprocRadioBtn = nullptr; // Hash allowing to find wxRadioBox containing the given radio button by its // HWND. This is used by (subclassed) radio button window proc to find the @@ -131,7 +131,7 @@ RadioBoxFromButton gs_boxFromButton; wxRadioBox* wxRadioBox::GetFromRadioButtonHWND(WXHWND hwnd) { const RadioBoxFromButton::const_iterator it = gs_boxFromButton.find(hwnd); - return it == gs_boxFromButton.end() ? NULL : it->second; + return it == gs_boxFromButton.end() ? nullptr : it->second; } // --------------------------------------------------------------------------- @@ -142,8 +142,8 @@ wxRadioBox* wxRadioBox::GetFromRadioButtonHWND(WXHWND hwnd) void wxRadioBox::Init() { m_selectedButton = wxNOT_FOUND; - m_radioButtons = NULL; - m_dummyHwnd = NULL; + m_radioButtons = nullptr; + m_dummyHwnd = nullptr; } bool wxRadioBox::Create(wxWindow *parent, @@ -197,7 +197,7 @@ bool wxRadioBox::Create(wxWindow *parent, GetHwndOf(parent), (HMENU)wxUIntToPtr(subid.GetValue()), wxGetInstance(), - NULL); + nullptr); if ( !hwndBtn ) { @@ -223,7 +223,7 @@ bool wxRadioBox::Create(wxWindow *parent, WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD, 0, 0, 0, 0, GetHwndOf(parent), (HMENU)wxUIntToPtr(m_dummyId.GetValue()), - wxGetInstance(), NULL); + wxGetInstance(), nullptr); m_radioButtons->SetFont(GetFont()); @@ -501,7 +501,7 @@ void wxRadioBox::DoSetItemToolTip(unsigned int item, wxToolTip *tooltip) { // we have already checked for the item to be valid in wxRadioBoxBase const HWND hwndRbtn = (*m_radioButtons)[item]; - if ( tooltip != NULL ) + if ( tooltip != nullptr ) tooltip->AddOtherWindow(hwndRbtn); else // unset the tooltip wxToolTip::Remove(hwndRbtn, 0, wxRect(0,0,0,0)); diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 96929e7fbd..c7923ad0f6 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -571,7 +571,7 @@ wxConfigBase::EntryType wxRegConfig::GetEntryType(const wxString& key) const template bool wxRegConfig::DoReadValue(const wxString& key, T* pValue) const { - wxCHECK_MSG( pValue, false, wxT("wxRegConfig::Read(): NULL param") ); + wxCHECK_MSG( pValue, false, wxT("wxRegConfig::Read(): null param") ); wxConfigPathChanger path(this, key); diff --git a/src/msw/region.cpp b/src/msw/region.cpp index 9b383674d1..0aaee39e14 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -45,10 +45,10 @@ public: wxRegionRefData(const wxRegionRefData& data) : wxGDIRefData() { - DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL); + DWORD noBytes = ::GetRegionData(data.m_region, 0, nullptr); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(data.m_region, noBytes, rgnData); - m_region = ::ExtCreateRegion(NULL, noBytes, rgnData); + m_region = ::ExtCreateRegion(nullptr, noBytes, rgnData); delete[] (char*) rgnData; } @@ -82,7 +82,7 @@ private: wxRegion::wxRegion() { - m_refData = NULL; + m_refData = nullptr; } wxRegion::wxRegion(WXHRGN hRegion) @@ -338,7 +338,7 @@ void wxRegionIterator::Init() m_current = m_numRects = 0; - m_rects = NULL; + m_rects = nullptr; } wxRegionIterator::~wxRegionIterator() @@ -349,7 +349,7 @@ wxRegionIterator::~wxRegionIterator() // Initialize iterator for region wxRegionIterator::wxRegionIterator(const wxRegion& region) { - m_rects = NULL; + m_rects = nullptr; Reset(region); } @@ -371,7 +371,7 @@ wxRegionIterator& wxRegionIterator::operator=(const wxRegionIterator& ri) } else { - m_rects = NULL; + m_rects = nullptr; } return *this; @@ -393,7 +393,7 @@ void wxRegionIterator::Reset(const wxRegion& region) m_numRects = 0; else { - DWORD noBytes = ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, 0, NULL); + DWORD noBytes = ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, 0, nullptr); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, noBytes, rgnData); diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 186e048660..b289bbb611 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -110,7 +110,7 @@ static wxString GetFullName(const wxRegKey *pKey, const wxString& szValue); // returns "value" argument of wxRegKey methods converted into a value that can // be passed to win32 registry functions; specifically, converts empty string -// to NULL +// to nullptr static inline const wxChar *RegValueStr(const wxString& szValue); // Return the user-readable name of the given REG_XXX type constant. @@ -377,17 +377,17 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys, m_dwLastError = ::RegQueryInfoKey ( (HKEY) m_hKey, - NULL, // class name - NULL, // (ptr to) size of class name buffer + nullptr, // class name + nullptr, // (ptr to) size of class name buffer wxRESERVED_PARAM, REG_PARAM(SubKeys), // [out] number of subkeys REG_PARAM(MaxKeyLen), // [out] max length of a subkey name - NULL, // longest subkey class name + nullptr, // longest subkey class name REG_PARAM(Values), // [out] number of values REG_PARAM(MaxValueLen), // [out] max length of a value name - NULL, // longest value data - NULL, // security descriptor - NULL // time of last modification + nullptr, // longest value data + nullptr, // security descriptor + nullptr // time of last modification ); #ifdef __WIN64__ @@ -465,10 +465,10 @@ bool wxRegKey::Create(bool bOkIfExists) DWORD disposition; m_dwLastError = RegCreateKeyEx((HKEY) m_hRootKey, m_strKey.t_str(), wxRESERVED_PARAM, - NULL, // The user-defined class type of this key. + nullptr, // The user-defined class type of this key. REG_OPTION_NON_VOLATILE, // supports other values as well; see MS docs GetMSWAccessFlags(wxRegKey::Write, m_viewMode), - NULL, // pointer to a SECURITY_ATTRIBUTES structure + nullptr, // pointer to a SECURITY_ATTRIBUTES structure &tmpKey, &disposition); @@ -814,7 +814,7 @@ bool wxRegKey::HasValue(const wxString& szValue) const LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), wxRESERVED_PARAM, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); return dwRet == ERROR_SUCCESS; } @@ -861,7 +861,7 @@ wxRegKey::ValueType wxRegKey::GetValueType(const wxString& szValue) const DWORD dwType; m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), wxRESERVED_PARAM, - &dwType, NULL, NULL); + &dwType, nullptr, nullptr); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"), GetName().c_str()); @@ -983,7 +983,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxMemoryBuffer& buffer) const DWORD dwType, dwSize; m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), wxRESERVED_PARAM, - &dwType, NULL, &dwSize); + &dwType, nullptr, &dwSize); if ( m_dwLastError == ERROR_SUCCESS ) { if ( dwType != REG_BINARY ) { @@ -1031,7 +1031,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), wxRESERVED_PARAM, - &dwType, NULL, &dwSize); + &dwType, nullptr, &dwSize); if ( m_dwLastError == ERROR_SUCCESS ) { if ( dwType != REG_SZ && dwType != REG_EXPAND_SZ ) @@ -1073,7 +1073,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, // expand the var expansions in the string unless disabled if ( (dwType == REG_EXPAND_SZ) && !raw ) { - DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue.t_str(), NULL, 0); + DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue.t_str(), nullptr, 0); bool ok = dwExpSize != 0; if ( ok ) { @@ -1155,9 +1155,9 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex++, szValueName, &dwValueLen, wxRESERVED_PARAM, - NULL, // [out] type - NULL, // [out] buffer for value - NULL); // [i/o] it's length + nullptr, // [out] type + nullptr, // [out] buffer for value + nullptr); // [i/o] it's length if ( m_dwLastError != ERROR_SUCCESS ) { if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) { @@ -1608,7 +1608,7 @@ inline void RemoveTrailingSeparator(wxString& str) inline const wxChar *RegValueStr(const wxString& szValue) { - return szValue.empty() ? (const wxChar*)NULL : szValue.t_str(); + return szValue.empty() ? nullptr : szValue.t_str(); } #endif // wxUSE_REGKEY diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index ea70a36947..63be29e3c1 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -215,7 +215,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL) override; + wxHeaderButtonParams* params = nullptr) override; virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, @@ -570,8 +570,8 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * win) // create a temporary header window just to get its geometry - HWND hwndHeader = ::CreateWindow(WC_HEADER, NULL, 0, - 0, 0, 0, 0, NULL, NULL, NULL, NULL); + HWND hwndHeader = ::CreateWindow(WC_HEADER, nullptr, 0, + 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr); if ( !hwndHeader ) return DEFAULT_HEIGHT; @@ -672,7 +672,7 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win, CP_DROPDOWNBUTTON, state, &r, - NULL + nullptr ); } @@ -709,7 +709,7 @@ wxRendererXP::DrawHeaderButton(wxWindow *win, HP_HEADERITEM, state, &r, - NULL + nullptr ); // NOTE: Using the theme to draw HP_HEADERSORTARROW doesn't do anything. @@ -746,7 +746,7 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win, TVP_GLYPH, state, &r, - NULL + nullptr ); } @@ -792,7 +792,7 @@ wxRendererXP::DoDrawCheckMark(int kind, kind, state, &r, - NULL + nullptr ); return true; @@ -848,7 +848,7 @@ wxRendererXP::DoDrawButtonLike(HTHEME htheme, part, state, &r, - NULL + nullptr ); } @@ -907,7 +907,7 @@ wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win, int flags) if (::IsThemePartDefined(hTheme, BP_CHECKBOX, 0)) { SIZE checkSize; - if (::GetThemePartSize(hTheme, NULL, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, NULL, TS_DRAW, &checkSize) == S_OK) + if (::GetThemePartSize(hTheme, nullptr, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, nullptr, TS_DRAW, &checkSize) == S_OK) return wxSize(checkSize.cx, checkSize.cy); } } @@ -924,7 +924,7 @@ wxSize wxRendererXP::GetCheckMarkSize(wxWindow* win) if (::IsThemePartDefined(hTheme, MENU_POPUPCHECK, 0)) { SIZE checkSize; - if (::GetThemePartSize(hTheme, NULL, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, NULL, TS_DRAW, &checkSize) == S_OK) + if (::GetThemePartSize(hTheme, nullptr, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, nullptr, TS_DRAW, &checkSize) == S_OK) return wxSize(checkSize.cx, checkSize.cy); } } @@ -941,7 +941,7 @@ wxSize wxRendererXP::GetExpanderSize(wxWindow* win) if ( ::IsThemePartDefined(hTheme, TVP_GLYPH, 0) ) { SIZE expSize; - if (::GetThemePartSize(hTheme, NULL, TVP_GLYPH, GLPS_CLOSED, NULL, + if (::GetThemePartSize(hTheme, nullptr, TVP_GLYPH, GLPS_CLOSED, nullptr, TS_DRAW, &expSize) == S_OK) return wxSize(expSize.cx, expSize.cy); @@ -981,7 +981,7 @@ wxRendererXP::DrawCollapseButton(wxWindow *win, TDLG_EXPANDOBUTTON, state, &r, - NULL + nullptr ); } else @@ -1001,7 +1001,7 @@ wxSize wxRendererXP::GetCollapseButtonSize(wxWindow *win, wxDC& dc) GetHdcOf(dc.GetTempHDC()), TDLG_EXPANDOBUTTON, TDLGEBS_NORMAL, - NULL, + nullptr, TS_TRUE, &s); @@ -1051,8 +1051,8 @@ void wxRendererXP::DrawItemText(wxWindow* win, typedef HRESULT(__stdcall *DrawThemeTextEx_t)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, const WXDTTOPTS *); typedef HRESULT(__stdcall *GetThemeTextExtent_t)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, RECT *); - static DrawThemeTextEx_t s_DrawThemeTextEx = NULL; - static GetThemeTextExtent_t s_GetThemeTextExtent = NULL; + static DrawThemeTextEx_t s_DrawThemeTextEx = nullptr; + static GetThemeTextExtent_t s_GetThemeTextExtent = nullptr; static bool s_initDone = false; if ( !s_initDone ) @@ -1119,7 +1119,7 @@ void wxRendererXP::DrawItemText(wxWindow* win, */ bool useTopDrawing = false; - if ( s_GetThemeTextExtent != NULL ) + if ( s_GetThemeTextExtent != nullptr ) { /* Get the actual text extent using GetThemeTextExtent() and adjust @@ -1148,7 +1148,7 @@ void wxRendererXP::DrawItemText(wxWindow* win, DT_SINGLELINE combined with either DT_VCENTER or DT_BOTTOM results in a height that can't be used (either halved or 0), and having DT_END_ELLIPSIS ends up always ellipsizing. - Passing a non-NULL rect solves these problems but is not + Passing a non-null rect solves these problems but is not really a good option as it doesn't make the rectangle extent a tight fit and calculations would have to be done with large numbers needlessly (provided the passed rect is set to @@ -1157,7 +1157,7 @@ void wxRendererXP::DrawItemText(wxWindow* win, RECT rcExtent; HRESULT hr = s_GetThemeTextExtent(hTheme, dc.GetHDC(), LVP_LISTITEM, itemState, text.wchar_str(), -1, - defTextFlags, NULL, &rcExtent); + defTextFlags, nullptr, &rcExtent); if ( SUCCEEDED(hr) ) { /* @@ -1315,7 +1315,7 @@ void wxRendererXP::DrawGauge(wxWindow* win, flags & wxCONTROL_SPECIAL ? PP_BARVERT : PP_BAR, 0, &r, - NULL); + nullptr); RECT contentRect; ::GetThemeBackgroundContentRect( @@ -1348,7 +1348,7 @@ void wxRendererXP::DrawGauge(wxWindow* win, flags & wxCONTROL_SPECIAL ? PP_CHUNKVERT : PP_CHUNK, 0, &contentRect, - NULL); + nullptr); } // ---------------------------------------------------------------------------- diff --git a/src/msw/richmsgdlg.cpp b/src/msw/richmsgdlg.cpp index c149f1b3a2..59546c0ad3 100644 --- a/src/msw/richmsgdlg.cpp +++ b/src/msw/richmsgdlg.cpp @@ -85,7 +85,7 @@ int wxRichMessageDialog::ShowModal() // create the task dialog, process the answer and return it. BOOL checkBoxChecked; int msAns; - HRESULT hr = taskDialogIndirect( &tdc, &msAns, NULL, &checkBoxChecked ); + HRESULT hr = taskDialogIndirect( &tdc, &msAns, nullptr, &checkBoxChecked ); if ( FAILED(hr) ) { wxLogApiError( "TaskDialogIndirect", hr ); diff --git a/src/msw/rt/notifmsgrt.cpp b/src/msw/rt/notifmsgrt.cpp index 16ee6c9ff2..eeab0a3b7f 100644 --- a/src/msw/rt/notifmsgrt.cpp +++ b/src/msw/rt/notifmsgrt.cpp @@ -57,7 +57,7 @@ public: void Detach() { - m_impl = NULL; + m_impl = nullptr; } // DesktopToastActivatedEventHandler @@ -90,7 +90,7 @@ class wxToastNotifMsgImpl : public wxNotificationMessageImpl public: wxToastNotifMsgImpl(wxNotificationMessageBase* notification) : wxNotificationMessageImpl(notification), - m_toastEventHandler(NULL) + m_toastEventHandler(nullptr) { } @@ -160,8 +160,8 @@ public: { if ( m_toastEventHandler ) m_toastEventHandler->Detach(); - m_notifier = NULL; - m_toast = NULL; + m_notifier = nullptr; + m_toast = nullptr; } HRESULT CreateToast(IXmlDocument *xml) @@ -277,7 +277,7 @@ public: { // Prepare interfaces wxCOMPtr shellLink; - if ( FAILED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + if ( FAILED(CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLinkW, reinterpret_cast(&shellLink))) ) return false; wxCOMPtr persistFile; @@ -392,7 +392,7 @@ public: { if (ms_toastStaticsInitialized == 1) { - ms_toastMgr = NULL; + ms_toastMgr = nullptr; ms_toastStaticsInitialized = -1; } } @@ -511,7 +511,7 @@ wxNotificationMessageImpl* wxToastNotificationHelper::CreateInstance(wxNotificat return new wxToastNotifMsgImpl(notification); #else wxUnusedVar(notification); - return NULL; + return nullptr; #endif } diff --git a/src/msw/rt/utilsrt.cpp b/src/msw/rt/utilsrt.cpp index a0aa6cb81f..01ecea2849 100644 --- a/src/msw/rt/utilsrt.cpp +++ b/src/msw/rt/utilsrt.cpp @@ -163,7 +163,7 @@ int RTCore::ms_isAvailable = -1; // TempStringRef::TempStringRef(const wxString &str) - : m_hstring(NULL), m_header() + : m_hstring(nullptr), m_header() { if ( !RTCore::IsAvailable() ) { diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index 5557435384..21e1c9e3d7 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -235,7 +235,7 @@ WXHBRUSH wxScrollBar::MSWControlColor(WXHDC pDC, WXHWND hWnd) // XP) brush instead of GetBackgroundColour() one as the base class would // // note that fg colour isn't used for a scrollbar - return UseBgCol() ? wxControl::MSWControlColor(pDC, hWnd) : NULL; + return UseBgCol() ? wxControl::MSWControlColor(pDC, hWnd) : nullptr; } #endif // wxUSE_SCROLLBAR diff --git a/src/msw/secretstore.cpp b/src/msw/secretstore.cpp index ea7f04bc36..5ff0371882 100644 --- a/src/msw/secretstore.cpp +++ b/src/msw/secretstore.cpp @@ -91,7 +91,7 @@ public: wxSecretValueImpl** secret, wxString& errmsg) const override { - CREDENTIAL* pcred = NULL; + CREDENTIAL* pcred = nullptr; if ( !::CredRead(service.t_str(), CRED_TYPE_GENERIC, 0, &pcred) || !pcred ) { // Not having the password for this service/user combination is not diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index a9764fea2c..dee5d9ccbd 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -59,7 +59,7 @@ private: // the font returned by GetFont(wxSYS_DEFAULT_GUI_FONT): it is created when // GetFont() is called for the first time and deleted by wxSystemSettingsModule -static wxFont *gs_fontDefault = NULL; +static wxFont *gs_fontDefault = nullptr; // ============================================================================ // implementation @@ -148,7 +148,7 @@ wxFont wxCreateFontFromStockObject(int index) LOGFONT lf; if ( ::GetObject(hFont, sizeof(LOGFONT), &lf) != 0 ) { - wxNativeFontInfo info(lf, NULL); + wxNativeFontInfo info(lf, nullptr); font.Create(info); } else diff --git a/src/msw/slider.cpp b/src/msw/slider.cpp index 7597708098..1319795ec8 100644 --- a/src/msw/slider.cpp +++ b/src/msw/slider.cpp @@ -66,9 +66,9 @@ const int TICK = 8; void wxSlider::Init() { - m_labels = NULL; + m_labels = nullptr; - m_hBrushBg = NULL; + m_hBrushBg = nullptr; m_pageSize = 1; m_lineSize = 1; @@ -149,13 +149,13 @@ bool wxSlider::Create(wxWindow *parent, HWND wnd = ::CreateWindow ( wxT("STATIC"), - NULL, + nullptr, WS_CHILD | WS_VISIBLE | SS_CENTER, 0, 0, 0, 0, hwndParent, (HMENU)wxUIntToPtr(lblid.GetValue()), wxGetInstance(), - NULL + nullptr ); m_labels->Set(n, wnd, lblid); @@ -793,17 +793,17 @@ void wxSlider::SetTick(int tickPos) WXHWND wxSlider::GetStaticMin() const { - return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Min] : NULL; + return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Min] : nullptr; } WXHWND wxSlider::GetStaticMax() const { - return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Max] : NULL; + return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Max] : nullptr; } WXHWND wxSlider::GetEditValue() const { - return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Value] : NULL; + return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Value] : nullptr; } WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxSlider, wxSliderBase, m_labels) diff --git a/src/msw/snglinst.cpp b/src/msw/snglinst.cpp index 140705af1a..589679f19f 100644 --- a/src/msw/snglinst.cpp +++ b/src/msw/snglinst.cpp @@ -43,12 +43,12 @@ public: { // we don't care about m_wasOpened, it can't be accessed before being // initialized - m_hMutex = NULL; + m_hMutex = nullptr; } bool Create(const wxString& name) { - m_hMutex = ::CreateMutex(NULL, FALSE, name.t_str()); + m_hMutex = ::CreateMutex(nullptr, FALSE, name.t_str()); if ( !m_hMutex ) { wxLogLastError(wxT("CreateMutex")); @@ -85,7 +85,7 @@ private: // the result of the CreateMutex() call bool m_wasOpened; - // the mutex handle, may be NULL + // the mutex handle, may be null HANDLE m_hMutex; wxDECLARE_NO_COPY_CLASS(wxSingleInstanceCheckerImpl); diff --git a/src/msw/sockmsw.cpp b/src/msw/sockmsw.cpp index 4cc4bd6b1b..0ce7c15110 100644 --- a/src/msw/sockmsw.cpp +++ b/src/msw/sockmsw.cpp @@ -80,7 +80,7 @@ public: bool wxSocketMSWManager::OnInit() { - LPCTSTR pclassname = NULL; + LPCTSTR pclassname = nullptr; int i; /* Create internal window for event notifications */ @@ -91,7 +91,7 @@ bool wxSocketMSWManager::OnInit() /* Initialize socket list */ for (i = 0; i < MAXSOCKETS; i++) { - socketList[i] = NULL; + socketList[i] = nullptr; } firstAvailable = 0; @@ -118,7 +118,7 @@ wxSocketImplMSW::wxSocketImplMSW(wxSocketBase& wxsocket) wxCRIT_SECT_LOCKER(lock, gs_critical); int i = firstAvailable; - while (socketList[i] != NULL) + while (socketList[i] != nullptr) { i = (i + 1) % MAXSOCKETS; @@ -147,7 +147,7 @@ wxSocketImplMSW::~wxSocketImplMSW() while ( ::PeekMessage(&msg, hWin, m_msgnumber, m_msgnumber, PM_REMOVE) ) ; - socketList[m_msgnumber - WM_USER] = NULL; + socketList[m_msgnumber - WM_USER] = nullptr; } //else: the socket has never been created successfully } @@ -194,7 +194,7 @@ LRESULT CALLBACK wxSocket_Internal_WinProc(HWND hWnd, wxFD_ZERO(&fds); wxFD_SET(socket->m_fd, &fds); - if ( select(socket->m_fd + 1, &fds, NULL, NULL, &tv) != 1 ) + if ( select(socket->m_fd + 1, &fds, nullptr, nullptr, &tv) != 1 ) return 0; } diff --git a/src/msw/sound.cpp b/src/msw/sound.cpp index 56141ead19..91de326bb2 100644 --- a/src/msw/sound.cpp +++ b/src/msw/sound.cpp @@ -58,7 +58,7 @@ public: void *GetPtr() const { return m_waveDataPtr; } - virtual bool IsOk() const override { return GetPtr() != NULL; } + virtual bool IsOk() const override { return GetPtr() != nullptr; } virtual DWORD GetSoundFlag() const override { return SND_MEMORY; } virtual LPCTSTR GetSoundData() const override { return (LPCTSTR)GetPtr(); } @@ -148,7 +148,7 @@ bool wxSound::CheckCreatedOk() if ( m_data && !m_data->IsOk() ) Free(); - return m_data != NULL; + return m_data != nullptr; } bool wxSound::Create(const wxString& filename, bool isResource) @@ -175,7 +175,7 @@ bool wxSound::DoPlay(unsigned flags) const return false; DWORD flagsMSW = m_data->GetSoundFlag(); - HMODULE hmod = flagsMSW == SND_RESOURCE ? wxGetInstance() : NULL; + HMODULE hmod = flagsMSW == SND_RESOURCE ? wxGetInstance() : nullptr; // we don't want replacement default sound flagsMSW |= SND_NODEFAULT; @@ -194,7 +194,7 @@ bool wxSound::DoPlay(unsigned flags) const /* static */ void wxSound::Stop() { - ::PlaySound(NULL, NULL, 0); + ::PlaySound(nullptr, nullptr, 0); } #endif // wxUSE_SOUND diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp index a6f69cced4..437392e0f2 100644 --- a/src/msw/spinbutt.cpp +++ b/src/msw/spinbutt.cpp @@ -111,7 +111,7 @@ bool wxSpinButton::Create(wxWindow *parent, GetHwndOf(parent), m_windowId, wxGetInstance(), - NULL, // no buddy + nullptr, // no buddy m_max, m_min, m_min // initial position ); diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index e896662621..725e201bcd 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -152,7 +152,7 @@ wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy) const SpinForTextCtrl::const_iterator it = gs_spinForTextCtrl.find(hwndBuddy); if ( it == gs_spinForTextCtrl.end() ) - return NULL; + return nullptr; wxSpinCtrl * const spin = it->second; @@ -265,8 +265,8 @@ void wxSpinCtrl::NormalizeValue() void wxSpinCtrl::Init() { m_blockEvent = false; - m_hwndBuddy = NULL; - m_wndProcBuddy = NULL; + m_hwndBuddy = nullptr; + m_wndProcBuddy = nullptr; m_oldValue = INT_MIN; } @@ -312,7 +312,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, ( exStyle, // sunken border wxT("EDIT"), // window class - NULL, // no window title + nullptr, // no window title msStyle, // style (will be shown later) pos.x, pos.y, // position 0, 0, // size (will be set later) @@ -403,7 +403,7 @@ void wxSpinCtrl::Refresh(bool eraseBackground, const wxRect *rect) // Don't bother computing the intersection of the given rectangle with the // buddy control, just always refresh it entirely, as it's much simpler. - ::RedrawWindow(GetBuddyHwnd(), NULL, NULL, flags); + ::RedrawWindow(GetBuddyHwnd(), nullptr, nullptr, flags); } // ---------------------------------------------------------------------------- diff --git a/src/msw/stackwalk.cpp b/src/msw/stackwalk.cpp index af2b6da980..98d514bf74 100644 --- a/src/msw/stackwalk.cpp +++ b/src/msw/stackwalk.cpp @@ -264,10 +264,10 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) ::GetCurrentThread(), &sf, &ctx, - NULL, // read memory function (default) + nullptr, // read memory function (default) wxDbgHelpDLL::SymFunctionTableAccess, wxDbgHelpDLL::SymGetModuleBase, - NULL // address translator for 16 bit + nullptr // address translator for 16 bit ) ) { if ( ::GetLastError() ) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 42924e050a..ffd34a4467 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -176,7 +176,7 @@ wxSize wxStaticBox::DoGetBestSize() const int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); // If there is a sizer then the base best size is the sizer's minimum - if (GetSizer() != NULL) + if (GetSizer() != nullptr) { wxSize cm(GetSizer()->CalcMin()); best = ClientToWindowSize(cm); @@ -439,7 +439,7 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() // MSDN: "If you have changed certain window data using // SetWindowLong, you must call SetWindowPos to have the // changes take effect." - ::SetWindowPos(child, NULL, 0, 0, 0, 0, + ::SetWindowPos(child, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index bd4d9ea8b6..f194a6a96f 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -74,10 +74,10 @@ static const int DEFAULT_FIELD_WIDTH = 25; wxStatusBar::wxStatusBar() { - SetParent(NULL); + SetParent(nullptr); m_hWnd = 0; m_windowId = 0; - m_pDC = NULL; + m_pDC = nullptr; } WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const @@ -183,7 +183,7 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths) } // shrink/expand the array: - m_tooltips.resize(nFields, NULL); + m_tooltips.resize(nFields, nullptr); #endif // wxUSE_TOOLTIPS wxStatusBarBase::SetFieldsCount(nFields, widths); @@ -352,7 +352,7 @@ void wxStatusBar::DoUpdateStatusText(int nField) // create a new tooltip for this pane if needed if (GetField(nField).IsEllipsized()) m_tooltips[nField] = new wxToolTip(this, nField, GetStatusText(nField), rc); - //else: leave m_tooltips[nField]==NULL + //else: leave m_tooltips[nField]==nullptr } } #endif // wxUSE_TOOLTIPS @@ -459,7 +459,7 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const r.left -= 2; } - ::GetThemeBackgroundContentRect(theme, NULL, + ::GetThemeBackgroundContentRect(theme, nullptr, 1 /* SP_PANE */, 0, &r, &r); } @@ -521,7 +521,7 @@ void wxStatusBar::DoMoveWindow(int x, int y, int width, int height) // WM_WINDOWPOSCHANGING since we don't want to change pos/size later // we must use SWP_NOCOPYBITS here otherwise it paints incorrectly // if other windows are size deferred - ::SetWindowPos(GetHwnd(), NULL, x, y, width, height, + ::SetWindowPos(GetHwnd(), nullptr, x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOSENDCHANGING ); @@ -643,9 +643,9 @@ bool wxStatusBar::MSWProcessMessage(WXMSG* pMsg) { // for a tooltip to be shown, we need to relay mouse events to it; // this is typically done by wxWindowMSW::MSWProcessMessage but only - // if wxWindow::m_tooltip pointer is non-NULL. + // if wxWindow::m_tooltip pointer is non-null. // Since wxStatusBar has multiple tooltips for a single HWND, it keeps - // wxWindow::m_tooltip == NULL and then relays mouse events here: + // wxWindow::m_tooltip == nullptr and then relays mouse events here: MSG *msg = (MSG *)pMsg; if ( msg->message == WM_MOUSEMOVE ) wxToolTip::RelayEvent(pMsg); @@ -660,7 +660,7 @@ bool wxStatusBar::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM* W { // see comment in wxStatusBar::MSWProcessMessage for more info; // basically we need to override wxWindow::MSWOnNotify because - // we have wxWindow::m_tooltip always NULL but we still use tooltips... + // we have wxWindow::m_tooltip always null but we still use tooltips... NMHDR* hdr = (NMHDR *)lParam; diff --git a/src/msw/stdpaths.cpp b/src/msw/stdpaths.cpp index a819193d67..c8b98b7c01 100644 --- a/src/msw/stdpaths.cpp +++ b/src/msw/stdpaths.cpp @@ -67,7 +67,7 @@ struct ShellFunctions { ShellFunctions() { - pSHGetKnownFolderPath = NULL; + pSHGetKnownFolderPath = nullptr; initialized = false; } @@ -131,9 +131,9 @@ wxString wxStandardPaths::DoGetDirectory(int csidl) hr = ::SHGetFolderPath ( - NULL, // parent window, not used + nullptr, // parent window, not used csidl, - NULL, // access token (current user) + nullptr, // access token (current user) SHGFP_TYPE_CURRENT, // current path, not just default value wxStringBuffer(dir, MAX_PATH) ); @@ -149,9 +149,9 @@ wxString wxStandardPaths::DoGetDirectory(int csidl) // directory doesn't exist, maybe we can get its default value? hr = ::SHGetFolderPath ( - NULL, + nullptr, csidl, - NULL, + nullptr, SHGFP_TYPE_DEFAULT, wxStringBuffer(dir, MAX_PATH) ); diff --git a/src/msw/systhemectrl.cpp b/src/msw/systhemectrl.cpp index 80248e8c94..9dee0eddeb 100644 --- a/src/msw/systhemectrl.cpp +++ b/src/msw/systhemectrl.cpp @@ -25,8 +25,8 @@ void wxSystemThemedControlBase::DoEnableSystemTheme(bool enable, wxWindow* windo // window, just don't do anything in this case. if ( window->GetHandle() ) { - const wchar_t* const sysThemeId = enable ? L"EXPLORER" : NULL; - ::SetWindowTheme(GetHwndOf(window), sysThemeId, NULL); + const wchar_t* const sysThemeId = enable ? L"EXPLORER" : nullptr; + ::SetWindowTheme(GetHwndOf(window), sysThemeId, nullptr); } m_systemThemeDisabled = !enable; diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 48b2b6cc97..ae3d113491 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -66,7 +66,7 @@ class wxTaskBarIconWindow : public wxFrame { public: wxTaskBarIconWindow(wxTaskBarIcon *icon) - : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0), + : wxFrame(nullptr, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0), m_icon(icon) { } @@ -122,7 +122,7 @@ struct NotifyIconData : public NOTIFYICONDATA wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType WXUNUSED(iconType)) { - m_win = NULL; + m_win = nullptr; m_iconAdded = false; RegisterWindowMessages(); } @@ -303,7 +303,7 @@ bool wxTaskBarIcon::RemoveIcon() #if wxUSE_MENUS bool wxTaskBarIcon::PopupMenu(wxMenu *menu) { - wxASSERT_MSG( m_win != NULL, wxT("taskbar icon not initialized") ); + wxASSERT_MSG( m_win != nullptr, wxT("taskbar icon not initialized") ); static bool s_inPopup = false; diff --git a/src/msw/taskbarbutton.cpp b/src/msw/taskbarbutton.cpp index 22eb3b5926..4e62472175 100644 --- a/src/msw/taskbarbutton.cpp +++ b/src/msw/taskbarbutton.cpp @@ -331,7 +331,7 @@ inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) #if wxUSE_DYNLIB_CLASS typedef HRESULT (WINAPI *SHStrDupW_t)(LPCWSTR, LPWSTR*); - static SHStrDupW_t s_pfnSHStrDupW = NULL; + static SHStrDupW_t s_pfnSHStrDupW = nullptr; if ( !s_pfnSHStrDupW ) { wxDynamicLibrary dll(wxT("shlwapi.dll")); @@ -382,7 +382,7 @@ bool AddShellLink(IObjectCollection *collection, HRESULT hr = CoCreateInstance ( wxCLSID_ShellLink, - NULL, + nullptr, CLSCTX_INPROC_SERVER, wxIID_IShellLink, reinterpret_cast (&(shellLink)) @@ -450,10 +450,10 @@ bool AddShellLink(IObjectCollection *collection, wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link) { if ( !link ) - return NULL; + return nullptr; wxTaskBarJumpListItem* item = - new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTINATION); + new wxTaskBarJumpListItem(nullptr, wxTASKBAR_JUMP_LIST_DESTINATION); wxCOMPtr linkProps; HRESULT hr = link->QueryInterface @@ -464,7 +464,7 @@ wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link) if ( FAILED(hr) ) { wxLogApiError("IShellLink::QueryInterface", hr); - return NULL; + return nullptr; } PROPVARIANT var; @@ -482,7 +482,7 @@ wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link) link->GetIconLocation(buffer, bufferSize - 1, &dummyIndex); item->SetIconPath(wxString(buffer)); - link->GetPath(buffer, bufferSize - 1, NULL, 0x1); + link->GetPath(buffer, bufferSize - 1, nullptr, 0x1); item->SetFilePath(wxString(buffer)); return item; @@ -491,10 +491,10 @@ wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link) wxTaskBarJumpListItem* GetItemFromIShellItem(IShellItem *shellItem) { if ( !shellItem ) - return NULL; + return nullptr; wxTaskBarJumpListItem *item = - new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTINATION); + new wxTaskBarJumpListItem(nullptr, wxTASKBAR_JUMP_LIST_DESTINATION); wxCoTaskMemPtr name; shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name); @@ -510,7 +510,7 @@ IObjectCollection* CreateObjectCollection() hr = CoCreateInstance ( wxCLSID_EnumerableObjectCollection, - NULL, + nullptr, CLSCTX_INPROC, wxIID_IObjectCollection, reinterpret_cast(&(collection)) @@ -519,7 +519,7 @@ IObjectCollection* CreateObjectCollection() { wxLogApiError("CoCreateInstance(wxCLSID_EnumerableObjectCollection)", hr); - return NULL; + return nullptr; } return collection; @@ -552,7 +552,7 @@ public: class wxTaskBarJumpListImpl { public: - wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList = NULL, + wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList = nullptr, const wxString& appID = wxEmptyString); virtual ~wxTaskBarJumpListImpl(); void ShowRecentCategory(bool shown = true); @@ -614,7 +614,7 @@ wxThumbBarButton::wxThumbBarButton(int id, m_hasBackground(hasBackground), m_shown(shown), m_interactive(interactive), - m_taskBarButtonParent(NULL) + m_taskBarButtonParent(nullptr) { } @@ -699,12 +699,12 @@ bool wxThumbBarButton::UpdateParentTaskBarButton() /* static */ wxTaskBarButton* wxTaskBarButton::New(wxWindow* parent) { - wxITaskbarList3* taskbarList = NULL; + wxITaskbarList3* taskbarList = nullptr; HRESULT hr = CoCreateInstance ( wxCLSID_TaskbarList, - NULL, + nullptr, CLSCTX_INPROC_SERVER, wxIID_ITaskbarList3, reinterpret_cast(&taskbarList) @@ -712,7 +712,7 @@ wxTaskBarButton* wxTaskBarButton::New(wxWindow* parent) if ( FAILED(hr) ) { // Don't log this error, it may be normal when running under XP. - return NULL; + return nullptr; } hr = taskbarList->HrInit(); @@ -722,7 +722,7 @@ wxTaskBarButton* wxTaskBarButton::New(wxWindow* parent) wxLogApiError(wxT("ITaskbarList3::Init"), hr); taskbarList->Release(); - return NULL; + return nullptr; } return new wxTaskBarButtonImpl(taskbarList, parent); @@ -828,7 +828,7 @@ void wxTaskBarButtonImpl::SetThumbnailClip(const wxRect& rect) m_thumbnailClipRect = rect; RECT rc; wxCopyRectToRECT(rect, rc); - m_taskbarList->SetThumbnailClip(m_parent->GetHWND(), rect.IsEmpty() ? NULL : &rc); + m_taskbarList->SetThumbnailClip(m_parent->GetHWND(), rect.IsEmpty() ? nullptr : &rc); } void wxTaskBarButtonImpl::SetThumbnailContents(const wxWindow *child) @@ -892,13 +892,13 @@ wxThumbBarButton* wxTaskBarButtonImpl::RemoveThumbBarButton(int id) if ( id == button->GetID() ) { m_thumbBarButtons.erase(iter); - button->SetParent(NULL); + button->SetParent(nullptr); InitOrUpdateThumbBarButtons(); return button; } } - return NULL; + return nullptr; } bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons() @@ -959,7 +959,7 @@ bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons() wxThumbBarButton* wxTaskBarButtonImpl::GetThumbBarButtonByIndex(size_t index) { if ( index >= m_thumbBarButtons.size() ) - return NULL; + return nullptr; return m_thumbBarButtons[index]; } @@ -1113,7 +1113,7 @@ wxTaskBarJumpListCategory::Append(wxTaskBarJumpListItem *item) void wxTaskBarJumpListCategory::Delete(wxTaskBarJumpListItem *item) { item = Remove(item); - item->SetCategory(NULL); + item->SetCategory(nullptr); Update(); if ( item ) @@ -1130,13 +1130,13 @@ wxTaskBarJumpListCategory::Remove(wxTaskBarJumpListItem *item) if ( *it == item ) { m_items.erase(it); - item->SetCategory(NULL); + item->SetCategory(nullptr); Update(); return item; } } - return NULL; + return nullptr; } wxTaskBarJumpListItem* @@ -1266,13 +1266,13 @@ void wxTaskBarJumpList::Update() wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList, const wxString& appID) : m_jumpList(jumpList), - m_destinationList(NULL) + m_destinationList(nullptr) { m_appID = appID; HRESULT hr = CoCreateInstance ( wxCLSID_DestinationList, - NULL, + nullptr, CLSCTX_INPROC_SERVER, wxIID_ICustomDestinationList, reinterpret_cast (&(m_destinationList)) @@ -1310,7 +1310,7 @@ void wxTaskBarJumpListImpl::Update() wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetTasks() { - if ( m_tasks.get() == NULL ) + if ( m_tasks.get() == nullptr ) m_tasks.reset(new wxTaskBarJumpListCategory(m_jumpList, wxT("Tasks"))); return *(m_tasks.get()); @@ -1339,7 +1339,7 @@ void wxTaskBarJumpListImpl::HideFrequentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetFrequentCategory() { wxString title = wxT("Frequent"); - if ( m_frequent.get() == NULL ) + if ( m_frequent.get() == nullptr ) m_frequent.reset(new wxTaskBarJumpListCategory(m_jumpList, title)); LoadKnownCategory(title); @@ -1349,7 +1349,7 @@ const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetFrequentCategory() const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetRecentCategory() { wxString title = wxT("Recent"); - if ( m_recent.get() == NULL ) + if ( m_recent.get() == nullptr ) m_recent.reset(new wxTaskBarJumpListCategory(m_jumpList, title)); LoadKnownCategory(title); @@ -1365,7 +1365,7 @@ wxTaskBarJumpListImpl::GetCustomCategories() const void wxTaskBarJumpListImpl::AddCustomCategory(wxTaskBarJumpListCategory *category) { - wxASSERT_MSG( category != NULL, "Invalid category." ); + wxASSERT_MSG( category != nullptr, "Invalid category." ); m_customCategories.push_back(category); } @@ -1384,7 +1384,7 @@ wxTaskBarJumpListImpl::RemoveCustomCategory(const wxString& title) } } - return NULL; + return nullptr; } void wxTaskBarJumpListImpl::DeleteCustomCategory(const wxString& title) @@ -1396,11 +1396,11 @@ void wxTaskBarJumpListImpl::DeleteCustomCategory(const wxString& title) bool wxTaskBarJumpListImpl::BeginUpdate() { - if ( m_destinationList == NULL ) + if ( m_destinationList == nullptr ) return false; unsigned int max_count = 0; - m_objectArray = NULL; + m_objectArray = nullptr; HRESULT hr = m_destinationList->BeginList(&max_count, wxIID_IObjectArray, reinterpret_cast(&m_objectArray)); if ( !m_appID.empty() ) @@ -1467,7 +1467,7 @@ void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title) HRESULT hr = CoCreateInstance ( wxCLSID_ApplicationDocumentLists, - NULL, + nullptr, CLSCTX_INPROC_SERVER, wxIID_IApplicationDocumentLists, reinterpret_cast(&docList) @@ -1510,7 +1510,7 @@ void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title) wxCOMPtr shellLink; wxCOMPtr shellItem; - wxTaskBarJumpListItem* item = NULL; + wxTaskBarJumpListItem* item = nullptr; if ( SUCCEEDED(collectionItem->QueryInterface( wxIID_IShellLink, reinterpret_cast(&shellLink))) ) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 38b63951cd..b6ac602638 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -137,7 +137,7 @@ #if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT // dummy value used for m_dropTarget, different from any valid pointer value -// (which are all even under Windows) and NULL +// (which are all even under Windows) and nullptr static wxDropTarget * wxRICHTEXT_DEFAULT_DROPTARGET = reinterpret_cast(1); @@ -214,7 +214,7 @@ private: wxDECLARE_DYNAMIC_CLASS(wxRichEditModule); }; -HINSTANCE wxRichEditModule::ms_hRichEdit[Version_Max] = { NULL, NULL, NULL }; +HINSTANCE wxRichEditModule::ms_hRichEdit[Version_Max] = { nullptr, nullptr, nullptr }; #if wxUSE_INKEDIT wxDynamicLibrary wxRichEditModule::ms_inkEditLib; @@ -230,7 +230,7 @@ extern wxMenu *wxCurrentPopupMenu; class wxTextCtrlOleCallback : public IRichEditOleCallback { public: - wxTextCtrlOleCallback(wxTextCtrl *text) : m_textCtrl(text), m_menu(NULL) {} + wxTextCtrlOleCallback(wxTextCtrl *text) : m_textCtrl(text), m_menu(nullptr) {} virtual ~wxTextCtrlOleCallback() { DeleteContextMenuObject(); } wxSTDMETHODIMP ContextSensitiveHelp(BOOL WXUNUSED(enterMode)) override { return E_NOTIMPL; } @@ -270,7 +270,7 @@ private: { m_menu->MSWDetachHMENU(); if ( wxCurrentPopupMenu == m_menu ) - wxCurrentPopupMenu = NULL; + wxCurrentPopupMenu = nullptr; wxDELETE(m_menu); } } @@ -388,7 +388,7 @@ void wxTextCtrl::Init() m_isInkEdit = 0; #endif - m_privateContextMenu = NULL; + m_privateContextMenu = nullptr; m_updatesCount = -1; m_isNativeCaretShown = true; } @@ -418,7 +418,7 @@ wxTextCtrl::~wxTextCtrl() if ( m_dropTarget == wxRICHTEXT_DEFAULT_DROPTARGET ) { // don't try to destroy this dummy pointer in the base class dtor - m_dropTarget = NULL; + m_dropTarget = nullptr; } #endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT @@ -710,7 +710,7 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, // 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, + SetWindowPos(GetHwnd(), nullptr, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE| SWP_FRAMECHANGED); @@ -1218,7 +1218,7 @@ wxTextCtrl::StreamIn(const wxString& value, { wxCSConv conv(encoding); - const size_t len = conv.MB2WC(NULL, value.mb_str(), value.length()); + const size_t len = conv.MB2WC(nullptr, value.mb_str(), value.length()); if (len == wxCONV_FAILED) return false; @@ -1297,7 +1297,7 @@ wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const // now convert to the given encoding (this is a possibly lossful // conversion but what else can we do) wxCSConv conv(encoding); - size_t lenNeeded = conv.WC2MB(NULL, wchBuf, 0); + size_t lenNeeded = conv.WC2MB(nullptr, wchBuf, 0); if ( lenNeeded != wxCONV_FAILED && lenNeeded++ ) { @@ -1417,7 +1417,7 @@ void wxTextCtrl::AppendText(const wxString& text) // don't do this if we're frozen, saves some time if ( !IsFrozen() && IsMultiLine() && GetRichVersion() > 1 ) { - ::SendMessage(GetHwnd(), WM_VSCROLL, SB_BOTTOM, (LPARAM)NULL); + ::SendMessage(GetHwnd(), WM_VSCROLL, SB_BOTTOM, (LPARAM)nullptr); } #endif // wxUSE_RICHEDIT } @@ -2108,9 +2108,9 @@ void wxTextCtrl::EmptyUndoBuffer() ); if ( SUCCEEDED(hr) ) { - hr = pDoc->Undo(tomFalse, NULL); + hr = pDoc->Undo(tomFalse, nullptr); if ( SUCCEEDED(hr) ) - pDoc->Undo(tomTrue, NULL); + pDoc->Undo(tomTrue, nullptr); } } } @@ -2542,7 +2542,7 @@ wxTextCtrl::MSWHandleMessage(WXLRESULT *rc, if ( IsRich() ) { // wxCurrentPopupMenu stores the popup menu that will receive - // WM_COMMAND, but it may be non-NULL even when the underlying + // WM_COMMAND, but it may be non-null even when the underlying // native menu is no longer shown. Use ::IsMenu() to check whether // the menu still exists. extern wxMenu *wxCurrentPopupMenu; @@ -2757,7 +2757,7 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const int cy; wxFont font = GetFont(); font.WXAdjustToPPI(GetDPI()); - wxGetCharSize(GetHWND(), NULL, &cy, font); + wxGetCharSize(GetHWND(), nullptr, &cy, font); DWORD wText = FromDIP(1); ::SystemParametersInfo(SPI_GETCARETWIDTH, 0, &wText, 0); @@ -3113,7 +3113,7 @@ void wxTextCtrl::SetDropTarget(wxDropTarget *dropTarget) { // get rid of the built-in drop target ::RevokeDragDrop(GetHwnd()); - m_dropTarget = NULL; + m_dropTarget = nullptr; } wxTextCtrlBase::SetDropTarget(dropTarget); @@ -3729,7 +3729,7 @@ void wxRichEditModule::OnExit() if ( ms_hRichEdit[i] && ms_hRichEdit[i] != INVALID_HINSTANCE ) { ::FreeLibrary(ms_hRichEdit[i]); - ms_hRichEdit[i] = NULL; + ms_hRichEdit[i] = nullptr; } } #if wxUSE_INKEDIT diff --git a/src/msw/textentry.cpp b/src/msw/textentry.cpp index ab29243953..cc10729906 100644 --- a/src/msw/textentry.cpp +++ b/src/msw/textentry.cpp @@ -286,7 +286,7 @@ private: ::InitializeCriticalSection(&m_csCompleter); ::InitializeCriticalSection(&m_csRestart); - m_completer = NULL; + m_completer = nullptr; m_restart = FALSE; } @@ -328,7 +328,7 @@ private: CRITICAL_SECTION m_csCompleter; // The completer we delegate to for the completions generation. It is never - // NULL after the initial ChangeCompleter() call. + // nullptr after the initial ChangeCompleter() call. wxTextCompleter *m_completer; @@ -369,12 +369,12 @@ public: : m_entry(entry), m_win(entry->GetEditableWindow()) { - m_autoComplete = NULL; - m_autoCompleteDropDown = NULL; - m_enumStrings = NULL; + m_autoComplete = nullptr; + m_autoCompleteDropDown = nullptr; + m_enumStrings = nullptr; - m_fixedCompleter = NULL; - m_customCompleter = NULL; + m_fixedCompleter = nullptr; + m_customCompleter = nullptr; m_connectedCharEvent = false; @@ -384,7 +384,7 @@ public: HRESULT hr = CoCreateInstance ( wxCLSID_AutoComplete, - NULL, + nullptr, CLSCTX_INPROC_SERVER, IID_IAutoComplete, reinterpret_cast(&m_autoComplete) @@ -399,13 +399,13 @@ public: m_enumStrings = new wxIEnumString; m_enumStrings->AddRef(); hr = m_autoComplete->Init(m_entry->GetEditHWND(), m_enumStrings, - NULL, NULL); + nullptr, nullptr); if ( FAILED(hr) ) { wxLogApiError(wxT("IAutoComplete::Init"), hr); m_enumStrings->Release(); - m_enumStrings = NULL; + m_enumStrings = nullptr; return; } @@ -428,7 +428,7 @@ public: } // Finally set the completion options using IAutoComplete2. - IAutoComplete2 *pAutoComplete2 = NULL; + IAutoComplete2 *pAutoComplete2 = nullptr; hr = m_autoComplete->QueryInterface ( IID_IAutoComplete2, @@ -477,7 +477,7 @@ public: DoRefresh(); } - // Takes ownership of the pointer if it is non-NULL. + // Takes ownership of the pointer if it is non-null. bool ChangeCustomCompleter(wxTextCompleter *completer) { // Ensure that the old completer is not used any more before deleting @@ -601,7 +601,7 @@ private: // Check if the drop down is currently open. DWORD dwFlags = 0; if ( SUCCEEDED(m_autoCompleteDropDown->GetDropDownStatus(&dwFlags, - NULL)) + nullptr)) && dwFlags == ACDD_VISIBLE ) { if ( event.GetKeyCode() == WXK_ESCAPE ) @@ -646,10 +646,10 @@ private: // Enumerator for strings currently used for auto-completion. wxIEnumString *m_enumStrings; - // Fixed string completer or NULL if none. + // Fixed string completer or nullptr if none. wxTextCompleterFixed *m_fixedCompleter; - // Custom completer or NULL if none. + // Custom completer or nullptr if none. wxTextCompleter *m_customCompleter; // Initially false, set to true after connecting OnTextChanged() handler. @@ -676,7 +676,7 @@ static wxTextAutoCompleteData* const wxDUMMY_SHAUTOCOMPLETE_DATA = wxTextEntry::wxTextEntry() { #ifdef HAS_AUTOCOMPLETE - m_autoCompleteData = NULL; + m_autoCompleteData = nullptr; #endif // HAS_AUTOCOMPLETE } @@ -773,7 +773,7 @@ void wxTextEntry::SetInsertionPoint(long pos) long wxTextEntry::GetInsertionPoint() const { long from; - GetSelection(&from, NULL); + GetSelection(&from, nullptr); return from; } @@ -863,8 +863,8 @@ bool wxTextEntry::MSWHasAutoCompleteData() const { // We use special wxDUMMY_SHAUTOCOMPLETE_DATA for the pointer to indicate // that we're using SHAutoComplete(), so we need to check for it too, and - // not just whether the pointer is non-NULL. - return m_autoCompleteData != NULL + // not just whether the pointer is non-null. + return m_autoCompleteData != nullptr && m_autoCompleteData != wxDUMMY_SHAUTOCOMPLETE_DATA; } diff --git a/src/msw/textmeasure.cpp b/src/msw/textmeasure.cpp index 69bbfc2457..c6199ddf47 100644 --- a/src/msw/textmeasure.cpp +++ b/src/msw/textmeasure.cpp @@ -36,8 +36,8 @@ void wxTextMeasure::Init() { - m_hdc = NULL; - m_hfontOld = NULL; + m_hdc = nullptr; + m_hfontOld = nullptr; if ( m_dc ) { @@ -78,14 +78,14 @@ void wxTextMeasure::EndMeasuring() if ( m_hfontOld ) { ::SelectObject(m_hdc, m_hfontOld); - m_hfontOld = NULL; + m_hfontOld = nullptr; } if ( m_win ) ::ReleaseDC(GetHwndOf(m_win), m_hdc); //else: our HDC belongs to m_dc, don't touch it - m_hdc = NULL; + m_hdc = nullptr; } // Notice we don't check here the font. It is supposed to be OK before the call. diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index e817232aee..9de8dec445 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -107,10 +107,10 @@ static bool gs_bGuiOwnedByMainThread = true; // critical section which controls access to all GUI functions: any secondary // thread (i.e. except the main one) must enter this crit section before doing // any GUI calls -static wxCriticalSection *gs_critsectGui = NULL; +static wxCriticalSection *gs_critsectGui = nullptr; // critical section which protects gs_nWaitingForGui variable -static wxCriticalSection *gs_critsectWaitingForGui = NULL; +static wxCriticalSection *gs_critsectWaitingForGui = nullptr; // number of threads waiting for GUI in wxMutexGuiEnter() static size_t gs_nWaitingForGui = 0; @@ -164,7 +164,7 @@ public: wxMutexInternal(wxMutexType mutexType); ~wxMutexInternal(); - bool IsOk() const { return m_mutex != NULL; } + bool IsOk() const { return m_mutex != nullptr; } wxMutexError Lock() { return LockTimeout(INFINITE); } wxMutexError Lock(unsigned long ms) { return LockTimeout(ms); } @@ -188,9 +188,9 @@ wxMutexInternal::wxMutexInternal(wxMutexType mutexType) // create a nameless (hence intra process and always private) mutex m_mutex = ::CreateMutex ( - NULL, // default secutiry attributes + nullptr, // default secutiry attributes FALSE, // not initially locked - NULL // no name + nullptr // no name ); m_type = mutexType; @@ -294,7 +294,7 @@ public: wxSemaphoreInternal(int initialcount, int maxcount); ~wxSemaphoreInternal(); - bool IsOk() const { return m_semaphore != NULL; } + bool IsOk() const { return m_semaphore != nullptr; } wxSemaError Wait() { return WaitTimeout(INFINITE); } @@ -327,10 +327,10 @@ wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) m_semaphore = ::CreateSemaphore ( - NULL, // default security attributes + nullptr, // default security attributes initialcount, maxcount, - NULL // no name + nullptr // no name ); if ( !m_semaphore ) { @@ -370,7 +370,7 @@ wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds) wxSemaError wxSemaphoreInternal::Post() { - if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) ) + if ( !::ReleaseSemaphore(m_semaphore, 1, nullptr /* ptr to previous count */) ) { if ( GetLastError() == ERROR_TOO_MANY_POSTS ) { @@ -431,7 +431,7 @@ public: wxThreadError WaitForTerminate(wxCriticalSection& cs, wxThread::ExitCode *pRc, wxThreadWait waitMode, - wxThread *threadToDelete = NULL); + wxThread *threadToDelete = nullptr); // kill the thread unconditionally wxThreadError Kill(); @@ -639,7 +639,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) #ifdef wxUSE_BEGIN_THREAD m_hThread = (HANDLE)_beginthreadex ( - NULL, // default security + nullptr, // default security stackSize, wxThreadInternal::WinThreadStart, // entry point thread, @@ -649,7 +649,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) #else // compiler doesn't have _beginthreadex m_hThread = ::CreateThread ( - NULL, // default security + nullptr, // default security stackSize, // stack size wxThreadInternal::WinThreadStart, // thread entry point (LPVOID)thread, // parameter @@ -658,7 +658,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) ); #endif // _beginthreadex/CreateThread - if ( m_hThread == NULL ) + if ( m_hThread == nullptr ) { wxLogSysError(_("Can't create thread")); @@ -702,7 +702,7 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, // we may either wait passively for the thread to terminate (when called // from Wait()) or ask it to terminate (when called from Delete()) - bool shouldDelete = threadToDelete != NULL; + bool shouldDelete = threadToDelete != nullptr; DWORD rc = 0; @@ -928,7 +928,7 @@ wxThread *wxThread::This() { wxLogSysError(_("Couldn't get the current thread pointer")); - // return NULL... + // return nullptr... } return thread; @@ -1135,7 +1135,7 @@ wxThreadError wxThread::Kill() static bool wxSetThreadNameOnWindows10(const WCHAR *threadName) { typedef HRESULT(WINAPI* SetThreadDescription_t)(HANDLE, PCWSTR); - static SetThreadDescription_t s_pfnSetThreadDescription = NULL; + static SetThreadDescription_t s_pfnSetThreadDescription = nullptr; static bool s_initDone = false; if ( !s_initDone ) diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 1e70b006eb..2aea81850c 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -123,7 +123,7 @@ bool wxMSWTimerImpl::Start(int milliseconds, bool oneShot) wxTimerHiddenWindowModule::GetHWND(), // window for WM_TIMER m_id, // timer ID to create (UINT)m_milli, // delay - NULL // timer proc (unused) + nullptr // timer proc (unused) ); if ( ret == 0 ) @@ -183,13 +183,13 @@ wxTimerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // ---------------------------------------------------------------------------- -HWND wxTimerHiddenWindowModule::ms_hwnd = NULL; +HWND wxTimerHiddenWindowModule::ms_hwnd = nullptr; -const wxChar *wxTimerHiddenWindowModule::ms_className = NULL; +const wxChar *wxTimerHiddenWindowModule::ms_className = nullptr; bool wxTimerHiddenWindowModule::OnInit() { - // do not initialize ms_hwnd to ms_className to NULL here: it may happen + // do not initialize ms_hwnd to ms_className to nullptr here: it may happen // that our GetHWND() is called before the modules are initialized if a // timer is created from wxApp-derived class ctor and in this case we // shouldn't overwrite it @@ -206,7 +206,7 @@ void wxTimerHiddenWindowModule::OnExit() wxLogLastError(wxT("DestroyWindow(wxTimerHiddenWindow)")); } - ms_hwnd = NULL; + ms_hwnd = nullptr; } if ( ms_className ) @@ -216,7 +216,7 @@ void wxTimerHiddenWindowModule::OnExit() wxLogLastError(wxT("UnregisterClass(\"wxTimerHiddenWindow\")")); } - ms_className = NULL; + ms_className = nullptr; } } diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 3a402204c9..9503384ea0 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -159,7 +159,7 @@ public: : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, clientData, shortHelp, longHelp) { - m_staticText = NULL; + m_staticText = nullptr; m_toBeDeleted = false; } @@ -173,7 +173,7 @@ public: } else // no label { - m_staticText = NULL; + m_staticText = nullptr; } m_toBeDeleted = false; @@ -205,7 +205,7 @@ public: else { delete m_staticText; - m_staticText = NULL; + m_staticText = nullptr; } } else @@ -368,7 +368,7 @@ wxToolBar::CreateTool(wxControl *control, const wxString& label) void wxToolBar::Init() { m_hBitmap = 0; - m_disabledImgList = NULL; + m_disabledImgList = nullptr; m_nButtons = 0; m_totalFixedSize = 0; @@ -381,7 +381,7 @@ void wxToolBar::Init() m_defaultWidth = 16; m_defaultHeight = 15; - m_pInTool = NULL; + m_pInTool = nullptr; } bool wxToolBar::Create(wxWindow *parent, @@ -1050,8 +1050,8 @@ bool wxToolBar::Realize() { #ifdef TB_REPLACEBITMAP TBREPLACEBITMAP replaceBitmap; - replaceBitmap.hInstOld = NULL; - replaceBitmap.hInstNew = NULL; + replaceBitmap.hInstOld = nullptr; + replaceBitmap.hInstNew = nullptr; replaceBitmap.nIDOld = (UINT_PTR)oldToolBarBitmap; replaceBitmap.nIDNew = (UINT_PTR)hBitmap; replaceBitmap.nButtons = nButtons; @@ -1751,7 +1751,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const // TB_HITTEST returns m_nButtons ( not -1 ) if ( index < 0 || (size_t)index >= m_nButtons ) // it's a separator or there is no tool at all there - return NULL; + return nullptr; return m_tools.Item((size_t)index)->GetData(); } @@ -1916,7 +1916,7 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event) if ( m_pInTool ) { OnMouseEnter(wxID_ANY); - m_pInTool = NULL; + m_pInTool = nullptr; } event.Skip(); @@ -2096,7 +2096,7 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam) MSWDefWindowProc(WM_PAINT, wParam, lParam); if ( !hadHook ) - GetParent()->MSWSetEraseBgHook(NULL); + GetParent()->MSWSetEraseBgHook(nullptr); if ( rgnDummySeps.IsOk() ) @@ -2169,7 +2169,7 @@ bool wxToolBar::MSWEraseBgHook(WXHDC hDC) MSWDoEraseBackground(hDC); - ::SetWindowOrgEx(hdc, ptOldOrg.x, ptOldOrg.y, NULL); + ::SetWindowOrgEx(hdc, ptOldOrg.x, ptOldOrg.y, nullptr); return true; } diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 0c137aedca..412c814d1c 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -58,7 +58,7 @@ // ---------------------------------------------------------------------------- // the tooltip parent window -WXHWND wxToolTip::ms_hwndTT = (WXHWND)NULL; +WXHWND wxToolTip::ms_hwndTT = nullptr; // new tooltip maximum width, default value is set on first call to wxToolTip::Add() int wxToolTip::ms_maxWidth = 0; @@ -66,7 +66,7 @@ int wxToolTip::ms_maxWidth = 0; #if wxUSE_TTM_WINDOWFROMPOINT // the tooltip window proc -static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL; +static WNDPROC gs_wndprocToolTip = nullptr; #endif // wxUSE_TTM_WINDOWFROMPOINT @@ -280,7 +280,7 @@ void wxToolTip::DeleteToolTipCtrl() if ( ms_hwndTT ) { ::DestroyWindow((HWND)ms_hwndTT); - ms_hwndTT = (WXHWND)NULL; + ms_hwndTT = nullptr; } } @@ -304,13 +304,13 @@ WXHWND wxToolTip::GetToolTipCtrl() // active) and we don't want to strip "&"s from them ms_hwndTT = (WXHWND)::CreateWindowEx(exflags, TOOLTIPS_CLASS, - (LPCTSTR)NULL, + nullptr, TTS_ALWAYSTIP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, (HMENU)NULL, + nullptr, nullptr, wxGetInstance(), - NULL); + nullptr); if ( ms_hwndTT ) { HWND hwnd = (HWND)ms_hwndTT; @@ -330,7 +330,7 @@ WXHWND wxToolTip::GetToolTipCtrl() /* static */ void wxToolTip::UpdateVisibility() { - wxToolInfo ti(NULL, 0, wxRect()); + wxToolInfo ti(nullptr, 0, wxRect()); ti.uFlags = 0; if ( !SendTooltipMessage(ms_hwndTT, TTM_GETCURRENTTOOL, &ti) ) @@ -376,8 +376,8 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip(const wxString &tip) : m_text(tip) { - m_window = NULL; - m_others = NULL; + m_window = nullptr; + m_others = nullptr; // make sure m_rect.IsEmpty() == true m_rect.SetWidth(0); @@ -390,8 +390,8 @@ wxToolTip::wxToolTip(const wxString &tip) wxToolTip::wxToolTip(wxWindow* win, unsigned int id, const wxString &tip, const wxRect& rc) : m_text(tip), m_rect(rc), m_id(id) { - m_window = NULL; - m_others = NULL; + m_window = nullptr; + m_others = nullptr; SetWindow(win); } @@ -584,7 +584,7 @@ bool wxToolTip::AdjustMaxWidth() MemoryHDC hdc; if ( !hdc ) { - wxLogLastError(wxT("CreateCompatibleDC(NULL)")); + wxLogLastError(wxT("CreateCompatibleDC(nullptr)")); } if ( !SelectObject(hdc, hfont) ) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 5a4a6b885f..c1b5fbf1a2 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -100,7 +100,7 @@ void wxTopLevelWindowMSW::Init() m_fsIsMaximized = false; m_fsIsShowing = false; - m_menuSystem = NULL; + m_menuSystem = nullptr; } WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const @@ -211,11 +211,11 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const WXHWND wxTopLevelWindowMSW::MSWGetParent() const { - // for the frames without wxFRAME_FLOAT_ON_PARENT style we should use NULL + // for the frames without wxFRAME_FLOAT_ON_PARENT style we should use null // parent HWND or it would be always on top of its parent which is not what // we usually want (in fact, we only want it for frames with the // wxFRAME_FLOAT_ON_PARENT flag) - HWND hwndParent = NULL; + HWND hwndParent = nullptr; if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) ) { const wxWindow *parent = GetParent(); @@ -266,7 +266,7 @@ WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WX // 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, + // minimized and the focus is already null by then. Similarly, // we receive the activation event too early and restoring // focus in it fails because the window is still minimized. So // we need to do it here. @@ -347,7 +347,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, ( wxGetInstance(), static_cast(dlgTemplate), - parent ? GetHwndOf(parent) : NULL, + parent ? GetHwndOf(parent) : nullptr, (DLGPROC)wxDlgProc ); @@ -1221,7 +1221,7 @@ wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const if ( !hmenu ) { wxLogLastError(wxT("GetSystemMenu()")); - return NULL; + return nullptr; } wxTopLevelWindowMSW * const @@ -1300,13 +1300,13 @@ void wxTopLevelWindowMSW::DoSaveLastFocus() // remember the last focused child if it is our child wxWindow* const winFocus = FindFocus(); - m_winLastFocused = IsDescendant(winFocus) ? winFocus : NULL; + m_winLastFocused = IsDescendant(winFocus) ? winFocus : nullptr; } void wxTopLevelWindowMSW::DoRestoreLastFocus() { wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent() - : NULL; + : nullptr; if ( !parent ) { parent = this; @@ -1348,7 +1348,7 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) wxLogTrace(wxT("focus"), wxT("wxTLW %p deactivated, last focused: %p."), m_hWnd, - m_winLastFocused ? GetHwndOf(m_winLastFocused) : NULL); + m_winLastFocused ? GetHwndOf(m_winLastFocused) : nullptr); event.Skip(); } @@ -1381,14 +1381,14 @@ wxDlgProc(HWND WXUNUSED(hDlg), // wxTLWHiddenParentModule implementation // ============================================================================ -HWND wxTLWHiddenParentModule::ms_hwnd = NULL; +HWND wxTLWHiddenParentModule::ms_hwnd = nullptr; -const wxChar *wxTLWHiddenParentModule::ms_className = NULL; +const wxChar *wxTLWHiddenParentModule::ms_className = nullptr; bool wxTLWHiddenParentModule::OnInit() { - ms_hwnd = NULL; - ms_className = NULL; + ms_hwnd = nullptr; + ms_className = nullptr; return true; } @@ -1402,7 +1402,7 @@ void wxTLWHiddenParentModule::OnExit() wxLogLastError(wxT("DestroyWindow(hidden TLW parent)")); } - ms_hwnd = NULL; + ms_hwnd = nullptr; } if ( ms_className ) @@ -1412,7 +1412,7 @@ void wxTLWHiddenParentModule::OnExit() wxLogLastError(wxT("UnregisterClass(\"wxTLWHiddenParent\")")); } - ms_className = NULL; + ms_className = nullptr; } } @@ -1442,8 +1442,8 @@ HWND wxTLWHiddenParentModule::GetHWND() } } - ms_hwnd = ::CreateWindow(ms_className, wxEmptyString, 0, 0, 0, 0, 0, NULL, - (HMENU)NULL, wxGetInstance(), NULL); + ms_hwnd = ::CreateWindow(ms_className, wxEmptyString, 0, 0, 0, 0, 0, nullptr, + nullptr, wxGetInstance(), nullptr); if ( !ms_hwnd ) { wxLogLastError(wxT("CreateWindow(hidden TLW parent)")); diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index d83e139ee0..39c89e90cc 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -112,7 +112,7 @@ private: wxDECLARE_NO_COPY_CLASS(TreeItemUnlocker); }; -HTREEITEM TreeItemUnlocker::ms_unlockedItem = NULL; +HTREEITEM TreeItemUnlocker::ms_unlockedItem = nullptr; // another helper class: set the variable to true during its lifetime and reset // it to false when it is destroyed @@ -421,7 +421,7 @@ class wxTreeItemParam public: wxTreeItemParam() { - m_data = NULL; + m_data = nullptr; for ( size_t n = 0; n < WXSIZEOF(m_images); n++ ) { @@ -526,7 +526,7 @@ private: #pragma warning( default : 4097 ) #endif -// a macro to get the virtual root, returns NULL if none +// a macro to get the virtual root, returns nullptr if none #define GET_VIRTUAL_ROOT() ((wxVirtualNode *)m_pVirtualRoot) // returns true if the item is the virtual root @@ -713,12 +713,12 @@ bool wxTreeTraversal::Traverse(const wxTreeItemId& root, bool recursively) void wxTreeCtrl::Init() { - m_textCtrl = NULL; + m_textCtrl = nullptr; m_hasAnyAttr = false; #if wxUSE_DRAGIMAGE - m_dragImage = NULL; + m_dragImage = nullptr; #endif - m_pVirtualRoot = NULL; + m_pVirtualRoot = nullptr; m_dragStarted = false; m_focusLost = true; m_changingSelection = false; @@ -1064,7 +1064,7 @@ void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image, wxTreeItemParam *wxTreeCtrl::GetItemParam(const wxTreeItemId& item) const { - wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") ); + wxCHECK_MSG( item.IsOk(), nullptr, wxT("invalid tree item") ); wxTreeViewItem tvItem(item, TVIF_PARAM); @@ -1077,7 +1077,7 @@ wxTreeItemParam *wxTreeCtrl::GetItemParam(const wxTreeItemId& item) const // visible node. if ( !DoGetItem(&tvItem) ) { - return NULL; + return nullptr; } return (wxTreeItemParam *)tvItem.lParam; @@ -1097,7 +1097,7 @@ wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const { wxTreeItemParam *data = GetItemParam(item); - return data ? data->GetData() : NULL; + return data ? data->GetData() : nullptr; } void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) @@ -1512,7 +1512,7 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, tvIns.hParent = HITEM(parent); tvIns.hInsertAfter = HITEM(hInsertAfter); - // this is how we insert the item as the first child: supply a NULL + // this is how we insert the item as the first child: supply a null // hInsertAfter if ( !tvIns.hInsertAfter ) { @@ -1527,7 +1527,7 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, } else { - tvIns.item.pszText = NULL; + tvIns.item.pszText = nullptr; tvIns.item.cchTextMax = 0; } @@ -1577,7 +1577,7 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, param->SetItem(id); // setup wxTreeItemData - if ( data != NULL ) + if ( data != nullptr ) { param->SetData(data); data->SetId(id); @@ -1732,7 +1732,7 @@ void wxTreeCtrl::DeleteAllItems() if ( GET_VIRTUAL_ROOT() ) { delete GET_VIRTUAL_ROOT(); - m_pVirtualRoot = NULL; + m_pVirtualRoot = nullptr; } // and all the real items @@ -2060,7 +2060,7 @@ wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item, if ( !hWnd ) { wxDELETE(m_textCtrl); - return NULL; + return nullptr; } // textctrl is subclassed in MSWOnNotify @@ -3370,7 +3370,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_item = info->item.hItem; event.m_label = info->item.pszText; - event.m_editCancelled = info->item.pszText == NULL; + event.m_editCancelled = info->item.pszText == nullptr; break; } @@ -3570,7 +3570,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) int width, height; imageListState->GetSize(0, width, height); - HBITMAP hbmpTemp = ::CreateBitmap(width, height, 1, 1, NULL); + HBITMAP hbmpTemp = ::CreateBitmap(width, height, 1, 1, nullptr); int index = ::ImageList_Add(hImageList, hbmpTemp, hbmpTemp); ::DeleteObject(hbmpTemp); diff --git a/src/msw/uilocale.cpp b/src/msw/uilocale.cpp index 8024a23d16..1561d301ed 100644 --- a/src/msw/uilocale.cpp +++ b/src/msw/uilocale.cpp @@ -29,7 +29,7 @@ #include "wx/dynlib.h" #ifndef LOCALE_NAME_USER_DEFAULT - #define LOCALE_NAME_USER_DEFAULT NULL + #define LOCALE_NAME_USER_DEFAULT nullptr #endif #ifndef LOCALE_NAME_MAX_LENGTH @@ -98,7 +98,7 @@ static void wxMSWSetThreadUILanguage(LANGID langid) { wxLoadedDLL dllKernel32(wxS("kernel32.dll")); typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID); - SetThreadUILanguage_t pfnSetThreadUILanguage = NULL; + SetThreadUILanguage_t pfnSetThreadUILanguage = nullptr; wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32); if (pfnSetThreadUILanguage) pfnSetThreadUILanguage(langid); @@ -160,7 +160,7 @@ class wxUILocaleImplStdC : public wxUILocaleImpl { public: - // Create object corresponding to the given locale, return NULL if not + // Create object corresponding to the given locale, return nullptr if not // supported. static wxUILocaleImplStdC* Create() { @@ -429,7 +429,7 @@ public: { ULONG numberOfLanguages = 0; ULONG bufferSize = 0; - if (ms_GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numberOfLanguages, NULL, &bufferSize)) + if (ms_GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numberOfLanguages, nullptr, &bufferSize)) { wxScopedArray languages(bufferSize); if (ms_GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numberOfLanguages, languages.get(), &bufferSize)) @@ -501,14 +501,14 @@ public: return new wxUILocaleImplName(LOCALE_NAME_USER_DEFAULT); } - // Create object corresponding to the given locale, return NULL if not + // Create object corresponding to the given locale, return nullptr if not // supported. static wxUILocaleImplName* Create(const wchar_t* name) { // Getting the locale name seems to be the simplest way to see if it's // really supported: unknown locale result in an error here. - if ( !ms_GetLocaleInfoEx(name, LOCALE_SNAME, NULL, 0) ) - return NULL; + if ( !ms_GetLocaleInfoEx(name, LOCALE_SNAME, nullptr, 0) ) + return nullptr; // Unfortunately under Windows 10 the call above only fails if the given // locale name is not a valid BCP 47 identifier. For example, @@ -538,7 +538,7 @@ public: (LPWSTR)&isConstructed, sizeof(int) ) || isConstructed != 0) - return NULL; + return nullptr; } return new wxUILocaleImplName(name); @@ -721,7 +721,7 @@ public: dwFlags, lhs.wc_str(), -1, rhs.wc_str(), -1, - NULL, // [out] version information -- not needed + nullptr, // [out] version information -- not needed wxRESERVED_PARAM, wxRESERVED_PARAM ); @@ -769,9 +769,9 @@ private: // Ctor is private, use CreateDefault() or Create() instead. // - // Note that "name" can be NULL here (LOCALE_NAME_USER_DEFAULT). + // Note that "name" can be null here (LOCALE_NAME_USER_DEFAULT). explicit wxUILocaleImplName(const wchar_t* name) - : m_name(name ? wxStrdup(name) : NULL) + : m_name(name ? wxStrdup(name) : nullptr) { } @@ -825,7 +825,7 @@ wxUILocaleImpl* wxUILocaleImpl::CreateForLanguage(const wxLanguageInfo& info) if (info.WinLang == 0) { wxLogWarning(wxS("Locale '%s' not supported by OS."), info.Description); - return NULL; + return nullptr; } return new wxUILocaleImplLCID(info.GetLCID()); } @@ -844,7 +844,7 @@ wxUILocaleImpl* wxUILocaleImpl::CreateForLocale(const wxLocaleIdent& locId) // will be dropped soon, so it just doesn't seem worth to do it (note // that LocaleNameToLCID() itself is not available in XP either, so we // can't just use it here). - return NULL; + return nullptr; } return wxUILocaleImplName::Create(locId.GetTag(wxLOCALE_TAGTYPE_WINDOWS).wc_str()); diff --git a/src/msw/urlmsw.cpp b/src/msw/urlmsw.cpp index 055adfa484..24eabc4928 100644 --- a/src/msw/urlmsw.cpp +++ b/src/msw/urlmsw.cpp @@ -52,7 +52,7 @@ protected: // the only "reason for being" for this class is to tell // wxURL that there is someone dealing with the http protocol wxIMPLEMENT_DYNAMIC_CLASS(wxHTTPDummyProto, wxProtocol); -IMPLEMENT_PROTOCOL(wxHTTPDummyProto, wxT("http"), NULL, false) +IMPLEMENT_PROTOCOL(wxHTTPDummyProto, wxT("http"), nullptr, false) USE_PROTOCOL(wxHTTPDummyProto) #endif // !wxUSE_PROTOCOL_HTTP @@ -96,8 +96,8 @@ HINTERNET wxWinINetURL::GetSessionHandle() ( wxVERSION_STRING, INTERNET_OPEN_TYPE_PRECONFIG, - NULL, - NULL, + nullptr, + nullptr, rc == ERROR_SUCCESS ? 0 : INTERNET_FLAG_OFFLINE ); } @@ -158,7 +158,7 @@ size_t wxWinINetInputStream::OnSysRead(void *buffer, size_t bufsize) SetError(wxSTREAM_READ_ERROR); DWORD iError, bLength; - InternetGetLastResponseInfo(&iError, NULL, &bLength); + InternetGetLastResponseInfo(&iError, nullptr, &bLength); if ( bLength > 0 ) { wxString errorString; @@ -189,10 +189,10 @@ wxWinINetInputStream::wxWinINetInputStream(HINTERNET hFile) void wxWinINetInputStream::Attach(HINTERNET newHFile) { - wxCHECK_RET(m_hFile==NULL, + wxCHECK_RET(m_hFile==nullptr, wxT("cannot attach new stream when stream already exists")); m_hFile=newHFile; - SetError(m_hFile!=NULL ? wxSTREAM_NO_ERROR : wxSTREAM_READ_ERROR); + SetError(m_hFile!=nullptr ? wxSTREAM_NO_ERROR : wxSTREAM_READ_ERROR); } wxWinINetInputStream::~wxWinINetInputStream() @@ -231,7 +231,7 @@ wxInputStream *wxWinINetURL::GetInputStream(wxURL *owner) ( GetSessionHandle(), owner->GetURL(), - NULL, + nullptr, 0, INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_PASSIVE, diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 8ec3544def..c698455489 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -201,7 +201,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) struct hostent *pHostEnt = pfngethostbyname ? pfngethostbyname(bufA) - : NULL; + : nullptr; if ( pHostEnt ) { @@ -211,7 +211,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) pHostEnt = pfngethostbyaddr ? pfngethostbyaddr(pHostEnt->h_addr, 4, AF_INET) - : NULL; + : nullptr; } if ( pHostEnt ) @@ -286,7 +286,7 @@ bool wxGetUserName(wxChar *buf, int maxSize) wszDomain, WXSIZEOF(wszDomain) ); // Get the computer name of a DC for the domain. - if ( NetGetDCName( NULL, wszDomain, &ComputerName ) != NERR_Success ) + if ( NetGetDCName( nullptr, wszDomain, &ComputerName ) != NERR_Success ) { wxLogError(wxT("Cannot find domain controller")); @@ -322,7 +322,7 @@ bool wxGetUserName(wxChar *buf, int maxSize) // Convert the Unicode full name to ANSI WideCharToMultiByte( CP_ACP, 0, ui2->usri2_full_name, -1, - buf, maxSize, NULL, NULL ); + buf, maxSize, nullptr, nullptr ); return true; @@ -355,7 +355,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) // first branch is for Cygwin #if defined(__UNIX__) && !defined(__WINE__) const wxChar *szHome = wxGetenv(wxT("HOME")); - if ( szHome == NULL ) { + if ( szHome == nullptr ) { // we're homeless... wxLogWarning(_("can't find user's HOME, using current directory.")); strDir = wxT("."); @@ -384,18 +384,18 @@ const wxChar* wxGetHomeDir(wxString *pstr) // have unix utilities on them, we should use that. const wxChar *szHome = wxGetenv(wxT("HOME")); - if ( szHome != NULL ) + if ( szHome != nullptr ) { strDir = szHome; } else // no HOME, try HOMEDRIVE/PATH { szHome = wxGetenv(wxT("HOMEDRIVE")); - if ( szHome != NULL ) + if ( szHome != nullptr ) strDir << szHome; szHome = wxGetenv(wxT("HOMEPATH")); - if ( szHome != NULL ) + if ( szHome != nullptr ) { strDir << szHome; @@ -416,7 +416,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) // Windows NT, 2000 and XP, we should use that as our home directory. szHome = wxGetenv(wxT("USERPROFILE")); - if ( szHome != NULL ) + if ( szHome != nullptr ) strDir = szHome; } @@ -429,7 +429,7 @@ const wxChar* wxGetHomeDir(wxString *pstr) else // fall back to the program directory { // extract the directory component of the program file name - wxFileName::SplitPath(wxGetFullModuleName(), &strDir, NULL, NULL); + wxFileName::SplitPath(wxGetFullModuleName(), &strDir, nullptr, nullptr); } #endif // UNIX/Win @@ -459,7 +459,7 @@ bool wxGetDiskSpace(const wxString& path, if ( !::GetDiskFreeSpaceEx(path.t_str(), &bytesFree, &bytesTotal, - NULL) ) + nullptr) ) { wxLogLastError(wxT("GetDiskFreeSpaceEx")); @@ -498,7 +498,7 @@ bool wxGetEnv(const wxString& var, wxString *value) { // first get the size of the buffer - DWORD dwRet = ::GetEnvironmentVariable(var.t_str(), NULL, 0); + DWORD dwRet = ::GetEnvironmentVariable(var.t_str(), nullptr, 0); if ( !dwRet ) { // this means that there is no such variable @@ -555,7 +555,7 @@ bool wxSetEnv(const wxString& variable, const wxString& value) bool wxUnsetEnv(const wxString& variable) { - return wxDoSetEnv(variable, NULL); + return wxDoSetEnv(variable, nullptr); } // ---------------------------------------------------------------------------- @@ -628,7 +628,7 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags) dwAccess |= PROCESS_TERMINATE; HANDLE hProcess = ::OpenProcess(dwAccess, FALSE, (DWORD)pid); - if ( hProcess == NULL ) + if ( hProcess == nullptr ) { if ( krc ) { @@ -877,7 +877,7 @@ bool wxShutdown(int flags) TOKEN_PRIVILEGES tkp; // Get the LUID for the shutdown privilege. - bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, + bOK = ::LookupPrivilegeValue(nullptr, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid) != 0; if ( bOK ) @@ -887,7 +887,7 @@ bool wxShutdown(int flags) // Get the shutdown privilege for this process. ::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, - (PTOKEN_PRIVILEGES)NULL, 0); + nullptr, 0); // Cannot test the return value of AdjustTokenPrivileges. bOK = ::GetLastError() == ERROR_SUCCESS; @@ -971,7 +971,7 @@ wxLoadUserResource(const void **outData, const wxChar* resourceType, WXHINSTANCE instance) { - wxCHECK_MSG( outData && outLen, false, "output pointers can't be NULL" ); + wxCHECK_MSG( outData && outLen, false, "output pointers can't be null" ); HRSRC hResource = ::FindResource(instance, resourceName.t_str(), @@ -1011,7 +1011,7 @@ wxLoadUserResource(const wxString& resourceName, const void *data; size_t len; if ( !wxLoadUserResource(&data, &len, resourceName, resourceType, instance) ) - return NULL; + return nullptr; char *s = new char[len + 1]; memcpy(s, data, len); @@ -1362,7 +1362,7 @@ wxString wxGetCpuArchitectureName() // Try to get the current active CPU architecture via IsWow64Process2() // first, fallback to GetNativeSystemInfo() otherwise USHORT machine; - if (wxIsWow64Process2(::GetCurrentProcess(), &machine, NULL) && + if (wxIsWow64Process2(::GetCurrentProcess(), &machine, nullptr) && machine != IMAGE_FILE_MACHINE_UNKNOWN) return wxGetCpuArchitecureNameFromImageType(machine); @@ -1643,11 +1643,11 @@ extern long wxCharsetToCodepage(const char *name) extern "C" WXDLLIMPEXP_BASE HWND wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc) { - wxCHECK_MSG( classname && pclassname && wndproc, NULL, - wxT("NULL parameter in wxCreateHiddenWindow") ); + wxCHECK_MSG( classname && pclassname && wndproc, nullptr, + wxT("null parameter in wxCreateHiddenWindow") ); // register the class fi we need to first - if ( *pclassname == NULL ) + if ( *pclassname == nullptr ) { WNDCLASS wndclass; wxZeroMemory(wndclass); @@ -1660,7 +1660,7 @@ wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc) { wxLogLastError(wxT("RegisterClass() in wxCreateHiddenWindow")); - return NULL; + return nullptr; } *pclassname = classname; @@ -1670,13 +1670,13 @@ wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc) HWND hwnd = ::CreateWindow ( *pclassname, - NULL, + nullptr, 0, 0, 0, 0, 0, - (HWND) NULL, - (HMENU)NULL, + nullptr, + nullptr, wxGetInstance(), - (LPVOID) NULL + nullptr ); if ( !hwnd ) diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 0bdf0a0f58..0a8473ed26 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -87,7 +87,7 @@ // notifications and for this we need a (Win) class name for it which we will // register the first time it's needed static const wxChar *wxMSWEXEC_WNDCLASSNAME = wxT("_wxExecute_Internal_Class"); -static const wxChar *gs_classForHiddenWindow = NULL; +static const wxChar *gs_classForHiddenWindow = nullptr; // event used to wake up threads waiting in wxExecuteThread static wxWinAPI::Event gs_heventShutdown; @@ -178,7 +178,7 @@ public: wxLogLastError(wxT("UnregisterClass(wxExecClass)")); } - gs_classForHiddenWindow = NULL; + gs_classForHiddenWindow = nullptr; } } @@ -217,7 +217,7 @@ public: SECURITY_ATTRIBUTES security; security.nLength = sizeof(security); - security.lpSecurityDescriptor = NULL; + security.lpSecurityDescriptor = nullptr; security.bInheritHandle = TRUE; // to pass it to the child if ( !::CreatePipe(&m_handles[0], &m_handles[1], &security, 0) ) @@ -420,10 +420,10 @@ bool wxPipeInputStream::CanRead() const DWORD rc = ::PeekNamedPipe ( m_hInput, // handle - NULL, 0, // ptr to buffer and its size - NULL, // [out] bytes read + nullptr, 0, // ptr to buffer and its size + nullptr, // [out] bytes read &nAvailable, // [out] bytes available - NULL // [out] bytes left + nullptr // [out] bytes left ); if ( !rc ) @@ -457,7 +457,7 @@ size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len) } DWORD bytesRead; - if ( !::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) ) + if ( !::ReadFile(m_hInput, buffer, len, &bytesRead, nullptr) ) { m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE ? wxSTREAM_EOF @@ -484,8 +484,8 @@ wxPipeOutputStream::wxPipeOutputStream(HANDLE hOutput) ( m_hOutput, &mode, - NULL, // collection count (we don't set it) - NULL // timeout (we don't set it either) + nullptr, // collection count (we don't set it) + nullptr // timeout (we don't set it either) ) ) { wxLogLastError(wxT("SetNamedPipeHandleState(PIPE_NOWAIT)")); @@ -506,7 +506,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) while ( len > 0 ) { DWORD chunkWritten; - if ( !::WriteFile(m_hOutput, buffer, len, &chunkWritten, NULL) ) + if ( !::WriteFile(m_hOutput, buffer, len, &chunkWritten, nullptr) ) { m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE ? wxSTREAM_EOF @@ -561,7 +561,7 @@ wxExecuteDDE(const wxString& ddeServer, // we're prepared for this one to fail, so don't show errors wxLogNull noErrors; - ok = conn->Request(ddeCommand) != NULL; + ok = conn->Request(ddeCommand) != nullptr; } if ( !ok ) @@ -834,16 +834,16 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, bool ok = ::CreateProcess ( - NULL, // application name (use only cmd line) + nullptr, // application name (use only cmd line) wxMSW_CONV_LPTSTR(command), // full command line - NULL, // security attributes: defaults for both - NULL, // the process and its main thread + nullptr, // security attributes: defaults for both + nullptr, // the process and its main thread redirect, // inherit handles if we use pipes dwFlags, // process creation flags - envBuffer.data(), // environment (may be NULL which is fine) + envBuffer.data(), // environment (may be null which is fine) useCwd // initial working directory ? wxMSW_CONV_LPTSTR(env->cwd) - : NULL, // (or use the same) + : nullptr, // (or use the same) &si, // startup info (unused here) &pi // process info ) != 0; @@ -921,20 +921,20 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, if ( flags & wxEXEC_SYNC ) { - // handler may be !NULL for capturing program output, but we don't use + // handler may be non-null for capturing program output, but we don't use // it in wxExecuteData struct in this case because it's only needed // there for calling OnTerminate() on it and we don't do this when // executing synchronously - data->handler = NULL; + data->handler = nullptr; } else { - // may be NULL or not + // may be null or not data->handler = handler; } DWORD tid; - HANDLE hThread = ::CreateThread(NULL, + HANDLE hThread = ::CreateThread(nullptr, 0, wxExecuteThread, (void *)data, @@ -1021,7 +1021,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, wxAppTraits *traits = wxApp::GetTraitsIfExists(); wxCHECK_MSG( traits, -1, wxT("no wxAppTraits in wxExecute()?") ); - void *cookie = NULL; + void *cookie = nullptr; if ( !(flags & wxEXEC_NODISABLE) ) { // disable all app windows while waiting for the child process to finish diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 34014238d2..9caff8b7c3 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -203,7 +203,7 @@ void PixelToHIMETRIC(LONG *x, LONG *y) void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) { - MoveToEx(hdc, x1, y1, NULL); LineTo(hdc, x2, y2); + MoveToEx(hdc, x1, y1, nullptr); LineTo(hdc, x2, y2); } // Function dedicated to drawing horizontal/vertical lines with solid color @@ -231,7 +231,7 @@ void wxDrawHVLine(HDC hdc, int x1, int y1, int x2, int y2, COLORREF color, int w COLORREF bgColorOrig = ::GetBkColor(hdc); ::SetBkColor(hdc, color); - ::ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &r, L"", 0, NULL); + ::ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &r, L"", 0, nullptr); ::SetBkColor(hdc, bgColorOrig); } diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index eeef9def34..71a8d24f2c 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -425,7 +425,7 @@ wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset) // Local and mapped drives first. //------------------------------- // Allocate the required space for the API call. - const DWORD chars = GetLogicalDriveStrings(0, NULL); + const DWORD chars = GetLogicalDriveStrings(0, nullptr); TCHAR* buf = new TCHAR[chars+1]; // Get the list of drives. diff --git a/src/msw/webrequest_winhttp.cpp b/src/msw/webrequest_winhttp.cpp index 3608b1483b..f47358c834 100644 --- a/src/msw/webrequest_winhttp.cpp +++ b/src/msw/webrequest_winhttp.cpp @@ -37,7 +37,7 @@ public: #define wxLOAD_FUNC(name) \ wxDL_INIT_FUNC(, name, m_winhttp); \ - result &= (name != NULL); + result &= (name != nullptr); wxLOAD_FUNC(WinHttpQueryOption) wxLOAD_FUNC(WinHttpQueryHeaders) @@ -148,7 +148,7 @@ static wxString wxWinHTTPQueryHeaderString(HINTERNET hRequest, DWORD dwInfoLevel { wxString result; DWORD bufferLen = 0; - wxWinHTTP::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName, NULL, &bufferLen, + wxWinHTTP::WinHttpQueryHeaders(hRequest, dwInfoLevel, pwszName, nullptr, &bufferLen, WINHTTP_NO_HEADER_INDEX); if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER ) { @@ -176,7 +176,7 @@ static wxString wxWinHTTPQueryOptionString(HINTERNET hInternet, DWORD dwOption) { wxString result; DWORD bufferLen = 0; - wxWinHTTP::WinHttpQueryOption(hInternet, dwOption, NULL, &bufferLen); + wxWinHTTP::WinHttpQueryOption(hInternet, dwOption, nullptr, &bufferLen); if ( ::GetLastError() == ERROR_INSUFFICIENT_BUFFER ) { // Same as above: convert length in bytes into size in characters. @@ -238,8 +238,8 @@ wxWebRequestWinHTTP::wxWebRequestWinHTTP(wxWebSession& session, wxWebRequestImpl(session, sessionImpl, handler, id), m_sessionImpl(sessionImpl), m_url(url), - m_connect(NULL), - m_request(NULL), + m_connect(nullptr), + m_request(nullptr), m_dataWritten(0) { } @@ -329,7 +329,7 @@ void wxWebRequestWinHTTP::WriteData() m_request, m_dataWriteBuffer.GetData(), dataWriteSize, - NULL // [out] bytes written, must be null in async mode + nullptr // [out] bytes written, must be null in async mode ) ) { SetFailedWithLastError("Writing data"); @@ -340,7 +340,7 @@ void wxWebRequestWinHTTP::CreateResponse() { wxLogTrace(wxTRACE_WEBREQUEST, "Request %p: creating response", this); - if ( !wxWinHTTP::WinHttpReceiveResponse(m_request, NULL) ) + if ( !wxWinHTTP::WinHttpReceiveResponse(m_request, nullptr) ) { SetFailedWithLastError("Receiving response"); return; @@ -421,7 +421,7 @@ void wxWebRequestWinHTTP::Start() urlComps.nPort, wxRESERVED_PARAM ); - if ( m_connect == NULL ) + if ( m_connect == nullptr ) { SetFailedWithLastError("Connecting"); return; @@ -432,19 +432,19 @@ void wxWebRequestWinHTTP::Start() objectName += wxString(urlComps.lpszExtraInfo, urlComps.dwExtraInfoLength); // Open a request - static const wchar_t* acceptedTypes[] = { L"*/*", NULL }; + static const wchar_t* acceptedTypes[] = { L"*/*", nullptr }; m_request = wxWinHTTP::WinHttpOpenRequest ( m_connect, method.wc_str(), objectName.wc_str(), - NULL, // protocol version: use default, i.e. HTTP/1.1 + nullptr, // protocol version: use default, i.e. HTTP/1.1 WINHTTP_NO_REFERER, acceptedTypes, urlComps.nScheme == INTERNET_SCHEME_HTTPS ? WINHTTP_FLAG_SECURE : 0 ); - if ( m_request == NULL ) + if ( m_request == nullptr ) { SetFailedWithLastError("Opening request"); return; @@ -500,7 +500,7 @@ void wxWebRequestWinHTTP::SendRequest() ( m_request, allHeaders.wc_str(), allHeaders.length(), - NULL, 0, // No extra optional data right now + nullptr, 0, // No extra optional data right now m_dataSize, (DWORD_PTR)this ) ) @@ -513,7 +513,7 @@ void wxWebRequestWinHTTP::SendRequest() void wxWebRequestWinHTTP::DoCancel() { wxWinHTTPCloseHandle(m_request); - m_request = NULL; + m_request = nullptr; } // @@ -581,7 +581,7 @@ bool wxWebResponseWinHTTP::ReadData() m_requestHandle, GetDataBuffer(m_readSize), m_readSize, - NULL // [out] bytes read, must be null in async mode + nullptr // [out] bytes read, must be null in async mode ) == TRUE; } @@ -663,7 +663,7 @@ wxWebAuthChallengeWinHTTP::SetCredentials(const wxWebCredentials& cred) // wxWebSessionWinHTTP::wxWebSessionWinHTTP(): - m_handle(NULL) + m_handle(nullptr) { } diff --git a/src/msw/webview_edge.cpp b/src/msw/webview_edge.cpp index ee6f170b2d..e1d5efb6fc 100644 --- a/src/msw/webview_edge.cpp +++ b/src/msw/webview_edge.cpp @@ -63,8 +63,8 @@ typedef HRESULT(__stdcall *GetAvailableCoreWebView2BrowserVersionString_t)( PCWSTR browserExecutableFolder, LPWSTR* versionInfo); -CreateCoreWebView2EnvironmentWithOptions_t wxCreateCoreWebView2EnvironmentWithOptions = NULL; -GetAvailableCoreWebView2BrowserVersionString_t wxGetAvailableCoreWebView2BrowserVersionString = NULL; +CreateCoreWebView2EnvironmentWithOptions_t wxCreateCoreWebView2EnvironmentWithOptions = nullptr; +GetAvailableCoreWebView2BrowserVersionString_t wxGetAvailableCoreWebView2BrowserVersionString = nullptr; wxDynamicLibrary wxWebViewEdgeImpl::ms_loaderDll; #endif // wxUSE_WEBVIEW_EDGE_STATIC @@ -73,8 +73,8 @@ class wxWebViewEdgeHandlerRequest : public wxWebViewHandlerRequest public: wxWebViewEdgeHandlerRequest(ICoreWebView2WebResourceRequest* request): m_request(request), - m_handler(NULL), - m_dataStream(NULL) + m_handler(nullptr), + m_dataStream(nullptr) { } ~wxWebViewEdgeHandlerRequest() @@ -115,13 +115,13 @@ public: pos.QuadPart = 0; HRESULT hr = dataStream->Seek(pos, STREAM_SEEK_END, &size); if (FAILED(hr)) - return NULL; - hr = dataStream->Seek(pos, STREAM_SEEK_SET, NULL); + return nullptr; + hr = dataStream->Seek(pos, STREAM_SEEK_SET, nullptr); if (FAILED(hr)) - return NULL; - hr = dataStream->Read(m_data.GetWriteBuf(size.QuadPart), size.QuadPart, NULL); + return nullptr; + hr = dataStream->Read(m_data.GetWriteBuf(size.QuadPart), size.QuadPart, nullptr); if (FAILED(hr)) - return NULL; + return nullptr; m_dataStream = new wxMemoryInputStream(m_data.GetData(), size.QuadPart); } } @@ -178,7 +178,7 @@ public: m_args->GetDeferral(&m_deferral); // Create response - HRESULT hr = m_env->CreateWebResourceResponse(NULL, 200, NULL, NULL, &m_response); + HRESULT hr = m_env->CreateWebResourceResponse(nullptr, 200, nullptr, nullptr, &m_response); if (FAILED(hr)) wxLogApiError("CreateWebResourceResponse", hr); } @@ -397,8 +397,8 @@ HRESULT wxWebViewEdgeImpl::OnSourceChanged(ICoreWebView2 * WXUNUSED(sender), ICo wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATING, m_ctrl->GetId(), m_ctrl->GetCurrentURL(), wxString()); event.SetEventObject(m_ctrl); m_ctrl->GetEventHandler()->AddPendingEvent(event); - OnNavigationCompleted(NULL, NULL); - OnDOMContentLoaded(NULL, NULL); + OnNavigationCompleted(nullptr, nullptr); + OnDOMContentLoaded(nullptr, nullptr); } return S_OK; } @@ -711,21 +711,21 @@ void wxWebViewEdgeImpl::UpdateWebMessageHandler() wxString js = wxString::Format("window.%s = window.chrome.webview;", m_scriptMsgHandlerName); m_ctrl->AddUserScript(js); - m_webView->ExecuteScript(js.wc_str(), NULL); + m_webView->ExecuteScript(js.wc_str(), nullptr); } } ICoreWebView2Settings* wxWebViewEdgeImpl::GetSettings() { if (!m_webView) - return NULL; + return nullptr; ICoreWebView2Settings* settings; HRESULT hr = m_webView->get_Settings(&settings); if (FAILED(hr)) { wxLogApiError("WebView2::get_Settings", hr); - return NULL; + return nullptr; } return settings; diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 45afae0013..c8a057d538 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -120,7 +120,7 @@ wxWebViewIEImpl::wxWebViewIEImpl(wxWebViewIE* webview) bool wxWebViewIEImpl::Create() { - m_webBrowser = NULL; + m_webBrowser = nullptr; m_isBusy = false; m_historyLoadingFromList = false; m_historyEnabled = true; @@ -128,7 +128,7 @@ bool wxWebViewIEImpl::Create() m_zoomType = wxWEBVIEW_ZOOM_TYPE_TEXT; FindClear(); - if (::CoCreateInstance(CLSID_WebBrowser, NULL, + if (::CoCreateInstance(CLSID_WebBrowser, nullptr, CLSCTX_INPROC_SERVER, // CLSCTX_INPROC, IID_IWebBrowser2 , (void**)&m_webBrowser) != 0) { @@ -197,14 +197,14 @@ SAFEARRAY* MakeOneElementVariantSafeArray(const wxString& str) if ( !sa.Create(1) ) { wxLogLastError(wxT("SafeArrayCreateVector")); - return NULL; + return nullptr; } long ind = 0; if ( !sa.SetElement(&ind, str) ) { wxLogLastError(wxT("SafeArrayPtrOfIndex")); - return NULL; + return nullptr; } return sa.Detach(); @@ -407,7 +407,7 @@ void wxWebViewIE::SetIETextZoom(wxWebViewZoom level) #endif m_impl->m_webBrowser->ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, - &zoomVariant, NULL); + &zoomVariant, nullptr); wxASSERT(result == S_OK); } @@ -422,7 +422,7 @@ wxWebViewZoom wxWebViewIE::GetIETextZoom() const #endif m_impl->m_webBrowser->ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, - NULL, &zoomVariant); + nullptr, &zoomVariant); wxASSERT(result == S_OK); //We can safely cast here as we know that the range matches our enum @@ -472,7 +472,7 @@ void wxWebViewIE::SetIEOpticalZoomFactor(int zoom) m_impl->m_webBrowser->ExecWB((OLECMDID)63 /*OLECMDID_OPTICAL_ZOOM*/, OLECMDEXECOPT_DODEFAULT, &zoomVariant, - NULL); + nullptr); wxASSERT(result == S_OK); } @@ -513,7 +513,7 @@ int wxWebViewIE::GetIEOpticalZoomFactor() const HRESULT result = #endif m_impl->m_webBrowser->ExecWB((OLECMDID)63 /*OLECMDID_OPTICAL_ZOOM*/, - OLECMDEXECOPT_DODEFAULT, NULL, + OLECMDEXECOPT_DODEFAULT, nullptr, &zoomVariant); wxASSERT(result == S_OK); @@ -550,7 +550,7 @@ bool wxWebViewIE::CanSetZoomType(wxWebViewZoomType type) const void wxWebViewIE::Print() { m_impl->m_webBrowser->ExecWB(OLECMDID_PRINTPREVIEW, - OLECMDEXECOPT_DODEFAULT, NULL, NULL); + OLECMDEXECOPT_DODEFAULT, nullptr, nullptr); } bool wxWebViewIE::CanGoBack() const @@ -1040,7 +1040,7 @@ bool wxWebViewIE::RunScript(const wxString& javascript, wxString* output) const return false; } - IDispatch* scriptDispatch = NULL; + IDispatch* scriptDispatch = nullptr; if ( FAILED(document->get_Script(&scriptDispatch)) ) { wxLogWarning(_("Can't get the JavaScript object")); @@ -1086,7 +1086,7 @@ void wxWebViewIE::RegisterHandler(wxSharedPtr handler) HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, handler->GetName().wc_str(), - 0, NULL, 0); + 0, nullptr, 0); if(FAILED(hr)) { wxFAIL_MSG("Could not register protocol"); @@ -1129,7 +1129,7 @@ void wxWebViewIEImpl::ExecCommand(wxString command) if(document) { - document->execCommand(wxBasicString(command), VARIANT_FALSE, VARIANT(), NULL); + document->execCommand(wxBasicString(command), VARIANT_FALSE, VARIANT(), nullptr); } } @@ -1225,7 +1225,7 @@ void wxWebViewIEImpl::FindInternal(const wxString& text, int flags, int internal m_findPointers.reserve(text.Len() == 1 ? 1000 : 500); } - while(ptrBegin->FindText(text_bstr, find_flag, ptrEnd, NULL) == S_OK) + while(ptrBegin->FindText(text_bstr, find_flag, ptrEnd, nullptr) == S_OK) { wxCOMPtr elm; if(ptrBegin->CurrentScope(&elm) == S_OK) @@ -1395,7 +1395,7 @@ bool wxWebViewIEImpl::EnableControlFeature(long flag, bool enable) void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt) { - if (m_impl->m_webBrowser == NULL) return; + if (m_impl->m_webBrowser == nullptr) return; switch (evt.GetDispatchId()) { @@ -1609,7 +1609,7 @@ void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt) VirtualProtocol::VirtualProtocol(wxSharedPtr handler) { - m_file = NULL; + m_file = nullptr; m_handler = handler; } @@ -1647,7 +1647,7 @@ STDMETHODIMP VirtualProtocol::QueryInterface(REFIID riid, void **ppv) return S_OK; } - *ppv = NULL; + *ppv = nullptr; return (HRESULT) E_NOINTERFACE; } @@ -1710,7 +1710,7 @@ HRESULT STDMETHODCALLTYPE VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRe if(*pcbRead < cb) { wxDELETE(m_file); - m_protocolSink->ReportResult(S_OK, 0, NULL); + m_protocolSink->ReportResult(S_OK, 0, nullptr); } //As we are not eof there is more data return S_OK; @@ -1718,7 +1718,7 @@ HRESULT STDMETHODCALLTYPE VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRe else if(err == wxSTREAM_EOF) { wxDELETE(m_file); - m_protocolSink->ReportResult(S_OK, 0, NULL); + m_protocolSink->ReportResult(S_OK, 0, nullptr); //We are eof and so finished return S_OK; } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index bd002cf53e..68c32149f8 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -144,7 +144,7 @@ extern wxPopupWindow* wxCurrentPopupWindow; // This is a hack used by the owner-drawn wxButton implementation to ensure // that the brush used for erasing its background is correctly aligned with the // control. -wxWindowMSW *wxWindowBeingErased = NULL; +wxWindowMSW *wxWindowBeingErased = nullptr; #endif // wxUSE_UXTHEME namespace @@ -269,11 +269,11 @@ private: }; GestureFuncs::GetGestureInfo_t - GestureFuncs::ms_pfnGetGestureInfo = NULL; + GestureFuncs::ms_pfnGetGestureInfo = nullptr; GestureFuncs::CloseGestureInfoHandle_t - GestureFuncs::ms_pfnCloseGestureInfoHandle = NULL; + GestureFuncs::ms_pfnCloseGestureInfoHandle = nullptr; GestureFuncs::SetGestureConfig_t - GestureFuncs::ms_pfnSetGestureConfig = NULL; + GestureFuncs::ms_pfnSetGestureConfig = nullptr; bool GestureFuncs::ms_gestureSymbolsLoaded = false; @@ -405,7 +405,7 @@ wxWindow *wxWindowMSW::FindItem(long id, WXHWND hWnd) const current = current->GetNext(); } - return NULL; + return nullptr; } // Find an item given the MS Windows handle @@ -439,7 +439,7 @@ wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const current = current->GetNext(); } - return NULL; + return nullptr; } // Default command handler @@ -455,7 +455,7 @@ bool wxWindowMSW::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) void wxWindowMSW::Init() { // MSW specific - m_oldWndProc = NULL; + m_oldWndProc = nullptr; m_mouseInWindow = false; m_lastKeydownProcessed = false; @@ -561,7 +561,7 @@ bool wxWindowMSW::CreateUsingMSWClass(const wxChar* classname, if ( !classname ) classname = GetMSWClassName(style); - if ( !MSWCreate(classname, NULL, pos, size, msflags, exstyle) ) + if ( !MSWCreate(classname, nullptr, pos, size, msflags, exstyle) ) return false; InheritAttributes(); @@ -643,7 +643,7 @@ wxWindow *wxWindowBase::DoFindFocus() return wxGetWindowFromHWND((WXHWND)hWnd); } - return NULL; + return nullptr; } void wxWindowMSW::DoEnable( bool enable ) @@ -838,10 +838,10 @@ void wxWindowMSW::DoReleaseMouse() // the capture for it (it's going to happen anyhow), pretend that there is // no capture any more. if ( gs_insideCaptureChanged ) - return NULL; + return nullptr; HWND hwnd = ::GetCapture(); - return hwnd ? wxFindWinFromHandle(hwnd) : NULL; + return hwnd ? wxFindWinFromHandle(hwnd) : nullptr; } bool wxWindowMSW::SetFont(const wxFont& font) @@ -1223,7 +1223,7 @@ void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect) } else { - pr = NULL; + pr = nullptr; } @@ -1337,7 +1337,7 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd) // implement IsOfStandardClass() method which returns true for the // standard controls and false for the wxWidgets own windows as it can // simply check m_oldWndProc - m_oldWndProc = NULL; + m_oldWndProc = nullptr; } // we're officially created now, send the event @@ -1364,7 +1364,7 @@ void wxWindowMSW::UnsubclassWin() wxSetWindowProc(hwnd, m_oldWndProc); } - m_oldWndProc = NULL; + m_oldWndProc = nullptr; } } } @@ -1651,7 +1651,7 @@ bool wxWindowMSW::IsMouseInWindow() const while ( hwnd && (hwnd != GetHwnd()) ) hwnd = ::GetParent(hwnd); - return hwnd != NULL; + return hwnd != nullptr; } void wxWindowMSW::OnInternalIdle() @@ -1730,14 +1730,14 @@ void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect) } else { - pRect = NULL; + pRect = nullptr; } UINT flags = RDW_INVALIDATE | RDW_ALLCHILDREN; if ( eraseBack ) flags |= RDW_ERASE; - ::RedrawWindow(hWnd, pRect, NULL, flags); + ::RedrawWindow(hWnd, pRect, nullptr, flags); } } @@ -1949,7 +1949,7 @@ void wxWindowMSW::DoGetPosition(int *x, int *y) const { // 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, + ::MapWindowPoints(nullptr, parent ? GetHwndOf(parent) : HWND_DESKTOP, (LPPOINT)&rect, 2); } @@ -2044,10 +2044,10 @@ wxWindowMSW::DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height) // if our parent had prepared a defer window handle for us, use it wxWindowMSW * const parent = GetParent(); - HDWP hdwp = parent ? (HDWP)parent->m_hDWP : NULL; + HDWP hdwp = parent ? (HDWP)parent->m_hDWP : nullptr; if ( hdwp ) { - hdwp = ::DeferWindowPos(hdwp, (HWND)hwnd, NULL, x, y, width, height, + hdwp = ::DeferWindowPos(hdwp, (HWND)hwnd, nullptr, x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE); if ( !hdwp ) { @@ -2086,7 +2086,7 @@ void wxWindowMSW::MSWMoveWindowToAnyPosition(WXHWND hwnd, int x, int y, int widt if ( scroll ) { // scroll to the actual position (looks like there is no need to Freeze() the parent) - ::ScrollWindow(GetHwndOf(GetParent()), -x, -y, NULL, NULL); + ::ScrollWindow(GetHwndOf(GetParent()), -x, -y, nullptr, nullptr); } // move to relative coordinates @@ -2098,7 +2098,7 @@ void wxWindowMSW::MSWMoveWindowToAnyPosition(WXHWND hwnd, int x, int y, int widt if ( scroll ) { // scroll back - ::ScrollWindow(GetHwndOf(GetParent()), x, y, NULL, NULL); + ::ScrollWindow(GetHwndOf(GetParent()), x, y, nullptr, nullptr); } } @@ -2400,7 +2400,7 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) // platforms, so allow it under Windows too UINT flags = TPM_RIGHTBUTTON | TPM_RECURSE; - ::TrackPopupMenu(GetHmenuOf(menu), flags, pt.x, pt.y, 0, GetHwnd(), NULL); + ::TrackPopupMenu(GetHmenuOf(menu), flags, pt.x, pt.y, 0, GetHwnd(), nullptr); // we need to do it right now as otherwise the events are never going to be // sent to wxCurrentPopupMenu from HandleCommand() @@ -2489,7 +2489,7 @@ wxMenu* wxWindowMSW::MSWFindMenuFromHMENU(WXHMENU hMenu) if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu ) return wxCurrentPopupMenu; - return NULL; + return nullptr; } #endif // wxUSE_MENUS && !defined(__WXUNIVERSAL__) @@ -2612,7 +2612,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 - wxButton *btn = NULL; + wxButton *btn = nullptr; if ( lDlgCode & DLGC_DEFPUSHBUTTON ) { // let IsDialogMessage() handle this for all @@ -2843,7 +2843,7 @@ wxButton* wxWindowMSW::MSWGetDefaultButtonFor(wxWindow* win) return wxDynamicCast(tlw->GetDefaultItem(), wxButton); #endif // wxUSE_BUTTON - return NULL; + return nullptr; } /* static */ @@ -2911,7 +2911,7 @@ void wxWindowMSW::UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, // Hook for new window just as it's being created, when the window isn't yet // associated with the handle -static wxWindowMSW *gs_winBeingCreated = NULL; +static wxWindowMSW *gs_winBeingCreated = nullptr; // implementation of wxWindowCreationHook class: it just sets gs_winBeingCreated to the // window being created and insures that it's always unset back later @@ -2922,7 +2922,7 @@ wxWindowCreationHook::wxWindowCreationHook(wxWindowMSW *winBeingCreated) wxWindowCreationHook::~wxWindowCreationHook() { - gs_winBeingCreated = NULL; + gs_winBeingCreated = nullptr; } // Main window proc @@ -2946,7 +2946,7 @@ wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { wxAssociateWinWithHandle(hWnd, gs_winBeingCreated); wnd = gs_winBeingCreated; - gs_winBeingCreated = NULL; + gs_winBeingCreated = nullptr; wnd->SetHWND((WXHWND)hWnd); } @@ -3687,7 +3687,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, // we could have got an event from our child, reflect it back // to it if this is the case - wxWindowMSW *win = NULL; + wxWindowMSW *win = nullptr; WXHWND hWnd = (WXHWND)wParam; if ( hWnd != m_hWnd ) { @@ -3795,7 +3795,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, // now alter the client size making room for drawing a // themed border RECT *rect; - NCCALCSIZE_PARAMS *csparam = NULL; + NCCALCSIZE_PARAMS *csparam = nullptr; if ( wParam ) { csparam = (NCCALCSIZE_PARAMS *)lParam; @@ -3892,7 +3892,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } // Draw the border - ::DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL); + ::DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, nullptr); } } break; @@ -3939,15 +3939,15 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l wxWindow *wxFindWinFromHandle(HWND hwnd) { WindowHandles::const_iterator i = gs_windowHandles.find(hwnd); - return i == gs_windowHandles.end() ? NULL : i->second; + return i == gs_windowHandles.end() ? nullptr : i->second; } void wxAssociateWinWithHandle(HWND hwnd, wxWindowMSW *win) { - // adding NULL hwnd is (first) surely a result of an error and + // adding null hwnd is (first) surely a result of an error and // (secondly) breaks menu command processing - wxCHECK_RET( hwnd != (HWND)NULL, - wxT("attempt to add a NULL hwnd to window list ignored") ); + wxCHECK_RET( hwnd != nullptr, + wxT("attempt to add a null hwnd to window list ignored") ); #if wxDEBUG_LEVEL WindowHandles::const_iterator i = gs_windowHandles.find(hwnd); @@ -4023,7 +4023,7 @@ void wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, WXHWND wxWindowMSW::MSWGetParent() const { - return m_parent ? m_parent->GetHWND() : WXHWND(NULL); + return m_parent ? m_parent->GetHWND() : WXHWND(nullptr); } bool wxWindowMSW::MSWCreate(const wxChar *wclass, @@ -4083,7 +4083,7 @@ WXHWND wxWindowMSW::MSWCreateWindowAtAnyPosition(WXDWORD exStyle, const wxChar* { WXHWND hWnd = ::CreateWindowEx(exStyle, clName, title, style, x, y, width, height, parent, (HMENU)wxUIntToPtr(id), wxGetInstance(), - NULL); // no extra data + nullptr); // no extra data if ( !hWnd ) { @@ -4189,7 +4189,7 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code, // return an error size_t tipLength = wxMin(ttip.length(), WXSIZEOF(buf) - 1); - // Convert to WideChar without adding the NULL character. The NULL + // Convert to WideChar without adding the NUL character. The NUL // character is added afterwards (this is more efficient). int len = ::MultiByteToWideChar ( @@ -4306,7 +4306,7 @@ bool wxWindowMSW::HandleDestroy() { // delete our drop target if we've got one #if wxUSE_DRAG_AND_DROP - if ( m_dropTarget != NULL ) + if ( m_dropTarget != nullptr ) { m_dropTarget->Revoke(m_hWnd); @@ -4388,7 +4388,7 @@ bool wxWindowMSW::HandleSetFocus(WXHWND hwnd) wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId); event.SetEventObject(this); - // wxFindWinFromHandle() may return NULL, it is ok + // wxFindWinFromHandle() may return nullptr, it is ok event.SetWindow(wxFindWinFromHandle(hwnd)); return HandleWindowEvent(event); @@ -4421,7 +4421,7 @@ bool wxWindowMSW::HandleKillFocus(WXHWND hwnd) wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId); event.SetEventObject(this); - // wxFindWinFromHandle() may return NULL, it is ok + // wxFindWinFromHandle() may return nullptr, it is ok event.SetWindow(wxFindWinFromHandle(hwnd)); return HandleWindowEvent(event); @@ -4478,7 +4478,7 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam) for ( UINT wIndex = 0; wIndex < gwFilesDropped; wIndex++ ) { // first get the needed buffer length (+1 for terminating NUL) - size_t len = ::DragQueryFile(hFilesInfo, wIndex, NULL, 0) + 1; + size_t len = ::DragQueryFile(hFilesInfo, wIndex, nullptr, 0) + 1; // and now get the file name ::DragQueryFile(hFilesInfo, wIndex, @@ -4721,7 +4721,7 @@ wxWindowMSW::MSWOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), # if wxUSE_BUTTON wxDynamicCast(FindItem(id), wxButton) # else - NULL + nullptr # endif ; #endif // USE_OWNER_DRAWN @@ -4746,7 +4746,7 @@ wxWindowMSW::MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct) { wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData); - // according to Carsten Fuchs the pointer may be NULL under XP if an + // according to Carsten Fuchs the pointer may be null under XP if an // MDI child frame is initially maximized, see this for more info: // http://article.gmane.org/gmane.comp.lib.wxwidgets.general/27745 // @@ -4803,7 +4803,7 @@ static wxSize GetWindowDPI(HWND hwnd) { #if wxUSE_DYNLIB_CLASS typedef UINT (WINAPI *GetDpiForWindow_t)(HWND hwnd); - static GetDpiForWindow_t s_pfnGetDpiForWindow = NULL; + static GetDpiForWindow_t s_pfnGetDpiForWindow = nullptr; static bool s_initDone = false; if ( !s_initDone ) @@ -4835,7 +4835,7 @@ int wxGetSystemMetrics(int nIndex, const wxWindow* window) if ( window ) { typedef int (WINAPI * GetSystemMetricsForDpi_t)(int nIndex, UINT dpi); - static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = NULL; + static GetSystemMetricsForDpi_t s_pfnGetSystemMetricsForDpi = nullptr; static bool s_initDone = false; if ( !s_initDone ) @@ -4873,7 +4873,7 @@ bool wxSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWi if ( window ) { typedef int (WINAPI * SystemParametersInfoForDpi_t)(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni, UINT dpi); - static SystemParametersInfoForDpi_t s_pfnSystemParametersInfoForDpi = NULL; + static SystemParametersInfoForDpi_t s_pfnSystemParametersInfoForDpi = nullptr; static bool s_initDone = false; if ( !s_initDone ) @@ -4903,7 +4903,7 @@ wxSize wxWindowMSW::GetDPI() const { HWND hwnd = GetHwnd(); - if ( hwnd == NULL ) + if ( hwnd == nullptr ) { const wxWindow* topWin = wxGetTopLevelParent(const_cast(this)); if ( topWin ) @@ -4911,7 +4911,7 @@ wxSize wxWindowMSW::GetDPI() const hwnd = GetHwndOf(topWin); } - if ( hwnd == NULL ) + if ( hwnd == nullptr ) { // We shouldn't be using this function without a valid HWND because // we can't really find the correct DPI to use in this case for a @@ -5076,9 +5076,9 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC hDC, WXHWND hWnd) *brush = item->MSWControlColor(hDC, hWnd); else #endif // wxUSE_CONTROLS - *brush = NULL; + *brush = nullptr; - return *brush != NULL; + return *brush != nullptr; } bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) @@ -5111,7 +5111,7 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) // now check for the need to redraw if (result > 0) - ::InvalidateRect((HWND) hWndPalChange, NULL, TRUE); + ::InvalidateRect((HWND) hWndPalChange, nullptr, TRUE); } } @@ -5126,7 +5126,7 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture) { - // Ensure that wxWindow::GetCapture() returns NULL if called from the event + // Ensure that wxWindow::GetCapture() returns nullptr if called from the event // handlers invoked below. This is necessary to avoid wrongly calling // ReleaseMouse() when we're already losing the mouse capture anyhow. gs_insideCaptureChanged = true; @@ -5187,7 +5187,7 @@ bool wxWindowMSW::HandleQueryNewPalette() ::ReleaseDC((HWND) GetHWND(), hdc); /* now check for the need to redraw */ if (result > 0) - ::InvalidateRect((HWND) GetHWND(), NULL, TRUE); + ::InvalidateRect((HWND) GetHWND(), nullptr, TRUE); } #endif // wxUSE_PALETTE @@ -5567,13 +5567,13 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child) // uses RTL layout, which is exactly what we need here as the child // window origin is its _right_ top corner in this case and not the // left one. - ::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 2); + ::MapWindowPoints(nullptr, GetHwnd(), (POINT *)&rc, 2); int x = rc.left, y = rc.top; MSWAdjustBrushOrg(&x, &y); - if ( !::SetBrushOrgEx((HDC)hDC, -x, -y, NULL) ) + if ( !::SetBrushOrgEx((HDC)hDC, -x, -y, nullptr) ) { wxLogLastError(wxT("SetBrushOrgEx(bg brush)")); } @@ -5748,12 +5748,12 @@ void wxWindowMSW::EndRepositioningChildren() { wxASSERT_MSG( m_hDWP, wxS("Shouldn't be called") ); - // reset m_hDWP to NULL so that child windows don't try to use our + // reset m_hDWP to nullptr so that child windows don't try to use our // m_hDWP after we call EndDeferWindowPos() on it (this shouldn't // happen anyhow normally but who knows what weird flow of control we // may have depending on what the users EVT_SIZE handler does...) HDWP hDWP = (HDWP)m_hDWP; - m_hDWP = NULL; + m_hDWP = nullptr; // do put all child controls in place at once if ( !::EndDeferWindowPos(hDWP) ) @@ -5879,13 +5879,13 @@ bool wxWindowMSW::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND control) if ( !cmd && wxCurrentPopupMenu ) { wxMenu *popupMenu = wxCurrentPopupMenu; - wxCurrentPopupMenu = NULL; + wxCurrentPopupMenu = nullptr; return popupMenu->MSWCommand(cmd, id); } #endif // wxUSE_MENUS_NATIVE - wxWindow *win = NULL; + wxWindow *win = nullptr; // first try to find it from HWND - this works even with the broken // programs using the same ids for different controls @@ -6338,7 +6338,7 @@ void MSWInitAnyKeyEvent(wxKeyEvent& event, WXWPARAM wParam, WXLPARAM lParam, - const wxWindowBase *win /* may be NULL */) + const wxWindowBase *win /* may be null */) { if ( win ) { @@ -7131,7 +7131,7 @@ wxWindow *wxGetActiveWindow() { return wxFindWinFromHandle(hWnd); } - return NULL; + return nullptr; } extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) @@ -7141,7 +7141,7 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) // For a radiobutton, we get the radiobox from GWL_USERDATA (which is set // by code in msw/radiobox.cpp), for all the others we just search up the // window hierarchy - wxWindow *win = NULL; + wxWindow *win = nullptr; if ( hwnd ) { win = wxFindWinFromHandle(hwnd); @@ -7150,7 +7150,7 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) #if wxUSE_RADIOBOX && !defined(__WXUNIVERSAL__) // native radiobuttons return DLGC_RADIOBUTTON here and for any // wxWindow class which overrides WM_GETDLGCODE processing to - // do it as well, win would be already non NULL + // do it as well, win would be already non null if ( ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON ) { win = wxRadioBox::GetFromRadioButtonHWND(hwnd); @@ -7174,7 +7174,7 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) // this is a really ugly hack needed to avoid mistakenly returning the // parent frame wxWindow for the find/replace modeless dialog HWND - // this, in turn, is needed to call IsDialogMessage() from - // wxApp::ProcessMessage() as for this we must return NULL from here + // wxApp::ProcessMessage() as for this we must return nullptr from here // // 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 @@ -7267,7 +7267,7 @@ void wxSetKeyboardHook(bool doIt) ( WH_KEYBOARD, wxKeyboardHook, - NULL, // must be NULL for process hook + nullptr, // must be null for process hook ::GetCurrentThreadId() ); if ( !wxTheKeyboardHook ) @@ -7922,7 +7922,7 @@ public: ( WH_GETMESSAGE, &wxIdleWakeUpModule::MsgHookProc, - NULL, + nullptr, GetCurrentThreadId() ); diff --git a/src/osx/accel.cpp b/src/osx/accel.cpp index 49ca614533..99cab03dea 100644 --- a/src/osx/accel.cpp +++ b/src/osx/accel.cpp @@ -56,7 +56,7 @@ wxAcceleratorRefData::~wxAcceleratorRefData() wxAcceleratorTable::wxAcceleratorTable() { - m_refData = NULL; + m_refData = nullptr; } wxAcceleratorTable::~wxAcceleratorTable() @@ -80,7 +80,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] bool wxAcceleratorTable::IsOk() const { - return (m_refData != NULL); + return (m_refData != nullptr); } int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) diff --git a/src/osx/brush.cpp b/src/osx/brush.cpp index 9effab162a..f5d09c68d2 100644 --- a/src/osx/brush.cpp +++ b/src/osx/brush.cpp @@ -151,7 +151,7 @@ wxBrushStyle wxBrush::GetStyle() const wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") ); return M_BRUSHDATA->GetStipple(); } diff --git a/src/osx/carbon/app.cpp b/src/osx/carbon/app.cpp index c5c7596a46..48405ba557 100644 --- a/src/osx/carbon/app.cpp +++ b/src/osx/carbon/app.cpp @@ -62,7 +62,7 @@ wxBEGIN_EVENT_TABLE(wxApp, wxEvtHandler) wxEND_EVENT_TABLE() -wxWindow* wxApp::s_captureWindow = NULL ; +wxWindow* wxApp::s_captureWindow = nullptr ; long wxApp::s_lastModifiers = 0 ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; @@ -163,7 +163,7 @@ void wxApp::MacReopenApp() // as hidden TLWs, so do preferences and some classes like wxTaskBarIconWindow use placeholder TLWs. // We don't want to reshow those, so let's just reopen the minimized a.k.a. iconized TLWs. - wxTopLevelWindow* firstIconized = NULL; + wxTopLevelWindow* firstIconized = nullptr; wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); while (node) @@ -171,7 +171,7 @@ void wxApp::MacReopenApp() wxTopLevelWindow* win = (wxTopLevelWindow*) node->GetData(); if ( win->IsIconized() ) { - if ( firstIconized == NULL ) + if ( firstIconized == nullptr ) firstIconized = win; } else if ( win->IsShown() ) @@ -244,8 +244,8 @@ wxMacAssertOutputHandler(const char *WXUNUSED(componentName), #if wxUSE_UNICODE fileNameStr = wxString(fileName, wxConvLocal); assertionStr = wxString(assertionString, wxConvLocal); - exceptionStr = wxString((exceptionLabelString!=0) ? exceptionLabelString : "", wxConvLocal) ; - errorStr = wxString((errorString!=0) ? errorString : "", wxConvLocal) ; + exceptionStr = wxString((exceptionLabelString!=nullptr) ? exceptionLabelString : "", wxConvLocal) ; + errorStr = wxString((errorString!=nullptr) ? errorString : "", wxConvLocal) ; #else fileNameStr = fileName; assertionStr = assertionString; @@ -346,7 +346,7 @@ bool wxApp::OnInitGui() return false; #ifdef __WXOSX_COCOA__ - CGDisplayRegisterReconfigurationCallback(wxCGDisplayReconfigurationCallBack, NULL); + CGDisplayRegisterReconfigurationCallback(wxCGDisplayReconfigurationCallBack, nullptr); #endif return true ; @@ -384,9 +384,9 @@ wxApp::wxApp() { m_printMode = wxPRINT_WINDOWS; - m_macCurrentEvent = NULL ; - m_macCurrentEventHandlerCallRef = NULL ; - m_macPool = sm_isEmbedded ? NULL : new wxMacAutoreleasePool(); + m_macCurrentEvent = nullptr ; + m_macCurrentEventHandlerCallRef = nullptr ; + m_macPool = sm_isEmbedded ? nullptr : new wxMacAutoreleasePool(); } wxApp::~wxApp() @@ -397,8 +397,8 @@ wxApp::~wxApp() CFMutableArrayRef GetAutoReleaseArray() { - static CFMutableArrayRef array = 0; - if ( array == 0) + static CFMutableArrayRef array = nullptr; + if ( array == nullptr) array= CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks); return array; } diff --git a/src/osx/carbon/clipbrd.cpp b/src/osx/carbon/clipbrd.cpp index 6c463d0d99..c26ecf51a1 100644 --- a/src/osx/carbon/clipbrd.cpp +++ b/src/osx/carbon/clipbrd.cpp @@ -44,7 +44,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject); wxClipboard::wxClipboard() { m_open = false; - m_data = NULL ; + m_data = nullptr ; } wxClipboard::~wxClipboard() @@ -165,7 +165,7 @@ bool wxClipboard::GetData( wxDataObject& data ) if (dataSize == 0) { - data.SetData( format, 0, 0 ); + data.SetData( format, 0, nullptr ); } else { diff --git a/src/osx/carbon/colordlgosx.mm b/src/osx/carbon/colordlgosx.mm index dfd888ceda..ace9165bb2 100644 --- a/src/osx/carbon/colordlgosx.mm +++ b/src/osx/carbon/colordlgosx.mm @@ -87,7 +87,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); wxColourDialog::wxColourDialog() { - m_dialogParent = NULL; + m_dialogParent = nullptr; } wxColourDialog::wxColourDialog(wxWindow *parent, const wxColourData *data) diff --git a/src/osx/carbon/control.cpp b/src/osx/carbon/control.cpp index 9886b996fe..c61ec4e706 100644 --- a/src/osx/carbon/control.cpp +++ b/src/osx/carbon/control.cpp @@ -72,7 +72,7 @@ bool wxControl::ProcessCommand( wxCommandEvent &event ) void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) { - if ( GetPeer() == NULL || !GetPeer()->IsOk() ) + if ( GetPeer() == nullptr || !GetPeer()->IsOk() ) return; // TODO diff --git a/src/osx/carbon/cursor.cpp b/src/osx/carbon/cursor.cpp index 870a2c643b..09e13404c3 100644 --- a/src/osx/carbon/cursor.cpp +++ b/src/osx/carbon/cursor.cpp @@ -36,7 +36,7 @@ public: virtual bool IsOk() const override { #if wxOSX_USE_COCOA_OR_CARBON - if ( m_hCursor != NULL ) + if ( m_hCursor != nullptr ) return true; return false; @@ -201,12 +201,12 @@ wxCursor gMacCurrentCursor ; wxCursorRefData::wxCursorRefData() { - m_hCursor = NULL; + m_hCursor = nullptr; } wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) : wxGDIRefData() { - m_hCursor = NULL; + m_hCursor = nullptr; #if wxOSX_USE_COCOA m_hCursor = (WX_NSCursor) wxMacCocoaRetain(cursor.m_hCursor); @@ -249,7 +249,7 @@ wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const WXHCURSOR wxCursor::GetHCURSOR() const { - return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); + return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : nullptr); } #if wxUSE_IMAGE @@ -291,7 +291,7 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX ) ; image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotSpotY ) ; m_refData->DecRef() ; - m_refData = NULL ; + m_refData = nullptr ; InitFromImage( image ) ; } #endif diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index 133804edc6..888ba785d4 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -89,7 +89,7 @@ wxDataFormat& wxDataFormat::operator=(const wxDataFormat& rFormat) wxDataFormat::NativeFormat wxDataFormat::GetFormatForType(wxDataFormatId type) { - wxDataFormat::NativeFormat f = NULL; + wxDataFormat::NativeFormat f = nullptr; switch (type) { case wxDF_TEXT: @@ -300,7 +300,7 @@ void wxDataObject::WriteToSink(wxOSXDataSink * datatransfer) const wxScopedArray array(GetFormatCount()); GetAllFormats( array.get() ); - wxOSXDataSinkItem* sinkItem = NULL; + wxOSXDataSinkItem* sinkItem = nullptr; for (size_t i = 0; i < GetFormatCount(); i++) { @@ -335,7 +335,7 @@ void wxDataObject::WriteToSink(wxOSXDataSink * datatransfer) const size_t sz = datasize + 4; wxMemoryBuffer databuf( datasize+4 ); void* buf = databuf.GetWriteBuf(datasize+4); - if ( buf != NULL ) + if ( buf != nullptr ) { // empty the buffer because in some case GetDataHere does not fill buf memset( buf, 0, sz ); @@ -391,7 +391,7 @@ bool wxDataObject::ReadFromSource(wxDataObject * source) if (size == 0) { - SetData( format, 0, 0 ); + SetData( format, 0, nullptr ); } else { @@ -468,10 +468,10 @@ bool wxDataObject::ReadFromSource(wxOSXDataSource * source) { // revert the translation and decomposition to arrive at a proper utf8 string again - wxCFRef url = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*) buf, flavorDataSize, kCFStringEncodingUTF8, NULL); + wxCFRef url = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*) buf, flavorDataSize, kCFStringEncodingUTF8, nullptr); wxCFStringRef cfString = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); - CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString); + CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(nullptr, 0, cfString); CFStringNormalize(cfMutableString, kCFStringNormalizationFormC); // cfMutableString is released by the wxCFStringRef wxString path = wxCFStringRef(cfMutableString).AsString(); @@ -614,7 +614,7 @@ void wxFileDataObject::GetFileNames( wxCharBuffer &buf ) const bool wxFileDataObject::GetDataHere( void *pBuf ) const { - if (pBuf == NULL) + if (pBuf == nullptr) return false; wxCharBuffer buf; @@ -692,10 +692,10 @@ void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap ) CGImageRef cgImageRef = (CGImageRef) m_bitmap.CreateCGImage(); CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0); - CGImageDestinationRef destination = CGImageDestinationCreateWithData( data , kUTTypeTIFF , 1 , NULL ); + CGImageDestinationRef destination = CGImageDestinationCreateWithData( data , kUTTypeTIFF , 1 , nullptr ); if ( destination ) { - CGImageDestinationAddImage( destination, cgImageRef, NULL ); + CGImageDestinationAddImage( destination, cgImageRef, nullptr ); CGImageDestinationFinalize( destination ); CFRelease( destination ); } @@ -707,27 +707,27 @@ void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap ) void wxBitmapDataObject::Init() { - m_pictData = NULL; + m_pictData = nullptr; } void wxBitmapDataObject::Clear() { - if (m_pictData != NULL) + if (m_pictData != nullptr) { CFRelease( m_pictData ); - m_pictData = NULL; + m_pictData = nullptr; } } bool wxBitmapDataObject::GetDataHere( void *pBuf ) const { - if (m_pictData == NULL) + if (m_pictData == nullptr) { wxFAIL_MSG( wxT("attempt to copy empty bitmap failed") ); return false; } - if (pBuf == NULL) + if (pBuf == nullptr) return false; memcpy( pBuf, (const char *)CFDataGetBytePtr(m_pictData), CFDataGetLength(m_pictData) ); @@ -737,7 +737,7 @@ bool wxBitmapDataObject::GetDataHere( void *pBuf ) const size_t wxBitmapDataObject::GetDataSize() const { - if (m_pictData != NULL) + if (m_pictData != nullptr) return CFDataGetLength(m_pictData); else return 0; @@ -747,16 +747,16 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf ) { Clear(); - if ((pBuf == NULL) || (nSize == 0)) + if ((pBuf == nullptr) || (nSize == 0)) return false; - CGImageRef cgImageRef = NULL; + CGImageRef cgImageRef = nullptr; CFDataRef data = CFDataCreate( kCFAllocatorDefault, (const UInt8*) pBuf, nSize); - CGImageSourceRef source = CGImageSourceCreateWithData( data, NULL ); + CGImageSourceRef source = CGImageSourceCreateWithData( data, nullptr ); if ( source ) { - cgImageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL); + cgImageRef = CGImageSourceCreateImageAtIndex(source, 0, nullptr); CFRelease( source ); } m_pictData = data; @@ -765,7 +765,7 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf ) { m_bitmap.Create( cgImageRef ); CGImageRelease(cgImageRef); - cgImageRef = NULL; + cgImageRef = nullptr; } return m_bitmap.IsOk(); diff --git a/src/osx/carbon/dcclient.cpp b/src/osx/carbon/dcclient.cpp index 98061950e5..7e71c3cc9c 100644 --- a/src/osx/carbon/dcclient.cpp +++ b/src/osx/carbon/dcclient.cpp @@ -54,7 +54,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) CGContextRef cg = (CGContextRef) window->MacGetCGContextRef(); m_release = false; - if ( cg == NULL ) + if ( cg == nullptr ) { SetGraphicsContext( wxGraphicsContext::Create( window ) ) ; m_contentScaleFactor = window->GetContentScaleFactor(); diff --git a/src/osx/carbon/dcprint.cpp b/src/osx/carbon/dcprint.cpp index 7ab3f259ce..a4865add88 100644 --- a/src/osx/carbon/dcprint.cpp +++ b/src/osx/carbon/dcprint.cpp @@ -184,9 +184,9 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc ) m_err = PMSessionBeginPageNoDialog(native->GetPrintSession(), native->GetPageFormat(), - NULL); + nullptr); - CGContextRef pageContext = NULL ; + CGContextRef pageContext = nullptr ; if ( m_err == noErr ) { @@ -269,7 +269,7 @@ wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printda { wxString message ; message.Printf( wxT("Print Error %u"), m_nativePrinterDC->GetStatus() ) ; - wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ; + wxMessageDialog dialog( nullptr , message , wxEmptyString, wxICON_HAND | wxOK) ; dialog.ShowModal(); } else @@ -310,7 +310,7 @@ bool wxPrinterDCImpl::StartDoc( const wxString& message ) { wxString message ; message.Printf( wxT("Print Error %u"), m_nativePrinterDC->GetStatus() ) ; - wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ; + wxMessageDialog dialog( nullptr , message , wxEmptyString, wxICON_HAND | wxOK) ; dialog.ShowModal(); } @@ -329,7 +329,7 @@ void wxPrinterDCImpl::EndDoc() { wxString message ; message.Printf( wxT("Print Error %u"), m_nativePrinterDC->GetStatus() ) ; - wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ; + wxMessageDialog dialog( nullptr , message , wxEmptyString, wxICON_HAND | wxOK) ; dialog.ShowModal(); } } diff --git a/src/osx/carbon/dcscreen.cpp b/src/osx/carbon/dcscreen.cpp index 1c6a987f96..6a4372d27a 100644 --- a/src/osx/carbon/dcscreen.cpp +++ b/src/osx/carbon/dcscreen.cpp @@ -68,7 +68,7 @@ wxBitmap wxScreenDCImpl::DoGetAsBitmap(const wxRect *subrect) const if ( subrect ) srcRect = CGRectOffset( srcRect, -subrect->x, -subrect->y ) ; - CGImageRef image = NULL; + CGImageRef image = nullptr; image = CGDisplayCreateImage(kCGDirectMainDisplay); diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 45e4ca2de6..c0289bb4e4 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -294,7 +294,7 @@ void wxFontRefData::SetFont(CTFontRef font) m_ctFontAttributes = dict; - m_cgFont = CTFontCopyGraphicsFont(m_ctFont, NULL); + m_cgFont = CTFontCopyGraphicsFont(m_ctFont, nullptr); } static const CGAffineTransform kSlantTransform = CGAffineTransformMake(1, 0, tan(wxDegToRad(11)), 1, 0, 0); @@ -346,10 +346,10 @@ void wxFontRefData::Alloc() CachedFontEntry& entryNoSize = fontcache[lookupnameNoSize]; if ( entryNoSize.used ) { - m_ctFont = CTFontCreateCopyWithAttributes(entryNoSize.font, m_info.GetPointSize(), NULL, NULL); + m_ctFont = CTFontCreateCopyWithAttributes(entryNoSize.font, m_info.GetPointSize(), nullptr, nullptr); m_ctFontAttributes = entryNoSize.fontAttributes.CreateCopy(); m_ctFontAttributes.SetValue(kCTFontAttributeName,m_ctFont.get()); - m_cgFont = CTFontCopyGraphicsFont(m_ctFont, NULL); + m_cgFont = CTFontCopyGraphicsFont(m_ctFont, nullptr); entryWithSize.font = m_ctFont; entryWithSize.cgFont = m_cgFont; entryWithSize.fontAttributes = m_ctFontAttributes; @@ -359,7 +359,7 @@ void wxFontRefData::Alloc() { // emulate slant if necessary, the font descriptor itself carries that information, // while the weight can only be determined properly from the generated font itself - const CGAffineTransform* remainingTransform = NULL; + const CGAffineTransform* remainingTransform = nullptr; if ( m_info.GetStyle() != wxFONTSTYLE_NORMAL && m_info.GetCTSlant(m_info.GetCTFontDescriptor()) < 0.01 ) remainingTransform = &kSlantTransform; @@ -398,7 +398,7 @@ void wxFontRefData::Alloc() entryNoSize.used = true; } } - m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL)); + m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, nullptr)); } bool wxFontRefData::IsFixedWidth() const @@ -520,7 +520,7 @@ public: // Remember to update Cache array size when adding new cases to // this switch statement! } - wxCFRef ctfont(CTFontCreateUIFontForLanguage(uifont, 0.0, NULL)); + wxCFRef ctfont(CTFontCreateUIFontForLanguage(uifont, 0.0, nullptr)); cached = new wxFontRefData(ctfont); } @@ -700,7 +700,7 @@ void wxFont::SetStrikethrough(bool strikethrough) // accessors // ---------------------------------------------------------------------------- -// TODO: insert checks everywhere for M_FONTDATA == NULL! +// TODO: insert checks everywhere for M_FONTDATA == nullptr! double wxFont::GetFractionalPointSize() const { @@ -713,10 +713,10 @@ wxSize wxFont::GetPixelSize() const { #if wxUSE_GRAPHICS_CONTEXT // TODO: consider caching the value - wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef)NULL); + wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef)nullptr); dc->SetFont(*this, *wxBLACK); wxDouble width, height = 0; - dc->GetTextExtent(wxT("g"), &width, &height, NULL, NULL); + dc->GetTextExtent(wxT("g"), &width, &height, nullptr, nullptr); delete dc; return wxSize((int)width, (int)height); #else @@ -783,13 +783,13 @@ wxFontEncoding wxFont::GetEncoding() const CTFontRef wxFont::OSXGetCTFont() const { - wxCHECK_MSG(IsOk(), 0, wxT("invalid font")); + wxCHECK_MSG(IsOk(), nullptr, wxT("invalid font")); return M_FONTDATA->OSXGetCTFont(); } CFDictionaryRef wxFont::OSXGetCTFontAttributes() const { - wxCHECK_MSG(IsOk(), 0, wxT("invalid font")); + wxCHECK_MSG(IsOk(), nullptr, wxT("invalid font")); return M_FONTDATA->OSXGetCTFontAttributes(); } @@ -797,7 +797,7 @@ CFDictionaryRef wxFont::OSXGetCTFontAttributes() const CGFontRef wxFont::OSXGetCGFont() const { - wxCHECK_MSG(IsOk(), 0, wxT("invalid font")); + wxCHECK_MSG(IsOk(), nullptr, wxT("invalid font")); return M_FONTDATA->OSXGetCGFont(); } @@ -805,7 +805,7 @@ CGFontRef wxFont::OSXGetCGFont() const const wxNativeFontInfo* wxFont::GetNativeFontInfo() const { - return IsOk() ? &(M_FONTDATA->GetNativeFontInfo()) : NULL; + return IsOk() ? &(M_FONTDATA->GetNativeFontInfo()) : nullptr; } // ---------------------------------------------------------------------------- @@ -925,7 +925,7 @@ void wxNativeFontInfo::RealizeResource() const void wxNativeFontInfo::CreateCTFontDescriptor() { - CTFontDescriptorRef descriptor = NULL; + CTFontDescriptorRef descriptor = nullptr; wxCFMutableDictionaryRef attributes; // build all attributes that define our font. @@ -966,7 +966,7 @@ void wxNativeFontInfo::CreateCTFontDescriptor() // Create the font descriptor with our attributes descriptor = CTFontDescriptorCreateWithAttributes(attributes); - wxASSERT(descriptor != NULL); + wxASSERT(descriptor != nullptr); m_descriptor = descriptor; @@ -974,7 +974,7 @@ void wxNativeFontInfo::CreateCTFontDescriptor() #if wxDEBUG_LEVEL >= 2 // for debugging: show all different font names - wxCFRef font = CTFontCreateWithFontDescriptor(m_descriptor, 12, NULL); + wxCFRef font = CTFontCreateWithFontDescriptor(m_descriptor, 12, nullptr); wxString familyname; wxCFTypeRef(CTFontDescriptorCopyAttribute(m_descriptor, kCTFontFamilyNameAttribute)).GetValue(familyname); wxLogTrace(TRACE_CTFONT,"****** CreateCTFontDescriptor ******"); @@ -1156,11 +1156,11 @@ bool wxNativeFontInfo::FromString(const wxString& s) xml = GetPListPrefix()+xml; wxCFStringRef plist(xml); wxCFDataRef listData(CFStringCreateExternalRepresentation(kCFAllocatorDefault,plist,kCFStringEncodingUTF8,0)); - wxCFDictionaryRef attributes((CFDictionaryRef) CFPropertyListCreateWithData(kCFAllocatorDefault, listData, 0, NULL, NULL)); - CTFontDescriptorRef descriptor = NULL; - if (attributes != NULL) + wxCFDictionaryRef attributes((CFDictionaryRef) CFPropertyListCreateWithData(kCFAllocatorDefault, listData, 0, nullptr, nullptr)); + CTFontDescriptorRef descriptor = nullptr; + if (attributes != nullptr) descriptor = CTFontDescriptorCreateWithAttributes(attributes); - if (descriptor != NULL) + if (descriptor != nullptr) { InitFromFontDescriptor(descriptor); CFRelease(descriptor); @@ -1186,12 +1186,12 @@ wxString wxNativeFontInfo::ToString() const // the slant-ness has to be emulated in the font's transform wxCFDictionaryRef attributes(CTFontDescriptorCopyAttributes(GetCTFontDescriptor())); - if (attributes != NULL) + if (attributes != nullptr) { CFPropertyListFormat format = kCFPropertyListXMLFormat_v1_0; if (CFPropertyListIsValid(attributes, format)) { - wxCFDataRef listData(CFPropertyListCreateData(kCFAllocatorDefault, attributes, format, 0, NULL)); + wxCFDataRef listData(CFPropertyListCreateData(kCFAllocatorDefault, attributes, format, 0, nullptr)); wxCFStringRef cfString( CFStringCreateFromExternalRepresentation( kCFAllocatorDefault, listData, kCFStringEncodingUTF8) ); wxString xml = cfString.AsString(); xml.Replace("\r",wxEmptyString,true); diff --git a/src/osx/carbon/fontdlg.cpp b/src/osx/carbon/fontdlg.cpp index 9a3b7fd6d6..1d921ffbd6 100644 --- a/src/osx/carbon/fontdlg.cpp +++ b/src/osx/carbon/fontdlg.cpp @@ -205,7 +205,7 @@ void wxFontColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) if (event.LeftDown()) { wxWindow* parent = GetParent(); - while (parent != NULL && !parent->IsKindOf(CLASSINFO(wxDialog)) && !parent->IsKindOf(CLASSINFO(wxFrame))) + while (parent != nullptr && !parent->IsKindOf(CLASSINFO(wxDialog)) && !parent->IsKindOf(CLASSINFO(wxFrame))) parent = parent->GetParent(); wxColourData data; @@ -257,12 +257,12 @@ wxEND_EVENT_TABLE() wxFontDialog::wxFontDialog( ) { - m_dialogParent = NULL; + m_dialogParent = nullptr; } wxFontDialog::wxFontDialog(wxWindow* parent, const wxFontData& fontData) { - m_dialogParent = NULL; + m_dialogParent = nullptr; Create(parent, fontData); } @@ -283,13 +283,13 @@ bool wxFontDialog::Create(wxWindow* parent, const wxFontData& fontData) wxString caption = _("Font"); - m_facenameCtrl = NULL; - m_sizeCtrl = NULL; - m_boldCtrl = NULL; - m_italicCtrl = NULL; - m_underlinedCtrl = NULL; - m_colourCtrl = NULL; - m_previewCtrl = NULL; + m_facenameCtrl = nullptr; + m_sizeCtrl = nullptr; + m_boldCtrl = nullptr; + m_italicCtrl = nullptr; + m_underlinedCtrl = nullptr; + m_colourCtrl = nullptr; + m_previewCtrl = nullptr; InitializeFont(); @@ -328,7 +328,7 @@ void wxFontDialog::CreateControls() wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL); itemFlexGridSizer4->Add(itemBoxSizer6, 0, wxGROW, 5); - wxString* m_facenameCtrlStrings = NULL; + wxString* m_facenameCtrlStrings = nullptr; m_facenameCtrl = new wxListBox( itemDialog1, wxID_FONTDIALOG_FACENAME, wxDefaultPosition, wxSize(320, 100), 0, m_facenameCtrlStrings, wxLB_SINGLE ); itemBoxSizer6->Add(m_facenameCtrl, 0, wxGROW|wxALL, 5); diff --git a/src/osx/carbon/frame.cpp b/src/osx/carbon/frame.cpp index fdce201ced..dbde8c6f4a 100644 --- a/src/osx/carbon/frame.cpp +++ b/src/osx/carbon/frame.cpp @@ -176,14 +176,14 @@ void wxFrame::OnActivate(wxActivateEvent& event) else { #if wxUSE_MENUBAR - if (m_frameMenuBar != NULL) + if (m_frameMenuBar != nullptr) { m_frameMenuBar->MacInstallMenuBar(); } else { wxFrame *tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame ); - if (tlf != NULL) + if (tlf != nullptr) { // Trying top-level frame membar if (tlf->GetMenuBar()) @@ -218,7 +218,7 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) if ( (tlf == this) || (m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar()) ) makeCurrent = true; // or there is an app-level menubar like MDI - else if ( tlf && (tlf->GetMenuBar() == NULL) && (((wxFrame*)wxTheApp->GetTopWindow()) == this) ) + else if ( tlf && (tlf->GetMenuBar() == nullptr) && (((wxFrame*)wxTheApp->GetTopWindow()) == this) ) makeCurrent = true; wxFrameBase::AttachMenuBar( menuBar ); @@ -411,7 +411,7 @@ bool wxFrame::Show(bool show) if ( !show ) { #if wxUSE_MENUBAR - if (m_frameMenuBar != NULL) + if (m_frameMenuBar != nullptr) { m_frameMenuBar->MacUninstallMenuBar(); } diff --git a/src/osx/carbon/gdiobj.cpp b/src/osx/carbon/gdiobj.cpp index dab4b49829..c4314c04bf 100644 --- a/src/osx/carbon/gdiobj.cpp +++ b/src/osx/carbon/gdiobj.cpp @@ -53,7 +53,7 @@ void wxStockGDIMac::OnExit() const wxFont* wxStockGDIMac::GetFont(Item item) { wxFont* font = static_cast(ms_stockObject[item]); - if (font == NULL) + if (font == nullptr) { switch (item) { diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index 3c9c5283ef..acda667ebf 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -105,7 +105,7 @@ CGColorRef wxMacCreateCGColor( const wxColour& col ) { CGColorRef retval = col.CreateCGColor(); - wxASSERT(retval != NULL); + wxASSERT(retval != nullptr); return retval; } @@ -171,7 +171,7 @@ public : virtual void Render( CGContextRef ctxRef ) override { - if (m_image != NULL) + if (m_image != nullptr) wxMacDrawCGImage( ctxRef, &m_imageBounds, m_image ); } @@ -315,8 +315,8 @@ public : wxDouble tx=0.0, wxDouble ty=0.0) override; // 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 override; + virtual void Get(wxDouble* a=nullptr, wxDouble* b=nullptr, wxDouble* c=nullptr, + wxDouble* d=nullptr, wxDouble* tx=nullptr, wxDouble* ty=nullptr) const override; // makes this the inverse matrix virtual void Invert() override; @@ -519,7 +519,7 @@ protected: GradientComponents() { count = 0; - comps = NULL; + comps = nullptr; } void Init(unsigned count_) @@ -564,11 +564,11 @@ wxMacCoreGraphicsPenBrushDataBase::~wxMacCoreGraphicsPenBrushDataBase() void wxMacCoreGraphicsPenBrushDataBase::Init() { - m_gradientFunction = NULL; - m_shading = NULL; + m_gradientFunction = nullptr; + m_shading = nullptr; m_isShading = false; - m_shadingMatrix = NULL; - m_gradientComponents = NULL; + m_shadingMatrix = nullptr; + m_gradientComponents = nullptr; } void @@ -810,7 +810,7 @@ wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer case wxPENSTYLE_USER_DASH: wxDash *dashes; m_count = info.GetDashes( &dashes ); - if ((dashes != NULL) && (m_count > 0)) + if ((dashes != nullptr) && (m_count > 0)) { m_userLengths = new CGFloat[m_count]; for ( int i = 0; i < m_count; ++i ) @@ -831,7 +831,7 @@ wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer wxBitmap bmp = info.GetStipple(); if ( bmp.IsOk() ) { - m_colorSpace.reset( CGColorSpaceCreatePattern( NULL ) ); + m_colorSpace.reset( CGColorSpaceCreatePattern( nullptr ) ); m_pattern.reset( (CGPatternRef) *( new ImagePattern( &bmp , CGAffineTransformMakeScale( 1,-1 ) ) ) ); m_patternColorComponents = new CGFloat[1] ; m_patternColorComponents[0] = (CGFloat) 1.0; @@ -853,7 +853,7 @@ wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer } break; } - if ((m_lengths != NULL) && (m_count > 0)) + if ((m_lengths != nullptr) && (m_count > 0)) { // force the line cap, otherwise we get artifacts (overlaps) and just solid lines m_cap = kCGLineCapButt; @@ -890,11 +890,11 @@ wxMacCoreGraphicsPenData::~wxMacCoreGraphicsPenData() void wxMacCoreGraphicsPenData::Init() { - m_lengths = NULL; - m_userLengths = NULL; + m_lengths = nullptr; + m_userLengths = nullptr; m_width = 0; m_count = 0; - m_patternColorComponents = NULL; + m_patternColorComponents = nullptr; m_isPattern = false; } @@ -959,7 +959,7 @@ wxMacCoreGraphicsColour::~wxMacCoreGraphicsColour() void wxMacCoreGraphicsColour::Init() { m_isPattern = false; - m_patternColorComponents = NULL; + m_patternColorComponents = nullptr; } void wxMacCoreGraphicsColour::Apply( CGContextRef cgContext ) @@ -1010,7 +1010,7 @@ wxMacCoreGraphicsColour::wxMacCoreGraphicsColour( const wxBrush &brush ) m_isPattern = true; m_patternColorComponents = new CGFloat[1] ; m_patternColorComponents[0] = (CGFloat) 1.0; - m_colorSpace.reset( CGColorSpaceCreatePattern( NULL ) ); + m_colorSpace.reset( CGColorSpaceCreatePattern( nullptr ) ); m_pattern.reset( (CGPatternRef) *( new ImagePattern( bmp , CGAffineTransformMakeScale( 1,-1 ) ) ) ); } } @@ -1149,7 +1149,7 @@ wxMacCoreGraphicsBitmapData::~wxMacCoreGraphicsBitmapData() class WXDLLEXPORT wxMacCoreGraphicsPathData : public wxGraphicsPathData { public : - wxMacCoreGraphicsPathData( wxGraphicsRenderer* renderer, CGMutablePathRef path = NULL); + wxMacCoreGraphicsPathData( wxGraphicsRenderer* renderer, CGMutablePathRef path = nullptr); ~wxMacCoreGraphicsPathData(); @@ -1237,7 +1237,7 @@ wxGraphicsObjectRefData* wxMacCoreGraphicsPathData::Clone() const // opens (starts) a new subpath void wxMacCoreGraphicsPathData::MoveToPoint( wxDouble x1 , wxDouble y1 ) { - CGPathMoveToPoint( m_path , NULL , (CGFloat) x1 , (CGFloat) y1 ); + CGPathMoveToPoint( m_path , nullptr , (CGFloat) x1 , (CGFloat) y1 ); } void wxMacCoreGraphicsPathData::AddLineToPoint( wxDouble x1 , wxDouble y1 ) @@ -1250,7 +1250,7 @@ void wxMacCoreGraphicsPathData::AddLineToPoint( wxDouble x1 , wxDouble y1 ) } else { - CGPathAddLineToPoint( m_path , NULL , (CGFloat) x1 , (CGFloat) y1 ); + CGPathAddLineToPoint( m_path , nullptr , (CGFloat) x1 , (CGFloat) y1 ); } } @@ -1262,7 +1262,7 @@ void wxMacCoreGraphicsPathData::AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxD { MoveToPoint(cx1, cy1); } - CGPathAddCurveToPoint( m_path , NULL , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) cx2, (CGFloat) cy2, (CGFloat) x , (CGFloat) y ); + CGPathAddCurveToPoint( m_path , nullptr , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) cx2, (CGFloat) cy2, (CGFloat) x , (CGFloat) y ); } void wxMacCoreGraphicsPathData::AddQuadCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble x, wxDouble y ) @@ -1273,30 +1273,30 @@ void wxMacCoreGraphicsPathData::AddQuadCurveToPoint( wxDouble cx1, wxDouble cy1, { MoveToPoint(cx1, cy1); } - CGPathAddQuadCurveToPoint( m_path , NULL , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) x , (CGFloat) y ); + CGPathAddQuadCurveToPoint( m_path , nullptr , (CGFloat) cx1 , (CGFloat) cy1 , (CGFloat) x , (CGFloat) y ); } void wxMacCoreGraphicsPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) { CGRect cgRect = { { (CGFloat) x , (CGFloat) y } , { (CGFloat) w , (CGFloat) h } }; - CGPathAddRect( m_path , NULL , cgRect ); + CGPathAddRect( m_path , nullptr , cgRect ); } void wxMacCoreGraphicsPathData::AddCircle( wxDouble x, wxDouble y , wxDouble r ) { - CGPathAddEllipseInRect( m_path, NULL, CGRectMake(x-r,y-r,2*r,2*r)); + CGPathAddEllipseInRect( m_path, nullptr, CGRectMake(x-r,y-r,2*r,2*r)); } void wxMacCoreGraphicsPathData::AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) { - CGPathAddEllipseInRect( m_path, NULL, CGRectMake(x,y,w,h)); + CGPathAddEllipseInRect( m_path, nullptr, CGRectMake(x,y,w,h)); } // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle void wxMacCoreGraphicsPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) { // inverse direction as we the 'normal' state is a y axis pointing down, ie mirrored to the standard core graphics setup - CGPathAddArc( m_path, NULL , (CGFloat) x, (CGFloat) y, (CGFloat) r, (CGFloat) startAngle, (CGFloat) endAngle, !clockwise); + CGPathAddArc( m_path, nullptr , (CGFloat) x, (CGFloat) y, (CGFloat) r, (CGFloat) startAngle, (CGFloat) endAngle, !clockwise); } void wxMacCoreGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) @@ -1307,12 +1307,12 @@ void wxMacCoreGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDoub { MoveToPoint(0, 0); } - CGPathAddArcToPoint( m_path, NULL , (CGFloat) x1, (CGFloat) y1, (CGFloat) x2, (CGFloat) y2, (CGFloat) r); + CGPathAddArcToPoint( m_path, nullptr , (CGFloat) x1, (CGFloat) y1, (CGFloat) x2, (CGFloat) y2, (CGFloat) r); } void wxMacCoreGraphicsPathData::AddPath( const wxGraphicsPathData* path ) { - CGPathAddPath( m_path , NULL, (CGPathRef) path->GetNativePath() ); + CGPathAddPath( m_path , nullptr, (CGPathRef) path->GetNativePath() ); } // closes the current subpath @@ -1366,7 +1366,7 @@ void wxMacCoreGraphicsPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wx bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle) const { - return CGPathContainsPoint( m_path, NULL, CGPointMake((CGFloat) x,(CGFloat) y), fillStyle == wxODDEVEN_RULE ); + return CGPathContainsPoint( m_path, nullptr, CGPointMake((CGFloat) x,(CGFloat) y), fillStyle == wxODDEVEN_RULE ); } @@ -1380,7 +1380,7 @@ public: CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0, - wxWindow* window = NULL ); + wxWindow* window = nullptr ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ); @@ -1591,12 +1591,12 @@ public : void wxMacCoreGraphicsContext::Init() { - m_cgContext = NULL; + m_cgContext = nullptr; m_contextSynthesized = false; m_width = 0; m_height = 0; #if wxOSX_USE_COCOA_OR_IPHONE - m_view = NULL; + m_view = nullptr; #endif m_invisible = false; m_antialias = wxANTIALIAS_DEFAULT; @@ -1672,7 +1672,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer const wxSize sz = win->GetSize(); - // having a cgctx being NULL is fine (will be created on demand) + // having a cgctx being null is fine (will be created on demand) // this is the case for all wxWindowDCs except wxPaintDC m_width = sz.x; @@ -1683,7 +1683,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer } wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ) - : wxGraphicsContext(renderer, NULL ) + : wxGraphicsContext(renderer, nullptr ) { Init(); @@ -1705,7 +1705,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer #if wxUSE_PRINTING_ARCHITECTURE wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ) - : wxGraphicsContext(renderer, NULL) + : wxGraphicsContext(renderer, nullptr) { Init(); @@ -1726,7 +1726,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer #endif wxMacCoreGraphicsContext::~wxMacCoreGraphicsContext() { - SetNativeContext(NULL); + SetNativeContext(nullptr); } @@ -1795,7 +1795,7 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() if ( wxOSXLockFocus(m_view) ) { m_cgContext = wxOSXGetContextFromCurrentContext(); - wxASSERT_MSG( m_cgContext != NULL, wxT("Unable to retrieve drawing context from View")); + wxASSERT_MSG( m_cgContext != nullptr, wxT("Unable to retrieve drawing context from View")); } else { @@ -1804,7 +1804,7 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() #endif #if wxOSX_USE_IPHONE m_cgContext = wxOSXGetContextFromCurrentContext(); - if ( m_cgContext == NULL ) + if ( m_cgContext == nullptr ) { m_invisible = true; } @@ -1856,7 +1856,7 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() } CheckInvariants(); - return m_cgContext != NULL; + return m_cgContext != nullptr; } bool wxMacCoreGraphicsContext::SetAntialiasMode(wxAntialiasMode antialias) @@ -2072,7 +2072,7 @@ void wxMacCoreGraphicsContext::BeginLayer(wxDouble opacity) CheckInvariants(); CGContextSaveGState(m_cgContext); CGContextSetAlpha(m_cgContext, (CGFloat) opacity); - CGContextBeginTransparencyLayer(m_cgContext, 0); + CGContextBeginTransparencyLayer(m_cgContext, nullptr); CheckInvariants(); } @@ -2115,7 +2115,7 @@ void wxMacCoreGraphicsContext::Clip( const wxRegion ®ion ) } #else // allow usage as measuring context - // wxASSERT_MSG( m_cgContext != NULL, "Needs a valid context for clipping" ); + // wxASSERT_MSG( m_cgContext != nullptr, "Needs a valid context for clipping" ); #endif CheckInvariants(); } @@ -2254,7 +2254,7 @@ void wxMacCoreGraphicsContext::StrokePath( const wxGraphicsPath &path ) CGContextReplacePathWithStrokedPath(m_cgContext); CGContextClip( m_cgContext ); // Apply the gradient's transform, if there is one. - if ( penData->GetMatrix() != NULL ) + if ( penData->GetMatrix() != nullptr ) { wxMacCoreGraphicsMatrixData* m = penData->GetMatrix(); CGContextConcatCTM( m_cgContext, *(CGAffineTransform*) m->GetNativeMatrix()); @@ -2346,7 +2346,7 @@ void wxMacCoreGraphicsContext::FillPath( const wxGraphicsPath &path , wxPolygonF CGContextAddPath( m_cgContext , (CGPathRef) path.GetNativePath() ); CGContextClip( m_cgContext ); // Apply the gradient's transform, if there is one. - if ( brushData->GetMatrix() != NULL ) + if ( brushData->GetMatrix() != nullptr ) { wxMacCoreGraphicsMatrixData* m = brushData->GetMatrix(); CGContextConcatCTM( m_cgContext, *(CGAffineTransform*) m->GetNativeMatrix()); @@ -2370,7 +2370,7 @@ void wxMacCoreGraphicsContext::FillPath( const wxGraphicsPath &path , wxPolygonF void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg ) { // we allow either setting or clearing but not replacing - wxASSERT( m_cgContext == NULL || cg == NULL ); + wxASSERT( m_cgContext == nullptr || cg == nullptr ); if ( m_cgContext ) { @@ -2391,7 +2391,7 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg ) // FIXME: This check is needed because currently we need to use a DC/GraphicsContext // in order to get font properties, like wxFont::GetPixelSize, but since we don't have - // a native window attached to use, I create a wxGraphicsContext with a NULL CGContextRef + // a native window attached to use, I create a wxGraphicsContext with a null CGContextRef // for this one operation. // When wxFont::GetPixelSize on Mac no longer needs a graphics context, this check @@ -2548,7 +2548,7 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo // if we emulate boldness the stroke color is not taken from the current context // therefore we have to set it explicitly - if ( fontattr.GetValue(kCTStrokeWidthAttributeName) != NULL) + if ( fontattr.GetValue(kCTStrokeWidthAttributeName) != nullptr) { setColorsInLine = true; inlinefontattr = fontattr.CreateMutableCopy(); @@ -2574,7 +2574,7 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo if ( fref->GetUnderlined() ) { //AKT: draw horizontal line 1 pixel thick and with 1 pixel gap under baseline - CGFloat width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); + CGFloat width = CTLineGetTypographicBounds(line, nullptr, nullptr, nullptr); CGPoint points[] = { {0.0, -2.0}, {width, -2.0} }; @@ -2585,7 +2585,7 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo } if ( fref->GetStrikethrough() ) { - CGFloat width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); + CGFloat width = CTLineGetTypographicBounds(line, nullptr, nullptr, nullptr); CGFloat height = CTFontGetXHeight( font ) * 0.6; CGPoint points[] = { {0.0, height}, {width, height} }; CGContextSetStrokeColorWithColor(m_cgContext, col); @@ -2689,7 +2689,7 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr { ++u16index; } - widths.push_back( CTLineGetOffsetForStringIndex( line, u16index, NULL ) ); + widths.push_back( CTLineGetOffsetForStringIndex( line, u16index, nullptr ) ); } CheckInvariants(); @@ -2955,7 +2955,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC& #ifdef __WXMAC__ return new wxMacCoreGraphicsContext(this, dc); #endif - return NULL; + return nullptr; } #if wxUSE_PRINTING_ARCHITECTURE @@ -2964,7 +2964,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC& #ifdef __WXMAC__ return new wxMacCoreGraphicsContext(this, dc); #endif - return NULL; + return nullptr; } #endif @@ -2976,7 +2976,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window ) { wxUnusedVar(window); - return NULL; + return nullptr; } wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window ) @@ -3081,7 +3081,7 @@ wxImage wxMacCoreGraphicsRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& wxGraphicsBitmap wxMacCoreGraphicsRenderer::CreateBitmapFromNativeBitmap( void* bitmap ) { - if ( bitmap != NULL ) + if ( bitmap != nullptr ) { wxGraphicsBitmap p; p.SetRefData(new wxMacCoreGraphicsBitmapData( this , (CGImageRef) bitmap, false )); @@ -3216,16 +3216,16 @@ void wxMacReleaseCFDataConsumerCallback( void *info ) CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ) { - if ( data == NULL ) - return NULL; + if ( data == nullptr ) + return nullptr; return CGDataProviderCreateWithCFData( data ); } CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ) { - if ( data == NULL ) - return NULL; + if ( data == nullptr ) + return nullptr; return CGDataConsumerCreateWithCFData( data ); } @@ -3248,7 +3248,7 @@ CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffe if ( b->GetDataLen() == 0 ) { delete b; - return NULL; + return nullptr; } return CGDataProviderCreateWithData( b , (const void *) b->GetData() , b->GetDataLen() , diff --git a/src/osx/carbon/mdi.cpp b/src/osx/carbon/mdi.cpp index a53d474ab0..3a07b64aaa 100644 --- a/src/osx/carbon/mdi.cpp +++ b/src/osx/carbon/mdi.cpp @@ -74,7 +74,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent, // "Window" menu if ( style & wxFRAME_NO_WINDOW_MENU ) { - m_windowMenu = NULL; + m_windowMenu = nullptr; style -= wxFRAME_NO_WINDOW_MENU ; } else // normal case: we have the window menu, so construct it @@ -106,7 +106,7 @@ wxMDIParentFrame::~wxMDIParentFrame() DestroyChildren(); // already deleted by DestroyChildren() - m_clientWindow = NULL ; + m_clientWindow = nullptr ; } void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) @@ -147,7 +147,7 @@ void wxMDIParentFrame::RemoveChild(wxWindowBase *child) if ( child == m_currentChild ) { // the current child isn't active any more, try to find another one - m_currentChild = NULL; + m_currentChild = nullptr; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; @@ -194,15 +194,15 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating) wxLogTrace(TRACE_MDI, wxT("finished highliting child")); - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; } else if (s_macDeactivateWindow == this) { wxLogTrace(TRACE_MDI, wxT("Avoided deactivation/activation of this=%p"), this); - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; } - else // window to deactivate is NULL or is not us or one of our kids + else // window to deactivate is null or is not us or one of our kids { // activate kid instead if (m_currentChild) @@ -216,7 +216,7 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating) // We were scheduled for deactivation, and now we do it. if (s_macDeactivateWindow == this) { - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; if (m_currentChild) m_currentChild->MacActivate(timestamp, activating); wxFrame::MacActivate(timestamp, activating); @@ -348,7 +348,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) wxLogTrace(TRACE_MDI, wxT("finished highliting parent")); - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; } else if ((mdiparent->m_currentChild == this) || !s_macDeactivateWindow) mdiparent->wxFrame::MacActivate(timestamp, activating); @@ -361,7 +361,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) { wxLogTrace(TRACE_MDI, wxT("Avoided deactivation/activation of this=%p"), this); - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; } else wxFrame::MacActivate(timestamp, activating); @@ -371,7 +371,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) // We were scheduled for deactivation, and now we do it. if (s_macDeactivateWindow == this) { - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; wxFrame::MacActivate(timestamp, activating); if (mdiparent->m_currentChild == this) mdiparent->wxFrame::MacActivate(timestamp, activating); diff --git a/src/osx/carbon/metafile.cpp b/src/osx/carbon/metafile.cpp index e40c7e2a3c..94af4facb8 100644 --- a/src/osx/carbon/metafile.cpp +++ b/src/osx/carbon/metafile.cpp @@ -53,7 +53,7 @@ public: virtual ~wxMetafileRefData(); - virtual bool IsOk() const override { return m_data != NULL; } + virtual bool IsOk() const override { return m_data != nullptr; } void Init(); @@ -113,11 +113,11 @@ wxMetafileRefData::wxMetafileRefData( int width, int height) CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0); m_data.reset(data); CGDataConsumerRef dataConsumer = wxMacCGDataConsumerCreateWithCFData(data); - m_context = CGPDFContextCreate( dataConsumer, (width != 0 && height != 0) ? &r : NULL , NULL ); + m_context = CGPDFContextCreate( dataConsumer, (width != 0 && height != 0) ? &r : nullptr , nullptr ); CGDataConsumerRelease( dataConsumer ); if ( m_context ) { - CGPDFContextBeginPage(m_context, NULL); + CGPDFContextBeginPage(m_context, nullptr); CGColorSpaceRef genericColorSpace = wxMacGetGenericRGBColorSpace(); @@ -135,7 +135,7 @@ wxMetafileRefData::~wxMetafileRefData() void wxMetafileRefData::Init() { - m_context = NULL; + m_context = nullptr; m_width = -1; m_height = -1; } @@ -145,7 +145,7 @@ void wxMetafileRefData::Close() CGPDFContextEndPage(m_context); CGContextRelease(m_context); - m_context = NULL; + m_context = nullptr; UpdateDocumentFromData(); } @@ -154,7 +154,7 @@ void wxMetafileRefData::UpdateDocumentFromData() { wxCFRef provider(wxMacCGDataProviderCreateWithCFData(m_data)); m_pdfDoc.reset(CGPDFDocumentCreateWithProvider(provider)); - if ( m_pdfDoc != NULL ) + if ( m_pdfDoc != nullptr ) { CGPDFPageRef page = CGPDFDocumentGetPage( m_pdfDoc, 1 ); CGRect rect = CGPDFPageGetBoxRect ( page, kCGPDFMediaBox); @@ -196,7 +196,7 @@ bool wxMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) bool success = true; #if wxUSE_DRAG_AND_DROP - if (m_refData == NULL) + if (m_refData == nullptr) return false; bool alreadyOpen = wxTheClipboard->IsOpened(); @@ -282,7 +282,7 @@ wxMetafileDCImpl::wxMetafileDCImpl( m_metaFile->SetRefData( metafiledata ); SetGraphicsContext( wxGraphicsContext::CreateFromNative(metafiledata->GetContext())); - m_ok = (m_graphicContext != NULL) ; + m_ok = (m_graphicContext != nullptr) ; SetMapMode( wxMM_TEXT ); } diff --git a/src/osx/carbon/region.cpp b/src/osx/carbon/region.cpp index 722fe9a3b2..e947111039 100644 --- a/src/osx/carbon/region.cpp +++ b/src/osx/carbon/region.cpp @@ -481,14 +481,14 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, if (!tmpSLLBlock) return FALSE; (*SLLBlock)->next = tmpSLLBlock; - tmpSLLBlock->next = (ScanLineListBlock *)NULL; + tmpSLLBlock->next = (ScanLineListBlock *)nullptr; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; - pSLL->edgelist = (EdgeTableEntry *)NULL; + pSLL->edgelist = (EdgeTableEntry *)nullptr; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; @@ -496,7 +496,7 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, /* * now insert the edge in the right bucket */ - prev = (EdgeTableEntry *)NULL; + prev = (EdgeTableEntry *)nullptr; start = pSLL->edgelist; while (start && (start->bres.minor < ETE->bres.minor)) { @@ -552,18 +552,18 @@ miCreateETandAET(int count, const wxPoint * pts, EdgeTable *ET, EdgeTableEntry * /* * initialize the Active Edge Table */ - AET->next = (EdgeTableEntry *)NULL; - AET->back = (EdgeTableEntry *)NULL; - AET->nextWETE = (EdgeTableEntry *)NULL; + AET->next = (EdgeTableEntry *)nullptr; + AET->back = (EdgeTableEntry *)nullptr; + AET->nextWETE = (EdgeTableEntry *)nullptr; AET->bres.minor = INT_MIN; /* * initialize the Edge Table. */ - ET->scanlines.next = (ScanLineList *)NULL; + ET->scanlines.next = (ScanLineList *)nullptr; ET->ymax = INT_MIN; ET->ymin = INT_MAX; - pSLLBlock->next = (ScanLineListBlock *)NULL; + pSLLBlock->next = (ScanLineListBlock *)nullptr; PrevPt = &pts[count-1]; @@ -682,7 +682,7 @@ micomputeWAET(EdgeTableEntry *AET) int inside = 1; int isInside = 0; - AET->nextWETE = (EdgeTableEntry *)NULL; + AET->nextWETE = (EdgeTableEntry *)nullptr; pWETE = AET; AET = AET->next; while (AET) @@ -701,7 +701,7 @@ micomputeWAET(EdgeTableEntry *AET) } AET = AET->next; } - pWETE->nextWETE = (EdgeTableEntry *)NULL; + pWETE->nextWETE = (EdgeTableEntry *)nullptr; } /* @@ -1175,7 +1175,7 @@ bool wxRegion::IsEmpty() const WXHRGN wxRegion::GetWXHRGN() const { if ( !m_refData ) - return NULL; + return nullptr; return M_REGION ; } @@ -1227,7 +1227,7 @@ wxRegionContain wxRegion::DoContainsRect(const wxRect& r) const * Initialize empty iterator */ wxRegionIterator::wxRegionIterator() - : m_current(0), m_numRects(0), m_rects(NULL) + : m_current(0), m_numRects(0), m_rects(nullptr) { } @@ -1240,7 +1240,7 @@ wxRegionIterator::wxRegionIterator(const wxRegionIterator& iterator) : wxObject() , m_current(iterator.m_current) , m_numRects(0) - , m_rects(NULL) + , m_rects(nullptr) { SetRects(iterator.m_numRects, iterator.m_rects); } @@ -1277,7 +1277,7 @@ void wxRegionIterator::SetRects(long numRects, wxRect *rects) */ wxRegionIterator::wxRegionIterator(const wxRegion& region) { - m_rects = NULL; + m_rects = nullptr; Reset(region); } diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp index d5e0c1169f..3dc1199215 100644 --- a/src/osx/carbon/renderer.cpp +++ b/src/osx/carbon/renderer.cpp @@ -62,7 +62,7 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL ) override; + wxHeaderButtonParams* params = nullptr ) override; virtual int GetHeaderButtonHeight(wxWindow *win) override; @@ -811,7 +811,7 @@ void wxRendererMac::DrawGauge(wxWindow* WXUNUSED(win), cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext(); - HIThemeDrawTrack(&tdi, NULL, cgContext, kHIThemeOrientationNormal); + HIThemeDrawTrack(&tdi, nullptr, cgContext, kHIThemeOrientationNormal); } #endif diff --git a/src/osx/carbon/sound.cpp b/src/osx/carbon/sound.cpp index 7fadb12eaa..7a9a366395 100644 --- a/src/osx/carbon/sound.cpp +++ b/src/osx/carbon/sound.cpp @@ -76,7 +76,7 @@ protected: }; wxOSXSoundManagerSoundData::wxOSXSoundManagerSoundData(const wxString& fileName) : - m_pSndChannel(NULL) + m_pSndChannel(nullptr) { Str255 lpSnd ; @@ -96,7 +96,7 @@ void wxOSXSoundManagerSoundData::DoStop() if ( m_pSndChannel ) { SndDisposeChannel(m_pSndChannel, TRUE /* stop immediately, not after playing */); - m_pSndChannel = NULL; + m_pSndChannel = nullptr; wxSound::SoundStopped(this); } @@ -117,7 +117,7 @@ bool wxOSXSoundManagerSoundData::Play(unsigned flags) SndNewChannel(&m_pSndChannel, sampledSynth, initNoInterp - + (data.numChannels == 1 ? initMono : initStereo), NULL); + + (data.numChannels == 1 ? initMono : initStereo), nullptr); if(SndPlay(m_pSndChannel, (SndListHandle) m_hSnd, flags & wxSOUND_ASYNC ? 1 : 0) != noErr) return false; @@ -202,13 +202,13 @@ protected: wxOSXQuickTimeSoundData::wxOSXQuickTimeSoundData(const wxString& fileName) : - m_movie(NULL), m_soundHandle(NULL) + m_movie(nullptr), m_soundHandle(nullptr) { m_sndname = fileName; } wxOSXQuickTimeSoundData::wxOSXQuickTimeSoundData(size_t size, const void* data) : - m_movie(NULL) + m_movie(nullptr) { m_soundHandle = NewHandleClear((Size)size); BlockMove(data, *m_soundHandle, size); @@ -277,7 +277,7 @@ bool wxOSXQuickTimeSoundData::Play(unsigned flags) { OSErr err = noErr ; - Handle dataRef = NULL; + Handle dataRef = nullptr; OSType dataRefType; err = QTNewDataReferenceFromFullPathCFString(wxCFStringRef(m_sndname,wxLocale::GetSystemEncoding()), @@ -285,9 +285,9 @@ bool wxOSXQuickTimeSoundData::Play(unsigned flags) wxASSERT(err == noErr); - if (NULL != dataRef || err != noErr) + if (nullptr != dataRef || err != noErr) { - err = NewMovieFromDataRef( &m_movie, newMovieDontAskUnresolvedDataRefs , NULL, dataRef, dataRefType ); + err = NewMovieFromDataRef( &m_movie, newMovieDontAskUnresolvedDataRefs , nullptr, dataRef, dataRefType ); wxASSERT(err == noErr); DisposeHandle(dataRef); } @@ -330,7 +330,7 @@ void wxOSXQuickTimeSoundData::DoStop() { StopMovie(m_movie); DisposeMovie(m_movie); - m_movie = NULL; + m_movie = nullptr; wxSound::SoundStopped(this); wxExitQT(); } diff --git a/src/osx/carbon/statbrma.cpp b/src/osx/carbon/statbrma.cpp index 91e78d80bc..4b9ddc8807 100644 --- a/src/osx/carbon/statbrma.cpp +++ b/src/osx/carbon/statbrma.cpp @@ -42,7 +42,7 @@ wxStatusBarMac::wxStatusBarMac(wxWindow *parent, : wxStatusBarGeneric() { - SetParent( NULL ); + SetParent( nullptr ); Create( parent, id, style, name ); } @@ -50,7 +50,7 @@ wxStatusBarMac::wxStatusBarMac() : wxStatusBarGeneric() { - SetParent( NULL ); + SetParent( nullptr ); } wxStatusBarMac::~wxStatusBarMac() @@ -103,13 +103,13 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) // Notice that wxOSXGetKeyWindow (aka [NSApp keyWindow] used below is // subtly different from IsActive() (aka [NSWindow iskeyWindow]): the - // former remains non-NULL if another application shows a temporary + // former remains non-null if another application shows a temporary // floating window or a status icon's menu is used. That's what we want: in // that case, statusbar appearance shouldn't change. It also shouldn't // change if a window-modal sheet attached to this window is key. wxTopLevelWindow *tlw = wxDynamicCast(MacGetTopLevelWindow(), wxTopLevelWindow); wxNonOwnedWindow* directKeyWindow = wxNonOwnedWindow::GetFromWXWindow(wxOSXGetKeyWindow()); - wxWindow *keyWindow = directKeyWindow ? directKeyWindow->MacGetTopLevelWindow() : NULL; + wxWindow *keyWindow = directKeyWindow ? directKeyWindow->MacGetTopLevelWindow() : nullptr; while ( keyWindow && keyWindow != tlw ) { wxDialog *dlg = wxDynamicCast(keyWindow, wxDialog); diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index 4dbf4848e8..b28b49af08 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -101,7 +101,7 @@ void* wxMacCocoaRetain( void* obj ) NSFont* wxFont::OSXGetNSFont() const { - wxCHECK_MSG( m_refData != NULL , 0, wxT("invalid font") ); + wxCHECK_MSG( m_refData != nullptr , nullptr, wxT("invalid font") ); // cast away constness otherwise lazy font resolution is not possible const_cast(this)->RealizeResource(); @@ -117,7 +117,7 @@ NSFont* wxFont::OSXGetNSFont() const // As a workaround for this bug, don't use toll-free bridging, but // re-create NSFont from the descriptor instead on buggy OS X versions. int osMajor, osMinor; - wxGetOsVersion(&osMajor, &osMinor, NULL); + wxGetOsVersion(&osMajor, &osMinor, nullptr); if (osMajor == 10 && osMinor == 11) { return [NSFont fontWithDescriptor:[font fontDescriptor] size:[font pointSize]]; @@ -133,7 +133,7 @@ NSFont* wxFont::OSXGetNSFont() const UIFont* wxFont::OSXGetUIFont() const { - wxCHECK_MSG( m_refData != NULL , 0, wxT("invalid font") ); + wxCHECK_MSG( m_refData != nullptr , 0, wxT("invalid font") ); // cast away constness otherwise lazy font resolution is not possible const_cast(this)->RealizeResource(); @@ -259,14 +259,14 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage { // based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html - CGContextRef hbitmap = NULL; + CGContextRef hbitmap = nullptr; if (nsimage != nil) { double scale = wxOSXGetMainScreenContentScaleFactor(); CGSize imageSize = wxOSXGetImageSize(nsimage); - hbitmap = CGBitmapContextCreate(NULL, imageSize.width*scale, imageSize.height*scale, 8, 0, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); + hbitmap = CGBitmapContextCreate(nullptr, imageSize.width*scale, imageSize.height*scale, 8, 0, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); CGContextScaleCTM( hbitmap, scale, scale ); CGContextClearRect(hbitmap,CGRectMake(0, 0, imageSize.width, imageSize.height)); @@ -328,7 +328,7 @@ WXImage wxOSXGetIconForType(OSType type ) #if wxOSX_USE_COCOA return [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode(type)]; #else - return NULL; + return nullptr; #endif } @@ -366,7 +366,7 @@ CGSize wxOSXGetImageSize(WXImage image) CGImageRef wxOSXCreateCGImageFromImage( WXImage nsimage, double *scaleptr ) { - CGImageRef image = NULL; + CGImageRef image = nullptr; if (nsimage != nil) { #if wxOSX_USE_COCOA @@ -400,7 +400,7 @@ static NSCursor* wxCreateStockCursor( short sIndex ) //NSCursor takes an NSImage takes a number of Representations - here //we need only one for the raw data wxNSObjRef theRep( [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes: NULL // Tell Cocoa to allocate the planes for us. + initWithBitmapDataPlanes: nullptr // Tell Cocoa to allocate the planes for us. pixelsWide: 16 // All classic cursors are 16x16 pixelsHigh: 16 bitsPerSample: 1 // All classic cursors are bitmaps with bitmasks @@ -414,11 +414,11 @@ static NSCursor* wxCreateStockCursor( short sIndex ) // Ensure that Cocoa allocated 2 and only 2 of the 5 possible planes unsigned char *planes[5]; [theRep getBitmapDataPlanes:planes]; - wxCHECK(planes[0] != NULL, nil); - wxCHECK(planes[1] != NULL, nil); - wxCHECK(planes[2] == NULL, nil); - wxCHECK(planes[3] == NULL, nil); - wxCHECK(planes[4] == NULL, nil); + wxCHECK(planes[0] != nullptr, nil); + wxCHECK(planes[1] != nullptr, nil); + wxCHECK(planes[2] == nullptr, nil); + wxCHECK(planes[3] == nullptr, nil); + wxCHECK(planes[4] == nullptr, nil); // NOTE1: The Cursor's bits field is white=0 black=1.. thus the bitwise-not // Why not use NSCalibratedBlackColorSpace? Because that reverses the diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp index 6df17b34e5..5151d7ebdf 100644 --- a/src/osx/choice_osx.cpp +++ b/src/osx/choice_osx.cpp @@ -41,7 +41,7 @@ bool wxChoice::Create(wxWindow *parent, const wxValidator& validator, const wxString& name ) { - if ( !Create( parent, id, pos, size, 0, NULL, style, validator, name ) ) + if ( !Create( parent, id, pos, size, 0, nullptr, style, validator, name ) ) return false; Append( choices ); @@ -69,7 +69,7 @@ bool wxChoice::Create(wxWindow *parent, if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) ) return false; - SetPeer(wxWidgetImpl::CreateChoice( this, parent, id, NULL, pos, size, style, GetExtraStyle() )); + SetPeer(wxWidgetImpl::CreateChoice( this, parent, id, nullptr, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -130,7 +130,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, if (text.empty()) text = " "; // menu items can't have empty labels dynamic_cast(GetPeer())->InsertItem( idx, i+1, text ); - m_datas.Insert( NULL, idx ); + m_datas.Insert( nullptr, idx ); AssignNewItemClientData(idx, clientData, i, type); } diff --git a/src/osx/cocoa/aboutdlg.mm b/src/osx/cocoa/aboutdlg.mm index 23061c98fc..9c679cba48 100644 --- a/src/osx/cocoa/aboutdlg.mm +++ b/src/osx/cocoa/aboutdlg.mm @@ -56,7 +56,7 @@ public: void SetAttributedString( CFStringRef key, const wxString& value ) { wxCFRef attrString( - CFAttributedStringCreate(kCFAllocatorDefault, wxCFStringRef(value), NULL) ); + CFAttributedStringCreate(kCFAllocatorDefault, wxCFStringRef(value), nullptr) ); CFDictionarySetValue(*this, key, attrString); } }; diff --git a/src/osx/cocoa/activityindicator.mm b/src/osx/cocoa/activityindicator.mm index ac79ffae84..83694140eb 100644 --- a/src/osx/cocoa/activityindicator.mm +++ b/src/osx/cocoa/activityindicator.mm @@ -37,7 +37,7 @@ inline NSProgressIndicator *GetProgressIndicator(wxWidgetImpl* peer) { return peer ? static_cast(peer->GetWXWidget()) - : NULL; + : nullptr; } } // anonymous namespace diff --git a/src/osx/cocoa/colour.mm b/src/osx/cocoa/colour.mm index 54707c36cb..973620a49e 100644 --- a/src/osx/cocoa/colour.mm +++ b/src/osx/cocoa/colour.mm @@ -90,7 +90,7 @@ CGFloat wxNSColorRefData::GetCGColorComponent(CGColorRef col, int rgbaIndex) { if ( WX_IS_MACOS_OR_IOS_AVAILABLE(10, 11, 9, 0) ) { - rgbacol = CGColorCreateCopyByMatchingToColorSpace(wxMacGetGenericRGBColorSpace(), kCGRenderingIntentDefault, col, NULL); + rgbacol = CGColorCreateCopyByMatchingToColorSpace(wxMacGetGenericRGBColorSpace(), kCGRenderingIntentDefault, col, nullptr); noComp = CGColorGetNumberOfComponents(rgbacol); components = CGColorGetComponents(rgbacol); } @@ -173,7 +173,7 @@ WX_NSImage wxNSColorRefData::GetNSPatternImage() const } } - return NULL; + return nullptr; } WX_NSColor wxColourRefData::GetNSColor() const @@ -184,7 +184,7 @@ WX_NSColor wxColourRefData::GetNSColor() const WX_NSImage wxColourRefData::GetNSPatternImage() const { - return NULL; + return nullptr; } wxColour::wxColour(WX_NSColor col) diff --git a/src/osx/cocoa/combobox.mm b/src/osx/cocoa/combobox.mm index 74eada5ee7..2d2e30762a 100644 --- a/src/osx/cocoa/combobox.mm +++ b/src/osx/cocoa/combobox.mm @@ -198,7 +198,7 @@ void wxNSComboBoxControl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) bool reset = false; wxEventLoop* const loop = (wxEventLoop*) wxEventLoopBase::GetActive(); - if ( loop != NULL && [event type] == NSLeftMouseDown ) + if ( loop != nullptr && [event type] == NSLeftMouseDown ) { reset = true; loop->OSXUseLowLevelWakeup(true); diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 7120242397..791839f032 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -62,7 +62,7 @@ static const int MINIMUM_NATIVE_ROW_HEIGHT = 17; { self = [super init]; if (self != nil) - self->pointer = NULL; + self->pointer = nullptr; return self; } @@ -137,7 +137,7 @@ inline wxDataViewItem wxDataViewItemFromMaybeNilItem(id item) self = [super init]; if (self != nil) { - customRenderer = NULL; + customRenderer = nullptr; } return self; } @@ -194,7 +194,7 @@ inline wxDataViewItem wxDataViewItemFromMaybeNilItem(id item) NSPoint locInView = [self convertPoint:locInWindow fromView:nil]; NSInteger colIdx = [self columnAtPoint:locInView]; wxDataViewColumn* const - column = colIdx == -1 ? NULL : dvc->GetColumn(colIdx); + column = colIdx == -1 ? nullptr : dvc->GetColumn(colIdx); wxDataViewEvent event(wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, dvc, column); if ( !dvc->HandleWindowEvent(event) ) @@ -398,7 +398,7 @@ NSTableColumn* CreateNativeColumn(const wxDataViewColumn *column) { wxDataViewRenderer * const renderer = column->GetRenderer(); - wxCHECK_MSG( renderer, NULL, "column should have a renderer" ); + wxCHECK_MSG( renderer, nullptr, "column should have a renderer" ); wxDVCNSTableColumn * const nativeColumn( [[wxDVCNSTableColumn alloc] initWithColumnPointer: column] @@ -480,8 +480,8 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, self = [super init]; if (self != nil) { - columnPtr = NULL; - modelPtr = NULL; + columnPtr = nullptr; + modelPtr = nullptr; } return self; } @@ -550,8 +550,8 @@ initWithModelPtr:(wxDataViewModel*)initModelPtr self = [super init]; if (self != nil) { - implementation = NULL; - model = NULL; + implementation = nullptr; + model = nullptr; currentParentItem = nil; @@ -608,7 +608,7 @@ outlineView:(NSOutlineView*)outlineView wxDataViewItemArray dataViewChildren; - wxCHECK_MSG( model, 0, "Valid model in data source does not exist." ); + wxCHECK_MSG( model, nullptr, "Valid model in data source does not exist." ); model->GetChildren(wxDataViewItemFromMaybeNilItem(item), dataViewChildren); [self bufferItem:item withChildren:&dataViewChildren]; if ([sortDescriptors count] > 0) @@ -742,7 +742,7 @@ outlineView:(NSOutlineView*)outlineView // the program can do special actions before the sorting actually starts: wxDataViewColumn* const col = noOfDescriptors > 0 ? [[wxSortDescriptors objectAtIndex:0] columnPtr] - : NULL; + : nullptr; wxDataViewEvent event(wxEVT_DATAVIEW_COLUMN_SORTED, dvc, col); dvc->GetEventHandler()->ProcessEvent(event); @@ -1989,7 +1989,7 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer, [[NSScrollView alloc] initWithFrame:wxOSXGetFrameForControl(peer,pos,size)], wxWidgetImpl::Widget_UserKeyEvents ), - m_DataSource(NULL), + m_DataSource(nullptr), m_OutlineView([[wxCocoaOutlineView alloc] init]), m_expanderWidth(-1) { @@ -2441,7 +2441,7 @@ bool wxCocoaDataViewControl::AssociateModel(wxDataViewModel* model) [m_DataSource setModel:model]; } else - m_DataSource = NULL; + m_DataSource = nullptr; [m_OutlineView setDataSource:m_DataSource]; // if there is a data source the data is immediately going to be requested // By default, the first column is indented to leave enough place for the @@ -2468,7 +2468,7 @@ wxDataViewColumn *wxCocoaDataViewControl::GetCurrentColumn() const { int col = [m_OutlineView selectedColumn]; if ( col == -1 ) - return NULL; + return nullptr; return GetColumn(col); } @@ -2561,7 +2561,7 @@ wxDataViewColumn* wxCocoaDataViewControl::GetSortingColumn() const for (UInt32 i=0; i(wxGetTopLevelParent(GetParent())); diff --git a/src/osx/cocoa/dnd.mm b/src/osx/cocoa/dnd.mm index d8786cc2de..bf7aba90d1 100644 --- a/src/osx/cocoa/dnd.mm +++ b/src/osx/cocoa/dnd.mm @@ -39,7 +39,7 @@ wxOSXDataSinkItem::~wxOSXDataSinkItem() void wxOSXDataSinkItem::SetFilename(const wxString& filename) { wxCFRef url(wxOSXCreateURLFromFileSystemPath(filename)); - wxCFRef data(CFURLCreateData(NULL,url,kCFStringEncodingUTF8,true)); + wxCFRef data(CFURLCreateData(nullptr,url,kCFStringEncodingUTF8,true)); DoSetData( kUTTypeFileURL, data); } @@ -144,10 +144,10 @@ public: wxString tempdir = wxFileName::GetTempDir() + wxFILE_SEP_PATH + "wxtemp.XXXXXX"; char* result = mkdtemp((char*)tempdir.fn_str().data()); - wxCFRef dest(CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8*)result, strlen(result), true)); - PasteboardRef pboardRef = NULL; + wxCFRef dest(CFURLCreateFromFileSystemRepresentation(nullptr, (const UInt8*)result, strlen(result), true)); + PasteboardRef pboardRef = nullptr; PasteboardCreate((CFStringRef)[m_pasteboard name], &pboardRef); - if (pboardRef != NULL) { + if (pboardRef != nullptr) { PasteboardSynchronize(pboardRef); PasteboardSetPasteLocation(pboardRef, (CFURLRef)dest); CFRelease(pboardRef); @@ -244,7 +244,7 @@ size_t wxOSXPasteboard::GetItemCount() const #if wxUSE_DRAG_AND_DROP -wxDropSource* gCurrentSource = NULL; +wxDropSource* gCurrentSource = nullptr; wxDragResult NSDragOperationToWxDragResult(NSDragOperation code) { @@ -294,7 +294,7 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code) { dragFinished = NO; resultCode = NSDragOperationNone; - impl = 0; + impl = nullptr; m_dragFlags = wxDrag_CopyOnly; } return self; @@ -456,7 +456,7 @@ typedef NSString* NSPasteboardType; - (void) clearDataObject { - m_data = NULL; + m_data = nullptr; } - (nullable id)pasteboardPropertyListForType:(nonnull NSPasteboardType)type { @@ -488,7 +488,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) wxASSERT_MSG( m_data, wxT("Drop source: no data") ); wxDragResult result = wxDragNone; - if ((m_data == NULL) || (m_data->GetFormatCount() == 0)) + if ((m_data == nullptr) || (m_data->GetFormatCount() == 0)) return result; NSView* view = m_window->GetPeer()->GetWXWidget(); @@ -539,12 +539,12 @@ wxDragResult wxDropSource::DoDragDrop(int flags) wxWindow* mouseUpTarget = wxWindow::GetCapture(); - if ( mouseUpTarget == NULL ) + if ( mouseUpTarget == nullptr ) { mouseUpTarget = m_window; } - if ( mouseUpTarget != NULL ) + if ( mouseUpTarget != nullptr ) { wxMouseEvent wxevent(wxEVT_LEFT_DOWN); ((wxWidgetCocoaImpl*)mouseUpTarget->GetPeer())->SetupMouseEvent(wxevent , theEvent) ; @@ -553,7 +553,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) mouseUpTarget->HandleWindowEvent(wxevent); } - gCurrentSource = NULL; + gCurrentSource = nullptr; } diff --git a/src/osx/cocoa/evtloop.mm b/src/osx/cocoa/evtloop.mm index f0ca589d42..7f14a08f97 100644 --- a/src/osx/cocoa/evtloop.mm +++ b/src/osx/cocoa/evtloop.mm @@ -117,7 +117,7 @@ wxGUIEventLoop::wxGUIEventLoop() m_modalSession = nil; m_dummyWindow = nil; m_modalNestedLevel = 0; - m_modalWindow = NULL; + m_modalWindow = nullptr; m_osxLowLevelWakeUp = false; } @@ -168,11 +168,11 @@ bool wxGUIEventLoop::Dispatch() inMode:NSDefaultRunLoopMode dequeue: YES]) { - WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent(); - WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef(); + WXEVENTREF formerEvent = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEvent(); + WXEVENTHANDLERCALLREF formerHandler = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEventHandlerCallRef(); if (wxTheApp) - wxTheApp->MacSetCurrentEvent(event, NULL); + wxTheApp->MacSetCurrentEvent(event, nullptr); m_sleepTime = 0.0; [NSApp sendEvent: event]; @@ -352,7 +352,7 @@ void wxGUIEventLoop::OSXDoStop() // We should only stop the top level event loop. if ( gs_loopNestingLevel <= 1 ) { - [NSApp stop:0]; + [NSApp stop:nullptr]; } // For the top level loop only calling stop: is not enough when called from @@ -400,14 +400,14 @@ CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow) { m_modalWindow = dynamic_cast (modalWindow); - wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" ); + wxASSERT_MSG( m_modalWindow != nullptr, "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_modalWindow = nullptr; + wxASSERT_MSG( modalNativeWindow != nullptr, "must pass in a toplevel window for modal event loop" ); m_modalNativeWindow = modalNativeWindow; } @@ -456,7 +456,7 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) m_modalNestedLevel++; if ( m_modalNestedLevel > 1 ) { - wxModalSessionStack* stack = NULL; + wxModalSessionStack* stack = nullptr; if ( m_modalNestedLevel == 2 ) { @@ -490,7 +490,7 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) modalWindow->Show(); wxNonOwnedWindow* now = dynamic_cast (modalWindow); - wxASSERT_MSG( now != NULL, "must pass in a toplevel window for modal event loop" ); + wxASSERT_MSG( now != nullptr, "must pass in a toplevel window for modal event loop" ); nsnow = now ? now->GetWXWindow() : nil; } else @@ -506,12 +506,12 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) [nsnow orderOut:nil]; } m_modalSession = [NSApp beginModalSessionForWindow:nsnow]; - wxASSERT_MSG(m_modalSession != NULL, "modal session couldn't be started"); + wxASSERT_MSG(m_modalSession != nullptr, "modal session couldn't be started"); } void wxGUIEventLoop::EndModalSession() { - wxASSERT_MSG(m_modalSession != NULL, "no modal session active"); + wxASSERT_MSG(m_modalSession != nullptr, "no modal session active"); wxASSERT_MSG(m_modalNestedLevel > 0, "incorrect modal nesting level"); diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 57eb64368e..a2ba5a6f6f 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -108,8 +108,8 @@ void wxFileDialog::Init() { m_filterIndex = -1; m_delegate = nil; - m_filterPanel = NULL; - m_filterChoice = NULL; + m_filterPanel = nullptr; + m_filterChoice = nullptr; m_useFileTypeFilter = false; m_firstFileTypeFilter = 0; } @@ -242,7 +242,7 @@ void wxFileDialog::ShowWindowModal() wxCFStringRef dir( m_dir ); wxCFStringRef file( m_fileName ); - wxNonOwnedWindow* parentWindow = NULL; + wxNonOwnedWindow* parentWindow = nullptr; m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; @@ -321,7 +321,7 @@ wxWindow* wxFileDialog::CreateFilterPanel(wxWindow *extracontrol) // and then reparenting extracontrol. Reparenting is less desired as user // code may expect the parent to be a wxFileDialog as on other platforms. const bool useExtraControlAsPanel = extracontrol && - wxDynamicCast(extracontrol, wxPanel) != NULL; + wxDynamicCast(extracontrol, wxPanel) != nullptr; wxWindow* extrapanel = useExtraControlAsPanel ? extracontrol @@ -357,7 +357,7 @@ wxWindow* wxFileDialog::CreateFilterPanel(wxWindow *extracontrol) if ( useExtraControlAsPanel && existingSizer ) { // Move extra control's sizer to verticalSizer. - extracontrol->SetSizer(NULL, /* deleteOld = */ false); + extracontrol->SetSizer(nullptr, /* deleteOld = */ false); verticalSizer->Add(existingSizer); } else @@ -407,13 +407,13 @@ 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 || getenv("APP_SANDBOX_CONTAINER_ID") != NULL ) + if ( [panel contentView] == nil || getenv("APP_SANDBOX_CONTAINER_ID") != nullptr ) return; wxNonOwnedWindow::Create( GetParent(), nativeWindow ); // This won't do anything if there are no extra controls to create and - // extracontrol will be NULL in this case. + // extracontrol will be null in this case. CreateExtraControl(); wxWindow* const extracontrol = GetExtraControl(); @@ -426,8 +426,8 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) } else { - m_filterPanel = NULL; - m_filterChoice = NULL; + m_filterPanel = nullptr; + m_filterChoice = nullptr; if ( extracontrol != nil ) accView = extracontrol->GetHandle(); } diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index d92f7d4494..7cd50ad324 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -151,7 +151,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, { // Prevent the NSOpenGLView from making it's own context // We want to force using wxGLContexts - return NULL; + return nullptr; } @end diff --git a/src/osx/cocoa/listbox.mm b/src/osx/cocoa/listbox.mm index 0adf8f6b72..7723d40bee 100644 --- a/src/osx/cocoa/listbox.mm +++ b/src/osx/cocoa/listbox.mm @@ -142,7 +142,7 @@ public : { return col; } - virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) wxOVERRIDE ; + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = nullptr ) wxOVERRIDE ; virtual void UpdateLineToEnd( unsigned int n) wxOVERRIDE; virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; @@ -306,7 +306,7 @@ protected: wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); wxListBox* const list = wxDynamicCast(impl->GetWXPeer(), wxListBox); - wxCHECK_RET( list != NULL , "Associated control should be a wxListBox" ); + wxCHECK_RET( list != nullptr , "Associated control should be a wxListBox" ); list->MacHandleSelectionChange(row); } @@ -386,7 +386,7 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertTextColumn( unsigned pos, const [col1 setResizingMask: NSTableColumnAutoresizingMask]; wxListBox *list = static_cast ( GetWXPeer()); - if ( list != NULL ) + if ( list != nullptr ) [[col1 dataCell] setFont:list->GetFont().OSXGetNSFont()]; wxCocoaTableColumn* wxcol = new wxCocoaTableColumn( col1, editable ); @@ -410,7 +410,7 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertCheckColumn( unsigned pos , con [col1 setDataCell:checkbox] ; wxListBox *list = static_cast ( GetWXPeer()); - if ( list != NULL ) + if ( list != nullptr ) { NSControlSize size = NSRegularControlSize; @@ -619,7 +619,7 @@ void wxListWidgetCocoaImpl::UpdateLineToEnd( unsigned int WXUNUSED(n)) void wxListWidgetCocoaImpl::controlDoubleAction(WXWidget WXUNUSED(slf),void* WXUNUSED(_cmd), void *WXUNUSED(sender)) { wxListBox *list = static_cast ( GetWXPeer()); - wxCHECK_RET( list != NULL , wxT("Listbox expected")); + wxCHECK_RET( list != nullptr , wxT("Listbox expected")); int sel = [m_tableView clickedRow]; if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?) diff --git a/src/osx/cocoa/mediactrl.mm b/src/osx/cocoa/mediactrl.mm index 177dc3784b..97c234079c 100644 --- a/src/osx/cocoa/mediactrl.mm +++ b/src/osx/cocoa/mediactrl.mm @@ -390,7 +390,7 @@ bool wxAVMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent, WXRect r = wxOSXGetFrameForControl( mediactrl, pos , size ) ; - WXWidget view = NULL; + WXWidget view = nullptr; #if wxOSX_USE_AVKIT view = [[wxAVPlayerView alloc] initWithFrame: r player:m_player]; [(wxAVPlayerView*) view setControlsStyle:AVPlayerViewControlsStyleNone]; diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index 05a377726e..44002c7818 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -40,7 +40,7 @@ { if ( self = [super initWithTitle:title] ) { - impl = NULL; + impl = nullptr; } return self; } @@ -157,8 +157,8 @@ class wxMenuCocoaImpl : public wxMenuImpl public : wxMenuCocoaImpl( wxMenu* peer , wxNSMenu* menu) : wxMenuImpl(peer), m_osxMenu(menu) { - static wxNSMenuController* controller = NULL; - if ( controller == NULL ) + static wxNSMenuController* controller = nullptr; + if ( controller == nullptr ) { controller = [[wxNSMenuController alloc] init]; } @@ -334,7 +334,7 @@ public : wxTopLevelWindow* tlw = static_cast(wxGetTopLevelParent(win)); NSWindow* nsWindow = tlw->GetWXWindow(); NSRect nsrect = NSZeroRect; - nsrect.origin = wxToNSPoint( NULL, screenPoint ); + nsrect.origin = wxToNSPoint( nullptr, screenPoint ); nsrect = [nsWindow convertRectFromScreen:nsrect]; NSEvent* rightClick = [NSEvent mouseEventWithType:NSRightMouseDown diff --git a/src/osx/cocoa/menuitem.mm b/src/osx/cocoa/menuitem.mm index 9aa2f4d5a1..4cc0578c98 100644 --- a/src/osx/cocoa/menuitem.mm +++ b/src/osx/cocoa/menuitem.mm @@ -43,7 +43,7 @@ Mapping sActionToWXMapping[] = { wxID_PASTE, @selector(paste:) }, { wxID_CLEAR, @selector(delete:) }, { wxID_SELECTALL, @selector(selectAll:) }, - { 0, NULL } + { 0, nullptr } }; int wxOSXGetIdFromSelector(SEL action ) @@ -127,7 +127,7 @@ SEL wxOSXGetSelectorFromID(int menuId ) void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* entry ) { - if ( entry == NULL ) + if ( entry == nullptr ) { [menuItem setKeyEquivalent:@""]; return; @@ -339,7 +339,7 @@ wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer, wxMenu *pParentMenu, wxItemKind kind, wxMenu *pSubMenu ) { - wxMenuItemImpl* c = NULL; + wxMenuItemImpl* c = nullptr; NSMenuItem* item = nil; if ( kind == wxITEM_SEPARATOR ) @@ -351,7 +351,7 @@ wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer, wxMenu *pParentMenu, wxCFStringRef cfText(text); SEL selector = nil; bool targetSelf = false; - if ( (pParentMenu == NULL || !pParentMenu->GetNoEventsMode()) && pSubMenu == NULL ) + if ( (pParentMenu == nullptr || !pParentMenu->GetNoEventsMode()) && pSubMenu == nullptr ) { selector = wxOSXGetSelectorFromID(menuid); diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index f5e23a01e7..33fe1143b7 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -87,9 +87,9 @@ int wxMessageDialog::ShowModal() if ( !wxIsMainThread() ) { - CFStringRef defaultButtonTitle = NULL; - CFStringRef alternateButtonTitle = NULL; - CFStringRef otherButtonTitle = NULL; + CFStringRef defaultButtonTitle = nullptr; + CFStringRef alternateButtonTitle = nullptr; + CFStringRef otherButtonTitle = nullptr; #if wxUSE_UNICODE wxFontEncoding encoding = wxFONTENCODING_DEFAULT; @@ -148,7 +148,7 @@ int wxMessageDialog::ShowModal() CFOptionFlags exitButton; OSStatus err = CFUserNotificationDisplayAlert( - 0, alertType, NULL, NULL, NULL, cfTitle, cfText, + 0, alertType, nullptr, nullptr, nullptr, cfTitle, cfText, defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton ); if (err == noErr) SetReturnCode( m_buttonId[exitButton] ); @@ -175,7 +175,7 @@ int wxMessageDialog::ShowModal() void wxMessageDialog::ShowWindowModal() { - wxNonOwnedWindow* parentWindow = NULL; + wxNonOwnedWindow* parentWindow = nullptr; m_modality = wxDIALOG_MODALITY_WINDOW_MODAL; diff --git a/src/osx/cocoa/nativewin.mm b/src/osx/cocoa/nativewin.mm index 315dd1d562..dfb740ab22 100644 --- a/src/osx/cocoa/nativewin.mm +++ b/src/osx/cocoa/nativewin.mm @@ -53,7 +53,7 @@ wxNativeWindow::Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle view) { - wxCHECK_MSG( view, false, wxS("NULL NSView pointer") ); + wxCHECK_MSG( view, false, wxS("null NSView pointer") ); DontCreatePeer(); diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index ef72977c6f..0e65b89653 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -35,7 +35,7 @@ NSRect wxToNSRect( NSView* parent, const wxRect& r ) NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int y = r.y; int x = r.x ; - if ( parent == NULL || ![ parent isFlipped ] ) + if ( parent == nullptr || ![ parent isFlipped ] ) y = (int)(frame.size.height - ( r.y + r.height )); return NSMakeRect(x, y, r.width , r.height); } @@ -45,7 +45,7 @@ wxRect wxFromNSRect( NSView* parent, const NSRect& rect ) NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int y = (int)rect.origin.y; int x = (int)rect.origin.x; - if ( parent == NULL || ![ parent isFlipped ] ) + if ( parent == nullptr || ![ parent isFlipped ] ) y = (int)(frame.size.height - (rect.origin.y + rect.size.height)); return wxRect( x, y, (int)rect.size.width, (int)rect.size.height ); } @@ -55,7 +55,7 @@ NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ) NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int x = p.x ; int y = p.y; - if ( parent == NULL || ![ parent isFlipped ] ) + if ( parent == nullptr || ![ parent isFlipped ] ) y = (int)(frame.size.height - ( p.y )); return NSMakePoint(x, y); } @@ -65,7 +65,7 @@ wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p ) NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int x = (int)p.x; int y = (int)p.y; - if ( parent == NULL || ![ parent isFlipped ] ) + if ( parent == nullptr || ![ parent isFlipped ] ) y = (int)(frame.size.height - ( p.y )); return wxPoint( x, y); } @@ -124,14 +124,14 @@ static bool IsUsingFullScreenApi(WXWindow macWindow) bool handled = false; if ( ([event type] >= NSLeftMouseDown) && ([event type] <= NSMouseExited) ) { - WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent(); - WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef(); + WXEVENTREF formerEvent = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEvent(); + WXEVENTHANDLERCALLREF formerHandler = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEventHandlerCallRef(); wxWindow* cw = wxWindow::GetCapture(); - if ( cw != NULL ) + if ( cw != nullptr ) { if (wxTheApp) - wxTheApp->MacSetCurrentEvent(event, NULL); + wxTheApp->MacSetCurrentEvent(event, nullptr); ((wxWidgetCocoaImpl*)cw->GetPeer())->DoHandleMouseEvent( event); handled = true; } @@ -149,8 +149,8 @@ static bool IsUsingFullScreenApi(WXWindow macWindow) // wx native implementation // -static NSResponder* s_nextFirstResponder = NULL; -static NSResponder* s_formerFirstResponder = NULL; +static NSResponder* s_nextFirstResponder = nullptr; +static NSResponder* s_formerFirstResponder = nullptr; @interface wxNSWindow : NSWindow { @@ -168,11 +168,11 @@ static NSResponder* s_formerFirstResponder = NULL; { if ( ![self WX_filterSendEvent: event] ) { - WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent(); - WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef(); + WXEVENTREF formerEvent = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEvent(); + WXEVENTHANDLERCALLREF formerHandler = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEventHandlerCallRef(); if (wxTheApp) - wxTheApp->MacSetCurrentEvent(event, NULL); + wxTheApp->MacSetCurrentEvent(event, nullptr); [super sendEvent: event]; @@ -273,11 +273,11 @@ static NSResponder* s_formerFirstResponder = NULL; { if ( ![self WX_filterSendEvent: event] ) { - WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent(); - WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef(); + WXEVENTREF formerEvent = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEvent(); + WXEVENTHANDLERCALLREF formerHandler = wxTheApp == nullptr ? nullptr : wxTheApp->MacGetCurrentEventHandlerCallRef(); if (wxTheApp) - wxTheApp->MacSetCurrentEvent(event, NULL); + wxTheApp->MacSetCurrentEvent(event, nullptr); [super sendEvent: event]; @@ -375,9 +375,9 @@ extern int wxOSXGetIdFromSelector(SEL action ); wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar(); if ( mbar ) { - wxMenu* menu = NULL; + wxMenu* menu = nullptr; wxMenuItem* menuitem = mbar->FindItem(wxOSXGetIdFromSelector(action), &menu); - if ( menu != NULL && menuitem != NULL) + if ( menu != nullptr && menuitem != nullptr) return menu->HandleCommandProcess(menuitem); } return NO; @@ -390,9 +390,9 @@ extern int wxOSXGetIdFromSelector(SEL action ); wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar(); if ( mbar ) { - wxMenu* menu = NULL; + wxMenu* menu = nullptr; wxMenuItem* menuitem = mbar->FindItem(wxOSXGetIdFromSelector(action), &menu); - if ( menu != NULL && menuitem != NULL) + if ( menu != nullptr && menuitem != nullptr) { menu->HandleCommandUpdateStatus(menuitem); return menuitem->IsEnabled(); @@ -481,7 +481,7 @@ extern int wxOSXGetIdFromSelector(SEL action ); toSize:(NSSize)proposedFrameSize { NSRect frame = [window frame]; - wxRect wxframe = wxFromNSRect( NULL, frame ); + wxRect wxframe = wxFromNSRect( nullptr, frame ); wxframe.SetWidth( (int)proposedFrameSize.width ); wxframe.SetHeight( (int)proposedFrameSize.height ); @@ -535,7 +535,7 @@ extern int wxOSXGetIdFromSelector(SEL action ); NSResponder *firstResponder = [window firstResponder]; wxWidgetCocoaImpl *focused = firstResponder ? (wxWidgetCocoaImpl*)wxWidgetImpl::FindFromWXWidget(wxOSXGetViewFromResponder(firstResponder)) - : NULL; + : nullptr; if ( focused ) focused->DoNotifyFocusSet(); @@ -562,7 +562,7 @@ extern int wxOSXGetIdFromSelector(SEL action ); NSResponder *firstResponder = [window firstResponder]; wxWidgetCocoaImpl *focused = firstResponder ? (wxWidgetCocoaImpl*)wxWidgetImpl::FindFromWXWidget(wxOSXGetViewFromResponder(firstResponder)) - : NULL; + : nullptr; if ( focused ) focused->DoNotifyFocusLost(); @@ -666,7 +666,7 @@ static void SendFullScreenWindowEvent(NSNotification* notification, bool fullscr { NSWindow* theWindow = (NSWindow*)[notification object]; wxNonOwnedWindowCocoaImpl* windowimpl = [theWindow WX_implementation]; - wxNonOwnedWindow* wxpeer = windowimpl ? windowimpl->GetWXPeer() : NULL; + wxNonOwnedWindow* wxpeer = windowimpl ? windowimpl->GetWXPeer() : nullptr; if (wxpeer) { CGFloat newBackingScaleFactor = [theWindow backingScaleFactor]; @@ -715,7 +715,7 @@ static void SendFullScreenWindowEvent(NSNotification* notification, bool fullscr if (context == EffectiveAppearanceContext) { wxNonOwnedWindowCocoaImpl* windowimpl = [(NSWindow*)object WX_implementation]; - wxNonOwnedWindow* wxpeer = windowimpl ? windowimpl->GetWXPeer() : NULL; + wxNonOwnedWindow* wxpeer = windowimpl ? windowimpl->GetWXPeer() : nullptr; if (wxpeer) { wxSysColourChangedEvent event; @@ -732,14 +732,14 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl); wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) : wxNonOwnedWindowImpl(nonownedwnd) { - m_macWindow = NULL; - m_macFullScreenData = NULL; + m_macWindow = nullptr; + m_macFullScreenData = nullptr; } wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl() { - m_macWindow = NULL; - m_macFullScreenData = NULL; + m_macWindow = nullptr; + m_macFullScreenData = nullptr; } wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() @@ -751,7 +751,7 @@ wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() // make sure we remove this first, otherwise the ref count will not lead to the // native window's destruction - if ([m_macWindow parentWindow] != 0) + if ([m_macWindow parentWindow] != nullptr) [[m_macWindow parentWindow] removeChildWindow: m_macWindow]; [m_macWindow setReleasedWhenClosed:YES]; @@ -771,7 +771,7 @@ void wxNonOwnedWindowCocoaImpl::WillBeDestroyed() void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size, long style, long extraStyle, const wxString& WXUNUSED(name) ) { - static wxNonOwnedWindowController* controller = NULL; + static wxNonOwnedWindowController* controller = nullptr; if ( !controller ) controller =[[wxNonOwnedWindowController alloc] init]; @@ -829,7 +829,7 @@ long style, long extraStyle, const wxString& WXUNUSED(name) ) if ( ( style & wxPOPUP_WINDOW ) ) level = NSPopUpMenuWindowLevel; - NSRect frameRect = wxToNSRect( NULL, wxRect( pos, size) ); + NSRect frameRect = wxToNSRect( nullptr, wxRect( pos, size) ); NSRect contentRect = [NSWindow contentRectForFrameRect:frameRect styleMask:windowstyle]; @@ -974,7 +974,7 @@ bool wxNonOwnedWindowCocoaImpl::Show(bool show) else { // avoid propagation of orderOut to parent - if ([m_macWindow parentWindow] != 0) + if ([m_macWindow parentWindow] != nullptr) [[m_macWindow parentWindow] removeChildWindow: m_macWindow]; [m_macWindow orderOut:nil]; } @@ -1062,14 +1062,14 @@ bool wxNonOwnedWindowCocoaImpl::CanSetTransparent() void wxNonOwnedWindowCocoaImpl::MoveWindow(int x, int y, int width, int height) { - NSRect r = wxToNSRect( NULL, wxRect(x,y,width, height) ); + NSRect r = wxToNSRect( nullptr, wxRect(x,y,width, height) ); // do not trigger refreshes upon invisible and possible partly created objects [m_macWindow setFrame:r display:GetWXPeer()->IsShownOnScreen()]; } void wxNonOwnedWindowCocoaImpl::GetPosition( int &x, int &y ) const { - wxRect r = wxFromNSRect( NULL, [m_macWindow frame] ); + wxRect r = wxFromNSRect( nullptr, [m_macWindow frame] ); x = r.GetLeft(); y = r.GetTop(); } @@ -1202,7 +1202,7 @@ bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const return [m_macWindow styleMask] & NSFullScreenWindowMask; } - return m_macFullScreenData != NULL ; + return m_macFullScreenData != nullptr ; } bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable, long style) @@ -1274,7 +1274,7 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long style) | kUIOptionDisableForceQuit */); } - else if ( m_macFullScreenData != NULL ) + else if ( m_macFullScreenData != nullptr ) { FullScreenData *data = (FullScreenData *) m_macFullScreenData ; @@ -1282,7 +1282,7 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long style) [m_macWindow setStyleMask:data->m_formerStyleMask]; delete data ; - m_macFullScreenData = NULL ; + m_macFullScreenData = nullptr ; SetSystemUIMode(kUIModeNormal, 0); } @@ -1315,7 +1315,7 @@ void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y ) { wxPoint p((x ? *x : 0), (y ? *y : 0) ); NSRect nsrect = NSZeroRect; - nsrect.origin = wxToNSPoint( NULL, p ); + nsrect.origin = wxToNSPoint( nullptr, p ); nsrect = [m_macWindow convertRectFromScreen:nsrect]; NSPoint nspt = [[m_macWindow contentView] convertPoint:nsrect.origin fromView:nil]; p = wxFromNSPoint([m_macWindow contentView], nspt); @@ -1333,7 +1333,7 @@ void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y ) NSRect nsrect = NSZeroRect; nsrect.origin = nspt; nsrect = [m_macWindow convertRectToScreen:nsrect]; - p = wxFromNSPoint( NULL, nsrect.origin); + p = wxFromNSPoint( nullptr, nsrect.origin); if ( x ) *x = p.x; if ( y ) diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm index 45a86b2a13..03ea96d6e2 100644 --- a/src/osx/cocoa/notebook.mm +++ b/src/osx/cocoa/notebook.mm @@ -335,7 +335,7 @@ public: m_peer = new wxMacControl( this ); OSStatus err = CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - tabsize, tabstyle, 0, NULL, GetPeer()->GetControlRefAddr() ); + tabsize, tabstyle, 0, nullptr, GetPeer()->GetControlRefAddr() ); verify_noerr( err ); #endif */ @@ -347,7 +347,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer, long style, long WXUNUSED(extraStyle)) { - static wxTabViewController* controller = NULL; + static wxTabViewController* controller = nullptr; if ( !controller ) controller =[[wxTabViewController alloc] init]; diff --git a/src/osx/cocoa/notifmsg.mm b/src/osx/cocoa/notifmsg.mm index 3eb3459087..ce7f06d842 100644 --- a/src/osx/cocoa/notifmsg.mm +++ b/src/osx/cocoa/notifmsg.mm @@ -70,7 +70,7 @@ public: virtual ~wxUserNotificationMsgImpl() { - ms_activeNotifications[m_id] = NULL; + ms_activeNotifications[m_id] = nullptr; ReleaseHandler(); [m_notif release]; } diff --git a/src/osx/cocoa/overlay.mm b/src/osx/cocoa/overlay.mm index dc2007d0db..ed9e9728eb 100644 --- a/src/osx/cocoa/overlay.mm +++ b/src/osx/cocoa/overlay.mm @@ -99,7 +99,7 @@ NSRect backingBounds = [self convertRectToBacking:bounds]; NSBitmapImageRep* bmp = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:NULL + initWithBitmapDataPlanes:nullptr pixelsWide:backingBounds.size.width pixelsHigh:backingBounds.size.height bitsPerSample:8 @@ -158,9 +158,9 @@ wxOverlay::Impl* wxOverlay::Create() wxOverlayImpl::wxOverlayImpl() { - m_window = NULL ; - m_overlayContext = NULL ; - m_overlayWindow = NULL ; + m_window = nullptr ; + m_overlayContext = nullptr ; + m_overlayWindow = nullptr ; } wxOverlayImpl::~wxOverlayImpl() @@ -170,7 +170,7 @@ wxOverlayImpl::~wxOverlayImpl() bool wxOverlayImpl::IsOk() { - return m_overlayWindow != NULL ; + return m_overlayWindow != nullptr ; } void wxOverlayImpl::CreateOverlayWindow( wxDC* dc ) @@ -187,7 +187,7 @@ void wxOverlayImpl::CreateOverlayWindow( wxDC* dc ) origin = m_window->ClientToScreen(origin); wxSize size(m_width, m_height); - NSRect overlayRect = wxToNSRect(NULL, wxRect(origin, size)); + NSRect overlayRect = wxToNSRect(nullptr, wxRect(origin, size)); overlayRect = [NSWindow contentRectForFrameRect:overlayRect styleMask:NSBorderlessWindowMask]; m_overlayWindow = [[wxOSXOverlayWindow alloc] initWithContentRect:overlayRect @@ -198,7 +198,7 @@ void wxOverlayImpl::CreateOverlayWindow( wxDC* dc ) } else { - m_overlayParentWindow = NULL; + m_overlayParentWindow = nullptr; CGRect cgbounds; cgbounds = CGDisplayBounds(CGMainDisplayID()); @@ -223,7 +223,7 @@ void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height ) m_height = height ; CreateOverlayWindow(dc); - wxASSERT_MSG(m_overlayWindow != NULL, "Couldn't create the overlay window"); + wxASSERT_MSG(m_overlayWindow != nullptr, "Couldn't create the overlay window"); } void wxOverlayImpl::BeginDrawing( wxDC* dc) @@ -247,7 +247,7 @@ void wxOverlayImpl::BeginDrawing( wxDC* dc) wxOSXOverlayWindow* wxoverlay = (wxOSXOverlayWindow*) m_overlayWindow; NSBitmapImageRep* rep = wxoverlay.overlayView.bitmapImageRep; m_overlayContext = [[NSGraphicsContext graphicsContextWithBitmapImageRep:rep] CGContext]; - wxASSERT_MSG( m_overlayContext != NULL , "Couldn't init the context on the overlay window" ); + wxASSERT_MSG( m_overlayContext != nullptr , "Couldn't init the context on the overlay window" ); wxGraphicsContext* ctx = wxGraphicsContext::CreateFromNative( m_overlayContext ); ctx->Translate(0, ySize); @@ -266,10 +266,10 @@ void wxOverlayImpl::EndDrawing( wxDC* dc) wxDCImpl *impl = dc->GetImpl(); wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl); if (win_impl) - win_impl->SetGraphicsContext(NULL); + win_impl->SetGraphicsContext(nullptr); CGContextFlush( m_overlayContext ); - m_overlayContext = NULL; + m_overlayContext = nullptr; wxOSXOverlayWindow* wxoverlay = (wxOSXOverlayWindow*) m_overlayWindow; [wxoverlay.overlayView setNeedsDisplay:YES]; } @@ -286,7 +286,7 @@ void wxOverlayImpl::Reset() if ( m_overlayContext ) { [(id)m_overlayContext release]; - m_overlayContext = NULL ; + m_overlayContext = nullptr ; } // todo : don't dispose, only hide and reposition on next run @@ -294,7 +294,7 @@ void wxOverlayImpl::Reset() { [m_overlayParentWindow removeChildWindow:m_overlayWindow]; [m_overlayWindow release]; - m_overlayWindow = NULL ; + m_overlayWindow = nullptr ; } } diff --git a/src/osx/cocoa/preferences.mm b/src/osx/cocoa/preferences.mm index 5eb377430e..c1a2910214 100644 --- a/src/osx/cocoa/preferences.mm +++ b/src/osx/cocoa/preferences.mm @@ -69,11 +69,11 @@ class wxCocoaPrefsWindow : public wxFrame { public: wxCocoaPrefsWindow(const wxString& title) - : wxFrame(NULL, wxID_ANY, title, + : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)), m_toolbarRealized(false), - m_visiblePage(NULL) + m_visiblePage(nullptr) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16 if ( WX_IS_MACOS_AVAILABLE(11,0) ) @@ -134,7 +134,7 @@ protected: // the resizing is animated, so we need to override DoMoveWindow. virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE { - NSRect r = wxToNSRect(NULL, wxRect(x, y, width, height)); + NSRect r = wxToNSRect(nullptr, wxRect(x, y, width, height)); NSWindow *win = (NSWindow*)GetWXWindow(); [win setFrame:r display:YES animate:YES]; } @@ -143,7 +143,7 @@ protected: private: struct PageInfo : public wxObject { - PageInfo(wxPreferencesPage *p) : page(p), win(NULL) {} + PageInfo(wxPreferencesPage *p) : page(p), win(nullptr) {} wxSharedPtr page; wxWindow *win; @@ -258,7 +258,7 @@ class wxCocoaPreferencesEditorImpl : public wxPreferencesEditorImpl { public: wxCocoaPreferencesEditorImpl(const wxString& title) - : m_win(NULL), m_title(title) + : m_win(nullptr), m_title(title) { } diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm index c819deeb0c..b60573b4cb 100644 --- a/src/osx/cocoa/settings.mm +++ b/src/osx/cocoa/settings.mm @@ -257,11 +257,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUN // TODO case wxSYS_WINDOWMIN_Y: case wxSYS_SCREEN_X: - wxDisplaySize(&value, NULL); + wxDisplaySize(&value, nullptr); return value; case wxSYS_SCREEN_Y: - wxDisplaySize(NULL, &value); + wxDisplaySize(nullptr, &value); return value; // TODO case wxSYS_FRAMESIZE_X: diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index a5fcac4b62..5df7fde669 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -75,7 +75,7 @@ wxUnusedVar(words); wxUnusedVar(index); - NSMutableArray* matches = NULL; + NSMutableArray* matches = nullptr; // NSString* partialString; // partialString = [[textView string] substringWithRange:charRange]; matches = [NSMutableArray array]; diff --git a/src/osx/cocoa/taskbar.mm b/src/osx/cocoa/taskbar.mm index b3966549d5..300d944fe8 100644 --- a/src/osx/cocoa/taskbar.mm +++ b/src/osx/cocoa/taskbar.mm @@ -168,7 +168,7 @@ wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType iconType) else if(iconType == wxTBI_CUSTOM_STATUSITEM) m_impl = new wxTaskBarIconCustomStatusItemImpl(this); else - { m_impl = NULL; + { m_impl = nullptr; wxFAIL_MSG(wxT("Invalid wxTaskBarIcon type")); } } @@ -180,7 +180,7 @@ wxTaskBarIcon::~wxTaskBarIcon() if ( m_impl->IsIconInstalled() ) m_impl->RemoveIcon(); delete m_impl; - m_impl = NULL; + m_impl = nullptr; } } @@ -243,20 +243,20 @@ wxTaskBarIconImpl::~wxTaskBarIconImpl() // ============================================================================ // wxTaskBarIconDockImpl // ============================================================================ -wxTaskBarIconDockImpl *wxTaskBarIconDockImpl::sm_dockIcon = NULL; +wxTaskBarIconDockImpl *wxTaskBarIconDockImpl::sm_dockIcon = nullptr; wxTaskBarIconDockImpl::wxTaskBarIconDockImpl(wxTaskBarIcon *taskBarIcon) : wxTaskBarIconImpl(taskBarIcon) { wxASSERT_MSG(!sm_dockIcon, wxT("You should never have more than one dock icon!")); sm_dockIcon = this; - m_pMenu = NULL; + m_pMenu = nullptr; } wxTaskBarIconDockImpl::~wxTaskBarIconDockImpl() { if(sm_dockIcon == this) - sm_dockIcon = NULL; + sm_dockIcon = nullptr; } WX_NSMenu wxTaskBarIconDockImpl::OSXGetDockHMenu() diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index c759018e78..cf66ff17a3 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -367,7 +367,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); lastKeyDownEvent = event; - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super keyDown:event]; lastKeyDownEvent = nil; } @@ -375,28 +375,28 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; - (void) keyUp:(NSEvent*) event { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super keyUp:event]; } - (void) flagsChanged:(NSEvent*) event { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super flagsChanged:event]; } - (void) rightMouseDown:(NSEvent*) event { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleMouseEvent( event ) ) + if ( impl == nullptr || !impl->DoHandleMouseEvent( event ) ) [super rightMouseDown:event]; } - (void) rightMouseUp:(NSEvent*) event { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleMouseEvent( event ) ) + if ( impl == nullptr || !impl->DoHandleMouseEvent( event ) ) [super rightMouseUp:event]; } @@ -426,7 +426,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) textField ); BOOL r = [super becomeFirstResponder]; - if ( impl != NULL && r ) + if ( impl != nullptr && r ) impl->DoNotifyFocusSet(); return r; @@ -542,7 +542,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; - (BOOL)_handleClipboardEvent:(wxEventType)type { wxWidgetImpl *impl = wxWidgetImpl::FindFromWXWidget(self); - wxWindow* wxpeer = impl ? impl->GetWXPeer() : NULL; + wxWindow* wxpeer = impl ? impl->GetWXPeer() : nullptr; if ( wxpeer ) { wxClipboardTextEvent evt(type, wxpeer->GetId()); @@ -1098,22 +1098,22 @@ bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style) { if (m_textView && position >=0) { - NSFont* font = NULL; - NSColor* bgcolor = NULL; - NSColor* fgcolor = NULL; - NSNumber* ultype = NULL; - NSColor* ulcolor = NULL; + NSFont* font = nullptr; + NSColor* bgcolor = nullptr; + NSColor* fgcolor = nullptr; + NSNumber* ultype = nullptr; + NSColor* ulcolor = nullptr; // NOTE: It appears that other platforms accept GetStyle with the position == length // but that NSTextStorage does not accept length as a valid position. // Therefore we return the default control style in that case. if (position < (long) [[m_textView string] length]) { NSTextStorage* storage = [m_textView textStorage]; - font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL]; - bgcolor = [storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL]; - fgcolor = [storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL]; - ultype = [storage attribute:NSUnderlineStyleAttributeName atIndex:position effectiveRange:NULL]; - ulcolor = [storage attribute:NSUnderlineColorAttributeName atIndex:position effectiveRange:NULL]; + font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:nullptr]; + bgcolor = [storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:nullptr]; + fgcolor = [storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:nullptr]; + ultype = [storage attribute:NSUnderlineStyleAttributeName atIndex:position effectiveRange:nullptr]; + ulcolor = [storage attribute:NSUnderlineColorAttributeName atIndex:position effectiveRange:nullptr]; } else { @@ -1721,7 +1721,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, long WXUNUSED(extraStyle)) { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; - wxWidgetCocoaImpl* c = NULL; + wxWidgetCocoaImpl* c = nullptr; if ( style & wxTE_MULTILINE ) { diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index 0f4d79e79f..c74a067de8 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -89,7 +89,7 @@ public: : wxToolBarToolBase(tbar, control, label) { Init(); - if (control != NULL) + if (control != nullptr) SetControlHandle( (WXWidget) control->GetHandle() ); } @@ -124,14 +124,14 @@ public: // the embedded control is not under the responsibility of the tool, it gets disposed of in the // proper wxControl destructor } - m_controlHandle = NULL ; + m_controlHandle = nullptr ; } #if wxOSX_USE_NATIVE_TOOLBAR if ( m_toolbarItem ) { [m_toolbarItem release]; - m_toolbarItem = NULL; + m_toolbarItem = nullptr; } #endif // wxOSX_USE_NATIVE_TOOLBAR } @@ -290,10 +290,10 @@ private: void Init() { - m_controlHandle = NULL; + m_controlHandle = nullptr; #if wxOSX_USE_NATIVE_TOOLBAR - m_toolbarItem = NULL; + m_toolbarItem = nullptr; m_index = -1; #endif } @@ -365,7 +365,7 @@ private: { if ( self = [super initWithItemIdentifier:identifier] ) { - impl = NULL; + impl = nullptr; [self setTarget: self]; [self setAction: @selector(clickedAction:)]; } @@ -490,7 +490,7 @@ private: { if ( self = [super initWithFrame:frame] ) { - impl = NULL; + impl = nullptr; [self setTarget: self]; [self setAction: @selector(clickedAction:)]; } @@ -535,11 +535,11 @@ bool wxToolBarTool::Enable( bool enable ) else if ( IsButton() ) { #if wxOSX_USE_NATIVE_TOOLBAR - if ( m_toolbarItem != NULL ) + if ( m_toolbarItem != nullptr ) [m_toolbarItem setEnabled:enable]; #endif - if ( m_controlHandle != NULL ) + if ( m_controlHandle != nullptr ) [(NSControl*)m_controlHandle setEnabled:enable]; } @@ -623,7 +623,7 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) // be invalid. wxToolBar *tbar = (wxToolBar*) GetToolBar(); int style = tbar ? tbar->GetWindowStyleFlag() : 0; - if ( m_toolbarItem != NULL && !(style & wxTB_NOICONS) ) + if ( m_toolbarItem != nullptr && !(style & wxTB_NOICONS) ) { // the native toolbar item only has a 'selected' state (one for one toolbar) // so we emulate the toggle here @@ -688,7 +688,7 @@ void wxToolBar::Init() m_defaultHeight = kwxMacToolBarToolDefaultHeight; #if wxOSX_USE_NATIVE_TOOLBAR - m_macToolbar = NULL; + m_macToolbar = nullptr; m_macUsesNativeToolbar = false; #endif } @@ -721,7 +721,7 @@ bool wxToolBar::Create( m_macToolbar = tb ; - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { NSToolbarDisplayMode mode = NSToolbarDisplayModeDefault; NSToolbarSizeMode displaySize = NSToolbarSizeModeSmall; @@ -748,20 +748,20 @@ wxToolBar::~wxToolBar() wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame && frame->GetToolBar() == this ) { - frame->SetToolBar(NULL); + frame->SetToolBar(nullptr); } #if wxOSX_USE_NATIVE_TOOLBAR [(NSToolbar*)m_macToolbar setDelegate:nil]; [(NSToolbar*)m_macToolbar release]; - m_macToolbar = NULL; + m_macToolbar = nullptr; #endif // wxOSX_USE_NATIVE_TOOLBAR } bool wxToolBar::Show( bool show ) { WXWindow tlw = MacGetTopLevelWindowRef(); - bool bResult = (tlw != NULL); + bool bResult = (tlw != nullptr); if (bResult) { @@ -827,9 +827,9 @@ void wxToolBar::DoGetSize( int *width, int *height ) const - NSHeight([[tlw contentView] frame]); } - if ( width != NULL ) + if ( width != nullptr ) *width = (int)windowFrame.size.width; - if ( height != NULL ) + if ( height != nullptr ) *height = (int)toolbarHeight; } else @@ -862,9 +862,9 @@ void wxToolBar::DoGetPosition(int*x, int *y) const // it is extending to the north of the content area - if ( x != NULL ) + if ( x != nullptr ) *x = 0; - if ( y != NULL ) + if ( y != nullptr ) *y = -toolbarHeight; } else @@ -889,7 +889,7 @@ void wxToolBar::SetWindowStyleFlag( long style ) wxToolBarBase::SetWindowStyleFlag( style ); #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { NSToolbarDisplayMode mode = NSToolbarDisplayModeDefault; @@ -909,7 +909,7 @@ void wxToolBar::SetWindowStyleFlag( long style ) while ( node ) { tool = (wxToolBarTool *) node->GetData(); - if ( tool != NULL ) + if ( tool != nullptr ) { tool->UpdateLabel(); } @@ -930,15 +930,15 @@ bool wxToolBar::MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const { bool bResultV = false; - if (ownToolbarInstalled != NULL) + if (ownToolbarInstalled != nullptr) *ownToolbarInstalled = false; WXWindow tlw = MacGetTopLevelWindowRef(); - if (tlw != NULL) + if (tlw != nullptr) { NSToolbar* curToolbarRef = [tlw toolbar]; - bResultV = (curToolbarRef != NULL); - if (bResultV && (ownToolbarInstalled != NULL)) + bResultV = (curToolbarRef != nullptr); + if (bResultV && (ownToolbarInstalled != nullptr)) *ownToolbarInstalled = (curToolbarRef == m_macToolbar); } @@ -949,14 +949,14 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) { bool bResult = false; - if (usesNative && (m_macToolbar == NULL)) + if (usesNative && (m_macToolbar == nullptr)) return bResult; if (usesNative && HasFlag(wxTB_LEFT|wxTB_RIGHT|wxTB_BOTTOM) ) return bResult; WXWindow tlw = MacGetTopLevelWindowRef(); - if (tlw == NULL) + if (tlw == nullptr) return bResult; // check the existing toolbar @@ -967,7 +967,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) if (m_macUsesNativeToolbar) { // only install toolbar if there isn't one installed already - if (curToolbarRef == NULL) + if (curToolbarRef == nullptr) { bResult = true; [tlw setToolbar:(NSToolbar*) m_macToolbar]; @@ -1025,7 +1025,7 @@ void wxToolBar::DoLayout() while ( node ) { tool = (wxToolBarTool *) node->GetData(); - if ( tool != NULL ) + if ( tool != nullptr ) { wxSize sz = tool->GetSize(); @@ -1054,7 +1054,7 @@ void wxToolBar::DoLayout() while ( node ) { tool = (wxToolBarTool*) node->GetData(); - if ( tool == NULL ) + if ( tool == nullptr ) { node = node->GetNext(); continue; @@ -1121,7 +1121,7 @@ void wxToolBar::DoLayout() while ( node ) { tool = (wxToolBarTool*) node->GetData(); - if ( tool == NULL ) + if ( tool == nullptr ) { node = node->GetNext(); continue; @@ -1187,7 +1187,7 @@ bool wxToolBar::Realize() while ( node ) { tool = (wxToolBarTool*) node->GetData(); - if ( tool == NULL ) + if ( tool == nullptr ) { node = node->GetNext(); continue; @@ -1197,7 +1197,7 @@ bool wxToolBar::Realize() if ( refTB ) { NSToolbarItem* hiItemRef = tool->GetToolbarItemRef(); - if ( hiItemRef != NULL ) + if ( hiItemRef != nullptr ) { // since setting the help texts is non-virtual we have to update // the strings now @@ -1266,7 +1266,7 @@ bool wxToolBar::Realize() while ( node ) { tool = (wxToolBarTool*) node->GetData(); - if ( tool == NULL ) + if ( tool == nullptr ) { node = node->GetNext(); continue; @@ -1299,7 +1299,7 @@ bool wxToolBar::Realize() while ( nodePrev ) { wxToolBarToolBase *toggleTool = nodePrev->GetData(); - if ( (toggleTool == NULL) || !toggleTool->IsButton() || (toggleTool->GetKind() != wxITEM_RADIO) ) + if ( (toggleTool == nullptr) || !toggleTool->IsButton() || (toggleTool->GetKind() != wxITEM_RADIO) ) break; if ( toggleTool->Toggle( false ) ) @@ -1334,7 +1334,7 @@ void wxToolBar::DoSetToolBitmapSize(const wxSize& size) m_defaultHeight = size.y + kwxMacToolBorder; #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { int maxs = wxMax( size.x, size.y ); NSToolbarSizeMode sizeSpec; @@ -1411,7 +1411,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const while ( node ) { tool = (wxToolBarTool *)node->GetData(); - if (tool != NULL) + if (tool != nullptr) { wxRect2DInt r( tool->GetPosition(), tool->GetSize() ); if ( r.Contains( wxPoint( x, y ) ) ) @@ -1421,13 +1421,13 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const node = node->GetNext(); } - return NULL; + return nullptr; } wxString wxToolBar::MacGetToolTipString( wxPoint &pt ) { wxToolBarToolBase *tool = FindToolForPosition( pt.x, pt.y ); - if ( tool != NULL ) + if ( tool != nullptr ) return tool->GetShortHelp(); return wxEmptyString; @@ -1441,20 +1441,20 @@ void wxToolBar::DoEnableTool(wxToolBarToolBase * WXUNUSED(t), bool WXUNUSED(enab void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle) { wxToolBarTool *tool = (wxToolBarTool *)t; - if ( ( tool != NULL ) && tool->IsButton() ) + if ( ( tool != nullptr ) && tool->IsButton() ) tool->UpdateToggleImage( toggle ); } bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) { wxToolBarTool *tool = static_cast< wxToolBarTool*>(toolBase ); - if (tool == NULL) + if (tool == nullptr) return false; long style = GetWindowStyleFlag(); wxSize toolSize = GetToolSize(); - WXWidget controlHandle = NULL; + WXWidget controlHandle = nullptr; NSRect toolrect = NSMakeRect(0, 0, toolSize.x, toolSize.y + 2 ); #if wxOSX_USE_NATIVE_TOOLBAR @@ -1471,7 +1471,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) { case wxTOOL_STYLE_SEPARATOR: { - wxASSERT( tool->GetControlHandle() == NULL ); + wxASSERT( tool->GetControlHandle() == nullptr ); toolSize.x /= 4; toolSize.y /= 4; if ( IsVertical() ) @@ -1481,7 +1481,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) // in flat style we need a visual separator #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { NSString * nsItemId = nil; @@ -1504,7 +1504,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) case wxTOOL_STYLE_BUTTON: { - wxASSERT( tool->GetControlHandle() == NULL ); + wxASSERT( tool->GetControlHandle() == nullptr ); wxNSToolBarButton* v = [[wxNSToolBarButton alloc] initWithFrame:toolrect]; @@ -1518,7 +1518,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) controlHandle = v; #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { wxString identifier = wxString::Format(wxT("%ld"), (long) tool); wxCFStringRef cfidentifier( identifier, wxFont::GetDefaultEncoding() ); @@ -1536,7 +1536,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) #if 0 InstallControlEventHandler( (WXWidget) controlHandle, GetwxMacToolBarToolEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, tool, NULL ); + GetEventTypeCount(eventList), eventList, tool, nullptr ); #endif } break; @@ -1544,10 +1544,10 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) case wxTOOL_STYLE_CONTROL: #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { WXWidget view = (WXWidget) tool->GetControl()->GetHandle() ; - wxCHECK_MSG( view, false, wxT("control must be non-NULL") ); + wxCHECK_MSG( view, false, wxT("control must be non-null") ); wxString identifier = wxString::Format(wxT("%ld"), (long) tool); wxCFStringRef cfidentifier( identifier, wxFont::GetDefaultEncoding() ); @@ -1568,7 +1568,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) if ( controlHandle ) { WXWidget container = (WXWidget) GetHandle(); - wxASSERT_MSG( container != NULL, wxT("No valid Mac container control") ); + wxASSERT_MSG( container != nullptr, wxT("No valid Mac container control") ); // SetControlVisibility( controlHandle, true, true ); [container addSubview:controlHandle]; @@ -1609,7 +1609,7 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase) #endif #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { if ( removeIndex != -1 && m_macToolbar ) { @@ -1636,7 +1636,7 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase) tool2->SetPosition( pt ); #if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) + if (m_macToolbar != nullptr) { if ( removeIndex != -1 && tool2->GetIndex() > removeIndex ) tool2->SetIndex( tool2->GetIndex() - 1 ); @@ -1696,7 +1696,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event) #if wxOSX_USE_NATIVE_TOOLBAR void wxToolBar::OSXSetSelectableTools(bool set) { - wxCHECK_RET( m_macToolbar, "toolbar must be non-NULL" ); + wxCHECK_RET( m_macToolbar, "toolbar must be non-null" ); [(wxNSToolbarDelegate*)[(NSToolbar*)m_macToolbar delegate] setSelectable:set]; } @@ -1704,7 +1704,7 @@ void wxToolBar::OSXSelectTool(int toolId) { wxToolBarToolBase *tool = FindById(toolId); wxCHECK_RET( tool, "invalid tool ID" ); - wxCHECK_RET( m_macToolbar, "toolbar must be non-NULL" ); + wxCHECK_RET( m_macToolbar, "toolbar must be non-null" ); wxString identifier = wxString::Format(wxT("%ld"), (long)tool); wxCFStringRef cfidentifier(identifier, wxFont::GetDefaultEncoding()); diff --git a/src/osx/cocoa/tooltip.mm b/src/osx/cocoa/tooltip.mm index 57642f820e..4ac310120b 100644 --- a/src/osx/cocoa/tooltip.mm +++ b/src/osx/cocoa/tooltip.mm @@ -40,7 +40,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip( const wxString &tip ) { m_text = tip; - m_window = NULL; + m_window = nullptr; } wxToolTip::~wxToolTip() diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index ed93022959..78a12bd90f 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -240,14 +240,14 @@ void wxBell() ++i ) { wxTopLevelWindow * const win = static_cast(*i); - wxNonOwnedWindowImpl* winimpl = win ? win->GetNonOwnedPeer() : NULL; + wxNonOwnedWindowImpl* winimpl = win ? win->GetNonOwnedPeer() : nullptr; WXWindow nswindow = win ? win->GetWXWindow() : nil; if ( nswindow && [nswindow hidesOnDeactivate] == NO && winimpl) winimpl->RestoreWindowLevel(); } if ( wxTheApp ) - wxTheApp->SetActive( true , NULL ) ; + wxTheApp->SetActive( true , nullptr ) ; } - (void)applicationWillResignActive:(NSNotification *)notification @@ -270,7 +270,7 @@ void wxBell() { wxUnusedVar(notification); if ( wxTheApp ) - wxTheApp->SetActive( false , NULL ) ; + wxTheApp->SetActive( false , nullptr ) ; } @end @@ -286,7 +286,7 @@ void wxBell() { sheetFinished = NO; resultCode = -1; - impl = 0; + impl = nullptr; } return self; } @@ -462,7 +462,7 @@ extern // used from src/osx/core/display.cpp wxRect wxOSXGetMainDisplayClientArea() { NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame]; - return wxFromNSRect( NULL, displayRect ); + return wxFromNSRect( nullptr, displayRect ); } static NSScreen* wxOSXGetScreenFromDisplay( CGDirectDisplayID ID) @@ -473,19 +473,19 @@ static NSScreen* wxOSXGetScreenFromDisplay( CGDirectDisplayID ID) if ( displayID == ID ) return screen; } - return NULL; + return nullptr; } extern // used from src/osx/core/display.cpp wxRect wxOSXGetDisplayClientArea(CGDirectDisplayID ID) { NSRect displayRect = [wxOSXGetScreenFromDisplay(ID) visibleFrame]; - return wxFromNSRect( NULL, displayRect ); + return wxFromNSRect( nullptr, displayRect ); } void wxGetMousePosition( int* x, int* y ) { - wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]); + wxPoint pt = wxFromNSPoint(nullptr, [NSEvent mouseLocation]); if ( x ) *x = pt.x; if ( y ) diff --git a/src/osx/cocoa/utils_base.mm b/src/osx/cocoa/utils_base.mm index 1174d91479..f3f0bf4be2 100644 --- a/src/osx/cocoa/utils_base.mm +++ b/src/osx/cocoa/utils_base.mm @@ -30,7 +30,7 @@ // needed hack, see the above-mentioned files for more information class wxSocketManager; extern WXDLLIMPEXP_BASE wxSocketManager *wxOSXSocketManagerCF; -wxSocketManager *wxOSXSocketManagerCF = NULL; +wxSocketManager *wxOSXSocketManagerCF = nullptr; #endif // wxUSE_SOCKETS // our OS version is the same in non GUI and GUI cases @@ -38,13 +38,13 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro) { NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion; - if ( verMaj != NULL ) + if ( verMaj != nullptr ) *verMaj = osVer.majorVersion; - if ( verMin != NULL ) + if ( verMin != nullptr ) *verMin = osVer.minorVersion; - if ( verMicro != NULL ) + if ( verMicro != nullptr ) *verMicro = osVer.patchVersion; return wxOS_MAC_OSX_DARWIN; @@ -179,7 +179,7 @@ bool wxCocoaLaunch(const char* const* argv, pid_t &pid) // Loop through command line arguments to the bundle, // turn them into CFURLs and then put them in cfaFiles // For use to launch services call - for( ; *argv != NULL; ++argv ) + for( ; *argv != nullptr; ++argv ) { NSURL *cfurlCurrentFile; wxString dir( *argv ); @@ -234,8 +234,8 @@ bool wxCocoaLaunch(const char* const* argv, pid_t &pid) configuration:[NSDictionary dictionary] error:&error]; - // this was already processed argv is NULL and nothing bad will happen - for( ; *argv != NULL; ++argv ) + // this was already processed argv is null and nothing bad will happen + for( ; *argv != nullptr; ++argv ) { wxString currfile(*argv); if( [ws openFile:wxCFStringRef(currfile).AsNSString() diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 635ea286d4..e872e7bfc2 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -132,7 +132,7 @@ wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control) // NSScrollViews can have their subviews like NSClipView // therefore check and use the NSScrollView peer in that case - if ( impl == NULL && [[control superview] isKindOfClass:[NSScrollView class]]) + if ( impl == nullptr && [[control superview] isKindOfClass:[NSScrollView class]]) impl = FindFromWXWidget([control superview]); return impl; @@ -234,7 +234,7 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); CFRelease(currentKeyboard); - if (uchr == NULL) { + if (uchr == nullptr) { // this can happen for some non-U.S. input methods (eg. Romaji or Hiragana) return c; } @@ -1015,7 +1015,7 @@ void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text); NSDragOperation wxOSX_draggingEntered( id self, SEL _cmd, id sender ) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NSDragOperationNone; return impl->draggingEntered(sender, self, _cmd); @@ -1024,7 +1024,7 @@ NSDragOperation wxOSX_draggingEntered( id self, SEL _cmd, id sen void wxOSX_draggingExited( id self, SEL _cmd, id sender ) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return ; return impl->draggingExited(sender, self, _cmd); @@ -1033,7 +1033,7 @@ void wxOSX_draggingExited( id self, SEL _cmd, id sender ) NSDragOperation wxOSX_draggingUpdated( id self, SEL _cmd, id sender ) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NSDragOperationNone; return impl->draggingUpdated(sender, self, _cmd); @@ -1042,7 +1042,7 @@ NSDragOperation wxOSX_draggingUpdated( id self, SEL _cmd, id sen BOOL wxOSX_performDragOperation( id self, SEL _cmd, id sender ) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NSDragOperationNone; return impl->performDragOperation(sender, self, _cmd) ? YES:NO ; @@ -1053,7 +1053,7 @@ BOOL wxOSX_performDragOperation( id self, SEL _cmd, id sender ) void wxOSX_mouseEvent(NSView* self, SEL _cmd, NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; // We shouldn't let disabled windows get mouse events. @@ -1064,7 +1064,7 @@ void wxOSX_mouseEvent(NSView* self, SEL _cmd, NSEvent *event) void wxOSX_cursorUpdate(NSView* self, SEL _cmd, NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; impl->cursorUpdate(event, self, _cmd); @@ -1080,7 +1080,7 @@ BOOL wxOSX_acceptsFirstMouse(NSView* WXUNUSED(self), SEL WXUNUSED(_cmd), NSEvent void wxOSX_keyEvent(NSView* self, SEL _cmd, NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) { wxLogTrace(TRACE_KEYS, "Dropping %s for %s", wxDumpSelector(_cmd), wxDumpNSView(self)); @@ -1093,7 +1093,7 @@ void wxOSX_keyEvent(NSView* self, SEL _cmd, NSEvent *event) void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; impl->insertText(text, self, _cmd); @@ -1102,7 +1102,7 @@ void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text) void wxOSX_panGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSPanGestureRecognizer* panGestureRecognizer) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->PanGestureEvent(panGestureRecognizer); @@ -1111,7 +1111,7 @@ void wxOSX_panGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSPanGestureRecogni void wxOSX_zoomGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSMagnificationGestureRecognizer* magnificationGestureRecognizer) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->ZoomGestureEvent(magnificationGestureRecognizer); @@ -1120,7 +1120,7 @@ void wxOSX_zoomGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSMagnificationGes void wxOSX_rotateGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSRotationGestureRecognizer* rotationGestureRecognizer) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->RotateGestureEvent(rotationGestureRecognizer); @@ -1129,7 +1129,7 @@ void wxOSX_rotateGestureEvent(NSView* self, SEL WXUNUSED(_cmd), NSRotationGestur void wxOSX_longPressEvent(NSView* self, SEL WXUNUSED(_cmd), NSPressGestureRecognizer* pressGestureRecognizer) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl ==NULL ) + if ( impl ==nullptr ) return; impl->LongPressEvent(pressGestureRecognizer); @@ -1138,7 +1138,7 @@ void wxOSX_longPressEvent(NSView* self, SEL WXUNUSED(_cmd), NSPressGestureRecogn void wxOSX_touchesBegan(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->TouchesBegan(event); @@ -1147,7 +1147,7 @@ void wxOSX_touchesBegan(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) void wxOSX_touchesMoved(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->TouchesMoved(event); @@ -1156,7 +1156,7 @@ void wxOSX_touchesMoved(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) void wxOSX_touchesEnded(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if ( impl == NULL ) + if ( impl == nullptr ) return; impl->TouchesEnded(event); @@ -1165,7 +1165,7 @@ void wxOSX_touchesEnded(NSView* self, SEL WXUNUSED(_cmd), NSEvent *event) BOOL wxOSX_acceptsFirstResponder(NSView* self, SEL _cmd) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->acceptsFirstResponder(self, _cmd); @@ -1174,7 +1174,7 @@ BOOL wxOSX_acceptsFirstResponder(NSView* self, SEL _cmd) BOOL wxOSX_becomeFirstResponder(NSView* self, SEL _cmd) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->becomeFirstResponder(self, _cmd); @@ -1183,7 +1183,7 @@ BOOL wxOSX_becomeFirstResponder(NSView* self, SEL _cmd) BOOL wxOSX_resignFirstResponder(NSView* self, SEL _cmd) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->resignFirstResponder(self, _cmd); @@ -1194,7 +1194,7 @@ BOOL wxOSX_resignFirstResponder(NSView* self, SEL _cmd) BOOL wxOSX_isFlipped(NSView* self, SEL _cmd) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->isFlipped(self, _cmd) ? YES:NO; @@ -1207,7 +1207,7 @@ typedef void (*wxOSX_DrawRectHandlerPtr)(NSView* self, SEL _cmd, NSRect rect); void wxOSX_drawRect(NSView* self, SEL _cmd, NSRect rect) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; #if wxUSE_THREADS @@ -1256,7 +1256,7 @@ void wxOSX_drawRect(NSView* self, SEL _cmd, NSRect rect) void wxOSX_controlAction(NSView* self, SEL _cmd, id sender) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; impl->controlAction(self, _cmd, sender); @@ -1265,7 +1265,7 @@ void wxOSX_controlAction(NSView* self, SEL _cmd, id sender) void wxOSX_controlDoubleAction(NSView* self, SEL _cmd, id sender) { wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; impl->controlDoubleAction(self, _cmd, sender); @@ -1281,8 +1281,8 @@ unsigned int wxOnDraggingEnteredOrUpdated(wxWidgetCocoaImpl* viewImpl, void *s, bool entered) { wxWindow* wxpeer = viewImpl->GetWXPeer(); - wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : NULL; - if ( target == NULL ) + wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : nullptr; + if ( target == nullptr ) { if ([[slf superclass] instancesRespondToSelector:(SEL)_cmd]) { @@ -1383,8 +1383,8 @@ unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget slf, void *_cm void wxWidgetCocoaImpl::draggingExited(void* s, WXWidget slf, void *_cmd) { wxWindow* wxpeer = GetWXPeer(); - wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : NULL; - if ( target == NULL ) + wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : nullptr; + if ( target == nullptr ) { if ([[slf superclass] instancesRespondToSelector:(SEL)_cmd]) { @@ -1409,8 +1409,8 @@ unsigned int wxWidgetCocoaImpl::draggingUpdated(void* s, WXWidget slf, void *_cm bool wxWidgetCocoaImpl::performDragOperation(void* s, WXWidget slf, void *_cmd) { wxWindow* wxpeer = GetWXPeer(); - wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : NULL; - if ( target == NULL ) + wxDropTarget* target = wxpeer ? wxpeer->GetDropTarget() : nullptr; + if ( target == nullptr ) { if ([[slf superclass] instancesRespondToSelector:(SEL)_cmd]) { @@ -1453,7 +1453,7 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) if ( [event type] == NSMouseMoved ) { NSView* hitview = [[[slf window] contentView] hitTest:[event locationInWindow]]; - if ( hitview == NULL || hitview != slf) + if ( hitview == nullptr || hitview != slf) return; } @@ -1492,7 +1492,7 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) // 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 ) + if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() && impl != nullptr ) { wxMouseEvent wxevent(wxEVT_LEFT_DOWN); SetupMouseEvent(wxevent , event) ; @@ -1533,7 +1533,7 @@ bool wxWidgetCocoaImpl::SetupCursor(WX_NSEvent event) { // at least in GTK cursor events are not propagated either ... #if 1 - cursorTarget = NULL; + cursorTarget = nullptr; #else cursorTarget = cursorTarget->GetParent() ; if ( cursorTarget ) @@ -1541,7 +1541,7 @@ bool wxWidgetCocoaImpl::SetupCursor(WX_NSEvent event) #endif } - return cursorTarget != NULL; + return cursorTarget != nullptr; } } @@ -1591,7 +1591,7 @@ public: m_lastTouchTime = 0; m_allowedGestures = 0; m_activeGestures = 0; - m_initialTouch = NULL; + m_initialTouch = nullptr; Class cls = [m_view class]; @@ -2166,7 +2166,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. - result = DoHandleCharEvent(NULL,text); + result = DoHandleCharEvent(nullptr,text); } } if ( !result ) @@ -2292,7 +2292,7 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) // Restrict the update region to the shape of the window, if any, and also // remember the region that we need to clear later. wxNonOwnedWindow* const tlwParent = wxpeer->MacGetTopLevelWindow(); - if ( tlwParent == NULL ) + if ( tlwParent == nullptr ) return; const bool isTopLevel = tlwParent == wxpeer; @@ -2322,10 +2322,10 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) wxpeer->GetUpdateRegion() = updateRgn; // setting up the drawing context - // note that starting from 10.14 this may be NULL in certain views + // note that starting from 10.14 this may be null in certain views CGContextRef context = [[NSGraphicsContext currentContext] CGContext]; wxpeer->MacSetCGContextRef( context ); - if ( context != NULL ) + if ( context != nullptr ) { CGContextSaveGState( context ); @@ -2352,7 +2352,7 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) } bool handled = wxpeer->MacDoRedraw( 0 ); - if ( context != NULL ) + if ( context != nullptr ) { CGContextRestoreGState( context ); CGContextSaveGState( context ); @@ -2364,14 +2364,14 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) SEL _cmd = @selector(drawRect:); wxOSX_DrawRectHandlerPtr superimpl = (wxOSX_DrawRectHandlerPtr) [[slf superclass] instanceMethodForSelector:_cmd]; superimpl(slf, _cmd, *(NSRect*)rect); - if ( context != NULL ) + if ( context != nullptr ) { CGContextRestoreGState( context ); CGContextSaveGState( context ); } } - if ( context != NULL ) + if ( context != nullptr ) { // as we called restore above, we have to flip again if necessary if ( ![slf isFlipped] ) @@ -2411,7 +2411,7 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) wxpeer->MacPaintChildrenBorders(); CGContextRestoreGState( context ); } - wxpeer->MacSetCGContextRef( NULL ); + wxpeer->MacSetCGContextRef( nullptr ); } void wxWidgetCocoaImpl::controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender)) @@ -2527,8 +2527,8 @@ void wxOSXCocoaClassAddWXMethods(Class c, wxOSXSkipOverrides skipFlags) #if OBJC_API_VERSION < 2 } ; static int method_count = WXSIZEOF( wxmethods ); - static objc_method_list *wxmethodlist = NULL; - if ( wxmethodlist == NULL ) + static objc_method_list *wxmethodlist = nullptr; + if ( wxmethodlist == nullptr ) { wxmethodlist = (objc_method_list*) malloc(sizeof(objc_method_list) + sizeof(wxmethods) ); memcpy( &wxmethodlist->method_list[0], &wxmethods[0], sizeof(wxmethods) ); @@ -2569,7 +2569,7 @@ wxWidgetCocoaImpl::wxWidgetCocoaImpl() void wxWidgetCocoaImpl::Init() { - m_osxView = NULL; + m_osxView = nullptr; #if !wxOSX_USE_NATIVE_FLIPPED m_isFlipped = true; #endif @@ -2658,7 +2658,7 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible ) // trigger redraw upon shown for layer-backed views if ( WX_IS_MACOS_AVAILABLE(10, 14 ) ) if( !m_osxView.isHiddenOrHasHiddenAncestor ) - SetNeedsDisplay(NULL); + SetNeedsDisplay(nullptr); } double wxWidgetCocoaImpl::GetContentScaleFactor() const @@ -3259,7 +3259,7 @@ void wxWidgetCocoaImpl::SetDropTarget(wxDropTarget* target) { [m_osxView unregisterDraggedTypes]; - if (target == NULL) + if (target == nullptr) return; wxDataObject* dobj = target->GetDataObject(); @@ -3293,7 +3293,7 @@ void wxWidgetCocoaImpl::RemoveFromParent() void wxWidgetCocoaImpl::Embed( wxWidgetImpl *parent ) { NSView* container = parent->GetWXWidget() ; - wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; + wxASSERT_MSG( container != nullptr , wxT("No valid mac container control") ) ; [container addSubview:m_osxView]; // User panes will be frozen elsewhere @@ -3314,7 +3314,7 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col ) { wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow); - if ( toplevel == NULL || toplevel->GetShape().IsEmpty() ) + if ( toplevel == nullptr || toplevel->GetShape().IsEmpty() ) [targetView setBackgroundColor: col.IsOk() ? col.OSXGetNSColor() : nil]; } @@ -4033,7 +4033,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) { NSWindow* tlw = now->GetWXWindow(); - wxWidgetCocoaImpl* c = NULL; + wxWidgetCocoaImpl* c = nullptr; if ( now->IsNativeWindowWrapper() ) { NSView* cv = [tlw contentView]; diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index 5578d844a1..3936eba603 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -59,13 +59,13 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, { DontCreatePeer(); - m_text = NULL; - m_choice = NULL; + m_text = nullptr; + m_choice = nullptr; if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; - SetPeer(wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() )); + SetPeer(wxWidgetImpl::CreateComboBox( this, parent, id, nullptr, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -107,7 +107,7 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, if (idx > m_datas.GetCount()) m_datas.SetCount(idx); - m_datas.Insert( NULL, idx ); + m_datas.Insert( nullptr, idx ); AssignNewItemClientData(idx, clientData, i, type); } diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 567205ce6c..f9eeacfda6 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -152,19 +152,19 @@ static size_t GetBestBytesPerRow( size_t rawBytes ) void wxBitmapRefData::Init() { - m_nsImage = NULL; - m_bitmapMask = NULL ; - m_cgImageRef = NULL ; + m_nsImage = nullptr; + m_bitmapMask = nullptr ; + m_cgImageRef = nullptr ; m_isTemplate = false; #if wxOSX_USE_ICONREF - m_iconRef = NULL ; + m_iconRef = nullptr ; #endif - m_hBitmap = NULL ; + m_hBitmap = nullptr ; m_rawAccessCount = 0 ; m_scaleFactor = 1.0; - m_selectedInto = NULL; + m_selectedInto = nullptr; } wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData &tocopy) : wxGDIRefData() @@ -239,19 +239,19 @@ bool wxBitmapRefData::Create( WXImage image ) bool wxBitmapRefData::Create(CGImageRef image, double scale) { - if (image != NULL) + if (image != nullptr) { size_t width = CGImageGetWidth(image); size_t height = CGImageGetHeight(image); - m_hBitmap = NULL; + m_hBitmap = nullptr; m_scaleFactor = scale; size_t bytesPerRow = GetBestBytesPerRow(width * 4); CGImageAlphaInfo alpha = CGImageGetAlphaInfo(image); bool hasAlpha = IsCGImageAlphaFlag(alpha); - m_hBitmap = CGBitmapContextCreate(NULL, width, height, 8, bytesPerRow, wxMacGetGenericRGBColorSpace(), + m_hBitmap = CGBitmapContextCreate(nullptr, width, height, 8, bytesPerRow, wxMacGetGenericRGBColorSpace(), hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst); wxCHECK_MSG(m_hBitmap, false, wxT("Unable to create CGBitmapContext context")); CGRect rect = CGRectMake(0, 0, width, height); @@ -265,7 +265,7 @@ bool wxBitmapRefData::Create(CGImageRef image, double scale) bool wxBitmapRefData::Create(CGContextRef context) { - if ( context != NULL && CGBitmapContextGetData(context) ) + if ( context != nullptr && CGBitmapContextGetData(context) ) { m_hBitmap = context; // our own contexts conform to this, always. @@ -286,10 +286,10 @@ bool wxBitmapRefData::Create(int w, int h, int WXUNUSED(d), double logicalscale) size_t height = wxMax(1, h); m_scaleFactor = logicalscale; - m_hBitmap = NULL; + m_hBitmap = nullptr; size_t bytesPerRow = GetBestBytesPerRow(width * 4); - m_hBitmap = CGBitmapContextCreate(NULL, width, height, 8, bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); + m_hBitmap = CGBitmapContextCreate(nullptr, width, height, 8, bytesPerRow, wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst); wxCHECK_MSG(m_hBitmap, false, wxT("Unable to create CGBitmapContext context")); CGContextTranslateCTM(m_hBitmap, 0, height); CGContextScaleCTM(m_hBitmap, 1 * GetScaleFactor(), -1 * GetScaleFactor()); @@ -299,7 +299,7 @@ bool wxBitmapRefData::Create(int w, int h, int WXUNUSED(d), double logicalscale) bool wxBitmapRefData::IsOk() const { - return (m_hBitmap.get() != NULL || m_nsImage != NULL); + return (m_hBitmap.get() != nullptr || m_nsImage != nullptr); } int wxBitmapRefData::GetWidth() const @@ -358,7 +358,7 @@ bool wxBitmapRefData::HasAlpha() const WXImage wxBitmapRefData::GetImage() const { - wxCHECK_MSG( IsOk() , 0 , "Invalid Bitmap"); + wxCHECK_MSG( IsOk() , nullptr , "Invalid Bitmap"); if ( !m_nsImage ) { @@ -388,7 +388,7 @@ void wxBitmapRefData::UseAlpha( bool use ) if ( HasAlpha() == use ) return ; - CGContextRef hBitmap = CGBitmapContextCreate(NULL, GetWidth(), GetHeight(), 8, GetBytesPerRow(), wxMacGetGenericRGBColorSpace(), use ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst ); + CGContextRef hBitmap = CGBitmapContextCreate(nullptr, GetWidth(), GetHeight(), 8, GetBytesPerRow(), wxMacGetGenericRGBColorSpace(), use ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst ); memcpy(CGBitmapContextGetData(hBitmap),CGBitmapContextGetData(m_hBitmap),GetBytesPerRow()*GetHeight()); wxCHECK_RET( hBitmap , wxT("Unable to create CGBitmapContext context") ) ; @@ -400,7 +400,7 @@ void wxBitmapRefData::UseAlpha( bool use ) const void *wxBitmapRefData::GetRawAccess() const { - wxCHECK_MSG( IsOk(), NULL , wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk(), nullptr , wxT("invalid bitmap") ) ; EnsureBitmapExists(); @@ -415,11 +415,11 @@ void *wxBitmapRefData::GetRawAccess() void *wxBitmapRefData::BeginRawAccess() { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ) ; wxASSERT( m_rawAccessCount == 0 ) ; #if wxOSX_USE_ICONREF - wxASSERT_MSG( m_iconRef == NULL , + wxASSERT_MSG( m_iconRef == nullptr , wxT("Currently, modifying bitmaps that are used in controls already is not supported") ) ; #endif @@ -461,7 +461,7 @@ bool wxBitmapRefData::HasNativeSize() #if wxOSX_USE_ICONREF IconRef wxBitmapRefData::GetIconRef() const { - if ( m_iconRef == NULL ) + if ( m_iconRef == nullptr ) { // Create Icon Family Handle @@ -538,7 +538,7 @@ IconRef wxBitmapRefData::GetIconRef() const bool hasAlpha = HasAlpha() ; wxMask *mask = m_bitmapMask ; unsigned char * sourcePtr = (unsigned char*) GetRawAccess() ; - unsigned char * masksourcePtr = mask ? (unsigned char*) mask->GetRawAccess() : NULL ; + unsigned char * masksourcePtr = mask ? (unsigned char*) mask->GetRawAccess() : nullptr ; for ( int y = 0 ; y < h ; ++y, sourcePtr += GetBytesPerRow() , masksourcePtr += mask ? mask->GetBytesPerRow() : 0 ) { @@ -593,10 +593,10 @@ IconRef wxBitmapRefData::GetIconRef() const { // setup the header properly - Handle data = NULL ; - Handle maskdata = NULL ; - unsigned char * maskptr = NULL ; - unsigned char * ptr = NULL ; + Handle data = nullptr ; + Handle maskdata = nullptr ; + unsigned char * maskptr = nullptr ; + unsigned char * ptr = nullptr ; size_t datasize, masksize ; datasize = sz * sz * 4 ; @@ -614,7 +614,7 @@ IconRef wxBitmapRefData::GetIconRef() const bool hasAlpha = HasAlpha() ; wxMask *mask = m_bitmapMask ; unsigned char * sourcePtr = (unsigned char*) GetRawAccess() ; - unsigned char * masksourcePtr = mask ? (unsigned char*) mask->GetRawAccess() : NULL ; + unsigned char * masksourcePtr = mask ? (unsigned char*) mask->GetRawAccess() : nullptr ; for ( int y = 0 ; y < h ; ++y, sourcePtr += GetBytesPerRow() , masksourcePtr += mask ? mask->GetBytesPerRow() : 0 ) { @@ -665,7 +665,7 @@ IconRef wxBitmapRefData::GetIconRef() const HUnlock((Handle) iconFamily); DisposeHandle( (Handle) iconFamily ) ; - wxCHECK_MSG( err == noErr, NULL, wxT("Error when constructing icon ref") ); + wxCHECK_MSG( err == noErr, nullptr, wxT("Error when constructing icon ref") ); } return m_iconRef ; @@ -677,7 +677,7 @@ CGImageRef wxBitmapRefData::CreateCGImage() const wxASSERT( IsOk() ) ; wxASSERT( m_rawAccessCount >= 0 ) ; CGImageRef image ; - if ( m_rawAccessCount > 0 || m_cgImageRef == NULL ) + if ( m_rawAccessCount > 0 || m_cgImageRef == nullptr ) { if ( m_hBitmap ) { @@ -697,7 +697,7 @@ CGImageRef wxBitmapRefData::CreateCGImage() const // Convert masked image to plain ARGB image without mask int w = GetWidth(); int h = GetHeight(); - CGContextRef hBmpAlpha = CGBitmapContextCreate(NULL, w, h, 8, GetBytesPerRow(), wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); + CGContextRef hBmpAlpha = CGBitmapContextCreate(nullptr, w, h, 8, GetBytesPerRow(), wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); CGRect r = CGRectMake(0, 0, w, h); CGContextDrawImage(hBmpAlpha, r, imageMasked); CGContextTranslateCTM(hBmpAlpha, 0, h); @@ -717,7 +717,7 @@ CGImageRef wxBitmapRefData::CreateCGImage() const CGImageRetain( image ) ; } - if ( m_rawAccessCount == 0 && m_cgImageRef == NULL) + if ( m_rawAccessCount == 0 && m_cgImageRef == nullptr) { // we keep it for later use m_cgImageRef = image ; @@ -734,16 +734,16 @@ CGContextRef wxBitmapRefData::GetBitmapContext() const void wxBitmapRefData::SetSelectedInto(wxDC *dc) { - if ( dc == NULL ) + if ( dc == nullptr ) { - if ( m_selectedInto != NULL ) + if ( m_selectedInto != nullptr ) EndRawAccess(); } else { - wxASSERT_MSG( m_selectedInto == NULL || m_selectedInto == dc, "Bitmap already selected into a different dc"); + wxASSERT_MSG( m_selectedInto == nullptr || m_selectedInto == dc, "Bitmap already selected into a different dc"); - if ( m_selectedInto == NULL ) + if ( m_selectedInto == nullptr ) (void) BeginRawAccess(); } @@ -760,13 +760,13 @@ void wxBitmapRefData::FreeDerivedRepresentations() if ( m_cgImageRef ) { CGImageRelease( m_cgImageRef ) ; - m_cgImageRef = NULL ; + m_cgImageRef = nullptr ; } #if wxOSX_USE_ICONREF if ( m_iconRef ) { ReleaseIconRef( m_iconRef ) ; - m_iconRef = NULL ; + m_iconRef = nullptr ; } #endif // wxOSX_USE_ICONREF } @@ -879,14 +879,14 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const #if WXWIN_COMPATIBILITY_3_0 const void * wxBitmap::GetRawAccess() const { - wxCHECK_MSG( IsOk() , NULL , wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk() , nullptr , wxT("invalid bitmap") ) ; return GetBitmapData()->GetRawAccess() ; } void * wxBitmap::BeginRawAccess() { - wxCHECK_MSG( IsOk() , NULL , wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk() , nullptr , wxT("invalid bitmap") ) ; return GetBitmapData()->BeginRawAccess() ; } @@ -901,7 +901,7 @@ void wxBitmap::EndRawAccess() CGImageRef wxBitmap::CreateCGImage() const { - wxCHECK_MSG( IsOk(), NULL , wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk(), nullptr , wxT("invalid bitmap") ) ; return GetBitmapData()->CreateCGImage() ; } @@ -910,7 +910,7 @@ CGImageRef wxBitmap::CreateCGImage() const IconRef wxBitmap::GetIconRef() const { - wxCHECK_MSG( IsOk(), NULL , wxT("invalid bitmap") ) ; + wxCHECK_MSG( IsOk(), nullptr , wxT("invalid bitmap") ) ; return GetBitmapData()->GetIconRef() ; } @@ -960,7 +960,7 @@ bool wxBitmap::Create(CGContextRef bitmapcontext) WXImage wxBitmap::OSXGetImage() const { - return IsOk() ? GetBitmapData()->GetImage() : NULL; + return IsOk() ? GetBitmapData()->GetImage() : nullptr; } wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const @@ -984,9 +984,9 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const { const unsigned char* sourcedata = static_cast(GetBitmapData()->GetRawAccess()); unsigned char *destdata = (unsigned char*) ret.GetBitmapData()->BeginRawAccess() ; - wxASSERT((sourcedata != NULL) && (destdata != NULL)); + wxASSERT((sourcedata != nullptr) && (destdata != nullptr)); - if ( (sourcedata != NULL) && (destdata != NULL) ) + if ( (sourcedata != nullptr) && (destdata != nullptr) ) { int sourcelinesize = GetBitmapData()->GetBytesPerRow() ; int destlinesize = ret.GetBitmapData()->GetBytesPerRow() ; @@ -1012,9 +1012,9 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const unsigned char *source = (unsigned char *) GetBitmapData()->m_bitmapMask->GetRawAccess() ; unsigned char *destdata = (unsigned char * ) maskbuf.GetWriteBuf( maskbufsize ) ; - wxASSERT( (source != NULL) && (destdata != NULL) ) ; + wxASSERT( (source != nullptr) && (destdata != nullptr) ) ; - if ( (source != NULL) && (destdata != NULL) ) + if ( (source != nullptr) && (destdata != nullptr) ) { source += rect.x * kMaskBytesPerPixel + rect.y * sourcelinesize ; unsigned char *dest = destdata ; @@ -1134,7 +1134,7 @@ bool wxBitmap::Create(const void* data, wxBitmapType type, int width, int height wxBitmapHandler *handler = FindHandler(type); - if ( handler == NULL ) + if ( handler == nullptr ) { wxLogWarning(wxT("no bitmap handler for type %d defined."), type); @@ -1172,9 +1172,9 @@ void wxBitmap::InitFromImage(const wxImage& image, int depth, double scale) const unsigned char *sourcePixels = image.GetData(); unsigned char* destinationPixels = (unsigned char*) GetBitmapData()->BeginRawAccess() ; - if ( destinationPixels != NULL && sourcePixels != NULL ) + if ( destinationPixels != nullptr && sourcePixels != nullptr ) { - const unsigned char *sourceAlpha = hasAlpha ? image.GetAlpha() : NULL ; + const unsigned char *sourceAlpha = hasAlpha ? image.GetAlpha() : nullptr ; const unsigned char mr = hasMask ? image.GetMaskRed() : 0; const unsigned char mg = hasMask ? image.GetMaskGreen() : 0; @@ -1186,7 +1186,7 @@ void wxBitmap::InitFromImage(const wxImage& image, int depth, double scale) int maskRowBytes = GetBestBytesPerRow( width * kMaskBytesPerPixel ); size_t maskbufsize = maskRowBytes * height ; - unsigned char *destinationMask = NULL; + unsigned char *destinationMask = nullptr; if ( hasMask ) destinationMask = (unsigned char * ) maskbuf.GetWriteBuf( maskbufsize ) ; @@ -1279,8 +1279,8 @@ wxImage wxBitmap::ConvertToImage() const bool hasAlpha = false ; bool hasMask = false ; int maskBytesPerRow = 0 ; - unsigned char *alpha = NULL ; - unsigned char *mask = NULL ; + unsigned char *alpha = nullptr ; + unsigned char *mask = nullptr ; if ( HasAlpha() ) hasAlpha = true ; @@ -1437,7 +1437,7 @@ int wxBitmap::GetDepth() const wxMask *wxBitmap::GetMask() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return GetBitmapData()->m_bitmapMask; } @@ -1472,7 +1472,7 @@ void wxBitmap::SetDepth(int WXUNUSED_UNLESS_DEBUG(d)) #if wxUSE_PALETTE wxPalette *wxBitmap::GetPalette() const { - wxCHECK_MSG( IsOk(), NULL, wxT("Invalid bitmap GetPalette()") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("Invalid bitmap GetPalette()") ); return & const_cast(GetBitmapData())->m_bitmapPalette; } @@ -1543,7 +1543,7 @@ void wxMask::Init() void *wxMask::GetRawAccess() const { - wxCHECK_MSG( m_maskBitmap, NULL , wxT("invalid mask") ) ; + wxCHECK_MSG( m_maskBitmap, nullptr , wxT("invalid mask") ) ; return CGBitmapContextGetData(m_maskBitmap); } @@ -1573,7 +1573,7 @@ void wxMask::DoCreateMaskBitmap(int width, int height, int bytesPerRow) if ( bytesPerRow < 0 ) bytesPerRow = GetBestBytesPerRow(width * kMaskBytesPerPixel); - m_maskBitmap = CGBitmapContextCreate(NULL, width, height, kMaskBytesPerPixel * 8, bytesPerRow, colorspace, + m_maskBitmap = CGBitmapContextCreate(nullptr, width, height, kMaskBytesPerPixel * 8, bytesPerRow, colorspace, kCGImageAlphaNone); wxASSERT_MSG(m_maskBitmap, wxT("Unable to create CGBitmapContext context")); } @@ -1584,7 +1584,7 @@ void wxMask::RealizeNative() if ( m_maskBitmap ) { CGContextRelease( (CGContextRef) m_maskBitmap ); - m_maskBitmap = NULL ; + m_maskBitmap = nullptr ; } CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); @@ -1632,8 +1632,8 @@ bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) wxNativePixelData::Iterator p(data); unsigned char * destdatabase = (unsigned char*) GetRawAccess(); - wxASSERT( destdatabase != NULL ) ; - if ( destdatabase != NULL) + wxASSERT( destdatabase != nullptr ) ; + if ( destdatabase != nullptr) { for ( int y = 0 ; y < height; ++y, destdatabase += bytesPerRow ) { @@ -1670,8 +1670,8 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxNativePixelData::Iterator p(data); unsigned char * destdatabase = (unsigned char*) GetRawAccess(); - wxASSERT( destdatabase != NULL ) ; - if ( destdatabase != NULL) + wxASSERT( destdatabase != nullptr ) ; + if ( destdatabase != nullptr) { for ( int y = 0 ; y < height; ++y, destdatabase += bytesPerRow ) { @@ -1940,11 +1940,11 @@ bool wxICNSResourceHandler::LoadFile(wxBitmap *bitmap, theId = kHelpFolderIcon; } - WXImage img = NULL; + WXImage img = nullptr; if ( theId != 0 ) { - IconRef iconRef = NULL ; + IconRef iconRef = nullptr ; wxOSX_VERIFY_NOERR(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ; img = wxOSXGetNSImageFromIconRef(iconRef); @@ -1955,7 +1955,7 @@ bool wxICNSResourceHandler::LoadFile(wxBitmap *bitmap, wxCFStringRef resname(resourceName); wxCFStringRef restype(GetExtension().Lower()); - iconURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, NULL)); + iconURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, nullptr)); img = wxOSXGetNSImageFromCFURL(iconURL); } @@ -1987,30 +1987,30 @@ bool wxBundleResourceHandler::LoadFile(wxBitmap *bitmap, if ( contentScaleFactor > 1 ) { wxCFStringRef resname(wxString::Format("%s@%dx", name, contentScaleFactor)); - imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, NULL)); + imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, nullptr)); scale = contentScaleFactor; } - if ( imageURL.get() == NULL ) + if ( imageURL.get() == nullptr ) { wxCFStringRef resname(name); - imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, NULL)); + imageURL.reset(CFBundleCopyResourceURL(CFBundleGetMainBundle(), resname, restype, nullptr)); scale = 1.0; } - if ( imageURL.get() != NULL ) + if ( imageURL.get() != nullptr ) { // Create the data provider object wxCFRef provider(CGDataProviderCreateWithURL (imageURL) ); - CGImageRef image = NULL; + CGImageRef image = nullptr; if ( ext == "jpeg" ) - image = CGImageCreateWithJPEGDataProvider (provider, NULL, true, + image = CGImageCreateWithJPEGDataProvider (provider, nullptr, true, kCGRenderingIntentDefault); else if ( ext == "png" ) - image = CGImageCreateWithPNGDataProvider (provider, NULL, true, + image = CGImageCreateWithPNGDataProvider (provider, nullptr, true, kCGRenderingIntentDefault); - if ( image != NULL ) + if ( image != nullptr ) { bitmap->Create(image,scale); CGImageRelease(image); @@ -2025,9 +2025,9 @@ bool wxBundleResourceHandler::LoadFile(wxBitmap *bitmap, wxBitmap wxBitmapHelpers::NewFromPNGData(const void* data, size_t size) { wxCFRef - provider(CGDataProviderCreateWithData(NULL, data, size, NULL) ); + provider(CGDataProviderCreateWithData(nullptr, data, size, nullptr) ); wxCFRef - image(CGImageCreateWithPNGDataProvider(provider, NULL, true, + image(CGImageCreateWithPNGDataProvider(provider, nullptr, true, kCGRenderingIntentDefault)); return wxBitmap(image); @@ -2052,10 +2052,10 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { if ( !IsOk() ) // no bitmap, no data (raw or otherwise) - return NULL; + return nullptr; if ( bpp != GetDepth() ) - return NULL; + return nullptr; data.m_width = GetWidth() ; data.m_height = GetHeight() ; diff --git a/src/osx/core/bmpbndl.mm b/src/osx/core/bmpbndl.mm index 8810a2576d..a363f6ed96 100644 --- a/src/osx/core/bmpbndl.mm +++ b/src/osx/core/bmpbndl.mm @@ -41,7 +41,7 @@ namespace { class wxOSXImageHolder { public: - wxOSXImageHolder() : m_nsImage(NULL) + wxOSXImageHolder() : m_nsImage(nullptr) { } @@ -86,7 +86,7 @@ WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromBundleImpl(const wxBitmapBundleImpl* i if (image != gs_nativeImages.end()) return image->second.GetImage(); else - return NULL; + return nullptr; } void WXDLLIMPEXP_CORE wxOSXSetImageForBundleImpl(const wxBitmapBundleImpl* impl, WXImage image) @@ -210,15 +210,15 @@ wxBitmapBundle wxBitmapBundle::FromFiles(const wxString& path, const wxString& f wxCFRef imageURL(wxOSXCreateURLFromFileSystemPath(fn.GetFullPath())); // Create the data provider object wxCFRef provider(CGDataProviderCreateWithURL(imageURL)); - CGImageRef image = NULL; + CGImageRef image = nullptr; if ( ext == "jpeg" ) - image = CGImageCreateWithJPEGDataProvider (provider, NULL, true, + image = CGImageCreateWithJPEGDataProvider (provider, nullptr, true, kCGRenderingIntentDefault); else if ( ext == "png" ) - image = CGImageCreateWithPNGDataProvider (provider, NULL, true, + image = CGImageCreateWithPNGDataProvider (provider, nullptr, true, kCGRenderingIntentDefault); - if ( image != NULL ) + if ( image != nullptr ) { wxBitmap bmp(image, dpiFactor); CGImageRelease(image); @@ -238,13 +238,13 @@ wxBitmapBundle wxBitmapBundle::FromResources(const wxString& name) WXImage wxOSXGetImageFromBundle(const wxBitmapBundle& bundle) { if (!bundle.IsOk()) - return NULL; + return nullptr; wxBitmapBundleImpl* impl = bundle.GetImpl(); WXImage image = wxOSXGetImageFromBundleImpl(impl); - if (image == 0) + if (image == nullptr) { wxSize sz = impl->GetDefaultSize(); diff --git a/src/osx/core/cfstring.cpp b/src/osx/core/cfstring.cpp index 977b316282..dfb9badf47 100644 --- a/src/osx/core/cfstring.cpp +++ b/src/osx/core/cfstring.cpp @@ -632,7 +632,7 @@ wxString wxCFStringRef::AsStringWithNormalizationFormC( CFStringRef ref, wxFontE if ( !ref ) return wxEmptyString ; - CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, ref); + CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(nullptr, 0, ref); CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); wxString str = wxCFStringRef::AsString(cfMutableString,encoding); CFRelease(cfMutableString); @@ -662,7 +662,7 @@ wxString wxCFStringRef::AsString( CFStringRef ref, wxFontEncoding WXUNUSED_IN_UN CFIndex cStrLen ; CFStringGetBytes( ref , CFRangeMake(0, cflen) , cfencoding , - '?' , false , NULL , 0 , &cStrLen ) ; + '?' , false , nullptr , 0 , &cStrLen ) ; char* buf = new char[cStrLen]; CFStringGetBytes( ref , CFRangeMake(0, cflen) , cfencoding, '?' , false , (unsigned char*) buf , cStrLen , &cStrLen) ; diff --git a/src/osx/core/colour.cpp b/src/osx/core/colour.cpp index df20207bc7..1358a4d494 100644 --- a/src/osx/core/colour.cpp +++ b/src/osx/core/colour.cpp @@ -32,7 +32,7 @@ public: wxCGColorRefData(const wxCGColorRefData& other); - virtual bool IsOk() const override{ return m_cgColour != NULL; } + virtual bool IsOk() const override{ return m_cgColour != nullptr; } virtual CGFloat Red() const override { return m_red; } virtual CGFloat Green() const override { return m_green; } @@ -94,7 +94,7 @@ void wxCGColorRefData::Init(CGFloat components[4]) wxCGColorRefData::wxCGColorRefData(CGColorRef col) { - wxASSERT_MSG(col != NULL, "Invalid CoreGraphics Color"); + wxASSERT_MSG(col != nullptr, "Invalid CoreGraphics Color"); m_cgColour.reset(col); wxCFRef rgbacol; @@ -120,7 +120,7 @@ wxCGColorRefData::wxCGColorRefData(CGColorRef col) { if ( WX_IS_MACOS_OR_IOS_AVAILABLE(10, 11, 9, 0) ) { - rgbacol = CGColorCreateCopyByMatchingToColorSpace(wxMacGetGenericRGBColorSpace(), kCGRenderingIntentDefault, col, NULL); + rgbacol = CGColorCreateCopyByMatchingToColorSpace(wxMacGetGenericRGBColorSpace(), kCGRenderingIntentDefault, col, nullptr); noComp = CGColorGetNumberOfComponents(rgbacol); components = CGColorGetComponents(rgbacol); } @@ -155,7 +155,7 @@ wxColour::wxColour(const RGBColor& col) wxColour::wxColour(CGColorRef col) { - wxASSERT_MSG(col != NULL, "Invalid CoreGraphics Color"); + wxASSERT_MSG(col != nullptr, "Invalid CoreGraphics Color"); m_refData = new wxCGColorRefData(col); } @@ -208,7 +208,7 @@ void wxColour::GetRGBColor(RGBColor* col) const CGColorRef wxColour::GetCGColor() const { - wxCHECK_MSG( IsOk(), NULL, "invalid colour" ); + wxCHECK_MSG( IsOk(), nullptr, "invalid colour" ); return M_COLDATA->GetCGColor(); } @@ -216,14 +216,14 @@ CGColorRef wxColour::GetCGColor() const #if wxOSX_USE_COCOA WX_NSColor wxColour::OSXGetNSColor() const { - wxCHECK_MSG( IsOk(), NULL, "invalid colour" ); + wxCHECK_MSG( IsOk(), nullptr, "invalid colour" ); return M_COLDATA->GetNSColor(); } WX_NSImage wxColour::OSXGetNSPatternImage() const { - wxCHECK_MSG( IsOk(), NULL, "invalid colour" ); + wxCHECK_MSG( IsOk(), nullptr, "invalid colour" ); return M_COLDATA->GetNSPatternImage(); } diff --git a/src/osx/core/dcmemory.cpp b/src/osx/core/dcmemory.cpp index ca67cb4686..699fb18884 100644 --- a/src/osx/core/dcmemory.cpp +++ b/src/osx/core/dcmemory.cpp @@ -56,7 +56,7 @@ wxMemoryDCImpl::~wxMemoryDCImpl() { if ( m_selected.IsOk() ) { - m_selected.SetSelectedInto(NULL); + m_selected.SetSelectedInto(nullptr); wxDELETE(m_graphicContext); } } @@ -65,7 +65,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { if ( m_selected.IsOk() ) { - m_selected.SetSelectedInto(NULL); + m_selected.SetSelectedInto(nullptr); wxDELETE(m_graphicContext); } @@ -74,7 +74,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) { wxASSERT_MSG( !bitmap.GetSelectedInto() || (bitmap.GetSelectedInto() == GetOwner()), - "Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)" ); + "Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(nullptr)" ); m_selected.SetSelectedInto(GetOwner()); m_width = bitmap.GetLogicalWidth(); @@ -93,7 +93,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) m_graphicContext->SetContentScaleFactor(m_contentScaleFactor); } } - m_ok = (m_graphicContext != NULL) ; + m_ok = (m_graphicContext != nullptr) ; } else { diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index ea6fb0b4f5..7ac37076c4 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -145,7 +145,7 @@ static CGDisplayErr wxOSXGetDisplayList(CGDisplayCount maxDisplays, CGDisplayErr error = kCGErrorSuccess; CGDisplayCount onlineCount; - error = CGGetOnlineDisplayList(0,NULL,&onlineCount); + error = CGGetOnlineDisplayList(0,nullptr,&onlineCount); if ( error == kCGErrorSuccess ) { *displayCount = 0; @@ -160,7 +160,7 @@ static CGDisplayErr wxOSXGetDisplayList(CGDisplayCount maxDisplays, if ( CGDisplayMirrorsDisplay(onlineDisplays[i]) != kCGNullDirectDisplay ) continue; - if ( displays == NULL ) + if ( displays == nullptr ) *displayCount += 1; else { @@ -182,7 +182,7 @@ static int wxOSXGetDisplayFromID( CGDirectDisplayID theID ) { int nWhich = wxNOT_FOUND; CGDisplayCount theCount; - CGDisplayErr err = wxOSXGetDisplayList(0, NULL, &theCount); + CGDisplayErr err = wxOSXGetDisplayList(0, nullptr, &theCount); if (err == CGDisplayNoErr && theCount > 0 ) { @@ -207,7 +207,7 @@ static int wxOSXGetDisplayFromID( CGDirectDisplayID theID ) unsigned wxDisplayFactoryMacOSX::GetCount() { CGDisplayCount count; - CGDisplayErr err = wxOSXGetDisplayList(0, NULL, &count); + CGDisplayErr err = wxOSXGetDisplayList(0, nullptr, &count); wxCHECK_MSG( err == CGDisplayNoErr, 0, "wxOSXGetDisplayList() failed" ); @@ -231,11 +231,11 @@ int wxDisplayFactoryMacOSX::GetFromPoint(const wxPoint& p) int wxDisplayFactoryMacOSX::GetFromWindow(const wxWindow *window) { - wxCHECK_MSG( window, wxNOT_FOUND, "window can't be NULL" ); + wxCHECK_MSG( window, wxNOT_FOUND, "window can't be null" ); wxNonOwnedWindow* const tlw = window->MacGetTopLevelWindow(); // not yet instantiated - if ( tlw->GetWXWindow() == NULL ) + if ( tlw->GetWXWindow() == nullptr ) return wxNOT_FOUND; int x,y,w,h; @@ -245,9 +245,9 @@ int wxDisplayFactoryMacOSX::GetFromWindow(const wxWindow *window) CGRect r = CGRectMake(x, y, w, h); CGDisplayCount theCount; - CGDisplayErr err = CGGetDisplaysWithRect(r, 0, NULL, &theCount); + CGDisplayErr err = CGGetDisplaysWithRect(r, 0, nullptr, &theCount); wxCHECK_MSG( err == CGDisplayNoErr, - wxNOT_FOUND, "CGGetDisplaysWithRect(NULL) failed" ); + wxNOT_FOUND, "CGGetDisplaysWithRect(nullptr) failed" ); wxScopedArray theIDs(theCount); err = CGGetDisplaysWithRect(r, theCount, theIDs.get(), &theCount); @@ -274,9 +274,9 @@ wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n) wxScopedArray theIDs(theCount); CGDisplayErr err = wxOSXGetDisplayList(theCount, theIDs.get(), &theCount); - wxCHECK_MSG( err == CGDisplayNoErr, NULL, "wxOSXGetDisplayList() failed" ); + wxCHECK_MSG( err == CGDisplayNoErr, nullptr, "wxOSXGetDisplayList() failed" ); - wxCHECK_MSG( n < theCount, NULL, wxS("Invalid display index") ); + wxCHECK_MSG( n < theCount, nullptr, wxS("Invalid display index") ); return new wxDisplayImplMacOSX(n, theIDs[n]); } @@ -328,7 +328,7 @@ wxArrayVideoModes wxDisplayImplMacOSX::GetModes(const wxVideoMode& mode) const { wxArrayVideoModes resultModes; - wxCFRef theArray(CGDisplayCopyAllDisplayModes( m_id ,NULL ) ); + wxCFRef theArray(CGDisplayCopyAllDisplayModes( m_id ,nullptr ) ); for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i) { @@ -372,7 +372,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) wxT("at least the width and height must be specified") ); bool bOK = false; - wxCFRef theArray(CGDisplayCopyAllDisplayModes( m_id ,NULL ) ); + wxCFRef theArray(CGDisplayCopyAllDisplayModes( m_id ,nullptr ) ); for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i) { @@ -388,7 +388,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) ( mode.GetDepth() == 0 || theMode.GetDepth() == mode.GetDepth() ) && ( mode.GetRefresh() == 0 || theMode.GetRefresh() == mode.GetRefresh() ) ) { - CGDisplaySetDisplayMode( m_id, theValue , NULL ); + CGDisplaySetDisplayMode( m_id, theValue , nullptr ); bOK = true; break; } diff --git a/src/osx/core/evtloop_cf.cpp b/src/osx/core/evtloop_cf.cpp index 9004763836..54d7e36c80 100644 --- a/src/osx/core/evtloop_cf.cpp +++ b/src/osx/core/evtloop_cf.cpp @@ -397,10 +397,10 @@ static bool gs_bGuiOwnedByMainThread = true; // critical section which controls access to all GUI functions: any secondary // thread (i.e. except the main one) must enter this crit section before doing // any GUI calls -static wxCriticalSection *gs_critsectGui = NULL; +static wxCriticalSection *gs_critsectGui = nullptr; // critical section which protects gs_nWaitingForGui variable -static wxCriticalSection *gs_critsectWaitingForGui = NULL; +static wxCriticalSection *gs_critsectWaitingForGui = nullptr; // number of threads waiting for GUI in wxMutexGuiEnter() static size_t gs_nWaitingForGui = 0; diff --git a/src/osx/core/fontenum.cpp b/src/osx/core/fontenum.cpp index 2fc33ff908..6b0f27eed5 100644 --- a/src/osx/core/fontenum.cpp +++ b/src/osx/core/fontenum.cpp @@ -57,7 +57,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, if ( encoding != wxFONTENCODING_SYSTEM || fixedWidthOnly) { - wxCFRef font(CTFontCreateWithName(fontName, 12.0, NULL)); + wxCFRef font(CTFontCreateWithName(fontName, 12.0, nullptr)); if ( encoding != wxFONTENCODING_SYSTEM ) { CFStringEncoding fontFamiliyEncoding = CTFontGetStringEncoding(font); diff --git a/src/osx/core/hid.cpp b/src/osx/core/hid.cpp index 4cb408dc51..d63e447019 100644 --- a/src/osx/core/hid.cpp +++ b/src/osx/core/hid.cpp @@ -71,7 +71,7 @@ bool wxHIDDevice::Create (int nClass, int nType, int nDev) //the services we want to hid services (and also eats the //dictionary up for us (consumes one reference)) CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey); - if(pDictionary == NULL) + if(pDictionary == nullptr) { wxLogSysError( wxT("IOServiceMatching(kIOHIDDeviceKey) failed") ); return false; @@ -235,7 +235,7 @@ size_t wxHIDDevice::GetCount (int nClass, int nType) //the matching dictionary for determining which kind of devices we want, //then later some registry properties from an iterator (see below) CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey); - if(pDictionary == NULL) + if(pDictionary == nullptr) { wxLogSysError( wxT("IOServiceMatching(kIOHIDDeviceKey) failed") ); return false; @@ -328,7 +328,7 @@ void wxHIDDevice::InitCookies(size_t dwSize, bool bQueue) m_pCookies = new IOHIDElementCookie[dwSize]; if (bQueue) { - wxASSERT( m_ppQueue == NULL); + wxASSERT( m_ppQueue == nullptr); m_ppQueue = (*m_ppDevice)->allocQueue(m_ppDevice); if ( !m_ppQueue ) { @@ -385,9 +385,9 @@ bool wxHIDDevice::HasElement(int nIndex) // ---------------------------------------------------------------------------- wxHIDDevice::~wxHIDDevice() { - if (m_ppDevice != NULL) + if (m_ppDevice != nullptr) { - if (m_ppQueue != NULL) + if (m_ppQueue != nullptr) { (*m_ppQueue)->stop(m_ppQueue); (*m_ppQueue)->dispose(m_ppQueue); @@ -398,7 +398,7 @@ wxHIDDevice::~wxHIDDevice() mach_port_deallocate(mach_task_self(), m_pPort); } - if (m_pCookies != NULL) + if (m_pCookies != nullptr) { delete [] m_pCookies; } @@ -483,7 +483,7 @@ void wxHIDKeyboard::DoBuildCookies(CFArrayRef Array) CFSTR(kIOHIDElementKey) ); - if (ref != NULL) + if (ref != nullptr) { DoBuildCookies((CFArrayRef) ref); } diff --git a/src/osx/core/hidjoystick.cpp b/src/osx/core/hidjoystick.cpp index bdf39f01cc..6978e9b93d 100644 --- a/src/osx/core/hidjoystick.cpp +++ b/src/osx/core/hidjoystick.cpp @@ -140,11 +140,11 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject); // // 1) Initializes member variables // 2) Attempts to create the native HID joystick implementation - if none -// could be found (no joysticks, etc.) then it sets it to NULL +// could be found (no joysticks, etc.) then it sets it to nullptr //--------------------------------------------------------------------------- wxJoystick::wxJoystick(int joystick) : m_joystick(joystick), - m_thread(NULL) + m_thread(nullptr) { m_hid = new wxHIDJoystick(); @@ -249,7 +249,7 @@ bool wxJoystick::GetButtonState(unsigned int id) const //--------------------------------------------------------------------------- bool wxJoystick::IsOk() const { - return m_hid != NULL; + return m_hid != nullptr; } //--------------------------------------------------------------------------- @@ -350,7 +350,7 @@ bool wxJoystick::ReleaseCapture() { if (m_thread) { - m_thread->m_catchwin = NULL; + m_thread->m_catchwin = nullptr; m_thread->m_polling = 0; return true; } @@ -603,7 +603,7 @@ void wxHIDJoystick::MakeCookies(CFArrayRef Array) CFSTR(kIOHIDElementKey) ); - if (ref != NULL) + if (ref != nullptr) { MakeCookies((CFArrayRef) ref); } @@ -710,7 +710,7 @@ wxJoystickThread::wxJoystickThread(wxHIDJoystick* hid, int joystick) m_joystick(joystick), m_lastposition(127,127), m_buttons(0), - m_catchwin(NULL), + m_catchwin(nullptr), m_polling(0) { memset(m_axe, 0, sizeof(int) * wxJS_MAX_AXES); @@ -729,16 +729,16 @@ wxJoystickThread::wxJoystickThread(wxHIDJoystick* hid, int joystick) //--------------------------------------------------------------------------- void* wxJoystickThread::Entry() { - CFRunLoopSourceRef pRLSource = NULL; + CFRunLoopSourceRef pRLSource = nullptr; if ((*m_hid->GetQueue())->createAsyncEventSource( m_hid->GetQueue(), &pRLSource) != kIOReturnSuccess ) { wxLogSysError(wxT("Couldn't create async event source")); - return NULL; + return nullptr; } - wxASSERT(pRLSource != NULL); + wxASSERT(pRLSource != nullptr); //attach runloop source to main run loop in thread CFRunLoopRef pRL = CFRunLoopGetCurrent(); @@ -750,13 +750,13 @@ void* wxJoystickThread::Entry() wxJoystickThread::HIDCallback, this, this) != kIOReturnSuccess ) { wxLogSysError(wxT("Could not set event callout for queue")); - return NULL; + return nullptr; } if( (*m_hid->GetQueue())->start(m_hid->GetQueue()) != kIOReturnSuccess ) { wxLogSysError(wxT("Could not start queue")); - return NULL; + return nullptr; } double dTime; @@ -776,7 +776,7 @@ void* wxJoystickThread::Entry() #if 1 CFRunLoopRunInMode(kCFRunLoopDefaultMode, dTime, true); #else - IOReturn ret = NULL; + IOReturn ret = nullptr; HIDCallback(this, ret, this, this); Sleep(3000); #endif @@ -787,7 +787,7 @@ void* wxJoystickThread::Entry() CFRunLoopRemoveSource(pRL, pRLSource, kCFRunLoopDefaultMode); CFRelease(pRLSource); - return NULL; + return nullptr; } //--------------------------------------------------------------------------- diff --git a/src/osx/core/mimetype.cpp b/src/osx/core/mimetype.cpp index 9f878b0ab3..954e7a7db6 100644 --- a/src/osx/core/mimetype.cpp +++ b/src/osx/core/mimetype.cpp @@ -130,7 +130,7 @@ bool CheckDocTypeMatchesExt( CFDictionaryRef docType, CFStringRef requiredExt ) CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt ) { if( !docTypeData ) - return NULL; + return nullptr; if( CFGetTypeID( docTypeData ) == CFArrayGetTypeID() ) { @@ -161,7 +161,7 @@ CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt return docType; } - return NULL; + return nullptr; } @@ -170,7 +170,7 @@ CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt // path to that icon. Returns the path, or an empty wxString on failure wxString GetPathForIconFile( CFBundleRef bundle, CFStringRef iconFile ) { - // If either parameter is NULL there is no hope of success + // If either parameter is null there is no hope of success if( !bundle || !iconFile ) return wxEmptyString; @@ -215,7 +215,7 @@ wxString GetPathForIconFile( CFBundleRef bundle, CFStringRef iconFile ) wxCFStringRef iconExt = CFStringCreateWithSubstring( kCFAllocatorDefault, iconFile, iconExtRange ); // Now it is possible to query the URL for the icon as a resource - wxCFRef< CFURLRef > iconUrl = wxCFRef< CFURLRef >( CFBundleCopyResourceURL( bundle, iconName, iconExt, NULL ) ); + wxCFRef< CFURLRef > iconUrl = wxCFRef< CFURLRef >( CFBundleCopyResourceURL( bundle, iconName, iconExt, nullptr ) ); if( !iconUrl.get() ) return wxEmptyString; @@ -249,7 +249,7 @@ wxMimeTypesManagerImpl::~wxMimeTypesManagerImpl() // // If this behaviour really messes up your app, please feel free to implement // the trawling approach (perhaps with a configure switch?). A good place to -// start would be CFBundleCreateBundlesFromDirectory( NULL, "/Applications", "app" ) +// start would be CFBundleCreateBundlesFromDirectory( nullptr, "/Applications", "app" ) ///////////////////////////////////////////////////////////////////////////// @@ -311,7 +311,7 @@ void wxMimeTypesManagerImpl::ClearData() // One other point which may require consideration is handling of unrecognised // types. Using UTI these will be assigned a unique ID of dyn.xxx. This will // result in a wxFileType object being returned, although querying properties -// on that object will fail. If it would be more helpful to return NULL in this +// on that object will fail. If it would be more helpful to return nullptr in this // case a suitable check can be added. ///////////////////////////////////////////////////////////////////////////// @@ -326,7 +326,7 @@ wxFileType *wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext if( extItr == m_extMap.end() ) { - wxCFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, wxCFStringRef( ext ), NULL ); + wxCFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, wxCFStringRef( ext ), nullptr ); m_extMap[ ext ] = uti = utiRef.AsString(); } else @@ -346,7 +346,7 @@ wxFileType *wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mime if( mimeItr == m_mimeMap.end() ) { - wxCFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, wxCFStringRef( mimeType ), NULL ); + wxCFStringRef utiRef = UTTypeCreatePreferredIdentifierForTag( kUTTagClassFilenameExtension, wxCFStringRef( mimeType ), nullptr ); m_mimeMap[ mimeType ] = uti = utiRef.AsString(); } else @@ -427,7 +427,7 @@ void wxMimeTypesManagerImpl::LoadDisplayDataForUti(const wxString& uti) wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( cfuti, kUTTagClassFilenameExtension ); // Look up the preferred application - wxCFRef appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, NULL); + wxCFRef appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, nullptr); if( !appUrl ) return; @@ -492,7 +492,7 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& WXUNUSED(mimetype wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& WXUNUSED(ftInfo)) { - return 0; + return nullptr; } bool wxMimeTypesManagerImpl::Unassociate(wxFileType *WXUNUSED(ft)) diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index c69ad4d0cc..56f585706e 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -65,7 +65,7 @@ static int ResolutionSorter(const void *e1, const void *e2) static PMResolution *GetSupportedResolutions(PMPrinter printer, UInt32 *count) { - PMResolution res, *resolutions = NULL; + PMResolution res, *resolutions = nullptr; OSStatus status = PMPrinterGetPrinterResolutionCount(printer, count); if (status == noErr) { @@ -83,7 +83,7 @@ static PMResolution *GetSupportedResolutions(PMPrinter printer, UInt32 *count) if ((*count == 0) && (resolutions)) { free(resolutions); - resolutions = NULL; + resolutions = nullptr; } return resolutions; } @@ -124,7 +124,7 @@ void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data ) if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr) { CFIndex index, count; - PMPrinter printer = NULL; + PMPrinter printer = nullptr; count = CFArrayGetCount(printerList); for (index = 0; index < count; index++) { @@ -175,7 +175,7 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data ) fabs( height - papersize.y ) >= 5 ) { // we have to change the current paper - CFArrayRef paperlist = 0 ; + CFArrayRef paperlist = nullptr ; if ( PMPrinterGetPaperList( printer, &paperlist ) == noErr ) { PMPaper bestPaper = kPMNoData ; @@ -523,7 +523,7 @@ wxPrintNativeDataBase* wxOSXCreatePrintData() #if wxOSX_USE_COCOA return new wxOSXCocoaPrintData(); #else - return NULL; + return nullptr; #endif } @@ -545,7 +545,7 @@ wxMacPrinter::~wxMacPrinter() bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; - sm_abortWindow = NULL; + sm_abortWindow = nullptr; if (!printout) { @@ -559,7 +559,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) m_printDialogData.SetMaxPage(9999); // Create a suitable device context - wxPrinterDC *dc = NULL; + wxPrinterDC *dc = nullptr; if (prompt) { wxMacPrintDialog dialog(parent, & m_printDialogData); @@ -681,7 +681,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) wxDC* wxMacPrinter::PrintDialog(wxWindow *parent) { - wxDC* dc = NULL; + wxDC* dc = nullptr; wxPrintDialog dialog(parent, & m_printDialogData); int ret = dialog.ShowModal(); diff --git a/src/osx/core/secretstore.cpp b/src/osx/core/secretstore.cpp index db512b04f1..50d2eef5f7 100644 --- a/src/osx/core/secretstore.cpp +++ b/src/osx/core/secretstore.cpp @@ -45,7 +45,7 @@ public: PasswordData() { m_size = 0; - m_data = NULL; + m_data = nullptr; } // These methods are only supposed to be used once to fill in the data. @@ -59,7 +59,7 @@ public: ~PasswordData() { if ( m_data ) - SecKeychainItemFreeContent(NULL, m_data); + SecKeychainItemFreeContent(nullptr, m_data); } private: @@ -72,7 +72,7 @@ private: // Implement wxSecretStore API using OS X Keychain Services. // // Note that this implementation currently always uses the default keychain by -// passing NULL to the keychain functions, but it would be simple to allow +// passing nullptr to the keychain functions, but it would be simple to allow // using other keychains if required. class wxSecretStoreOSXImpl : public wxSecretStoreImpl { @@ -101,14 +101,14 @@ public: OSStatus err = SecKeychainAddGenericPassword ( - NULL, // default keychain + nullptr, // default keychain serviceUTF8.length(), serviceUTF8.data(), userUTF8.length(), userUTF8.data(), secret.GetSize(), secret.GetData(), - NULL // no output item + nullptr // no output item ); if ( err != errSecSuccess ) @@ -128,14 +128,14 @@ public: const wxScopedCharBuffer serviceUTF8 = service.utf8_str(); PasswordData password; - SecKeychainItemRef itemRef = NULL; + SecKeychainItemRef itemRef = nullptr; OSStatus err = SecKeychainFindGenericPassword ( - NULL, // default keychain + nullptr, // default keychain serviceUTF8.length(), serviceUTF8.data(), 0, // no account name - NULL, + nullptr, password.SizePtr(), password.DataPtr(), &itemRef @@ -157,15 +157,15 @@ public: attrInfo.tag = &attrTag; attrInfo.format = &attrFormat; - SecKeychainAttributeList* attrList = NULL; + SecKeychainAttributeList* attrList = nullptr; err = SecKeychainItemCopyAttributesAndData ( itemRef, &attrInfo, // attrs to get - NULL, // no output item class + nullptr, // no output item class &attrList, // output attr - 0, // no output data - NULL // (length/data) + nullptr, // no output data + nullptr // (length/data) ); if ( err != errSecSuccess ) @@ -175,13 +175,13 @@ public: return false; } - if ( SecKeychainAttribute* attr = attrList ? attrList->attr : NULL ) + if ( SecKeychainAttribute* attr = attrList ? attrList->attr : nullptr ) { *user = wxString::FromUTF8(static_cast(attr->data), attr->length); } - SecKeychainItemFreeAttributesAndData(attrList, NULL); + SecKeychainItemFreeAttributesAndData(attrList, nullptr); *secret = new wxSecretValueGenericImpl(password.GetSize(), password.GetData()); @@ -194,16 +194,16 @@ public: { const wxScopedCharBuffer serviceUTF8 = service.utf8_str(); - SecKeychainItemRef itemRef = NULL; + SecKeychainItemRef itemRef = nullptr; OSStatus err = SecKeychainFindGenericPassword ( - NULL, // default keychain + nullptr, // default keychain serviceUTF8.length(), serviceUTF8.data(), 0, // no account name - NULL, - 0, // no output password - NULL, // (length/data) + nullptr, + nullptr, // no output password + nullptr, // (length/data) &itemRef ); wxCFRef ensureItemRefReleased(itemRef); @@ -229,7 +229,7 @@ private: // Just a tiny helper wrapper. static wxString GetSecurityErrorMessage(OSStatus err) { - return wxCFStringRef(SecCopyErrorMessageString(err, NULL)).AsString(); + return wxCFStringRef(SecCopyErrorMessageString(err, nullptr)).AsString(); } }; diff --git a/src/osx/core/sockosx.cpp b/src/osx/core/sockosx.cpp index 29f9ca93a3..e8e630b2bf 100644 --- a/src/osx/core/sockosx.cpp +++ b/src/osx/core/sockosx.cpp @@ -30,7 +30,7 @@ namespace // Sockets must use the event loop to monitor the events so we store a // reference to the main thread event loop here -static CFRunLoopRef gs_mainRunLoop = NULL; +static CFRunLoopRef gs_mainRunLoop = nullptr; // ---------------------------------------------------------------------------- // Mac-specific socket implementation @@ -42,8 +42,8 @@ public: wxSocketImplMac(wxSocketBase& wxsocket) : wxSocketImplUnix(wxsocket) { - m_socket = NULL; - m_source = NULL; + m_socket = nullptr; + m_source = nullptr; } virtual ~wxSocketImplMac() @@ -83,10 +83,10 @@ private: CFSocketInvalidate(m_socket); CFRelease(m_source); - m_source = NULL; + m_source = nullptr; CFRelease(m_socket); - m_socket = NULL; + m_socket = nullptr; } // initialize the data associated with the given socket @@ -99,13 +99,13 @@ private: CFSocketContext cont; cont.version = 0; // this currently must be 0 cont.info = this; // pointer passed to our callback - cont.retain = NULL; // no need to retain/release/copy the - cont.release = NULL; // socket pointer, so all callbacks - cont.copyDescription = NULL; // can be left NULL + cont.retain = nullptr; // no need to retain/release/copy the + cont.release = nullptr; // socket pointer, so all callbacks + cont.copyDescription = nullptr; // can be left nullptr m_socket = CFSocketCreateWithNative ( - NULL, // default allocator + nullptr, // default allocator m_fd, kCFSocketReadCallBack | kCFSocketWriteCallBack | @@ -116,12 +116,12 @@ private: if ( !m_socket ) return false; - m_source = CFSocketCreateRunLoopSource(NULL, m_socket, 0); + m_source = CFSocketCreateRunLoopSource(nullptr, m_socket, 0); if ( !m_source ) { CFRelease(m_socket); - m_socket = NULL; + m_socket = nullptr; return false; } @@ -143,13 +143,13 @@ private: { case kCFSocketConnectCallBack: wxASSERT(!socket->IsServer()); - // KH: If data is non-NULL, the connect failed, do not call Detected_Write, + // KH: If data is non-null, the connect failed, do not call Detected_Write, // which will only end up creating a spurious connect event because the // call to getsocketopt SO_ERROR inexplicably returns no error. // The change in behaviour cannot be traced to any particular commit or // timeframe so I'm not sure what to think, but after so many hours, // this seems to address the issue and it's time to move on. - if (data == NULL) + if (data == nullptr) socket->OnWriteWaiting(); break; @@ -211,7 +211,7 @@ private: bool wxSocketManagerMac::OnInit() { // No need to store the main loop again - if (gs_mainRunLoop != NULL) + if (gs_mainRunLoop != nullptr) return true; // Get the loop for the main thread so our events will actually fire. @@ -228,9 +228,9 @@ bool wxSocketManagerMac::OnInit() void wxSocketManagerMac::OnExit() { - // Release the reference count, and set the reference back to NULL + // Release the reference count, and set the reference back to nullptr CFRelease(gs_mainRunLoop); - gs_mainRunLoop = NULL; + gs_mainRunLoop = nullptr; } /* static */ diff --git a/src/osx/core/sound.cpp b/src/osx/core/sound.cpp index 4f21b88128..9043850ada 100644 --- a/src/osx/core/sound.cpp +++ b/src/osx/core/sound.cpp @@ -106,7 +106,7 @@ bool wxOSXAudioToolboxSoundData::Play(unsigned flags) m_flags = flags; - AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this ); + AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), nullptr, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this ); m_playing = true; diff --git a/src/osx/core/strconv_cf.cpp b/src/osx/core/strconv_cf.cpp index dfdca0fbc7..79dc5fe849 100644 --- a/src/osx/core/strconv_cf.cpp +++ b/src/osx/core/strconv_cf.cpp @@ -39,7 +39,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf( const char* name) if(!result->IsOk()) { delete result; - return NULL; + return nullptr; } else return result; @@ -52,7 +52,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) if(!result->IsOk()) { delete result; - return NULL; + return nullptr; } else return result; @@ -79,14 +79,14 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) // First create the temporary CFString wxCFRef theString( CFStringCreateWithBytes ( - NULL, //the allocator + nullptr, //the allocator (const UInt8*)src, srcSize, m_encoding, false //no BOM/external representation )); - if ( theString == NULL ) + if ( theString == nullptr ) return wxCONV_FAILED; if ( m_normalization & ToWChar_C ) @@ -95,14 +95,14 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) // important because Darwin uses decomposed form (NFD) for e.g. file // names but we want to use NFC internally. wxCFRef - cfMutableString(CFStringCreateMutableCopy(NULL, 0, theString)); + cfMutableString(CFStringCreateMutableCopy(nullptr, 0, theString)); CFStringNormalize(cfMutableString, kCFStringNormalizationFormC); theString = cfMutableString; } - /* NOTE: The string content includes the NULL element if the source string did + /* NOTE: The string content includes the null element if the source string did * That means we have to do nothing special because the destination will have - * the NULL element iff the source did and the NULL element will be included + * the null element iff the source did and the null element will be included * in the count iff it was included in the source count. */ @@ -115,8 +115,8 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) wxCFStringEncodingWcharT, 0, false, - // if dstSize is 0 then pass NULL to get required length in usedBufLen - dstSize != 0?(UInt8*)dst:NULL, + // if dstSize is 0 then pass nullptr to get required length in usedBufLen + dstSize != 0?(UInt8*)dst:nullptr, dstSize * sizeof(wchar_t), &usedBufLen); @@ -129,7 +129,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) wxASSERT( (usedBufLen % sizeof(wchar_t)) == 0 ); // CFStringGetBytes does exactly the right thing when buffer - // pointer is NULL and returns the number of bytes required + // pointer is null and returns the number of bytes required return usedBufLen / sizeof(wchar_t); } @@ -151,7 +151,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) wxCFStringEncodingWcharT, false)); - wxCHECK(theString != NULL, wxCONV_FAILED); + wxCHECK(theString != nullptr, wxCONV_FAILED); if ( m_normalization & FromWChar_D ) { @@ -172,8 +172,8 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) &usedBufLen ); - // when dst is non-NULL, we check usedBufLen against dstSize as - // CFStringGetBytes sometimes treats dst as being NULL when dstSize==0 + // when dst is non-null, we check usedBufLen against dstSize as + // CFStringGetBytes sometimes treats dst as being null when dstSize==0 if( (charsConverted < CFStringGetLength(theString)) || (dst && (size_t) usedBufLen > dstSize) ) return wxCONV_FAILED; @@ -189,12 +189,12 @@ wxMacUniCharBuffer::wxMacUniCharBuffer( const wxString &str ) { wxMBConvUTF16 converter ; #if wxUSE_UNICODE - size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ; + size_t unicharlen = converter.WC2MB( nullptr , str.wc_str() , 0 ) ; m_ubuf = (UniChar*) malloc( unicharlen + 2 ) ; converter.WC2MB( (char*) m_ubuf , str.wc_str(), unicharlen + 2 ) ; #else const wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ; - size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ; + size_t unicharlen = converter.WC2MB( nullptr , wchar.data() , 0 ) ; m_ubuf = (UniChar*) malloc( unicharlen + 2 ) ; converter.WC2MB( (char*) m_ubuf , wchar.data() , unicharlen + 2 ) ; #endif diff --git a/src/osx/core/timer.cpp b/src/osx/core/timer.cpp index 900295d2b6..585be9fbb6 100644 --- a/src/osx/core/timer.cpp +++ b/src/osx/core/timer.cpp @@ -27,7 +27,7 @@ struct wxOSXTimerInfo void wxProcessTimer(CFRunLoopTimerRef WXUNUSED(theTimer), void *data) { - if ( data == NULL ) + if ( data == nullptr ) return; wxOSXTimerImpl* timer = (wxOSXTimerImpl*)data; @@ -67,7 +67,7 @@ bool wxOSXTimerImpl::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") ); + wxCHECK_MSG( m_info->m_timerRef == nullptr, false, wxT("attempting to restart a timer") ); CFRunLoopTimerContext ctx ; memset( &ctx, 0 , sizeof(ctx) ); @@ -80,9 +80,9 @@ bool wxOSXTimerImpl::Start( int milliseconds, bool mode ) IsOneShot() ? 0 : CFTimeInterval( m_milli / 1000.0 ) , 0, 0, wxProcessTimer, &ctx); - wxASSERT_MSG( m_info->m_timerRef != NULL, wxT("unable to create timer")); + wxASSERT_MSG( m_info->m_timerRef != nullptr, wxT("unable to create timer")); - CFRunLoopRef runLoop = 0; + CFRunLoopRef runLoop = nullptr; #if wxOSX_USE_IPHONE runLoop = CFRunLoopGetMain(); #else diff --git a/src/osx/core/uilocale.mm b/src/osx/core/uilocale.mm index 923ec8e599..af817ae6c2 100644 --- a/src/osx/core/uilocale.mm +++ b/src/osx/core/uilocale.mm @@ -91,11 +91,11 @@ public: wxCFStringRef cfName(locId.GetName()); if ( ![(NSArray*)all.get() containsObject: cfName.AsNSString()] ) - return NULL; + return nullptr; auto nsloc = [NSLocale localeWithLocaleIdentifier: cfName.AsNSString()]; if ( !nsloc ) - return NULL; + return nullptr; return new wxUILocaleImplCF(nsloc); } @@ -149,7 +149,7 @@ wxUILocaleImplCF::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) const wxString wxUILocaleImplCF::GetLocalizedName(wxLocaleName name, wxLocaleForm form) const { - NSString* str = NULL; + NSString* str = nullptr; switch (name) { case wxLOCALE_NAME_LOCALE: diff --git a/src/osx/core/utilsexc_cf.cpp b/src/osx/core/utilsexc_cf.cpp index 011dc39c9f..71fc01a0c9 100644 --- a/src/osx/core/utilsexc_cf.cpp +++ b/src/osx/core/utilsexc_cf.cpp @@ -74,12 +74,12 @@ public: wxEventLoopSource * AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) override { - wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); + wxCHECK_MSG( fd != -1, nullptr, "can't monitor invalid fd" ); wxScopedPtr source(new wxCFEventLoopSource(handler, flags)); - CFSocketContext context = { 0, source.get(), NULL, NULL, NULL }; + CFSocketContext context = { 0, source.get(), nullptr, nullptr, nullptr }; int callbackTypes = 0; if ( flags & wxEVENT_SOURCE_INPUT ) @@ -100,7 +100,7 @@ public: if ( !cfSocket ) { wxLogError(wxS("Failed to create event loop source socket.")); - return NULL; + return nullptr; } // Adjust the socket options to suit our needs: @@ -129,7 +129,7 @@ public: { wxLogError(wxS("Failed to create low level event loop source.")); CFSocketInvalidate(cfSocket); - return NULL; + return nullptr; } // Save the socket so that we can remove it later if asked to. diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index c303b43545..b519255cb1 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -158,8 +158,8 @@ private: wxOSXDataViewModelNotifier::wxOSXDataViewModelNotifier(wxDataViewCtrl* initDataViewCtrlPtr) :m_DataViewCtrlPtr(initDataViewCtrlPtr) { - if (initDataViewCtrlPtr == NULL) - wxFAIL_MSG("Pointer to dataview control must not be NULL"); + if (initDataViewCtrlPtr == nullptr) + wxFAIL_MSG("Pointer to dataview control must not be null"); m_needsAdjustmentOnThaw = false; } @@ -193,7 +193,7 @@ bool wxOSXDataViewModelNotifier::ItemsAdded(wxDataViewItem const& parent, wxData bool wxOSXDataViewModelNotifier::ItemChanged(wxDataViewItem const& item) { wxCHECK_MSG(item.IsOk(), false,"Changed item is invalid."); - wxCHECK_MSG(GetOwner() != NULL,false,"Owner not initialized."); + wxCHECK_MSG(GetOwner() != nullptr,false,"Owner not initialized."); if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item)) { // send the equivalent wxWidgets event: @@ -263,7 +263,7 @@ bool wxOSXDataViewModelNotifier::ItemsDeleted(wxDataViewItem const& parent, wxDa bool wxOSXDataViewModelNotifier::ValueChanged(wxDataViewItem const& item, unsigned int col) { wxCHECK_MSG(item.IsOk(), false,"Passed item is invalid."); - wxCHECK_MSG(GetOwner() != NULL,false,"Owner not initialized."); + wxCHECK_MSG(GetOwner() != nullptr,false,"Owner not initialized."); if (m_DataViewCtrlPtr->GetDataViewPeer()->Update(GetOwner()->GetParent(item),item)) { wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, m_DataViewCtrlPtr, m_DataViewCtrlPtr->GetColumn(col), item); @@ -382,7 +382,7 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer() wxDC* wxDataViewCustomRenderer::GetDC() { - if ((m_DCPtr == NULL) && (GetOwner() != NULL) && (GetOwner()->GetOwner() != NULL)) + if ((m_DCPtr == nullptr) && (GetOwner() != nullptr) && (GetOwner()->GetOwner() != nullptr)) m_DCPtr = new wxClientDC(GetOwner()->GetOwner()); return m_DCPtr; } @@ -408,28 +408,28 @@ wxDataViewCtrl::~wxDataViewCtrl() // Ensure that the already destructed controls is not notified about changes // in the model any more. - if (m_ModelNotifier != NULL) + if (m_ModelNotifier != nullptr) m_ModelNotifier->GetOwner()->RemoveNotifier(m_ModelNotifier); } void wxDataViewCtrl::Init() { - m_CustomRendererPtr = NULL; - m_Deleting = NULL; - m_cgContext = NULL; - m_ModelNotifier = NULL; + m_CustomRendererPtr = nullptr; + m_Deleting = nullptr; + m_cgContext = nullptr; + m_ModelNotifier = nullptr; } bool wxDataViewCtrl::IsDeleting() const { - return m_Deleting != NULL; + return m_Deleting != nullptr; } bool wxDataViewCtrl::IsClearing() const { // We only set the item being deleted to an invalid item when we're // clearing the entire model. - return m_Deleting != NULL && !m_Deleting->m_parent.IsOk(); + return m_Deleting != nullptr && !m_Deleting->m_parent.IsOk(); } bool wxDataViewCtrl::Create(wxWindow *parent, @@ -459,19 +459,19 @@ bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model) wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); - wxCHECK_MSG(dataViewWidgetPtr != NULL,false,"Pointer to native control must not be NULL."); + wxCHECK_MSG(dataViewWidgetPtr != nullptr,false,"Pointer to native control must not be null."); // 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; + m_ModelNotifier = nullptr; } if (wxDataViewCtrlBase::AssociateModel(model) && dataViewWidgetPtr->AssociateModel(model)) { - if (model != NULL) + if (model != nullptr) { m_ModelNotifier = new wxOSXDataViewModelNotifier(this); model->AddNotifier(m_ModelNotifier); @@ -497,9 +497,9 @@ bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) wxDataViewWidgetImpl* dataViewWidgetPtr(GetDataViewPeer()); // first, some error checking: - 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(dataViewWidgetPtr != nullptr, false,"Pointer to native control must not be null."); + wxCHECK_MSG(columnPtr != nullptr, false,"Column pointer must not be null."); + wxCHECK_MSG(columnPtr->GetRenderer() != nullptr, false,"Column does not have a renderer."); // add column to wxWidget's internal structure: if (wxDataViewCtrlBase::InsertColumn(pos,columnPtr)) @@ -749,7 +749,7 @@ void wxDataViewCtrl::AddChildren(wxDataViewItem const& parentItem) { wxDataViewItemArray items; - wxCHECK_RET(GetModel() != NULL,"Model pointer not initialized."); + wxCHECK_RET(GetModel() != nullptr,"Model pointer not initialized."); GetModel()->GetChildren(parentItem,items); (void) GetModel()->ItemsAdded(parentItem,items); } @@ -763,7 +763,7 @@ void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn bool wxDataViewCtrl::DoEnableDropTarget(const wxVector &formats) { - wxDropTarget* dt = NULL; + wxDropTarget* dt = nullptr; if (wxDataObject* dataObject = CreateDataObject(formats)) { dt = new wxDropTarget(dataObject); @@ -782,7 +782,7 @@ void wxDataViewCtrl::FinishCustomItemEditing() { GetCustomRendererPtr()->FinishEditing(); SetCustomRendererItem(wxDataViewItem()); - SetCustomRendererPtr (NULL); + SetCustomRendererPtr (nullptr); } } @@ -817,7 +817,7 @@ wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) // inherited methods from wxDataViewCtrlBase void wxDataViewCtrl::DoSetExpanderColumn() { - if (GetExpanderColumn() != NULL) + if (GetExpanderColumn() != nullptr) GetDataViewPeer()->DoSetExpanderColumn(GetExpanderColumn()); } @@ -837,12 +837,12 @@ void wxDataViewCtrl::OnSize(wxSizeEvent& event) { wxDataViewColumn* dataViewColumnPtr(GetColumn(i)); - if (dataViewColumnPtr != NULL) + if (dataViewColumnPtr != nullptr) { wxDataViewCustomRenderer* dataViewCustomRendererPtr(dynamic_cast(dataViewColumnPtr->GetRenderer())); - if (dataViewCustomRendererPtr != NULL) - dataViewCustomRendererPtr->SetDC(NULL); + if (dataViewCustomRendererPtr != nullptr) + dataViewCustomRendererPtr->SetDC(nullptr); } } diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index aeef9e0f1a..5421da83df 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -61,7 +61,7 @@ void wxDialog::OSXEndModalDialog() void wxDialog::Init() { m_modality = wxDIALOG_MODALITY_NONE; - m_eventLoop = NULL; + m_eventLoop = nullptr; } bool wxDialog::Create( wxWindow *parent, @@ -168,7 +168,7 @@ int wxDialog::ShowModal() modalLoop.Run(); OSXEndModalDialog(); - m_eventLoop = NULL; + m_eventLoop = nullptr; return GetReturnCode(); } diff --git a/src/osx/dnd_osx.cpp b/src/osx/dnd_osx.cpp index 9e0ade0128..0119228567 100644 --- a/src/osx/dnd_osx.cpp +++ b/src/osx/dnd_osx.cpp @@ -37,7 +37,7 @@ wxDragResult wxDropTarget::OnDragOver( wxDataFormat wxDropTarget::GetMatchingPair() { wxDataFormat supported; - if (m_dataObject != NULL) + if (m_dataObject != nullptr) { if ( wxDropSource* currentSource = wxDropSource::GetCurrentDropSource() ) { @@ -56,7 +56,7 @@ wxDataFormat wxDropTarget::GetMatchingPair() bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) { - if (m_dataObject == NULL) + if (m_dataObject == nullptr) return false; return CurrentDragHasSupportedFormat(); @@ -66,7 +66,7 @@ wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def ) { - if (m_dataObject == NULL) + if (m_dataObject == nullptr) return wxDragNone; if (!CurrentDragHasSupportedFormat()) @@ -82,7 +82,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() bool wxDropTarget::GetData() { - if (m_dataObject == NULL) + if (m_dataObject == nullptr) return false; if ( !CurrentDragHasSupportedFormat() ) @@ -93,7 +93,7 @@ bool wxDropTarget::GetData() { wxDataObject* data = currentSource->GetDataObject(); - if (data != NULL) + if (data != nullptr) transferred = m_dataObject->ReadFromSource(data); } diff --git a/src/osx/fswatcher_fsevents.cpp b/src/osx/fswatcher_fsevents.cpp index 7471bedf3a..cea11ade62 100644 --- a/src/osx/fswatcher_fsevents.cpp +++ b/src/osx/fswatcher_fsevents.cpp @@ -345,9 +345,9 @@ bool wxFsEventsFileSystemWatcher::AddTree(const wxFileName& path, int events, ); ctx.version = 0; ctx.info = watcherContext; - ctx.retain = NULL; + ctx.retain = nullptr; ctx.release = &wxDeleteContext; - ctx.copyDescription = NULL; + ctx.copyDescription = nullptr; CFTimeInterval latency = 0.2; wxMacUniCharBuffer pathChars(path.GetPath()); @@ -357,7 +357,7 @@ bool wxFsEventsFileSystemWatcher::AddTree(const wxFileName& path, int events, pathChars.GetChars() ); CFArrayRef pathRefs = CFArrayCreate( - kCFAllocatorDefault, (const void**)&pathRef, 1, NULL + kCFAllocatorDefault, (const void**)&pathRef, 1, nullptr ); FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot | kFSEventStreamCreateFlagFileEvents; @@ -504,7 +504,7 @@ int wxFsEventsFileSystemWatcher::GetWatchedPathsCount() const int wxFsEventsFileSystemWatcher::GetWatchedPaths(wxArrayString* paths) const { - wxCHECK_MSG( paths != NULL, -1, "Null array passed to retrieve paths"); + wxCHECK_MSG( paths != nullptr, -1, "Null array passed to retrieve paths"); if ( !paths ) { return 0; diff --git a/src/osx/glcanvas_osx.cpp b/src/osx/glcanvas_osx.cpp index 07ee0ab4c0..86c5feb4e9 100644 --- a/src/osx/glcanvas_osx.cpp +++ b/src/osx/glcanvas_osx.cpp @@ -364,9 +364,9 @@ wxGLAttributes& wxGLAttributes::Defaults() wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other, const wxGLContextAttrs *ctxAttrs) - : m_glContext(NULL) + : m_glContext(nullptr) { - const int* contextAttribs = NULL; + const int* contextAttribs = nullptr; int ctxSize = 0; if ( ctxAttrs ) @@ -391,7 +391,7 @@ wxGLContext::wxGLContext(wxGLCanvas *win, if ( pf ) { - m_glContext = WXGLCreateContext(pf, other ? other->m_glContext : NULL); + m_glContext = WXGLCreateContext(pf, other ? other->m_glContext : nullptr); if ( m_glContext ) { m_isOk = true; @@ -455,7 +455,7 @@ bool wxGLCanvas::Create(wxWindow *parent, { // Separate 'pixel format' attributes. // Also store context attributes for wxGLContext ctor - // If 'attribList' is NULL, ParseAttribList() will set defaults. + // If 'attribList' is null, ParseAttribList() will set defaults. wxGLAttributes dispAttrs; if ( ! ParseAttribList(attribList, dispAttrs, &m_GLCTXAttrs) ) return false; @@ -472,7 +472,7 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxString& name, const wxPalette& WXUNUSED(palette)) { - m_glFormat = NULL; + m_glFormat = nullptr; // Don't allow an empty list if ( !dispAttrs.GetGLAttrs() ) { @@ -534,9 +534,9 @@ bool wxGLCanvasBase::IsExtensionSupported(const char *extension) { // We need a valid context to query for extensions. Use a default one. wxGLAttributes dispAttrs; - ParseAttribList(NULL, dispAttrs); // Sets defaults + ParseAttribList(nullptr, dispAttrs); // Sets defaults WXGLPixelFormat fmt = WXGLChoosePixelFormat(dispAttrs.GetGLAttrs(), dispAttrs.GetSize()); - WXGLContext ctx = WXGLCreateContext(fmt, NULL); + WXGLContext ctx = WXGLCreateContext(fmt, nullptr); if ( !ctx ) return false; diff --git a/src/osx/iphone/evtloop.mm b/src/osx/iphone/evtloop.mm index 263612a604..4e95525378 100644 --- a/src/osx/iphone/evtloop.mm +++ b/src/osx/iphone/evtloop.mm @@ -118,14 +118,14 @@ void wxGUIEventLoop::WakeUp() wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow) { m_modalWindow = dynamic_cast (modalWindow); - wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" ); + wxASSERT_MSG( m_modalWindow != nullptr, "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_modalWindow = nullptr; + wxASSERT_MSG( modalNativeWindow != nullptr, "must pass in a toplevel window for modal event loop" ); m_modalNativeWindow = modalNativeWindow; } diff --git a/src/osx/iphone/glcanvas.mm b/src/osx/iphone/glcanvas.mm index 6f292b86cf..ffeb4cc42e 100644 --- a/src/osx/iphone/glcanvas.mm +++ b/src/osx/iphone/glcanvas.mm @@ -135,8 +135,8 @@ bool wxGLCanvas::DoCreate(wxWindow *parent, // We need a context, otherwise the view will not get an initial // Paint Event, making our own samples fail ... - WXGLPixelFormat pf = WXGLChoosePixelFormat(NULL, 0, NULL, 0); - WXGLContext context = WXGLCreateContext(pf, NULL); + WXGLPixelFormat pf = WXGLChoosePixelFormat(nullptr, 0, nullptr, 0); + WXGLContext context = WXGLCreateContext(pf, nullptr); wxUICustomOpenGLView* v = [[wxUICustomOpenGLView alloc] initWithFrame:r context: context ]; diff --git a/src/osx/iphone/menu.mm b/src/osx/iphone/menu.mm index 29619377d9..30b9f28fb5 100644 --- a/src/osx/iphone/menu.mm +++ b/src/osx/iphone/menu.mm @@ -42,7 +42,7 @@ { if ( self = [super initWithTitle:title] ) { - impl = NULL; + impl = nullptr; } return self; } @@ -158,8 +158,8 @@ public : wxMenuCocoaImpl( wxMenu* peer , UIMenu* menu) : wxMenuImpl(peer), m_osxMenu(wxCFRetain(menu)) { /* - static wxUIMenuController* controller = NULL; - if ( controller == NULL ) + static wxUIMenuController* controller = nullptr; + if ( controller == nullptr ) { controller = [[wxUIMenuController alloc] init]; } @@ -237,7 +237,7 @@ public : wxTopLevelWindow* tlw = static_cast(wxGetTopLevelParent(win)); NSWindow* nsWindow = tlw->GetWXWindow(); NSRect nsrect = NSZeroRect; - nsrect.origin = wxToNSPoint( NULL, screenPoint ); + nsrect.origin = wxToNSPoint( nullptr, screenPoint ); nsrect = [nsWindow convertRectFromScreen:nsrect]; NSEvent* rightClick = [NSEvent mouseEventWithType:NSRightMouseDown diff --git a/src/osx/iphone/menuitem.mm b/src/osx/iphone/menuitem.mm index 1863e0ccd7..ca2855e574 100644 --- a/src/osx/iphone/menuitem.mm +++ b/src/osx/iphone/menuitem.mm @@ -44,7 +44,7 @@ Mapping sActionToWXMapping[] = { wxID_PASTE, @selector(paste:) }, { wxID_CLEAR, @selector(delete:) }, { wxID_SELECTALL, @selector(selectAll:) }, - { 0, NULL } + { 0, nullptr } }; int wxOSXGetIdFromSelector(SEL action ) @@ -76,7 +76,7 @@ SEL wxOSXGetSelectorFromID(int menuId ) /* void wxMacCocoaMenuItemSetAccelerator( UIMenuItem* menuItem, wxAcceleratorEntry* entry ) { - if ( entry == NULL ) + if ( entry == nullptr ) { [menuItem setKeyEquivalent:@""]; return; @@ -287,7 +287,7 @@ wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer, wxMenu *pParentMenu, wxItemKind kind, wxMenu *pSubMenu ) { - wxMenuItemImpl* c = NULL; + wxMenuItemImpl* c = nullptr; UIMenuElement* item = nil; if ( kind == wxITEM_SEPARATOR ) diff --git a/src/osx/iphone/msgdlg.mm b/src/osx/iphone/msgdlg.mm index 30d1f58777..c990101cec 100644 --- a/src/osx/iphone/msgdlg.mm +++ b/src/osx/iphone/msgdlg.mm @@ -109,7 +109,7 @@ int wxMessageDialog::ShowModal() } - wxNonOwnedWindow* parentWindow = NULL; + wxNonOwnedWindow* parentWindow = nullptr; int button = -1; if (GetParent()) diff --git a/src/osx/iphone/nonownedwnd.mm b/src/osx/iphone/nonownedwnd.mm index de69b157c6..accea9574f 100644 --- a/src/osx/iphone/nonownedwnd.mm +++ b/src/osx/iphone/nonownedwnd.mm @@ -74,15 +74,15 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl); wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) : wxNonOwnedWindowImpl(nonownedwnd) { - m_macWindow = NULL; - m_macFullScreenData = NULL; + m_macWindow = nullptr; + m_macFullScreenData = nullptr; m_initialShowSent = false; } wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl() { - m_macWindow = NULL; - m_macFullScreenData = NULL; + m_macWindow = nullptr; + m_macFullScreenData = nullptr; m_initialShowSent = false; } @@ -281,7 +281,7 @@ void wxNonOwnedWindowIPhoneImpl::Maximize(bool maximize) bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const { - return m_macFullScreenData != NULL ; + return m_macFullScreenData != nullptr ; } bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable), long WXUNUSED(style)) diff --git a/src/osx/iphone/settings.mm b/src/osx/iphone/settings.mm index ae2b8f2da8..6d5be2c23a 100644 --- a/src/osx/iphone/settings.mm +++ b/src/osx/iphone/settings.mm @@ -190,11 +190,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, const wxWindow* WXUN // TODO case wxSYS_WINDOWMIN_Y: case wxSYS_SCREEN_X: - wxDisplaySize(&value, NULL); + wxDisplaySize(&value, nullptr); return value; case wxSYS_SCREEN_Y: - wxDisplaySize(NULL, &value); + wxDisplaySize(nullptr, &value); return value; // TODO case wxSYS_FRAMESIZE_X: diff --git a/src/osx/iphone/textctrl.mm b/src/osx/iphone/textctrl.mm index 147f8cb1d3..0469eef440 100644 --- a/src/osx/iphone/textctrl.mm +++ b/src/osx/iphone/textctrl.mm @@ -121,7 +121,7 @@ protected : wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) { - impl->DoNotifyFocusEvent( false, NULL ); + impl->DoNotifyFocusEvent( false, nullptr ); } } @@ -134,7 +134,7 @@ protected : { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); lastKeyDownEvent = event; - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super keyDown:event]; lastKeyDownEvent = nil; } @@ -142,14 +142,14 @@ protected : - (void) keyUp:(NSEvent*) event { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super keyUp:event]; } - (void) flagsChanged:(NSEvent*) event { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || !impl->DoHandleKeyEvent(event) ) + if ( impl == nullptr || !impl->DoHandleKeyEvent(event) ) [super flagsChanged:event]; } @@ -162,7 +162,7 @@ protected : - (void) insertText:(id) str { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl == NULL || lastKeyDownEvent==nil || !impl->DoHandleCharEvent(lastKeyDownEvent, str) ) + if ( impl == nullptr || lastKeyDownEvent==nil || !impl->DoHandleCharEvent(lastKeyDownEvent, str) ) { [super insertText:str]; } @@ -244,7 +244,7 @@ protected : wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) { - impl->DoNotifyFocusEvent( false, NULL ); + impl->DoNotifyFocusEvent( false, nullptr ); } } @end @@ -275,14 +275,14 @@ protected : { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( textView ); if ( impl ) - impl->DoNotifyFocusEvent(true, NULL); + impl->DoNotifyFocusEvent(true, nullptr); } - (void)textViewDidEndEditing:(UITextView *)textView { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( textView ); if ( impl ) - impl->DoNotifyFocusEvent(false, NULL); + impl->DoNotifyFocusEvent(false, nullptr); } - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text @@ -436,9 +436,9 @@ bool wxUITextViewControl::GetStyle(long position, wxTextAttr& style) { if (m_textView && position >=0) { - // UIFont* font = NULL; - // NSColor* bgcolor = NULL; - // NSColor* fgcolor = NULL; + // UIFont* font = nullptr; + // NSColor* bgcolor = nullptr; + // NSColor* fgcolor = nullptr; // NOTE: It appears that other platforms accept GetStyle with the position == length // but that UITextStorage does not accept length as a valid position. // Therefore we return the default control style in that case. @@ -446,9 +446,9 @@ bool wxUITextViewControl::GetStyle(long position, wxTextAttr& style) if (position < [[m_textView string] length]) { UITextStorage* storage = [m_textView textStorage]; - font = [[storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL] autorelease]; - bgcolor = [[storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease]; - fgcolor = [[storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease]; + font = [[storage attribute:NSFontAttributeName atIndex:position effectiveRange:nullptr] autorelease]; + bgcolor = [[storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:nullptr] autorelease]; + fgcolor = [[storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:nullptr] autorelease]; } else { @@ -690,8 +690,8 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, long WXUNUSED(extraStyle)) { CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; - wxWidgetIPhoneImpl* c = NULL; - wxTextWidgetImpl* t = NULL; + wxWidgetIPhoneImpl* c = nullptr; + wxTextWidgetImpl* t = nullptr; id tv = nil; #if wxOSX_IPHONE_USE_TEXTFIELD diff --git a/src/osx/iphone/toolbar.mm b/src/osx/iphone/toolbar.mm index 9b6ea25d97..cd726c9986 100644 --- a/src/osx/iphone/toolbar.mm +++ b/src/osx/iphone/toolbar.mm @@ -91,7 +91,7 @@ private: void Init() { - m_toolbarItem = NULL; + m_toolbarItem = nullptr; m_index = -1; } @@ -206,7 +206,7 @@ void wxToolBar::Init() m_maxWidth = -1; m_maxHeight = -1; - m_macToolbar = NULL; + m_macToolbar = nullptr; } // also for the toolbar we have the dual implementation: @@ -256,7 +256,7 @@ bool wxToolBar::Create( wxToolBar::~wxToolBar() { - m_macToolbar = NULL; + m_macToolbar = nullptr; } bool wxToolBar::Realize() @@ -325,13 +325,13 @@ void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmapBundle& bitmap ) wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const { - return NULL; + return nullptr; } void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable) { /* - if ( t != NULL ) + if ( t != nullptr ) ((wxToolBarTool*)t)->DoEnable( enable ); */ } @@ -340,7 +340,7 @@ void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle) { /* wxToolBarTool *tool = (wxToolBarTool *)t; - if ( ( tool != NULL ) && tool->IsButton() ) + if ( ( tool != nullptr ) && tool->IsButton() ) tool->UpdateToggleImage( toggle ); */ } @@ -348,7 +348,7 @@ void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle) bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool *tool = static_cast< wxToolBarTool*>(toolBase ); - if (tool == NULL) + if (tool == nullptr) return false; wxSize toolSize = GetToolSize(); diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index cfde22b67a..a5f0dd770c 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -238,10 +238,10 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const wxSize sz = m_window->GetSize(); - int left = subrect != NULL ? subrect->x : 0 ; - int top = subrect != NULL ? subrect->y : 0 ; - int width = subrect != NULL ? subrect->width : sz.x; - int height = subrect != NULL ? subrect->height : sz.y ; + int left = subrect != nullptr ? subrect->x : 0 ; + int top = subrect != nullptr ? subrect->y : 0 ; + int width = subrect != nullptr ? subrect->width : sz.x; + int height = subrect != nullptr ? subrect->height : sz.y ; wxBitmap bmp = wxBitmap(width, height, 32); diff --git a/src/osx/iphone/window.mm b/src/osx/iphone/window.mm index 88b7bd5040..125bd4d7fd 100644 --- a/src/osx/iphone/window.mm +++ b/src/osx/iphone/window.mm @@ -198,7 +198,7 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSSet* touches, UIEvent * nsEvent void wxOSX_touchEvent(UIView* self, SEL _cmd, NSSet* touches, UIEvent *event ) { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; impl->touchEvent(touches, event, self, _cmd); @@ -207,7 +207,7 @@ void wxOSX_touchEvent(UIView* self, SEL _cmd, NSSet* touches, UIEvent *event ) BOOL wxOSX_becomeFirstResponder(UIView* self, SEL _cmd) { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->becomeFirstResponder(self, _cmd); @@ -216,7 +216,7 @@ BOOL wxOSX_becomeFirstResponder(UIView* self, SEL _cmd) BOOL wxOSX_resignFirstResponder(UIView* self, SEL _cmd) { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return NO; return impl->resignFirstResponder(self, _cmd); @@ -225,7 +225,7 @@ BOOL wxOSX_resignFirstResponder(UIView* self, SEL _cmd) void wxOSX_drawRect(UIView* self, SEL _cmd, CGRect rect) { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl == NULL) + if (impl == nullptr) return; return impl->drawRect(&rect, self, _cmd); @@ -258,14 +258,14 @@ void wxOSXIPhoneClassAddWXMethods(Class c) - (void) WX_touchUpInsideAction:(id)sender event:(UIEvent*)event { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl != NULL) + if (impl != nullptr) impl->controlAction(sender, UIControlEventTouchUpInside, event); } - (void) WX_valueChangedAction:(id)sender event:(UIEvent*)event { wxWidgetIPhoneImpl* impl = (wxWidgetIPhoneImpl* ) wxWidgetImpl::FindFromWXWidget( self ); - if (impl != NULL) + if (impl != nullptr) impl->controlAction(sender, UIControlEventValueChanged, event); } @@ -284,7 +284,7 @@ wxWidgetIPhoneImpl::wxWidgetIPhoneImpl() void wxWidgetIPhoneImpl::Init() { - m_osxView = NULL; + m_osxView = nullptr; } wxWidgetIPhoneImpl::~wxWidgetIPhoneImpl() @@ -404,7 +404,7 @@ void wxWidgetIPhoneImpl::RemoveFromParent() void wxWidgetIPhoneImpl::Embed( wxWidgetImpl *parent ) { UIView* container = parent->GetWXWidget() ; - wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; + wxASSERT_MSG( container != nullptr , wxT("No valid mac container control") ) ; [container addSubview:m_osxView]; } @@ -661,9 +661,9 @@ void wxWidgetIPhoneImpl::drawRect(CGRect* rect, WXWidget slf, void *WXUNUSED(_cm wxWindow* wxpeer = GetWXPeer(); wxpeer->GetUpdateRegion() = updateRgn; - // note that context may be NULL in certain views + // note that context may be null in certain views CGContextRef context = (CGContextRef) UIGraphicsGetCurrentContext(); - if ( context != NULL ) + if ( context != nullptr ) { CGContextSaveGState( context ); // draw background @@ -678,7 +678,7 @@ void wxWidgetIPhoneImpl::drawRect(CGRect* rect, WXWidget slf, void *WXUNUSED(_cm bool handled = wxpeer->MacDoRedraw( 0 ); - if ( context != NULL ) + if ( context != nullptr ) { CGContextRestoreGState( context ); CGContextSaveGState( context ); @@ -692,7 +692,7 @@ void wxWidgetIPhoneImpl::drawRect(CGRect* rect, WXWidget slf, void *WXUNUSED(_cm if ( superimpl != wxOSX_drawRect ) { superimpl(slf, _cmd, *rect); - if ( context != NULL ) + if ( context != nullptr ) { CGContextRestoreGState( context ); CGContextSaveGState( context ); @@ -700,13 +700,13 @@ void wxWidgetIPhoneImpl::drawRect(CGRect* rect, WXWidget slf, void *WXUNUSED(_cm } } - if ( context != NULL ) + if ( context != nullptr ) { wxpeer->MacPaintChildrenBorders(); CGContextRestoreGState( context ); } - wxpeer->MacSetCGContextRef( NULL ); + wxpeer->MacSetCGContextRef( nullptr ); } void wxWidgetIPhoneImpl::touchEvent(NSSet* touches, UIEvent *event, WXWidget slf, void *WXUNUSED(_cmd)) diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index ba99b6ffd5..52b7fc1b71 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -108,14 +108,14 @@ wxListBox::~wxListBox() m_blockEvents = false; // make sure no native events get sent to a object in destruction - SetPeer(NULL); + SetPeer(nullptr); if ( IsSorted() ) delete m_strings.sorted; else delete m_strings.unsorted; - m_strings.sorted = NULL; + m_strings.sorted = nullptr; } void wxListBox::FreeData() @@ -379,7 +379,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, idx = IsSorted() ? m_strings.sorted->Add(item) : (m_strings.unsorted->Insert(item, pos), pos++); - m_itemsClientData.Insert(NULL, idx); + m_itemsClientData.Insert(nullptr, idx); AssignNewItemClientData(idx, clientData, i, type); GetListPeer()->ListInsert(startpos+i); diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index bd8c44f52e..b28c1617e5 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -62,7 +62,7 @@ void wxMenu::Init() m_doBreak = false; m_allowRearrange = true; m_noEventsMode = false; - m_radioData = NULL; + m_radioData = nullptr; m_peer = wxMenuImpl::Create( this, wxStripMenuCodes(m_title, wxStrip_Menu) ); @@ -86,7 +86,7 @@ WXHMENU wxMenu::GetHMenu() const { if ( m_peer ) return m_peer->GetHMenu(); - return NULL; + return nullptr; } void wxMenu::SetAllowRearrange( bool allow ) @@ -108,13 +108,13 @@ bool wxMenu::OSXGetRadioGroupRange(int pos, int *start, int *end) const // append a new item or submenu to the menu bool wxMenu::DoInsertOrAppend(wxMenuItem *item, size_t pos) { - wxASSERT_MSG( item != NULL, wxT("can't append NULL item to the menu") ); + wxASSERT_MSG( item != nullptr, wxT("can't append nullptr item to the menu") ); GetPeer()->InsertOrAppend( item, pos ); wxMenu *pSubMenu = item->GetSubMenu() ; - if ( pSubMenu != NULL ) + if ( pSubMenu != nullptr ) { - wxASSERT_MSG( pSubMenu->GetHMenu() != NULL , wxT("invalid submenu added")); + wxASSERT_MSG( pSubMenu->GetHMenu() != nullptr , wxT("invalid submenu added")); pSubMenu->m_menuParent = this ; pSubMenu->DoRearrange(); @@ -179,7 +179,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) if (wxMenuBase::DoAppend(item) && DoInsertOrAppend(item) ) return item; - return NULL; + return nullptr; } wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) @@ -187,7 +187,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos)) return item; - return NULL; + return nullptr; } wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) @@ -217,7 +217,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) } // DoRemove() (unlike Remove) can only be called for existing item! - wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") ); + wxCHECK_MSG( node, nullptr, wxT("bug in wxMenu::Remove logic") ); wxOSXMenuRemoveItem(m_hMenu , pos ); */ @@ -265,7 +265,7 @@ void wxMenu::DoRearrange() if ( !AllowRearrange() ) return; - wxMenuItem* previousItem = NULL ; + wxMenuItem* previousItem = nullptr ; size_t pos ; wxMenuItemList::compatibility_iterator node; wxMenuItem *item; @@ -295,9 +295,9 @@ void wxMenu::DoRearrange() // separator at the menu start or end nor 2 consecutive // separators wxMenuItemList::compatibility_iterator nextNode = node->GetNext(); - wxMenuItem *next = nextNode ? nextNode->GetData() : NULL; + wxMenuItem *next = nextNode ? nextNode->GetData() : nullptr; - wxMenuItem *sepToHide = 0; + wxMenuItem *sepToHide = nullptr; if ( !previousItem && next && next->IsSeparator() ) { // next (i.e. second as we must be first) item is @@ -306,7 +306,7 @@ void wxMenu::DoRearrange() sepToHide = next; } else if ( GetMenuItems().GetCount() == pos + 1 && - previousItem != NULL && + previousItem != nullptr && previousItem->IsSeparator() ) { // prev item is a trailing separator we want to hide @@ -390,7 +390,7 @@ void wxMenu::HandleMenuItemHighlighted( wxMenuItem* item ) void wxMenu::DoHandleMenuOpenedOrClosed(wxEventType evtType) { - // Popup menu being currently shown or NULL, defined in wincmn.cpp. + // Popup menu being currently shown or nullptr, defined in wincmn.cpp. extern wxMenu *wxCurrentPopupMenu; // Set the id to allow wxMenuEvent::IsPopup() to work correctly. @@ -468,10 +468,10 @@ auto-merge for MDI in case this will be necessary */ -wxMenuBar* wxMenuBar::s_macInstalledMenuBar = NULL ; -wxMenuBar* wxMenuBar::s_macCommonMenuBar = NULL ; +wxMenuBar* wxMenuBar::s_macInstalledMenuBar = nullptr ; +wxMenuBar* wxMenuBar::s_macCommonMenuBar = nullptr ; bool wxMenuBar::s_macAutoWindowMenu = true ; -WXHMENU wxMenuBar::s_macWindowMenuHandle = NULL ; +WXHMENU wxMenuBar::s_macWindowMenuHandle = nullptr ; const int firstMenuPos = 1; // to account for the 0th application menu on mac @@ -543,7 +543,7 @@ void wxMenuBar::Init() } m_eventHandler = this; - m_menuBarFrame = NULL; + m_menuBarFrame = nullptr; m_rootMenu = new wxMenu(); m_rootMenu->Attach(this); @@ -577,12 +577,12 @@ wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], lon wxMenuBar::~wxMenuBar() { if (s_macCommonMenuBar == this) - s_macCommonMenuBar = NULL; + s_macCommonMenuBar = nullptr; MacUninstallMenuBar(); wxDELETE( m_rootMenu ); // apple menu is a submenu, therefore we don't have to delete it - m_appleMenu = NULL; + m_appleMenu = nullptr; // deleting the root menu also removes all its wxMenu* submenus, therefore // we must avoid double deleting them in the superclass destructor @@ -599,7 +599,7 @@ void wxMenuBar::MacUninstallMenuBar() if (s_macInstalledMenuBar == this) { gs_emptyMenuBar->GetPeer()->MakeRoot(); - s_macInstalledMenuBar = NULL; + s_macInstalledMenuBar = nullptr; } } @@ -612,15 +612,15 @@ void wxMenuBar::MacInstallMenuBar() // hide items in the apple menu that don't exist in the wx menubar - wxMenuItem* appleItem = NULL; - wxMenuItem* wxItem = NULL; + wxMenuItem* appleItem = nullptr; + wxMenuItem* wxItem = nullptr; int menuid = wxApp::s_macAboutMenuItemId; appleItem = m_appleMenu->FindItem(menuid); wxItem = FindItem(menuid); - if ( appleItem != NULL ) + if ( appleItem != nullptr ) { - if ( wxItem == NULL ) + if ( wxItem == nullptr ) appleItem->GetPeer()->Hide(); else appleItem->SetItemLabel(wxItem->GetItemLabel()); @@ -629,9 +629,9 @@ void wxMenuBar::MacInstallMenuBar() menuid = wxApp::s_macPreferencesMenuItemId; appleItem = m_appleMenu->FindItem(menuid); wxItem = FindItem(menuid); - if ( appleItem != NULL ) + if ( appleItem != nullptr ) { - if ( wxItem == NULL ) + if ( wxItem == nullptr ) appleItem->GetPeer()->Hide(); else appleItem->SetItemLabel(wxItem->GetItemLabel()); @@ -709,7 +709,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) { wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title); if ( !menuOld ) - return NULL; + return nullptr; wxMenuItem* item = m_rootMenu->FindItemByPosition(pos+firstMenuPos); m_rootMenu->Remove(item); @@ -733,7 +733,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) - return NULL; + return nullptr; wxMenuItem* item = m_rootMenu->FindItemByPosition(pos+firstMenuPos); m_rootMenu->Remove(item); @@ -743,7 +743,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) bool wxMenuBar::Append(wxMenu *menu, const wxString& title) { - WXHMENU submenu = menu ? menu->GetHMenu() : 0; + WXHMENU submenu = menu ? menu->GetHMenu() : nullptr; wxCHECK_MSG( submenu, false, wxT("can't append invalid menu to menubar") ); if ( !wxMenuBarBase::Append(menu, title) ) diff --git a/src/osx/menuitem_osx.cpp b/src/osx/menuitem_osx.cpp index 39b839d0e3..23cc23e000 100644 --- a/src/osx/menuitem_osx.cpp +++ b/src/osx/menuitem_osx.cpp @@ -37,15 +37,15 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, wxMenu *pSubMenu) :wxMenuItemBase(pParentMenu, id, t, strHelp, kind, pSubMenu) { - wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ; + wxASSERT_MSG( id != 0 || pSubMenu != nullptr , wxT("A MenuItem ID of Zero does not work under Mac") ) ; // In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines // therefore these item must not be translated - if (pParentMenu != NULL && !pParentMenu->GetNoEventsMode()) + if (pParentMenu != nullptr && !pParentMenu->GetNoEventsMode()) if ( wxStripMenuCodes(m_text, wxStrip_Menu).Upper() == wxT("EXIT") ) m_text = wxT("Quit\tCtrl+Q") ; - wxString text = wxStripMenuCodes(m_text, (pParentMenu != NULL && pParentMenu->GetNoEventsMode()) ? wxStrip_Accel : wxStrip_Menu); + wxString text = wxStripMenuCodes(m_text, (pParentMenu != nullptr && pParentMenu->GetNoEventsMode()) ? wxStrip_Accel : wxStrip_Menu); if (text.IsEmpty() && !IsSeparator()) { wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?")); @@ -58,7 +58,7 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu ); delete entry; #else - m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, NULL, strHelp, GetKind(), pSubMenu ); + m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, nullptr, strHelp, GetKind(), pSubMenu ); #endif // wxUSE_ACCEL/!wxUSE_ACCEL } @@ -186,7 +186,7 @@ void wxMenuItem::UpdateItemText() if ( !m_parentMenu ) return ; - wxString text = wxStripMenuCodes(m_text, m_parentMenu != NULL && m_parentMenu->GetNoEventsMode() ? wxStrip_Accel : wxStrip_Menu); + wxString text = wxStripMenuCodes(m_text, m_parentMenu != nullptr && m_parentMenu->GetNoEventsMode() ? wxStrip_Accel : wxStrip_Menu); if (text.IsEmpty() && !IsSeparator()) { wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?")); @@ -198,7 +198,7 @@ void wxMenuItem::UpdateItemText() GetPeer()->SetLabel( text, entry ); delete entry ; #else - GetPeer()->SetLabel( text, NULL ); + GetPeer()->SetLabel( text, nullptr ); #endif // wxUSE_ACCEL/!wxUSE_ACCEL } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 81938b9a92..c9781afe71 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -53,14 +53,14 @@ wxNonOwnedWindow* wxNonOwnedWindow::GetFromWXWindow( WXWindow win ) { wxNonOwnedWindowImpl* impl = wxNonOwnedWindowImpl::FindFromWXWindow(win); - return ( impl != NULL ? impl->GetWXPeer() : NULL ) ; + return ( impl != nullptr ? impl->GetWXPeer() : nullptr ) ; } wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::FindFromWXWindow (WXWindow window) { MacWindowMap::iterator node = wxWinMacWindowList.find(window); - return (node == wxWinMacWindowList.end()) ? NULL : node->second; + return (node == wxWinMacWindowList.end()) ? nullptr : node->second; } void wxNonOwnedWindowImpl::RemoveAssociations( wxNonOwnedWindowImpl* impl) @@ -78,9 +78,9 @@ void wxNonOwnedWindowImpl::RemoveAssociations( wxNonOwnedWindowImpl* impl) void wxNonOwnedWindowImpl::Associate( WXWindow window, wxNonOwnedWindowImpl *impl ) { - // adding NULL WindowRef is (first) surely a result of an error and + // adding null WindowRef is (first) surely a result of an error and // nothing else :-) - wxCHECK_RET( window != (WXWindow) NULL, wxT("attempt to add a NULL WindowRef to window list") ); + wxCHECK_RET( window != (WXWindow) nullptr, wxT("attempt to add a null WindowRef to window list") ); wxWinMacWindowList[window] = impl; } @@ -91,11 +91,11 @@ void wxNonOwnedWindowImpl::Associate( WXWindow window, wxNonOwnedWindowImpl *imp wxIMPLEMENT_ABSTRACT_CLASS(wxNonOwnedWindowImpl, wxObject); -wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = NULL; +wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = nullptr; void wxNonOwnedWindow::Init() { - m_nowpeer = NULL; + m_nowpeer = nullptr; m_isNativeWindowWrapper = false; m_ignoreResizing = false; } @@ -171,7 +171,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, WXWindow nativeWindow) void wxNonOwnedWindow::SubclassWin(WXWindow nativeWindow) { wxASSERT_MSG( !m_isNativeWindowWrapper, wxT("subclassing window twice?") ); - wxASSERT_MSG( m_nowpeer == NULL, wxT("window already was created") ); + wxASSERT_MSG( m_nowpeer == nullptr, wxT("window already was created") ); m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, GetParent(), nativeWindow ); m_isNativeWindowWrapper = true; @@ -188,7 +188,7 @@ void wxNonOwnedWindow::UnsubclassWin() wxNonOwnedWindowImpl::RemoveAssociations(m_nowpeer) ; wxDELETE(m_nowpeer); - SetPeer(NULL); + SetPeer(nullptr); m_isNativeWindowWrapper = false; } @@ -205,7 +205,7 @@ wxNonOwnedWindow::~wxNonOwnedWindow() // avoid dangling refs if ( s_macDeactivateWindow == this ) - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; } bool wxNonOwnedWindow::Destroy() @@ -358,7 +358,7 @@ void wxNonOwnedWindow::MacActivate( long timestamp , bool WXUNUSED(inIsActivatin wxLogTrace(TRACE_ACTIVATE, wxT("TopLevel=%p::MacActivate"), this); if (s_macDeactivateWindow == this) - s_macDeactivateWindow = NULL; + s_macDeactivateWindow = nullptr; MacDelayedDeactivation(timestamp); } @@ -413,7 +413,7 @@ bool wxNonOwnedWindow::SetBackgroundStyle(wxBackgroundStyle style) void wxNonOwnedWindow::DoMoveWindow(int x, int y, int width, int height) { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return; m_cachedClippedRectValid = false ; @@ -424,7 +424,7 @@ void wxNonOwnedWindow::DoMoveWindow(int x, int y, int width, int height) void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return; int x1,y1 ; @@ -438,7 +438,7 @@ void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return; int w,h; @@ -453,7 +453,7 @@ void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return; int left, top, w, h; @@ -479,7 +479,7 @@ void wxNonOwnedWindow::WindowWasPainted() void wxNonOwnedWindow::Update() { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return; if ( clock() - s_lastFlush > CLOCKS_PER_SEC / 30 ) @@ -491,7 +491,7 @@ void wxNonOwnedWindow::Update() WXWindow wxNonOwnedWindow::GetWXWindow() const { - return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL; + return m_nowpeer ? m_nowpeer->GetWXWindow() : nullptr; } #if wxOSX_USE_COCOA_OR_IPHONE diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index 144797a9dc..b7cb91b85b 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -169,7 +169,7 @@ bool wxNotebook::SetPageImage(size_t nPage, int nImage) // remove one page from the notebook, without deleting the window wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, + wxCHECK_MSG( IS_VALID_PAGE(nPage), nullptr, wxT("DoRemovePage: invalid notebook page") ); wxNotebookPage* page = m_pages[nPage] ; diff --git a/src/osx/palette.cpp b/src/osx/palette.cpp index cb78603864..d511647a32 100644 --- a/src/osx/palette.cpp +++ b/src/osx/palette.cpp @@ -41,7 +41,7 @@ protected: wxPaletteRefData::wxPaletteRefData() { - m_palette = NULL; + m_palette = nullptr; m_count = 0; } diff --git a/src/osx/pen.cpp b/src/osx/pen.cpp index 171a4263b6..15f8261729 100644 --- a/src/osx/pen.cpp +++ b/src/osx/pen.cpp @@ -65,7 +65,7 @@ wxPenRefData::wxPenRefData() m_join = wxJOIN_ROUND ; m_cap = wxCAP_ROUND ; m_nbDash = 0 ; - m_dash = 0 ; + m_dash = nullptr ; } wxPenRefData::wxPenRefData(const wxPenRefData& data) @@ -203,7 +203,7 @@ int wxPen::GetDashCount() const wxBitmap *wxPen::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid pen") ); return &M_PENDATA->m_stipple; } diff --git a/src/osx/printdlg_osx.cpp b/src/osx/printdlg_osx.cpp index f1db3b82fd..50fc4a4099 100644 --- a/src/osx/printdlg_osx.cpp +++ b/src/osx/printdlg_osx.cpp @@ -33,8 +33,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase); wxMacPrintDialog::wxMacPrintDialog() { - m_dialogParent = NULL; - m_printerDC = NULL; + m_dialogParent = nullptr; + m_printerDC = nullptr; m_destroyDC = true; } @@ -46,7 +46,7 @@ wxMacPrintDialog::wxMacPrintDialog( wxWindow *p, wxPrintDialogData *data ) wxMacPrintDialog::wxMacPrintDialog( wxWindow *p, wxPrintData *data ) { wxPrintDialogData data2; - if (data != NULL) + if (data != nullptr) data2 = *data; Create( p, &data2 ); @@ -55,10 +55,10 @@ wxMacPrintDialog::wxMacPrintDialog( wxWindow *p, wxPrintData *data ) bool wxMacPrintDialog::Create( wxWindow *p, wxPrintDialogData *data ) { m_dialogParent = p; - m_printerDC = NULL; + m_printerDC = nullptr; m_destroyDC = true; - if (data != NULL) + if (data != nullptr) m_printDialogData = *data; return true; @@ -89,7 +89,7 @@ bool wxMacPageSetupDialog::Create( wxWindow *p, wxPageSetupDialogData *data ) { m_dialogParent = p; - if (data != NULL) + if (data != nullptr) m_pageSetupData = (*data); return true; diff --git a/src/osx/radiobox_osx.cpp b/src/osx/radiobox_osx.cpp index 626b0f5fec..f2ee77409f 100644 --- a/src/osx/radiobox_osx.cpp +++ b/src/osx/radiobox_osx.cpp @@ -50,7 +50,7 @@ wxRadioBox::wxRadioBox() { m_noItems = 0; m_noRowsOrCols = 0; - m_radioButtonCycle = NULL; + m_radioButtonCycle = nullptr; } wxRadioBox::~wxRadioBox() @@ -60,7 +60,7 @@ wxRadioBox::~wxRadioBox() wxRadioButton *next, *current; current = m_radioButtonCycle; - if (current != NULL) + if (current != nullptr) { // We need to start deleting the buttons from the second one because // deleting the first one would change the pointers stored in them. @@ -111,7 +111,7 @@ bool wxRadioBox::Create( wxWindow *parent, // during construction we must keep this at 0, otherwise GetBestSize fails m_noItems = 0; m_noRowsOrCols = majorDim; - m_radioButtonCycle = NULL; + m_radioButtonCycle = nullptr; SetMajorDim( majorDim == 0 ? n : majorDim, style ); @@ -502,7 +502,7 @@ wxSize wxRadioBox::DoGetBestSize() const wxFont font = GetFont(); // GetParent()->GetFont() GetTextExtent( wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), - &charWidth, &charHeight, NULL, NULL, &font ); + &charWidth, &charHeight, nullptr, nullptr, &font ); charWidth /= 52; @@ -515,7 +515,7 @@ wxSize wxRadioBox::DoGetBestSize() const for (unsigned int i = 0 ; i < m_noItems; i++) { - GetTextExtent(GetString(i), &eachWidth, &eachHeight, NULL, NULL, &font ); + GetTextExtent(GetString(i), &eachWidth, &eachHeight, nullptr, nullptr, &font ); eachWidth = (eachWidth + RADIO_SIZE); eachHeight = wxMax(eachHeight, bestSizeRadio.y ); if (maxWidth < eachWidth) @@ -541,7 +541,7 @@ wxSize wxRadioBox::DoGetBestSize() const totHeight += 10; // handle radio box title as well - GetTextExtent( GetLabel(), &eachWidth, NULL ); + GetTextExtent( GetLabel(), &eachWidth, nullptr ); eachWidth = (int)(eachWidth + RADIO_SIZE) + 3 * charWidth; if (totWidth < eachWidth) totWidth = eachWidth; diff --git a/src/osx/radiobut_osx.cpp b/src/osx/radiobut_osx.cpp index 51a7655b7e..528b5f3b66 100644 --- a/src/osx/radiobut_osx.cpp +++ b/src/osx/radiobut_osx.cpp @@ -39,12 +39,12 @@ bool wxRadioButton::Create( wxWindow *parent, if (HasFlag( wxRB_GROUP )) { - AddInCycle( NULL ); + AddInCycle( nullptr ); } else { // search backward for last group start - wxRadioButton *chief = NULL; + wxRadioButton *chief = nullptr; wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); while (node) { @@ -80,7 +80,7 @@ void wxRadioButton::SetValue(bool val) if (val) { cycle = this->NextInCycle(); - if (cycle != NULL) + if (cycle != nullptr) { while (cycle != this) { @@ -113,7 +113,7 @@ bool wxRadioButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxRadioButton *cycle; cycle = this->NextInCycle(); - if (cycle != NULL) + if (cycle != nullptr) { while (cycle != this) { @@ -138,7 +138,7 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle) { wxRadioButton *current; - if (cycle == NULL) + if (cycle == nullptr) { m_cycle = this; } @@ -157,7 +157,7 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle) void wxRadioButton::RemoveFromCycle() { - if ((m_cycle == NULL) || (m_cycle == this)) + if ((m_cycle == nullptr) || (m_cycle == this)) return; // Find the previous one and make it point to the next one diff --git a/src/osx/slider_osx.cpp b/src/osx/slider_osx.cpp index 1d58526aa4..08b4477a71 100644 --- a/src/osx/slider_osx.cpp +++ b/src/osx/slider_osx.cpp @@ -44,9 +44,9 @@ wxSlider::wxSlider() m_rangeMin = 0; m_tickFreq = 0; - m_macMinimumStatic = NULL; - m_macMaximumStatic = NULL; - m_macValueStatic = NULL; + m_macMinimumStatic = nullptr; + m_macMaximumStatic = nullptr; + m_macValueStatic = nullptr; } bool wxSlider::Create(wxWindow *parent, @@ -59,9 +59,9 @@ bool wxSlider::Create(wxWindow *parent, { DontCreatePeer(); - m_macMinimumStatic = NULL; - m_macMaximumStatic = NULL; - m_macValueStatic = NULL; + m_macMinimumStatic = nullptr; + m_macMaximumStatic = nullptr; + m_macValueStatic = nullptr; m_lineSize = 1; m_tickFreq = 0; diff --git a/src/osx/sound_osx.cpp b/src/osx/sound_osx.cpp index 84cde6e878..df60bc5b8c 100644 --- a/src/osx/sound_osx.cpp +++ b/src/osx/sound_osx.cpp @@ -88,7 +88,7 @@ wxSound::~wxSound() void wxSound::Init() { - m_data = NULL; + m_data = nullptr; } bool wxSound::DoPlay(unsigned flags) const diff --git a/src/osx/srchctrl_osx.cpp b/src/osx/srchctrl_osx.cpp index 0fb0c0e5fc..ec2cf5e03e 100644 --- a/src/osx/srchctrl_osx.cpp +++ b/src/osx/srchctrl_osx.cpp @@ -60,7 +60,7 @@ wxSearchCtrl::wxSearchCtrl(wxWindow *parent, wxWindowID id, void wxSearchCtrl::Init() { #if wxUSE_MENUS - m_menu = 0; + m_menu = nullptr; #endif } @@ -100,7 +100,7 @@ void wxSearchCtrl::SetMenu( wxMenu* menu ) if ( m_menu ) { - m_menu->SetInvokingWindow( 0 ); + m_menu->SetInvokingWindow( nullptr ); } delete m_menu; diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 327ee21195..f0b4949572 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -71,7 +71,7 @@ void wxTextCtrl::Init() { m_dirty = false; - m_privateContextMenu = NULL; + m_privateContextMenu = nullptr; } wxTextCtrl::~wxTextCtrl() @@ -628,7 +628,7 @@ void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event) } #if wxUSE_MENUS - if (m_privateContextMenu == NULL) + if (m_privateContextMenu == nullptr) { m_privateContextMenu = new wxMenu; m_privateContextMenu->Append(wxID_UNDO, _("&Undo")); diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index f0b58ab524..0d01cfe919 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -46,7 +46,7 @@ wxTextEntry::wxTextEntry() { - m_completer = NULL; + m_completer = nullptr; m_editable = true; m_maxLength = 0; } @@ -297,7 +297,7 @@ wxTextWidgetImpl * wxTextEntry::GetTextPeer() const { wxWindow * const win = const_cast(this)->GetEditableWindow(); - return win ? dynamic_cast(win->GetPeer()) : NULL; + return win ? dynamic_cast(win->GetPeer()) : nullptr; } bool wxTextEntry::SetHint(const wxString& hint) diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index 354d46c4de..c04a9f2917 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -118,7 +118,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize) bool wxTopLevelWindowMac::IsMaximized() const { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return false; return m_nowpeer->IsMaximized(); @@ -132,7 +132,7 @@ void wxTopLevelWindowMac::Iconize(bool iconize) bool wxTopLevelWindowMac::IsIconized() const { - if ( m_nowpeer == NULL ) + if ( m_nowpeer == nullptr ) return false; return m_nowpeer->IsIconized(); diff --git a/src/osx/uiaction_osx.cpp b/src/osx/uiaction_osx.cpp index 152d715929..460cbd266e 100644 --- a/src/osx/uiaction_osx.cpp +++ b/src/osx/uiaction_osx.cpp @@ -144,7 +144,7 @@ bool wxUIActionSimulatorOSXImpl::MouseDown(int button) { CGEventType type = CGEventTypeForMouseButton(button, true); wxCFRef event( - CGEventCreateMouseEvent(NULL, type, GetMousePosition(), CGButtonForMouseButton(button))); + CGEventCreateMouseEvent(nullptr, type, GetMousePosition(), CGButtonForMouseButton(button))); if ( !event ) return false; @@ -166,7 +166,7 @@ bool wxUIActionSimulatorOSXImpl::MouseMove(long x, long y) CGEventType type = kCGEventMouseMoved; wxCFRef event( - CGEventCreateMouseEvent(NULL, type, pos, kCGMouseButtonLeft)); + CGEventCreateMouseEvent(nullptr, type, pos, kCGMouseButtonLeft)); if ( !event ) return false; @@ -185,7 +185,7 @@ bool wxUIActionSimulatorOSXImpl::MouseUp(int button) { CGEventType type = CGEventTypeForMouseButton(button, false); wxCFRef event( - CGEventCreateMouseEvent(NULL, type, GetMousePosition(), CGButtonForMouseButton(button))); + CGEventCreateMouseEvent(nullptr, type, GetMousePosition(), CGButtonForMouseButton(button))); if ( !event ) return false; @@ -204,7 +204,7 @@ bool wxUIActionSimulatorOSXImpl::MouseDblClick(int button) CGEventType downtype = CGEventTypeForMouseButton(button, true); CGEventType uptype = CGEventTypeForMouseButton(button, false); wxCFRef event( - CGEventCreateMouseEvent(NULL, downtype, GetMousePosition(), CGButtonForMouseButton(button))); + CGEventCreateMouseEvent(nullptr, downtype, GetMousePosition(), CGButtonForMouseButton(button))); if ( !event ) return false; @@ -242,7 +242,7 @@ bool wxUIActionSimulatorOSXImpl::MouseDragDrop(long x1, long y1, long x2, long y CGEventType dragtype = CGEventTypeForMouseDrag(button) ; wxCFRef event( - CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, pos1, CGButtonForMouseButton(button))); + CGEventCreateMouseEvent(nullptr, kCGEventMouseMoved, pos1, CGButtonForMouseButton(button))); if ( !event ) return false; @@ -273,7 +273,7 @@ wxUIActionSimulatorOSXImpl::DoKey(int keycode, int WXUNUSED(modifiers), bool isD CGKeyCode cgcode = wxCharCodeWXToOSX((wxKeyCode)keycode); wxCFRef - event(CGEventCreateKeyboardEvent(NULL, cgcode, isDown)); + event(CGEventCreateKeyboardEvent(nullptr, cgcode, isDown)); if ( !event ) return false; diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 4de0607d62..c91c1c110a 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -66,7 +66,7 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) wxUnusedVar(flags); wxCFRef curl(wxOSXCreateURLFromFileSystemPath(document)); - OSStatus err = LSOpenCFURLRef( curl , NULL ); + OSStatus err = LSOpenCFURLRef( curl , nullptr ); if (err == noErr) { @@ -86,8 +86,8 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault, - wxCFStringRef( params.url ), NULL ) ); - OSStatus err = LSOpenCFURLRef( curl , NULL ); + wxCFStringRef( params.url ), nullptr ) ); + OSStatus err = LSOpenCFURLRef( curl , nullptr ); if (err == noErr) { @@ -140,7 +140,7 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace() { static wxCFRef genericRGBColorSpace; - if (genericRGBColorSpace == NULL) + if (genericRGBColorSpace == nullptr) { #if wxOSX_USE_IPHONE genericRGBColorSpace.reset( CGColorSpaceCreateDeviceRGB() ); diff --git a/src/osx/webrequest_urlsession.mm b/src/osx/webrequest_urlsession.mm index cd101335c2..5fb7397d2c 100644 --- a/src/osx/webrequest_urlsession.mm +++ b/src/osx/webrequest_urlsession.mm @@ -54,7 +54,7 @@ - (wxWebRequestURLSession*)requestForTask:(NSURLSessionTask*)task { - wxWebRequestURLSession* request = NULL; + wxWebRequestURLSession* request = nullptr; NSValue* val = [m_requests objectForKey:task]; if (val) request = static_cast(val.pointerValue); diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 87a3dffe69..893e7baecf 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -775,7 +775,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) wxString message = wxCFStringRef::AsString([error localizedDescription]); NSString* detail = [error localizedFailureReason]; - if (detail != NULL) + if (detail != nullptr) { message = message + " (" + wxCFStringRef::AsString(detail) + ")"; } @@ -853,7 +853,7 @@ class wxWebViewWebKitHandlerRequest: public wxWebViewHandlerRequest { public: wxWebViewWebKitHandlerRequest(NSURLRequest* request): - m_data(NULL), + m_data(nullptr), m_request(request) { } diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index e4357aadd2..2541423c88 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -203,18 +203,18 @@ wxWindowMac::wxWindowMac(wxWindowMac *parent, void wxWindowMac::Init() { - m_peer = NULL ; + m_peer = nullptr ; m_macAlpha = 255 ; - m_cgContextRef = NULL ; + m_cgContextRef = nullptr ; // as all windows are created with WS_VISIBLE style... m_isShown = true; - m_hScrollBar = NULL ; - m_vScrollBar = NULL ; + m_hScrollBar = nullptr ; + m_vScrollBar = nullptr ; m_hScrollBarAlwaysShown = false; m_vScrollBarAlwaysShown = false; - m_growBox = NULL ; + m_growBox = nullptr ; m_clipChildren = false ; m_cachedClippedRectValid = false ; @@ -252,7 +252,7 @@ wxWindowMac::~wxWindowMac() if ( tlw ) { if ( tlw->GetDefaultItem() == (wxButton*) this) - tlw->SetDefaultItem(NULL); + tlw->SetDefaultItem(nullptr); } // delete our drop target if we've got one @@ -267,12 +267,12 @@ WXWidget wxWindowMac::GetHandle() const { if ( GetPeer() ) return (WXWidget) GetPeer()->GetWXWidget() ; - return NULL; + return nullptr; } wxOSXWidgetImpl* wxWindowMac::GetPeer() const { - return m_peer == kOSXNoWidgetImpl ? NULL : m_peer ; + return m_peer == kOSXNoWidgetImpl ? nullptr : m_peer ; } bool wxWindowMac::ShouldCreatePeer() const @@ -288,10 +288,10 @@ void wxWindowMac::DontCreatePeer() void wxWindowMac::SetWrappingPeer(wxOSXWidgetImpl* wrapper) { wxOSXWidgetImpl* inner = GetPeer(); - wxASSERT_MSG( inner != NULL && inner->IsOk(), "missing or incomplete inner peer" ); - wxASSERT_MSG( wrapper != NULL && wrapper->IsOk(), "missing or incomplete wrapper" ); + wxASSERT_MSG( inner != nullptr && inner->IsOk(), "missing or incomplete inner peer" ); + wxASSERT_MSG( wrapper != nullptr && wrapper->IsOk(), "missing or incomplete wrapper" ); - if ( !(inner != NULL && inner->IsOk() && wrapper != NULL && wrapper->IsOk()) ) + if ( !(inner != nullptr && inner->IsOk() && wrapper != nullptr && wrapper->IsOk()) ) return; inner->RemoveFromParent(); @@ -342,7 +342,7 @@ void wxWindowMac::SetPeer(wxOSXWidgetImpl* peer) bool wxWindowMac::MacIsUserPane() const { - return GetPeer() == NULL || GetPeer()->IsUserPane(); + return GetPeer() == nullptr || GetPeer()->IsUserPane(); } // --------------------------------------------------------------------------- @@ -440,7 +440,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) m_windowVariant = variant ; - if (GetPeer() == NULL || !GetPeer()->IsOk()) + if (GetPeer() == nullptr || !GetPeer()->IsOk()) return; GetPeer()->SetControlSize( variant ); @@ -555,7 +555,7 @@ void wxWindowMac::SetFocus() void wxWindowMac::OSXSimulateFocusEvents() { wxWeakRef former = FindFocus() ; - if ( former != NULL && former != this ) + if ( former != nullptr && former != this ) { { wxFocusEvent event( wxEVT_KILL_FOCUS, former->GetId()); @@ -565,7 +565,7 @@ void wxWindowMac::OSXSimulateFocusEvents() } // 'former' could have been destroyed by a wxEVT_KILL_FOCUS handler, - // so we must test it for non-NULL again + // so we must test it for non-null again if ( former ) { wxFocusEvent event(wxEVT_SET_FOCUS, former->GetId()); @@ -589,7 +589,7 @@ wxWindow * wxWindowBase::GetCapture() void wxWindowMac::DoReleaseMouse() { - wxApp::s_captureWindow = NULL ; + wxApp::s_captureWindow = nullptr ; GetPeer()->ReleaseMouse() ; } @@ -852,7 +852,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) wxASSERT_MSG( m_cursor.IsOk(), wxT("cursor must be valid after call to the base version")); - if ( GetPeer() != NULL ) + if ( GetPeer() != nullptr ) GetPeer()->SetCursor( m_cursor ); return true ; @@ -902,7 +902,7 @@ void wxWindowMac::DoSetToolTip(wxToolTip *tooltip) void wxWindowMac::MacInvalidateBorders() { - if ( GetPeer() == NULL ) + if ( GetPeer() == nullptr ) return ; bool vis = IsShownOnScreen() ; @@ -1018,7 +1018,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) wxSize wxWindowMac::DoGetBestSize() const { - if ( GetPeer() == NULL || GetPeer()->IsUserPane() || IsTopLevel() ) + if ( GetPeer() == nullptr || GetPeer()->IsUserPane() || IsTopLevel() ) { return wxWindowBase::DoGetBestSize() ; } @@ -1280,7 +1280,7 @@ bool wxWindowMac::MacIsReallyHilited() int wxWindowMac::GetCharHeight() const { wxCoord height; - GetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL ); + GetTextExtent( wxT("g") , nullptr , &height , nullptr , nullptr , nullptr ); return height; } @@ -1288,7 +1288,7 @@ int wxWindowMac::GetCharHeight() const int wxWindowMac::GetCharWidth() const { wxCoord width; - GetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL ); + GetTextExtent( wxT("g") , &width , nullptr , nullptr , nullptr , nullptr ); return width; } @@ -1332,7 +1332,7 @@ void wxWindowMac::DoGetTextExtent(const wxString& str, void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect) { - if ( GetPeer() == NULL ) + if ( GetPeer() == nullptr ) return ; if ( !IsShownOnScreen() ) @@ -1359,7 +1359,7 @@ void wxWindowMac::DoThaw() wxWindow *wxGetActiveWindow() { // actually this is a windows-only concept - return NULL; + return nullptr; } // Coordinates relative to the window @@ -1589,11 +1589,11 @@ void wxWindowMac::RemoveChild( wxWindowBase *child ) { #if wxUSE_SCROLLBAR if ( child == m_hScrollBar ) - m_hScrollBar = NULL ; + m_hScrollBar = nullptr ; if ( child == m_vScrollBar ) - m_vScrollBar = NULL ; + m_vScrollBar = nullptr ; if ( child == m_growBox ) - m_growBox = NULL ; + m_growBox = nullptr ; #endif if (!child->IsBeingDeleted() && !child->IsTopLevel()) { @@ -1685,7 +1685,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) { wxWindowMac* child; child = node->GetData(); - if (child == NULL) + if (child == nullptr) continue; if (child->IsTopLevel()) @@ -1759,7 +1759,7 @@ void wxWindowMac::Lower() GetPeer()->Lower(); } -// static wxWindow *gs_lastWhich = NULL; +// static wxWindow *gs_lastWhich = nullptr; bool wxWindowMac::MacSetupCursor( const wxPoint& pt ) { @@ -1842,7 +1842,7 @@ wxNonOwnedWindow* wxWindowMac::MacGetTopLevelWindow() const iter = iter->GetParent() ; } - return NULL ; + return nullptr ; } const wxRect& wxWindowMac::MacGetClippedClientRect() const @@ -1987,7 +1987,7 @@ void wxWindowMac::MacPaintChildrenBorders() { wxWindowMac* child; child = node->GetData(); - if (child == NULL) + if (child == nullptr) continue; #if wxUSE_SCROLLBAR if (child == m_vScrollBar) @@ -2023,7 +2023,7 @@ void wxWindowMac::MacPaintChildrenBorders() WXWindow wxWindowMac::MacGetTopLevelWindowRef() const { wxNonOwnedWindow* tlw = MacGetTopLevelWindow(); - return tlw ? tlw->GetWXWindow() : NULL ; + return tlw ? tlw->GetWXWindow() : nullptr ; } bool wxWindowMac::MacHasScrollBarCorner() const @@ -2047,7 +2047,7 @@ bool wxWindowMac::MacHasScrollBarCorner() const void wxWindowMac::MacCreateScrollBars( long style ) { #if wxUSE_SCROLLBAR - wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ; + wxASSERT_MSG( m_vScrollBar == nullptr && m_hScrollBar == nullptr , wxT("attempt to create window twice") ) ; if ( style & ( wxVSCROLL | wxHSCROLL ) ) { @@ -2092,7 +2092,7 @@ void wxWindowMac::MacCreateScrollBars( long style ) bool wxWindowMac::MacIsChildOfClientArea( const wxWindow* child ) const { - bool result = ((child == NULL) + bool result = ((child == nullptr) #if wxUSE_SCROLLBAR || ((child != m_hScrollBar) && (child != m_vScrollBar) && (child != m_growBox)) #endif @@ -2145,7 +2145,7 @@ void wxWindowMac::MacRepositionScrollBars() bool wxWindowMac::AcceptsFocus() const { - if ( GetPeer() == NULL || GetPeer()->HasUserKeyHandling() ) + if ( GetPeer() == nullptr || GetPeer()->HasUserKeyHandling() ) return wxWindowBase::AcceptsFocus(); else return GetPeer()->CanFocus(); @@ -2422,7 +2422,7 @@ wxHotKeyHandler(EventHandlerCallRef WXUNUSED(nextHandler), { EventHotKeyID hotKeyId; - GetEventParameter( event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotKeyId), NULL, &hotKeyId); + GetEventParameter( event, kEventParamDirectObject, typeEventHotKeyID, nullptr, sizeof(hotKeyId), nullptr, &hotKeyId); for ( unsigned i = 0; i < s_hotkeys.size(); ++i ) { @@ -2433,9 +2433,9 @@ wxHotKeyHandler(EventHandlerCallRef WXUNUSED(nextHandler), UInt32 modifiers ; UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - 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 ); + GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, nullptr, 1, nullptr, &charCode ); + GetEventParameter( event, kEventParamKeyCode, typeUInt32, nullptr, sizeof(UInt32), nullptr, &keyCode ); + GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, nullptr, sizeof(UInt32), nullptr, &modifiers ); UInt32 keymessage = (keyCode << 8) + charCode; @@ -2470,7 +2470,7 @@ bool wxWindowMac::RegisterHotKey(int hotkeyId, int modifiers, int keycode) eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; - InstallApplicationEventHandler(&wxHotKeyHandler, 1, &eventType, NULL, NULL); + InstallApplicationEventHandler(&wxHotKeyHandler, 1, &eventType, nullptr, nullptr); installed = true; } @@ -2624,21 +2624,21 @@ wxWindowMac *wxFindWindowFromWXWidget(WXWidget inControl ) if ( impl ) return impl->GetWXPeer(); - return NULL; + return nullptr; } wxWidgetImpl *wxWidgetImpl::FindFromWXWidget(WXWidget inControl ) { MacControlMap::iterator node = wxWinMacControlList.find(inControl); - return (node == wxWinMacControlList.end()) ? NULL : node->second; + return (node == wxWinMacControlList.end()) ? nullptr : node->second; } void wxWidgetImpl::Associate(WXWidget inControl, wxWidgetImpl *impl) { - // adding NULL ControlRef is (first) surely a result of an error and + // adding null ControlRef is (first) surely a result of an error and // (secondly) breaks native event processing - wxCHECK_RET( inControl != (WXWidget) NULL, wxT("attempt to add a NULL WXWidget to control map") ); + wxCHECK_RET( inControl != (WXWidget) nullptr, wxT("attempt to add a null WXWidget to control map") ); wxWinMacControlList[inControl] = impl; } @@ -2668,7 +2668,7 @@ void wxWidgetImpl::RemoveAssociations(wxWidgetImpl* impl) void wxWidgetImpl::RemoveAssociation(WXWidget control) { - wxCHECK_RET( control != NULL, wxT("attempt to remove a NULL WXWidget from control map") ); + wxCHECK_RET( control != nullptr, wxT("attempt to remove a null WXWidget from control map") ); wxWinMacControlList.erase(control); } @@ -2703,7 +2703,7 @@ wxWidgetImpl::wxWidgetImpl() wxWidgetImpl::~wxWidgetImpl() { - m_wxPeer = NULL; + m_wxPeer = nullptr; } void wxWidgetImpl::Init() @@ -2711,7 +2711,7 @@ void wxWidgetImpl::Init() m_isRootControl = false; m_wantsUserKey = false; m_wantsUserMouse = false; - m_wxPeer = NULL; + m_wxPeer = nullptr; m_needsFrame = true; } diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index cd28798674..f794765dcc 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -221,7 +221,7 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl, // Destructor. It is useful to reset the global pointer in it. wxPGSpinCtrlEditor::~wxPGSpinCtrlEditor() { - wxPG_EDITOR(SpinCtrl) = NULL; + wxPG_EDITOR(SpinCtrl) = nullptr; } // Create controls and initialize event handling. @@ -268,7 +268,7 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP { wxFAIL_MSG( "SpinCtrl editor can be assigned only to numeric property" ); tcSz.Set(sz.x, sz.y); - wnd2 = NULL; + wnd2 = nullptr; } wxWindow* wnd1 = wxPGTextCtrlEditor::CreateControls(propgrid, property, pos, tcSz).GetPrimary(); @@ -378,7 +378,7 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(DatePickerCtrl, wxPGDatePickerCtrlEditor::~wxPGDatePickerCtrlEditor() { - wxPG_EDITOR(DatePickerCtrl) = NULL; + wxPG_EDITOR(DatePickerCtrl) = nullptr; } wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgrid, @@ -387,7 +387,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri const wxSize& sz ) const { wxCHECK_MSG( wxDynamicCast(property, wxDateProperty), - NULL, + nullptr, wxS("DatePickerCtrl editor can only be used with wxDateProperty or derivative.") ); wxDateProperty* prop = wxDynamicCast(property, wxDateProperty); @@ -494,7 +494,7 @@ static const wxChar* const gs_fp_es_family_labels[] = { wxT("Roman"), wxT("Script"), wxT("Swiss"), wxT("Modern"), wxT("Teletype"), wxT("Unknown"), - (const wxChar*) NULL + (const wxChar*) nullptr }; static const long gs_fp_es_family_values[] = { @@ -508,7 +508,7 @@ static const wxChar* const gs_fp_es_style_labels[] = { wxT("Normal"), wxT("Slant"), wxT("Italic"), - (const wxChar*) NULL + (const wxChar*) nullptr }; static const long gs_fp_es_style_values[] = { @@ -528,7 +528,7 @@ static const wxChar* const gs_fp_es_weight_labels[] = { wxT("ExtraBold"), wxT("Heavy"), wxT("ExtraHeavy"), - (const wxChar*) NULL + (const wxChar*) nullptr }; static const long gs_fp_es_weight_values[] = { @@ -796,7 +796,7 @@ static const char* const gs_cp_es_syscolour_labels[] = { /* TRANSLATORS: Keyword of system colour */ wxTRANSLATE("WindowFrame"), /* TRANSLATORS: Keyword of system colour */ wxTRANSLATE("WindowText"), /* TRANSLATORS: Custom colour choice entry */ wxTRANSLATE("Custom"), - NULL + nullptr }; static const long gs_cp_es_syscolour_values[] = { @@ -1316,7 +1316,7 @@ void wxSystemColourProperty::OnCustomPaint( wxDC& dc, const wxRect& rect, if ( col.IsOk() ) { #if wxPG_USE_GC_FOR_ALPHA - wxGCDC *gdc = NULL; + wxGCDC *gdc = nullptr; if ( col.Alpha() != wxALPHA_OPAQUE ) { if ( wxPaintDC *paintdc = wxDynamicCast(&dc, wxPaintDC) ) @@ -1517,7 +1517,7 @@ static const char* const gs_cp_es_normcolour_labels[] = { wxTRANSLATE("Yellow"), wxTRANSLATE("White"), /* TRANSLATORS: Custom colour choice entry */ wxTRANSLATE("Custom"), - NULL + nullptr }; static const long gs_cp_es_normcolour_values[] = { @@ -1679,7 +1679,7 @@ static const char* const gs_cp_es_syscursors_labels[NUM_CURSORS+1] = { wxTRANSLATE_IN_CONTEXT("system cursor name", "Wait"), wxTRANSLATE_IN_CONTEXT("system cursor name", "Watch"), wxTRANSLATE_IN_CONTEXT("system cursor name", "Wait Arrow"), - NULL + nullptr }; static const long gs_cp_es_syscursors_values[NUM_CURSORS] = { @@ -2053,7 +2053,7 @@ bool wxMultiChoiceProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v _("Make a selection:"), m_dlgTitle.empty() ? GetLabel() : m_dlgTitle, choiceCount, - choiceCount?&labels[0]:NULL, + choiceCount?&labels[0]:nullptr, m_dlgStyle ); dlg.Move( pg->GetGoodEditorDialogPosition(this,dlg.GetSize()) ); diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index eab50b26dd..9e86f178e8 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -176,8 +176,8 @@ void wxPGEditor::SetControlAppearance( wxPropertyGrid* pg, bool unspecified ) const { // Get old editor appearance - wxTextCtrl* tc = NULL; - wxComboCtrl* cb = NULL; + wxTextCtrl* tc = nullptr; + wxComboCtrl* cb = nullptr; if ( wxDynamicCast(ctrl, wxTextCtrl) ) { tc = (wxTextCtrl*) ctrl; @@ -294,7 +294,7 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid, // If has children, and limited editing is specified, then don't create. if ( property->HasFlag(wxPG_PROP_NOEDITOR) && property->GetChildCount() ) - return NULL; + return nullptr; int argFlags = 0; if ( !property->HasFlag(wxPG_PROP_READONLY) && @@ -307,7 +307,7 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid, wxDynamicCast(property, wxStringProperty) ) flags |= wxTE_PASSWORD; - wxWindow* wnd = propGrid->GenerateEditorTextCtrl(pos,sz,text,NULL,flags, + wxWindow* wnd = propGrid->GenerateEditorTextCtrl(pos,sz,text,nullptr,flags, property->GetMaxLength()); return wnd; @@ -471,7 +471,7 @@ wxPGTextCtrlEditor::~wxPGTextCtrlEditor() { // Reset the global pointer. Useful when wxPropertyGrid is accessed // from an external main loop. - wxPG_EDITOR(TextCtrl) = NULL; + wxPG_EDITOR(TextCtrl) = nullptr; } @@ -575,7 +575,7 @@ public: wxPGComboBox() : wxOwnerDrawnComboBox() - , m_dclickProcessor(NULL) + , m_dclickProcessor(nullptr) { } @@ -649,7 +649,7 @@ public: wxRect rect; rect.x = -1; rect.width = 0; - pg->OnComboItemPaint( this, item, NULL, rect, 0 ); + pg->OnComboItemPaint( this, item, nullptr, rect, 0 ); return rect.height; } @@ -667,7 +667,7 @@ public: wxRect rect; rect.x = -1; rect.width = -1; - pg->OnComboItemPaint( this, item, NULL, rect, 0 ); + pg->OnComboItemPaint( this, item, nullptr, rect, 0 ); return rect.width; } @@ -792,8 +792,8 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, // // DrawItem call - wxPGCellRenderer* renderer = NULL; - const wxPGChoiceEntry* cell = NULL; + wxPGCellRenderer* renderer = nullptr; + const wxPGChoiceEntry* cell = nullptr; wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1, rect.y + 1); @@ -954,7 +954,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, // the same sense that wxTextCtrl is read-only, simply do not create // the control in this case. if ( property->HasFlag(wxPG_PROP_READONLY) ) - return NULL; + return nullptr; const wxPGChoices& choices = property->GetChoices(); wxString defString; @@ -1193,7 +1193,7 @@ bool wxPGChoiceEditor::CanContainCustomImage() const wxPGChoiceEditor::~wxPGChoiceEditor() { - wxPG_EDITOR(Choice) = NULL; + wxPG_EDITOR(Choice) = nullptr; } @@ -1232,8 +1232,8 @@ bool wxPGComboBoxEditor::OnEvent( wxPropertyGrid* propGrid, wxWindow* ctrl, wxEvent& event ) const { - wxOwnerDrawnComboBox* cb = NULL; - wxWindow* textCtrl = NULL; + wxOwnerDrawnComboBox* cb = nullptr; + wxWindow* textCtrl = nullptr; if ( ctrl ) { @@ -1280,7 +1280,7 @@ void wxPGComboBoxEditor::OnFocus( wxPGProperty* property, wxPGComboBoxEditor::~wxPGComboBoxEditor() { - wxPG_EDITOR(ComboBox) = NULL; + wxPG_EDITOR(ComboBox) = nullptr; } @@ -1336,7 +1336,7 @@ wxPGWindowList wxPGChoiceAndButtonEditor::CreateControls( wxPropertyGrid* propGr wxPGChoiceAndButtonEditor::~wxPGChoiceAndButtonEditor() { - wxPG_EDITOR(ChoiceAndButton) = NULL; + wxPG_EDITOR(ChoiceAndButton) = nullptr; } // ----------------------------------------------------------------------- @@ -1363,7 +1363,7 @@ wxPGWindowList wxPGTextCtrlAndButtonEditor::CreateControls( wxPropertyGrid* prop wxPGTextCtrlAndButtonEditor::~wxPGTextCtrlAndButtonEditor() { - wxPG_EDITOR(TextCtrlAndButton) = NULL; + wxPG_EDITOR(TextCtrlAndButton) = nullptr; } // ----------------------------------------------------------------------- @@ -1615,7 +1615,7 @@ wxPGWindowList wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid, const wxSize& size ) const { if ( property->HasFlag(wxPG_PROP_READONLY) ) - return NULL; + return nullptr; wxPoint pt = pos; pt.x -= wxPG_XBEFOREWIDGET; @@ -1733,7 +1733,7 @@ void wxPGCheckBoxEditor::SetValueToUnspecified( wxPGProperty* WXUNUSED(property) wxPGCheckBoxEditor::~wxPGCheckBoxEditor() { - wxPG_EDITOR(CheckBox) = NULL; + wxPG_EDITOR(CheckBox) = nullptr; } #endif // wxPG_INCLUDE_CHECKBOX @@ -1753,7 +1753,7 @@ void wxPropertyGrid::CorrectEditorWidgetSizeX() // Use fixed selColumn 1 for main editor widgets int newSplitterx; - CalcScrolledPosition(m_pState->DoGetSplitterPosition(0), 0, &newSplitterx, NULL); + CalcScrolledPosition(m_pState->DoGetSplitterPosition(0), 0, &newSplitterx, nullptr); int newWidth = newSplitterx + m_pState->GetColumnWidth(1); if ( m_wndEditor2 ) @@ -2029,7 +2029,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrlAndButton( const wxPoint& pos, // There is button Show in GenerateEditorTextCtrl as well but->Show(); #endif - return NULL; + return nullptr; } wxString text; @@ -2069,7 +2069,7 @@ wxTextCtrl* wxPropertyGrid::GetEditorTextCtrl() const wxWindow* wnd = GetEditorControl(); if ( !wnd ) - return NULL; + return nullptr; wxTextCtrl* tc = wxDynamicCast(wnd, wxTextCtrl); if ( tc ) @@ -2081,7 +2081,7 @@ wxTextCtrl* wxPropertyGrid::GetEditorTextCtrl() const return cb->GetTextCtrl(); } - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -2092,7 +2092,7 @@ wxPGEditor* wxPropertyGridInterface::GetEditorByName( const wxString& editorName it = wxPGGlobalVars->m_mapEditorClasses.find(editorName); if ( it == wxPGGlobalVars->m_mapEditorClasses.end() ) - return NULL; + return nullptr; return (wxPGEditor*) it->second; } diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 75d8a17766..339484dbf6 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -333,7 +333,7 @@ wxEND_EVENT_TABLE() wxPropertyGridPage::wxPropertyGridPage() : wxEvtHandler(), wxPropertyGridInterface(), wxPropertyGridPageState() - , m_manager(NULL) + , m_manager(nullptr) , m_isDefault(false) { m_pState = this; // wxPropertyGridInterface to point to State @@ -533,7 +533,7 @@ private: OnColumWidthsChanged(); wxPropertyGrid* pg = m_manager->GetGrid(); - pg->SendEvent(wxEVT_PG_COL_DRAGGING, NULL, NULL, 0, + pg->SendEvent(wxEVT_PG_COL_DRAGGING, nullptr, nullptr, 0, (unsigned int)col); } @@ -551,7 +551,7 @@ private: evt.Veto(); // Allow application to veto dragging else if ( pg->SendEvent(wxEVT_PG_COL_BEGIN_DRAG, - NULL, NULL, 0, + nullptr, nullptr, 0, (unsigned int)col) ) evt.Veto(); } @@ -561,7 +561,7 @@ private: int col = evt.GetColumn(); wxPropertyGrid* pg = m_manager->GetGrid(); pg->SendEvent(wxEVT_PG_COL_END_DRAG, - NULL, NULL, 0, + nullptr, nullptr, 0, (unsigned int)col); } @@ -647,19 +647,19 @@ bool wxPropertyGridManager::Create( wxWindow *parent, void wxPropertyGridManager::Init1() { - m_pPropGrid = NULL; + m_pPropGrid = nullptr; #if wxUSE_TOOLBAR - m_pToolbar = NULL; + m_pToolbar = nullptr; #endif #if wxUSE_HEADERCTRL - m_pHeaderCtrl = NULL; + m_pHeaderCtrl = nullptr; m_showHeader = false; #endif - m_pTxtHelpCaption = NULL; - m_pTxtHelpContent = NULL; + m_pTxtHelpCaption = nullptr; + m_pTxtHelpContent = nullptr; - m_emptyPage = NULL; + m_emptyPage = nullptr; m_selPage = -1; @@ -1014,10 +1014,10 @@ const wxString& wxPropertyGridManager::GetPageName( int index ) const wxPropertyGridPageState* wxPropertyGridManager::GetPageState( int page ) const { - // Do not change this into wxCHECK because returning NULL is important + // Do not change this into wxCHECK because returning nullptr is important // for wxPropertyGridInterface page enumeration mechanics. if ( page >= (int)GetPageCount() ) - return NULL; + return nullptr; if ( page == -1 ) return m_pState; @@ -1111,7 +1111,7 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index, if ( index < 0 ) index = GetPageCount(); - wxCHECK_MSG( (size_t)index == GetPageCount(), NULL, + wxCHECK_MSG( (size_t)index == GetPageCount(), nullptr, wxS("wxPropertyGridManager currently only supports appending pages (due to wxToolBar limitation).")); bool needInit = true; @@ -1322,7 +1322,7 @@ bool wxPropertyGridManager::IsPropertySelected( wxPGPropArg id ) const wxPGProperty* wxPropertyGridManager::GetPageRoot( int index ) const { wxCHECK_MSG( (index >= 0) && (index < (int)m_arrPages.size()), - NULL, + nullptr, wxS("invalid page index") ); return m_arrPages[index]->GetRoot(); @@ -1526,7 +1526,7 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height ) m_pHeaderCtrl->SetSize(0, propgridY, width, wxDefaultCoord); // Sync horizontal scroll position with grid int x; - m_pPropGrid->CalcScrolledPosition(0, 0, &x, NULL); + m_pPropGrid->CalcScrolledPosition(0, 0, &x, nullptr); m_pHeaderCtrl->ScrollWindow(x, 0); propgridY += m_pHeaderCtrl->GetSize().y; } @@ -1811,7 +1811,7 @@ void wxPropertyGridManager::RecreateControls() // No toolbar. if ( m_pToolbar ) m_pToolbar->Destroy(); - m_pToolbar = NULL; + m_pToolbar = nullptr; } #endif @@ -1873,12 +1873,12 @@ void wxPropertyGridManager::RecreateControls() if ( m_pTxtHelpCaption ) m_pTxtHelpCaption->Destroy(); - m_pTxtHelpCaption = NULL; + m_pTxtHelpCaption = nullptr; if ( m_pTxtHelpContent ) m_pTxtHelpContent->Destroy(); - m_pTxtHelpContent = NULL; + m_pTxtHelpContent = nullptr; } int width, height; @@ -1904,7 +1904,7 @@ wxPGProperty* wxPropertyGridManager::DoGetPropertyByName( const wxString& name ) return p; } } - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -1975,7 +1975,7 @@ void wxPropertyGridManager::OnToolbarClick( wxCommandEvent &event ) if ( DoSelectPage(index) ) { // Event dispatching must be last. - m_pPropGrid->SendEvent( wxEVT_PG_PAGE_CHANGED, (wxPGProperty*)NULL ); + m_pPropGrid->SendEvent( wxEVT_PG_PAGE_CHANGED, (wxPGProperty*)nullptr ); } else { diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 56f0094f3d..b9a005445c 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -102,7 +102,7 @@ void wxPGCellRenderer::DrawEditorValue( wxDC& dc, const wxRect& rect, void wxPGCellRenderer::DrawCaptionSelectionRect(wxDC& dc, int x, int y, int w, int h) const { - wxPGDrawFocusRect(NULL, dc, x, y, w, h); + wxPGDrawFocusRect(nullptr, dc, x, y, w, h); } #else void wxPGCellRenderer::DrawCaptionSelectionRect(wxWindow* win, wxDC& dc, @@ -186,7 +186,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, const wxPropertyGrid* propertyGrid, wxPGProperty* property, int column, int item, int flags ) const { - const wxPGEditor* editor = NULL; + const wxPGEditor* editor = nullptr; wxString text; bool isUnspecified = property->IsValueUnspecified(); @@ -279,9 +279,9 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect, propertyGrid->GetCellDisabledTextColour(); dc.SetTextForeground(hCol); - // Must make the editor NULL to override its own rendering + // Must make the editor nullptr to override its own rendering // code. - editor = NULL; + editor = nullptr; } } else @@ -453,22 +453,22 @@ void wxPGCell::SetEmptyData() wxIMPLEMENT_ABSTRACT_CLASS(wxPGProperty, wxObject); -wxString* wxPGProperty::sm_wxPG_LABEL = NULL; +wxString* wxPGProperty::sm_wxPG_LABEL = nullptr; void wxPGProperty::Init() { m_commonValue = -1; m_arrIndex = 0xFFFF; - m_parent = NULL; + m_parent = nullptr; - m_parentState = NULL; + m_parentState = nullptr; - m_clientData = NULL; - m_clientObject = NULL; + m_clientData = nullptr; + m_clientObject = nullptr; - m_customEditor = NULL; + m_customEditor = nullptr; #if wxUSE_VALIDATORS - m_validator = NULL; + m_validator = nullptr; #endif m_maxLen = 0; // infinite maximum length @@ -483,7 +483,7 @@ void wxPGProperty::Init() void wxPGProperty::Init( const wxString& label, const wxString& name ) { - // wxPG_LABEL reference can be NULL if we are called before property + // wxPG_LABEL reference can be null if we are called before property // grid has been initialized if ( sm_wxPG_LABEL && label != wxPG_LABEL ) @@ -502,10 +502,10 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState, { // // Called after property has been added to grid or page - // (so propgrid can be NULL, too). + // (so propgrid can be null, too). wxPGProperty* parent = m_parent; - bool parentIsRoot = wxDynamicCast(parent, wxPGRootProperty) != NULL; + bool parentIsRoot = wxDynamicCast(parent, wxPGRootProperty) != nullptr; // // Convert invalid cells to default ones in this grid @@ -681,7 +681,7 @@ wxPGProperty::~wxPGProperty() #endif // This makes it easier for us to detect dangling pointers - m_parent = NULL; + m_parent = nullptr; } @@ -733,7 +733,7 @@ wxString wxPGProperty::GetName() const wxPropertyGrid* wxPGProperty::GetGrid() const { - return m_parentState ? m_parentState->GetGrid() : NULL; + return m_parentState ? m_parentState->GetGrid() : nullptr; } int wxPGProperty::Index( const wxPGProperty* p ) const @@ -768,7 +768,7 @@ void wxPGProperty::GetDisplayInfo( unsigned int column, wxASSERT_MSG(!pCell || !(*pCell), wxS("Cell pointer is a dummy argument and shouldn't be used")); wxUnusedVar(pCell); - GetDisplayInfo(column, choiceIndex, flags, pString, (wxPGCell*)NULL); + GetDisplayInfo(column, choiceIndex, flags, pString, (wxPGCell*)nullptr); } #endif // WXWIN_COMPATIBILITY_3_0 @@ -1426,7 +1426,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags ) // For aggregate properties, we will trust RefreshChildren() // to update child values. if ( !HasFlag(wxPG_PROP_AGGREGATE) ) - child->SetValue(childValue, NULL, flags|wxPG_SETVAL_FROM_PARENT); + child->SetValue(childValue, nullptr, flags|wxPG_SETVAL_FROM_PARENT); if ( flags & wxPG_SETVAL_BY_USER ) child->SetFlag(wxPG_PROP_MODIFIED); } @@ -1469,7 +1469,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags ) if ( AreChildrenComponents() ) { for ( unsigned int i = 0; i < GetChildCount(); i++ ) - Item(i)->SetValue(value, NULL, flags|wxPG_SETVAL_FROM_PARENT); + Item(i)->SetValue(value, nullptr, flags|wxPG_SETVAL_FROM_PARENT); } } @@ -1798,7 +1798,7 @@ void wxPGProperty::SetDefaultColours(int flags) wxPGEditorDialogAdapter* wxPGProperty::GetEditorDialog() const { - return NULL; + return nullptr; } bool wxPGProperty::DoSetAttribute( const wxString& WXUNUSED(name), wxVariant& WXUNUSED(value) ) @@ -1943,7 +1943,7 @@ void wxPGProperty::SetFlagsFromString( const wxString& str ) wxValidator* wxPGProperty::DoGetValidator() const { - return NULL; + return nullptr; } int wxPGProperty::InsertChoice( const wxString& label, int index, int value ) @@ -2198,7 +2198,7 @@ bool wxPGProperty::IsVisible() const if ( HasFlag(wxPG_PROP_HIDDEN) ) return false; - for (const wxPGProperty* parent = GetParent(); parent != NULL; parent = parent->GetParent() ) + for (const wxPGProperty* parent = GetParent(); parent != nullptr; parent = parent->GetParent() ) { if ( !parent->IsExpanded() || parent->HasFlag(wxPG_PROP_HIDDEN) ) return false; @@ -2211,11 +2211,11 @@ wxPropertyGrid* wxPGProperty::GetGridIfDisplayed() const { wxPropertyGridPageState* state = GetParentState(); if ( !state ) - return NULL; + return nullptr; wxPropertyGrid* propGrid = state->GetGrid(); if ( state == propGrid->GetState() ) return propGrid; - return NULL; + return nullptr; } @@ -2226,7 +2226,7 @@ int wxPGProperty::GetY2( int lh ) const int y = 0; - for ( parent = GetParent(); parent != NULL; parent = child->GetParent() ) + for ( parent = GetParent(); parent != nullptr; parent = child->GetParent() ) { if ( !parent->IsExpanded() ) return parent->GetY2(lh); @@ -2401,7 +2401,7 @@ void wxPGProperty::FixIndicesOfChildren( unsigned int starthere ) } -// Returns (direct) child property with given name (or NULL if not found) +// Returns (direct) child property with given name (or nullptr if not found) wxPGProperty* wxPGProperty::GetPropertyByName( const wxString& name ) const { for ( unsigned int i = 0; i < GetChildCount(); i++ ) @@ -2414,12 +2414,12 @@ wxPGProperty* wxPGProperty::GetPropertyByName( const wxString& name ) const // Does it have point, then? int pos = name.Find(wxS('.')); if ( pos <= 0 ) - return NULL; + return nullptr; wxPGProperty* p = GetPropertyByName(name. substr(0,pos)); if ( !p || !p->GetChildCount() ) - return NULL; + return nullptr; return p->GetPropertyByName(name.substr(pos+1,name.length()-pos-1)); } @@ -2446,7 +2446,7 @@ wxPGProperty* wxPGProperty::GetPropertyByNameWH( const wxString& name, unsigned i = 0; } - return NULL; + return nullptr; } int wxPGProperty::GetChildrenHeight( int lh, int iMax ) const @@ -2490,8 +2490,8 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y, // Linear search at the moment // // nextItemY = y of next visible property, final value will be written back. - wxPGProperty* result = NULL; - wxPGProperty* current = NULL; + wxPGProperty* result = nullptr; + wxPGProperty* current = nullptr; unsigned int iy = *nextItemY; for ( unsigned int i = 0; i < GetChildCount(); i++ ) @@ -2557,7 +2557,7 @@ void wxPGProperty::Empty() wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y ) const { wxPropertyGrid *pg = GetGrid(); - wxCHECK_MSG( pg, NULL, + wxCHECK_MSG( pg, nullptr, wxS("Cannot obtain property item for detached property") ); unsigned int nextItem = 0; @@ -2608,7 +2608,7 @@ wxVariant wxPGProperty::ChildChanged( wxVariant& WXUNUSED(thisValue), bool wxPGProperty::AreAllChildrenSpecified( const wxVariant* pendingList ) const { - const wxVariantList* pList = NULL; + const wxVariantList* pList = nullptr; wxVariantList::const_iterator node; if ( pendingList ) @@ -2620,7 +2620,7 @@ bool wxPGProperty::AreAllChildrenSpecified( const wxVariant* pendingList ) const for ( unsigned int i = 0; i < GetChildCount(); i++ ) { wxPGProperty* child = Item(i); - const wxVariant* listValue = NULL; + const wxVariant* listValue = nullptr; wxVariant value; if ( pendingList ) @@ -2648,7 +2648,7 @@ bool wxPGProperty::AreAllChildrenSpecified( const wxVariant* pendingList ) const // Check recursively if ( child->GetChildCount() ) { - const wxVariant* childList = NULL; + const wxVariant* childList = nullptr; if ( listValue && listValue->IsType(wxPG_VARIANT_TYPE_LIST) ) childList = listValue; @@ -2706,7 +2706,7 @@ void wxPGProperty::SubPropsChanged( int oldSelInd ) child->InitAfterAdded(state, grid); } - wxPGProperty* sel = NULL; + wxPGProperty* sel = nullptr; if ( oldSelInd >= (int)m_children.size() ) oldSelInd = (int)m_children.size() - 1; @@ -2769,7 +2769,7 @@ bool wxPGProperty::SetMaxLength(int maxLen) wxBitmap* wxPGProperty::GetValueImage() const { if ( !m_valueBitmapBundle.IsOk() ) - return NULL; + return nullptr; wxPropertyGrid* pg = GetGrid(); if ( pg ) @@ -2854,7 +2854,7 @@ wxString wxPropertyCategory::GetValueAsString( int argFlags ) const static int DoGetTextExtent(const wxWindow* wnd, const wxString& label, const wxFont& font) { int x = 0, y = 0; - wnd->GetTextExtent(label, &x, &y, NULL, NULL, &font); + wnd->GetTextExtent(label, &x, &y, nullptr, nullptr, &font); return x; } diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 613afb9953..0f71c5d41e 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -161,12 +161,12 @@ void wxPGInitResourceModule() wxModule::InitializeModules(); } -wxPGGlobalVarsClass* wxPGGlobalVars = NULL; +wxPGGlobalVarsClass* wxPGGlobalVars = nullptr; wxPGGlobalVarsClass::wxPGGlobalVarsClass() // Prepare some shared variants - : m_fontFamilyChoices(NULL) + : m_fontFamilyChoices(nullptr) , m_defaultRenderer(new wxPGDefaultRenderer()) , m_vEmptyString(wxString()) , m_vZero(0L) @@ -217,8 +217,8 @@ wxPGGlobalVarsClass::~wxPGGlobalVarsClass() } // Make sure the global pointers have been reset - wxASSERT(wxPG_EDITOR(TextCtrl) == NULL); - wxASSERT(wxPG_EDITOR(ChoiceAndButton) == NULL); + wxASSERT(wxPG_EDITOR(TextCtrl) == nullptr); + wxASSERT(wxPG_EDITOR(ChoiceAndButton) == nullptr); delete wxPGProperty::sm_wxPG_LABEL; } @@ -322,18 +322,18 @@ void wxPropertyGrid::Init1() m_validatingEditor = 0; m_iFlags = 0; - m_pState = NULL; - m_wndEditor = m_wndEditor2 = NULL; + m_pState = nullptr; + m_wndEditor = m_wndEditor2 = nullptr; m_selColumn = 1; m_colHover = 1; - m_propHover = NULL; - m_labelEditor = NULL; - m_labelEditorProperty = NULL; + m_propHover = nullptr; + m_labelEditor = nullptr; + m_labelEditorProperty = nullptr; m_eventObject = this; - m_curFocused = NULL; - m_processedEvent = NULL; - m_tlp = NULL; - m_sortFunction = NULL; + m_curFocused = nullptr; + m_processedEvent = nullptr; + m_tlp = nullptr; + m_sortFunction = nullptr; m_inDoPropertyChanged = false; m_inCommitChangesFromEditor = false; m_inDoSelectProperty = false; @@ -358,7 +358,7 @@ void wxPropertyGrid::Init1() m_coloursCustomized = 0; - m_doubleBuffer = NULL; + m_doubleBuffer = nullptr; #ifndef wxPG_ICON_WIDTH m_iconWidth = 11; @@ -378,7 +378,7 @@ void wxPropertyGrid::Init1() m_commonValues.push_back(new wxPGCommonValue(_("Unspecified"), wxPGGlobalVars->m_defaultRenderer) ); m_cvUnspecified = 0; - m_chgInfo_changedProperty = NULL; + m_chgInfo_changedProperty = nullptr; #if WXWIN_COMPATIBILITY_3_0 // Object array for this wxPG shouldn't exist in the hash map. wxASSERT( gs_deletedEditorObjects.find(this) == gs_deletedEditorObjects.end() ); @@ -455,7 +455,7 @@ void wxPropertyGrid::Init2() #endif // wxALWAYS_NATIVE_DOUBLE_BUFFER // Hook the top-level parent - m_tlpClosed = NULL; + m_tlpClosed = nullptr; m_tlpClosedTime = 0; // set virtual size to this window size @@ -490,8 +490,8 @@ wxPropertyGrid::~wxPropertyGrid() for ( i=0; iSetPropertyGrid(NULL); - evt->SetProperty(NULL); + evt->SetPropertyGrid(nullptr); + evt->SetProperty(nullptr); } m_liveEvents.clear(); @@ -512,7 +512,7 @@ wxPropertyGrid::~wxPropertyGrid() wxS("at idle time instead.")); } - DoSelectProperty(NULL, wxPG_SEL_NOVALIDATE|wxPG_SEL_DONT_SEND_EVENT); + DoSelectProperty(nullptr, wxPG_SEL_NOVALIDATE|wxPG_SEL_DONT_SEND_EVENT); // This should do prevent things from going too badly wrong m_iFlags &= ~(wxPG_FL_INITIALIZED); @@ -520,10 +520,10 @@ wxPropertyGrid::~wxPropertyGrid() if ( m_iFlags & wxPG_FL_MOUSE_CAPTURED ) ReleaseMouse(); - // Call with NULL to disconnect event handling + // Call with nullptr to disconnect event handling if ( HasExtraStyle(wxPG_EX_ENABLE_TLP_TRACKING) ) { - OnTLPChanging(NULL); + OnTLPChanging(nullptr); wxASSERT_MSG( !IsEditorsValueModified(), wxS("Most recent change in property editor was ") @@ -697,7 +697,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags ) if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) ) { - SendEvent( wxEVT_PG_SELECTED, prop, NULL ); + SendEvent( wxEVT_PG_SELECTED, prop, nullptr ); } DrawItem(prop); @@ -716,7 +716,7 @@ bool wxPropertyGrid::DoRemoveFromSelection( wxPGProperty* prop, int selFlags ) wxArrayPGProperty& selection = m_pState->m_selection; if ( selection.size() <= 1 ) { - res = DoSelectProperty(NULL, selFlags); + res = DoSelectProperty(nullptr, selFlags); } else { @@ -953,13 +953,13 @@ void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex, if ( !(selFlags & wxPG_SEL_DONT_SEND_EVENT) ) { if ( SendEvent( wxEVT_PG_LABEL_EDIT_BEGIN, - selected, NULL, 0, + selected, nullptr, 0, colIndex ) ) return; } wxString text; - const wxPGCell* cell = NULL; + const wxPGCell* cell = nullptr; if ( selected->HasCell(colIndex) ) { cell = &selected->GetCell(colIndex); @@ -987,7 +987,7 @@ void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex, wxWindow* tc = GenerateEditorTextCtrl(r.GetPosition(), r.GetSize(), text, - NULL, + nullptr, wxTE_PROCESS_ENTER, 0, colIndex); @@ -1054,7 +1054,7 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags ) // wxPG_SEL_NOVALIDATE is passed correctly in selFlags if ( SendEvent( wxEVT_PG_LABEL_EDIT_ENDING, - prop, NULL, selFlags, + prop, nullptr, selFlags, m_selColumn ) ) return; } @@ -1069,7 +1069,7 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags ) } else { - wxPGCell* cell = NULL; + wxPGCell* cell = nullptr; if ( prop->HasCell(labelColIdx) ) { cell = &prop->GetCell(labelColIdx); @@ -1091,8 +1091,8 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags ) DestroyEditorWnd(m_labelEditor); - m_labelEditor = NULL; - m_labelEditorProperty = NULL; + m_labelEditor = nullptr; + m_labelEditorProperty = nullptr; // Fix focus (needed at least on wxGTK) if ( wasFocused ) @@ -1108,7 +1108,7 @@ void wxPropertyGrid::SetExtraStyle( long exStyle ) if ( exStyle & wxPG_EX_ENABLE_TLP_TRACKING ) OnTLPChanging(::wxGetTopLevelParent(this)); else - OnTLPChanging(NULL); + OnTLPChanging(nullptr); if ( exStyle & wxPG_EX_NATIVE_DOUBLE_BUFFERING ) { @@ -1192,11 +1192,11 @@ void wxPropertyGrid::OnTLPChanging( wxWindow* newTLP ) m_tlpClosedTime+250 < currentTime ) { newTLP->Bind(wxEVT_CLOSE_WINDOW, &wxPropertyGrid::OnTLPClose, this); - m_tlpClosed = NULL; + m_tlpClosed = nullptr; } else { - newTLP = NULL; + newTLP = nullptr; } } @@ -1214,10 +1214,10 @@ void wxPropertyGrid::OnTLPClose( wxCloseEvent& event ) return; } - // Ok, it can close, set tlp pointer to NULL. Some other event + // Ok, it can close, set tlp pointer to nullptr. Some other event // handler can of course veto the close, but our OnIdle() should // then be able to regain the tlp pointer. - OnTLPChanging(NULL); + OnTLPChanging(nullptr); event.Skip(); } @@ -1252,11 +1252,11 @@ void wxPropertyGrid::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int xPos, int yPos, bool noRefresh) { int oldX; - CalcUnscrolledPosition(0, 0, &oldX, NULL); + CalcUnscrolledPosition(0, 0, &oldX, nullptr); wxScrolled::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos, yPos, noRefresh); int newX; - CalcUnscrolledPosition(0, 0, &newX, NULL); + CalcUnscrolledPosition(0, 0, &newX, nullptr); if ( newX != oldX ) { // Notify wxPropertyGridManager about the grid being scrolled horizontally @@ -1275,7 +1275,7 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing ) m_captionFont = wxControl::GetFont(); - GetTextExtent(wxS("jG"), &x, &y, NULL, NULL, &m_captionFont); + GetTextExtent(wxS("jG"), &x, &y, nullptr, nullptr, &m_captionFont); m_subgroup_extramargin = x + (x/2); m_fontHeight = y; @@ -1306,7 +1306,7 @@ void wxPropertyGrid::CalculateFontAndBitmapStuff( int vspacing ) m_marginWidth = m_gutterWidth*2 + m_iconWidth; m_captionFont.SetWeight(wxFONTWEIGHT_BOLD); - GetTextExtent(wxS("jG"), &x, &y, NULL, NULL, &m_captionFont); + GetTextExtent(wxS("jG"), &x, &y, nullptr, nullptr, &m_captionFont); m_lineHeight = m_fontHeight+(2*m_spacingy)+1; @@ -1852,7 +1852,7 @@ wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y ) const { // Outside? if ( y < 0 ) - return NULL; + return nullptr; unsigned int a = 0; return m_pState->DoGetRoot()->GetItemAtY(y, m_lineHeight, &a); @@ -1864,7 +1864,7 @@ wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y ) const void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) ) { - wxDC* dcPtr = NULL; + wxDC* dcPtr = nullptr; if ( !HasExtraStyle(wxPG_EX_NATIVE_DOUBLE_BUFFERING) ) { if ( m_doubleBuffer ) @@ -2154,7 +2154,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, } } - visPropArray.push_back(NULL); + visPropArray.push_back(nullptr); wxPGProperty* nextP = visPropArray[0]; @@ -2399,7 +2399,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, if ( !isCategory ) cellRect.width -= 1; - wxWindow* cellEditor = NULL; + wxWindow* cellEditor = nullptr; int cellRenderFlags = renderFlags; // Tree Item Button (must be drawn before clipping is set up) @@ -2428,7 +2428,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, if ( m_dragStatus != 0 || (m_iFlags & wxPG_FL_CUR_USES_CUSTOM_IMAGE) ) - cellEditor = NULL; + cellEditor = nullptr; } else { @@ -2505,7 +2505,7 @@ wxRect wxPropertyGrid::GetPropertyRect( const wxPGProperty* p1, const wxPGProper { if ( m_width < 10 || m_height < 10 || !m_pState->DoGetRoot()->GetChildCount() || - p1 == NULL ) + p1 == nullptr ) return wxRect(0,0,0,0); int vy = 0; @@ -2651,7 +2651,7 @@ void wxPropertyGrid::Clear() { m_pState->DoClear(); - m_propHover = NULL; + m_propHover = nullptr; RecalculateVirtualSize(); @@ -2748,7 +2748,7 @@ void wxPropertyGrid::SwitchState( wxPropertyGridPageState* pNewState ) pgWidth - pNewState->GetVirtualWidth()); } - m_propHover = NULL; + m_propHover = nullptr; // If necessary, convert state to correct mode. if ( orig_mode != new_state_mode ) @@ -2838,7 +2838,7 @@ void wxPropertyGrid::CenterSplitter( bool enableAutoResizing ) wxPGProperty* wxPropertyGrid::GetNearestPaintVisible( wxPGProperty* p ) const { int vy1;// Top left corner of client - GetViewStart(NULL,&vy1); + GetViewStart(nullptr,&vy1); vy1 *= wxPG_PIXELS_PER_UNIT; int vy2 = vy1 + m_height; @@ -2902,7 +2902,7 @@ bool wxPropertyGrid::CommitChangesFromEditor( wxUint32 flags ) bool validationFailure = false; bool forceSuccess = (flags & (wxPG_SEL_NOVALIDATE|wxPG_SEL_FORCE)) ? true : false; - m_chgInfo_changedProperty = NULL; + m_chgInfo_changedProperty = nullptr; // If truly modified, schedule value as pending. if ( selected->GetEditorClass()-> @@ -2983,7 +2983,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue // // Adapt list to child values, if necessary wxVariant* pPendingValue = &pendingValue; - wxVariant* pList = NULL; + wxVariant* pList = nullptr; // If parent has wxPG_PROP_AGGREGATE flag, or uses composite // string value, then we need treat as it was changed instead @@ -3067,7 +3067,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue } } - wxASSERT( m_chgInfo_changedProperty == NULL ); + wxASSERT( m_chgInfo_changedProperty == nullptr ); m_chgInfo_changedProperty = changedProperty; m_chgInfo_baseChangedProperty = baseChangedProperty; m_chgInfo_pendingValue = value; @@ -3097,7 +3097,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue { // If called in 'generic' context, we need to reset // m_chgInfo_changedProperty and write back translated value. - m_chgInfo_changedProperty = NULL; + m_chgInfo_changedProperty = nullptr; pendingValue = value; } @@ -3117,7 +3117,7 @@ wxStatusBar* wxPropertyGrid::GetStatusBar() { return frame->GetStatusBar(); } - return NULL; + return nullptr; } #endif @@ -3350,7 +3350,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags ) m_pState->m_anyModified = true; // Maybe need to update control - wxASSERT( m_chgInfo_changedProperty != NULL ); + wxASSERT( m_chgInfo_changedProperty != nullptr ); // These values were calculated in PerformValidation() wxPGProperty* changedProperty = m_chgInfo_changedProperty; @@ -3379,7 +3379,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags ) // Propagate updates to parent(s) wxPGProperty* topPaintedProperty = changedProperty->GetMainParent(); wxPGProperty* pwc = p; - wxPGProperty* prevPwc = NULL; + wxPGProperty* prevPwc = nullptr; while ( prevPwc != topPaintedProperty ) { @@ -3424,12 +3424,12 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags ) while ( pwc != changedProperty ) { - SendEvent( wxEVT_PG_CHANGED, pwc, NULL ); + SendEvent( wxEVT_PG_CHANGED, pwc, nullptr ); pwc = pwc->GetParent(); } } - SendEvent( wxEVT_PG_CHANGED, changedProperty, NULL ); + SendEvent( wxEVT_PG_CHANGED, changedProperty, nullptr ); return true; } @@ -3440,7 +3440,7 @@ bool wxPropertyGrid::ChangePropertyValue( wxPGPropArg id, wxVariant newValue ) { wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false) - m_chgInfo_changedProperty = NULL; + m_chgInfo_changedProperty = nullptr; if ( PerformValidation(p, newValue) ) { @@ -3560,7 +3560,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event ) int usesAutoUnspecified = selected->UsesAutoUnspecified(); bool valueIsPending = false; - m_chgInfo_changedProperty = NULL; + m_chgInfo_changedProperty = nullptr; m_iFlags &= ~wxPG_FL_VALUE_CHANGE_IN_EVENT; @@ -3785,7 +3785,7 @@ wxRect wxPropertyGrid::GetImageRect( wxPGProperty* p, int item ) const // return size of custom paint image wxSize wxPropertyGrid::GetImageSize( wxPGProperty* p, int item ) const { - // If called with NULL property, then return default image + // If called with nullptr property, then return default image // size for properties that use image. if ( !p ) return wxSize(wxPG_CUSTOM_IMAGE_WIDTH,wxPG_STD_CUST_IMAGE_HEIGHT(m_lineHeight)); @@ -3797,7 +3797,7 @@ wxSize wxPropertyGrid::GetImageSize( wxPGProperty* p, int item ) const if ( item >= choiceCount && comVals > 0 ) { unsigned int cvi = item-choiceCount; - cis = GetCommonValue(cvi)->GetRenderer()->GetImageSize(NULL, 1, cvi); + cis = GetCommonValue(cvi)->GetRenderer()->GetImageSize(nullptr, 1, cvi); } else if ( item >= 0 && choiceCount == 0 ) return wxSize(0, 0); @@ -3979,7 +3979,7 @@ void wxPropertyGrid::FreeEditors() m_wndEditor2->Hide(); m_deletedEditorObjects.push_back(handler); DestroyEditorWnd(m_wndEditor2); - m_wndEditor2 = NULL; + m_wndEditor2 = nullptr; } if ( m_wndEditor ) @@ -3988,11 +3988,11 @@ void wxPropertyGrid::FreeEditors() m_wndEditor->Hide(); m_deletedEditorObjects.push_back(handler); DestroyEditorWnd(m_wndEditor); - m_wndEditor = NULL; + m_wndEditor = nullptr; } } -// Call with NULL to de-select property +// Call with nullptr to de-select property bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) { /* @@ -4003,7 +4003,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) } else { - wxLogDebug(wxS("SelectProperty( NULL, -1 )")); + wxLogDebug(wxS("SelectProperty( nullptr, -1 )")); } */ @@ -4019,10 +4019,10 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) wxArrayPGProperty prevSelection = m_pState->m_selection; wxPGProperty* prevFirstSel; - prevFirstSel = prevSelection.empty()? NULL: prevSelection[0]; + prevFirstSel = prevSelection.empty()? nullptr: prevSelection[0]; if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) ) - prevFirstSel = NULL; + prevFirstSel = nullptr; // Always send event, as this is indirect call DoEndLabelEdit(true, wxPG_SEL_NOVALIDATE); @@ -4036,10 +4036,10 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) if (p) wxPrintf( "P = %s\n", p->GetClassInfo()->GetClassName() ); else - wxPrintf( "P = NULL\n" ); + wxPrintf( "P = nullptr\n" ); */ - wxWindow* primaryCtrl = NULL; + wxWindow* primaryCtrl = nullptr; // If we are frozen, then just set the values. if ( IsFrozen() ) @@ -4053,7 +4053,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) FreeEditors(); // Prevent any further selection measures in this call - p = NULL; + p = nullptr; } else { @@ -4126,12 +4126,12 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) int propY = p->GetY2(m_lineHeight); int splitterX; - CalcScrolledPosition(GetSplitterPosition(), 0, &splitterX, NULL); + CalcScrolledPosition(GetSplitterPosition(), 0, &splitterX, nullptr); m_editorFocused = false; m_iFlags |= wxPG_FL_PRIMARY_FILLS_ENTIRE; - wxASSERT( m_wndEditor == NULL ); + wxASSERT( m_wndEditor == nullptr ); // // Only create editor for non-disabled non-caption @@ -4156,7 +4156,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) const wxPGEditor* editor = p->GetEditorClass(); wxCHECK_MSG(editor, false, - wxS("NULL editor class not allowed")); + wxS("null editor class not allowed")); m_iFlags &= ~wxPG_FL_FIXED_WIDTH_EDITOR; @@ -4185,7 +4185,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) // Essentially, primaryCtrl == m_wndEditor // - // NOTE: It is allowed for m_wndEditor to be NULL - in this + // NOTE: It is allowed for m_wndEditor to be null - in this // case value is drawn as normal, and m_wndEditor2 is // assumed to be a right-aligned button that triggers // a separate editorCtrl window. @@ -4306,7 +4306,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) ClearInternalFlag(wxPG_FL_IN_SELECT_PROPERTY); } - const wxString* pHelpString = NULL; + const wxString* pHelpString = nullptr; if ( p ) pHelpString = &p->GetHelpString(); @@ -4361,7 +4361,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) p = prevFirstSel; } if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) && p) - SendEvent( wxEVT_PG_SELECTED, p, NULL ); + SendEvent( wxEVT_PG_SELECTED, p, nullptr ); return true; } @@ -4727,7 +4727,7 @@ void wxPropertyGrid::SendEvent(wxEventType eventType, int intVal) wxPropertyGridEvent evt(eventType, m_eventObject->GetId()); evt.SetPropertyGrid(this); evt.SetEventObject(m_eventObject); - evt.SetProperty(NULL); + evt.SetProperty(nullptr); evt.SetColumn(0); evt.SetInt(intVal); @@ -4837,10 +4837,10 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even { ResetColumnSizes( true ); - SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)NULL); + SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)nullptr); SendEvent(wxEVT_PG_COL_DRAGGING, m_propHover, - NULL, + nullptr, wxPG_SEL_NOVALIDATE, 0); // dragged splitter is always 0 here } @@ -4856,7 +4856,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even // Allow application to veto dragging if ( !SendEvent(wxEVT_PG_COL_BEGIN_DRAG, - p, NULL, 0, + p, nullptr, 0, (unsigned int)splitterHit) ) { if ( m_wndEditor ) @@ -5000,10 +5000,10 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxPG_SPLITTER_REFRESH | wxPG_SPLITTER_FROM_EVENT); - SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)NULL); + SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)nullptr); SendEvent(wxEVT_PG_COL_DRAGGING, m_propHover, - NULL, + nullptr, wxPG_SEL_NOVALIDATE, (unsigned int)m_draggedSplitter); } @@ -5096,12 +5096,12 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, space -= m_propHover->GetImageOffset(imageWidth); space -= (wxPG_XBEFORETEXT + 1); int tw, th; - const wxFont* font = NULL; + const wxFont* font = nullptr; if ( (m_windowStyle & wxPG_BOLD_MODIFIED) && m_propHover->HasFlag(wxPG_PROP_MODIFIED) ) font = &m_captionFont; if ( cell.GetFont().IsOk() ) font = &cell.GetFont(); - GetTextExtent( tipString, &tw, &th, NULL, NULL, font ); + GetTextExtent( tipString, &tw, &th, nullptr, nullptr, font ); if ( tw > space ) SetToolTip( tipString ); } @@ -5215,7 +5215,7 @@ bool wxPropertyGrid::HandleMouseUp( int x, unsigned int WXUNUSED(y), SendEvent(wxEVT_PG_COL_END_DRAG, m_propHover, - NULL, + nullptr, wxPG_SEL_NOVALIDATE, (unsigned int)m_draggedSplitter); @@ -5287,7 +5287,7 @@ bool wxPropertyGrid::OnMouseCommon( wxMouseEvent& event, int* px, int* py ) wxRect r; if ( wnd ) r = wnd->GetRect(); - if ( wnd == NULL || m_dragStatus || + if ( wnd == nullptr || m_dragStatus || ( ux <= (splitterX + wxPG_SPLITTERX_DETECTMARGIN2) || ux >= (r.x+r.width) || @@ -6109,7 +6109,7 @@ wxPGEditor* wxPropertyGrid::DoRegisterEditorClass( wxPGEditor* editorClass, // Use this in RegisterDefaultEditors. #define wxPGRegisterDefaultEditorClass(EDITOR) \ - if ( wxPGEditor_##EDITOR == NULL ) \ + if ( wxPGEditor_##EDITOR == nullptr ) \ { \ wxPGEditor_##EDITOR = wxPropertyGrid::RegisterEditorClass( \ new wxPG##EDITOR##Editor, true ); \ @@ -6295,9 +6295,9 @@ wxDEFINE_EVENT( wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent); wxPropertyGridEvent::wxPropertyGridEvent(wxEventType commandType, int id) : wxCommandEvent(commandType,id) - , m_property(NULL) - , m_pg(NULL) - , m_validationInfo(NULL) + , m_property(nullptr) + , m_pg(nullptr) + , m_validationInfo(nullptr) , m_column(1) , m_canVeto(false) , m_wasVetoed(false) @@ -6370,8 +6370,8 @@ wxEvent* wxPropertyGridEvent::Clone() const // ----------------------------------------------------------------------- wxPropertyGridPopulator::wxPropertyGridPopulator() - : m_pg(NULL) - , m_state(NULL) + : m_pg(nullptr) + , m_state(nullptr) { wxPGGlobalVars->m_offline++; } @@ -6425,13 +6425,13 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass, if ( parent->HasFlag(wxPG_PROP_AGGREGATE) ) { ProcessError(wxString::Format(wxS("new children cannot be added to '%s'"),parent->GetName())); - return NULL; + return nullptr; } if ( !classInfo || !classInfo->IsKindOf(wxCLASSINFO(wxPGProperty)) ) { ProcessError(wxString::Format(wxS("'%s' is not valid property class"),propClass)); - return NULL; + return nullptr; } wxPGProperty* property = (wxPGProperty*) classInfo->CreateObject(); diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 06e7e4e2b8..5df83813d5 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -146,7 +146,7 @@ wxPGProperty* wxPropertyGridInterface::ReplaceProperty( wxPGPropArg id, wxPGProp wxPGProperty* replaced = p; wxCHECK_MSG( replaced && property, wxNullProperty, - wxS("NULL property") ); + wxS("null property") ); wxCHECK_MSG( !replaced->IsCategory(), wxNullProperty, wxS("cannot replace this type of property") ); @@ -199,9 +199,9 @@ bool wxPropertyGridInterface::DoClearSelection( bool validation, { wxPropertyGrid* pg = state->GetGrid(); if ( pg->GetState() == state ) - return pg->DoSelectProperty(NULL, selFlags); + return pg->DoSelectProperty(nullptr, selFlags); else - state->DoSetSelection(NULL); + state->DoSetSelection(nullptr); } return true; @@ -335,7 +335,7 @@ void wxPropertyGridInterface::ClearModifiedStatus() unsigned int pageIndex = 0; wxPropertyGridPageState* page; - while ( (page = GetPageState(pageIndex)) != NULL ) + while ( (page = GetPageState(pageIndex)) != nullptr ) { page->DoGetRoot()->SetFlagRecursively(wxPG_PROP_MODIFIED, false); page->m_anyModified = false; @@ -373,7 +373,7 @@ void wxPGTypeOperationFailed( const wxPGProperty* p, const wxString& typestr, const wxString& op ) { - wxASSERT( p != NULL ); + wxASSERT( p != nullptr ); wxLogError( _("Type operation \"%s\" failed: Property labeled \"%s\" is of type \"%s\", NOT \"%s\"."), op, p->GetLabel(), p->GetValue().GetType(), typestr ); } @@ -418,7 +418,7 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByNameA( const wxString& name wxPGProperty* wxPropertyGridInterface::GetPropertyByLabel( const wxString& label ) const { - return m_pState->BaseGetPropertyByLabel(label, NULL); + return m_pState->BaseGetPropertyByLabel(label, nullptr); } // ---------------------------------------------------------------------------- @@ -445,7 +445,7 @@ void wxPropertyGridInterface::SetPropertyAttributeAll( const wxString& attrName, unsigned int pageIndex = 0; wxPropertyGridPageState* page; - while ( (page = GetPageState(pageIndex)) != NULL ) + while ( (page = GetPageState(pageIndex)) != nullptr ) { DoSetPropertyAttribute(page->DoGetRoot(), attrName, value, wxPG_RECURSE); @@ -523,7 +523,7 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByName( const wxString& name ) // Check if it is "Property.SubProperty" format int pos = name.Find(wxS('.')); if ( pos <= 0 ) - return NULL; + return nullptr; return GetPropertyByName(name.substr(0,pos), name.substr(pos+1,name.length()-pos-1)); @@ -587,7 +587,7 @@ void wxPropertyGridInterface::Sort( int flags ) unsigned int pageIndex = 0; wxPropertyGridPageState* page; - while( (page = GetPageState(pageIndex)) != NULL ) + while( (page = GetPageState(pageIndex)) != nullptr ) { page->DoSort(flags); pageIndex++; @@ -930,7 +930,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const wxVector pageStates; unsigned int pageIndex = 0; wxPropertyGridPageState* page; - while ( (page = GetPageState(pageIndex)) != NULL ) + while ( (page = GetPageState(pageIndex)) != nullptr ) { pageStates.push_back(page); pageIndex++; @@ -1021,7 +1021,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int restoreStates ) { wxPropertyGrid* pg = GetPropertyGrid(); - wxPGProperty* newSelection = NULL; + wxPGProperty* newSelection = nullptr; size_t pageIndex; long vx = -1; long vy = -1; @@ -1172,7 +1172,7 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res // (may be needed on unclean source string). pageIndex = 0; wxPropertyGridPageState* pageState; - while ( (pageState = GetPageState(pageIndex)) != NULL ) + while ( (pageState = GetPageState(pageIndex)) != nullptr ) { pageState->VirtualHeightChanged(); pageIndex++; diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 7377d8acba..12925ce829 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -62,7 +62,7 @@ void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags, int startPos, int dir ) { - wxPGProperty* property = NULL; + wxPGProperty* property = nullptr; if ( startPos == wxTOP ) { @@ -122,7 +122,7 @@ void wxPropertyGridIteratorBase::Prev() // Up to a parent if ( parent == m_baseParent ) { - m_property = NULL; + m_property = nullptr; return; } else @@ -167,7 +167,7 @@ void wxPropertyGridIteratorBase::Next( bool iterateChildren ) // Next sibling of parent if ( parent == m_baseParent ) { - m_property = NULL; + m_property = nullptr; } else { @@ -190,11 +190,11 @@ void wxPropertyGridIteratorBase::Next( bool iterateChildren ) // ----------------------------------------------------------------------- wxPropertyGridPageState::wxPropertyGridPageState() - : m_pPropGrid(NULL) + : m_pPropGrid(nullptr) , m_properties(&m_regularArray) - , m_abcArray(NULL) + , m_abcArray(nullptr) , m_fSplitterX(wxPG_DEFAULT_SPLITTERX) - , m_currentCategory(NULL) + , m_currentCategory(nullptr) , m_width(0) , m_virtualHeight(0) , m_itemsAdded(false) @@ -302,9 +302,9 @@ void wxPropertyGridPageState::DoClear() // We need to clear parent grid's m_propHover if ( m_pPropGrid ) - m_pPropGrid->m_propHover = NULL; + m_pPropGrid->m_propHover = nullptr; - m_currentCategory = NULL; + m_currentCategory = nullptr; m_itemsAdded = false; m_virtualHeight = 0; @@ -392,7 +392,7 @@ void wxPropertyGridPageState::OnClientWidthChange( int newWidth, int widthChange if ( IsDisplayed() ) { - pg->SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)NULL); + pg->SendEvent(wxEVT_PG_COLS_RESIZED, (wxPGProperty*)nullptr); } } @@ -403,7 +403,7 @@ void wxPropertyGridPageState::OnClientWidthChange( int newWidth, int widthChange wxPGProperty* wxPropertyGridPageState::GetLastItem( int flags ) { if ( !m_properties->GetChildCount() ) - return NULL; + return nullptr; wxPG_ITERATOR_CREATE_MASKS(flags, wxPGProperty::FlagType itemExMask, wxPGProperty::FlagType parentExMask) @@ -437,7 +437,7 @@ wxPropertyCategory* wxPropertyGridPageState::GetPropertyCategory( const wxPGProp return const_cast(static_cast(parent)); } while ( grandparent ); - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -474,7 +474,7 @@ wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByLabel } } - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -482,7 +482,7 @@ wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByLabel wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByName( const wxString& name ) const { wxPGHashMapS2P::const_iterator it = m_dictName.find(name); - return it != m_dictName.end() ? (wxPGProperty*) it->second : NULL; + return it != m_dictName.end() ? (wxPGProperty*) it->second : nullptr; } // ----------------------------------------------------------------------- @@ -579,7 +579,7 @@ bool wxPropertyGridPageState::EnableCategories( bool enable ) i = parent->GetIndexInParent() + 1; parent = parent->GetParent(); - } while ( parent != NULL ); + } while ( parent != nullptr ); VirtualHeightChanged(); @@ -696,7 +696,7 @@ wxPGProperty* wxPropertyGridPageState::DoGetItemAtY( int y ) const { // Outside? if ( y < 0 ) - return NULL; + return nullptr; unsigned int a = 0; return m_properties->GetItemAtY(y, GetGrid()->GetRowHeight(), &a); @@ -733,7 +733,7 @@ int wxPropertyGridPageState::GetColumnFitWidth(const wxDC& dc, if ( !p->IsCategory() ) { wxString text; - p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)NULL); + p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)nullptr); dc.GetTextExtent(text, &w, &h); if ( col == 0 ) w += ( (p->GetDepth()-1) * pg->m_subgroup_extramargin ); @@ -775,7 +775,7 @@ int wxPropertyGridPageState::GetColumnFitWidth(const wxPGProperty* p, unsigned i if ( !pc->IsCategory() ) { wxString text; - pc->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)NULL); + pc->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)nullptr); int h; pg->GetTextExtent(text, &w, &h); if ( col == 0 ) @@ -810,7 +810,7 @@ int wxPropertyGridPageState::GetColumnFullWidth(const wxDC& dc, wxPGProperty* p, return 0; wxString text; - p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)NULL); + p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)nullptr); int w = dc.GetTextExtent(text).x; if ( col == 0 ) @@ -831,7 +831,7 @@ int wxPropertyGridPageState::GetColumnFullWidth(wxPGProperty* p, unsigned int co return 0; wxString text; - p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)NULL); + p->GetDisplayInfo(col, -1, 0, &text, (wxPGCell*)nullptr); int w = GetGrid()->GetTextExtent(text).x; if ( col == 0 ) @@ -1327,7 +1327,7 @@ void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty* prop ) // deselected, then we need to take some extra measures. wxArrayPGProperty sel(m_selection.begin() + 1, m_selection.end()); - wxPGProperty* newFirst = sel.empty()? NULL: sel[0]; + wxPGProperty* newFirst = sel.empty()? nullptr: sel[0]; pg->DoSelectProperty(newFirst, wxPG_SEL_DONT_SEND_EVENT); @@ -1518,7 +1518,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx if ( current->IsType(wxPG_VARIANT_TYPE_LIST) ) { DoSetPropertyValues( current->GetList(), - p->IsCategory()?p:(NULL) + p->IsCategory()?p:(nullptr) ); } else @@ -1629,7 +1629,7 @@ bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty* property, // This will allow better behaviour. if ( scheduledParent == m_properties ) - scheduledParent = NULL; + scheduledParent = nullptr; if ( scheduledParent && !scheduledParent->IsCategory() ) { @@ -1644,7 +1644,7 @@ bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty* property, // Parent of a category must be either root or another category // (otherwise Bad Things might happen). - wxASSERT_MSG( scheduledParent == NULL || + wxASSERT_MSG( scheduledParent == nullptr || scheduledParent == m_properties || scheduledParent->IsCategory(), wxS("Parent of a category must be either root or another category.")); @@ -1677,7 +1677,7 @@ bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty* property, } #endif // wxDEBUG_LEVEL - // NULL parent == root parent + // null parent == root parent if ( !scheduledParent ) scheduledParent = DoGetRoot(); @@ -1705,7 +1705,7 @@ wxPGProperty* wxPropertyGridPageState::DoAppend( wxPGProperty* property ) { wxPropertyCategory* cur_cat = m_currentCategory; if ( property->IsCategory() ) - cur_cat = NULL; + cur_cat = nullptr; return DoInsert( cur_cat, -1, property ); } @@ -1924,7 +1924,7 @@ static wxPGProperty* FindCategoryForProperty(wxPGProperty* cat, wxPGProperty* pr } } - return NULL; + return nullptr; } }; @@ -1971,7 +1971,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) { if (item == m_currentCategory || IsChildCategory(item, m_currentCategory, true)) { - m_currentCategory = NULL; + m_currentCategory = nullptr; } } @@ -2065,11 +2065,11 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) // We need to clear parent grid's m_propHover, if it matches item if ( pg && pg->m_propHover == item ) - pg->m_propHover = NULL; + pg->m_propHover = nullptr; // Mark the property as 'unattached' - item->m_parentState = NULL; - item->m_parent = NULL; + item->m_parentState = nullptr; + item->m_parent = nullptr; // We can actually delete it now if ( doDelete ) diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index 526fa35c88..d396d93f53 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -528,7 +528,7 @@ wxValidator* wxIntProperty::GetClassValidator() WX_PG_DOGETVALIDATOR_EXIT(validator) #else - return NULL; + return nullptr; #endif } @@ -547,7 +547,7 @@ wxVariant wxIntProperty::AddSpinStepValue(long stepScale) const long v = value.GetLong(); long step = m_spinStep.GetLong(); v += (step * stepScale); - DoValidation(this, v, NULL, mode); + DoValidation(this, v, nullptr, mode); value = v; } #if wxUSE_LONGLONG @@ -556,7 +556,7 @@ wxVariant wxIntProperty::AddSpinStepValue(long stepScale) const wxLongLong v = value.GetLongLong(); wxLongLong step = m_spinStep.GetLongLong(); v += (step * stepScale); - DoValidation(this, v, NULL, mode); + DoValidation(this, v, nullptr, mode); value = v; } #endif // wxUSE_LONGLONG @@ -803,7 +803,7 @@ wxValidator* wxUIntProperty::DoGetValidator() const WX_PG_DOGETVALIDATOR_EXIT(validator) #else - return NULL; + return nullptr; #endif } @@ -846,7 +846,7 @@ wxVariant wxUIntProperty::AddSpinStepValue(long stepScale) const long v = value.GetLong(); long step = m_spinStep.GetLong(); v += (step * stepScale); - DoValidation(this, v, NULL, mode); + DoValidation(this, v, nullptr, mode); value = v; } #if wxUSE_LONGLONG @@ -855,7 +855,7 @@ wxVariant wxUIntProperty::AddSpinStepValue(long stepScale) const wxULongLong v = value.GetULongLong(); wxULongLong step = m_spinStep.GetULongLong(); v += (step * stepScale); - DoValidation(this, v, NULL, mode); + DoValidation(this, v, nullptr, mode); value = v; } #endif // wxUSE_LONGLONG @@ -1035,7 +1035,7 @@ wxFloatProperty::GetClassValidator() WX_PG_DOGETVALIDATOR_EXIT(validator) #else - return NULL; + return nullptr; #endif } @@ -1052,7 +1052,7 @@ wxVariant wxFloatProperty::AddSpinStepValue(long stepScale) const double v = value.GetDouble(); double step = m_spinStep.GetDouble(); v += (step * stepScale); - DoValidation(this, v, NULL, mode); + DoValidation(this, v, nullptr, mode); value = v; return value; @@ -1296,7 +1296,7 @@ bool wxEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WXUNUS // unless property has string as preferred value type // To reduce code size, use conversion here as well if ( value.IsType(wxPG_VARIANT_TYPE_STRING) ) - return ValueFromString_(value, NULL, value.GetString(), wxPG_PROPERTY_SPECIFIC); + return ValueFromString_(value, nullptr, value.GetString(), wxPG_PROPERTY_SPECIFIC); return true; } @@ -1316,12 +1316,12 @@ wxString wxEnumProperty::ValueToString( wxVariant& value, bool wxEnumProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const { - return ValueFromString_(variant, NULL, text, argFlags); + return ValueFromString_(variant, nullptr, text, argFlags); } bool wxEnumProperty::IntToValue( wxVariant& variant, int intVal, int argFlags ) const { - return ValueFromInt_(variant, NULL, intVal, argFlags); + return ValueFromInt_(variant, nullptr, intVal, argFlags); } bool wxEnumProperty::ValueFromString_(wxVariant& value, int* pIndex, const wxString& text, int WXUNUSED(argFlags)) const @@ -1519,7 +1519,7 @@ void wxFlagsProperty::Init() { wxPropertyGridPageState* state = GetParentState(); - // State safety check (it may be NULL in immediate parent) + // State safety check (it may be null in immediate parent) wxASSERT( state ); if ( state ) @@ -1586,7 +1586,7 @@ void wxFlagsProperty::Init() wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name, const wxChar* const* labels, const long* values, long value ) : wxPGProperty(label,name) { - m_oldChoicesData = NULL; + m_oldChoicesData = nullptr; m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty if ( labels ) @@ -1607,7 +1607,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name, const wxArrayString& labels, const wxArrayInt& values, int value ) : wxPGProperty(label,name) { - m_oldChoicesData = NULL; + m_oldChoicesData = nullptr; m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty if ( !labels.empty() ) @@ -1628,7 +1628,7 @@ wxFlagsProperty::wxFlagsProperty( const wxString& label, const wxString& name, wxPGChoices& choices, long value ) : wxPGProperty(label,name) { - m_oldChoicesData = NULL; + m_oldChoicesData = nullptr; m_flags |= wxPG_PROP_USE_DCC; // same default like wxBoolProperty if ( choices.IsOk() ) @@ -2015,7 +2015,7 @@ wxValidator* wxFileProperty::GetClassValidator() WX_PG_DOGETVALIDATOR_EXIT(validator) #else - return NULL; + return nullptr; #endif } @@ -2355,9 +2355,9 @@ wxPGArrayEditorDialog::wxPGArrayEditorDialog() void wxPGArrayEditorDialog::Init() { - m_elb = NULL; - m_elbSubPanel = NULL; - m_lastFocused = NULL; + m_elb = nullptr; + m_elbSubPanel = nullptr; + m_lastFocused = nullptr; m_hasCustomNewAction = false; m_itemPendingAtIndex = -1; m_modified = false; @@ -2650,7 +2650,7 @@ wxPGArrayStringEditorDialog::wxPGArrayStringEditorDialog() void wxPGArrayStringEditorDialog::Init() { - m_pCallingClass = NULL; + m_pCallingClass = nullptr; } bool diff --git a/src/qt/accel.cpp b/src/qt/accel.cpp index 8037e95887..fdd916947a 100644 --- a/src/qt/accel.cpp +++ b/src/qt/accel.cpp @@ -107,5 +107,5 @@ wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) c bool wxAcceleratorTable::IsOk() const { - return (m_refData != NULL); + return (m_refData != nullptr); } diff --git a/src/qt/anybutton.cpp b/src/qt/anybutton.cpp index 6f928d3822..f112672db7 100644 --- a/src/qt/anybutton.cpp +++ b/src/qt/anybutton.cpp @@ -78,7 +78,7 @@ bool wxQtPushButton::event(QEvent* e) } wxAnyButton::wxAnyButton() : - m_qtPushButton(NULL) + m_qtPushButton(nullptr) { } @@ -101,7 +101,7 @@ void wxAnyButton::QtSetBitmap( const wxBitmapBundle &bitmapBundle ) // load the bitmap and resize the button: QPixmap *pixmap = bitmap.GetHandle(); - if ( pixmap != NULL ) + if ( pixmap != nullptr ) { m_qtPushButton->setIcon(QIcon(*pixmap)); m_qtPushButton->setIconSize(pixmap->rect().size()); diff --git a/src/qt/app.cpp b/src/qt/app.cpp index ee5c61ac87..fdb8463d3e 100644 --- a/src/qt/app.cpp +++ b/src/qt/app.cpp @@ -51,7 +51,7 @@ bool wxApp::Initialize( int &argc, wxChar **argv ) { m_qtArgv[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv[i])); } - m_qtArgv[argc] = NULL; + m_qtArgv[argc] = nullptr; m_qtArgc = argc; m_qtApplication.reset(new QApplication(m_qtArgc, m_qtArgv.get())); @@ -80,7 +80,7 @@ bool wxApp::Initialize( int &argc, wxChar **argv ) } argc = m_qtApplication->arguments().size(); - argv[argc] = NULL; + argv[argc] = nullptr; } return true; diff --git a/src/qt/bitmap.cpp b/src/qt/bitmap.cpp index 46e7707036..c8c3336d62 100644 --- a/src/qt/bitmap.cpp +++ b/src/qt/bitmap.cpp @@ -39,7 +39,7 @@ static wxImage ConvertImage( QImage qtImage ) unsigned char *data = (unsigned char *)malloc(sizeof(char) * 3 * numPixels); unsigned char *startData = data; - unsigned char *alpha = NULL; + unsigned char *alpha = nullptr; if (hasAlpha) alpha = (unsigned char *)malloc(sizeof(char) * numPixels); @@ -79,7 +79,7 @@ static QImage ConvertImage( const wxImage &image ) ( (hasAlpha || hasMask ) ? QImage::Format_ARGB32 : QImage::Format_RGB32 ) ); unsigned char *data = image.GetData(); - unsigned char *alpha = hasAlpha ? image.GetAlpha() : NULL; + unsigned char *alpha = hasAlpha ? image.GetAlpha() : nullptr; QRgb colour; QRgb maskedColour; @@ -122,7 +122,7 @@ static QImage ConvertImage( const wxImage &image ) class wxBitmapRefData: public wxGDIRefData { public: - wxBitmapRefData() { m_mask = NULL; } + wxBitmapRefData() { m_mask = nullptr; } wxBitmapRefData( int width, int height, int depth ) { @@ -130,13 +130,13 @@ class wxBitmapRefData: public wxGDIRefData m_qtPixmap = QBitmap( width, height ); else m_qtPixmap = QPixmap( width, height ); - m_mask = NULL; + m_mask = nullptr; } wxBitmapRefData( QPixmap pix ) : m_qtPixmap(pix) { - m_mask = NULL; + m_mask = nullptr; } virtual ~wxBitmapRefData() { delete m_mask; } @@ -212,7 +212,7 @@ wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type ) void wxBitmap::InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale) ) { - Qt::ImageConversionFlags flags = 0; + Qt::ImageConversionFlags flags = nullptr; if (depth == 1) flags = Qt::MonoOnly; m_refData = new wxBitmapRefData(QPixmap::fromImage(ConvertImage(image), flags)); @@ -309,7 +309,7 @@ bool wxBitmap::SaveFile(const wxString &name, wxBitmapType type, #endif //Try to save using Qt - const char* type_name = NULL; + const char* type_name = nullptr; switch (type) { case wxBITMAP_TYPE_BMP: type_name = "bmp"; break; @@ -378,7 +378,7 @@ bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type) wxPalette *wxBitmap::GetPalette() const { wxMISSING_IMPLEMENTATION( "wxBitmap palettes" ); - return 0; + return nullptr; } void wxBitmap::SetPalette(const wxPalette& WXUNUSED(palette)) @@ -410,7 +410,7 @@ void wxBitmap::SetDepth(int depth) void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) { - void* bits = NULL; + void* bits = nullptr; wxBitmapRefData *refData = static_cast(m_refData); @@ -438,7 +438,7 @@ void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data)) QPixmap *wxBitmap::GetHandle() const { - return ( m_refData != NULL ) ? &M_PIXDATA : NULL; + return ( m_refData != nullptr ) ? &M_PIXDATA : nullptr; } wxGDIRefData *wxBitmap::CreateGDIRefData() const @@ -451,7 +451,7 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const const wxBitmapRefData* oldRef = static_cast(data); wxBitmapRefData *d = new wxBitmapRefData; d->m_qtPixmap = oldRef->m_qtPixmap; //.copy();// copy not needed - d->m_mask = oldRef->m_mask ? new wxMask(*oldRef->m_mask) : NULL; + d->m_mask = oldRef->m_mask ? new wxMask(*oldRef->m_mask) : nullptr; return d; } @@ -468,13 +468,13 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject); wxMask::wxMask() { - m_qtBitmap = NULL; + m_qtBitmap = nullptr; } wxMask::wxMask(const wxMask &mask) { QBitmap *mask_bmp = mask.GetHandle(); - m_qtBitmap = mask_bmp ? new QBitmap(*mask_bmp) : NULL; + m_qtBitmap = mask_bmp ? new QBitmap(*mask_bmp) : nullptr; } wxMask& wxMask::operator=(const wxMask &mask) @@ -483,26 +483,26 @@ wxMask& wxMask::operator=(const wxMask &mask) { delete m_qtBitmap; QBitmap *mask_bmp = mask.GetHandle(); - m_qtBitmap = mask_bmp ? new QBitmap(*mask_bmp) : NULL; + m_qtBitmap = mask_bmp ? new QBitmap(*mask_bmp) : nullptr; } return *this; } wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour) { - m_qtBitmap = NULL; + m_qtBitmap = nullptr; Create(bitmap, colour); } wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex) { - m_qtBitmap = NULL; + m_qtBitmap = nullptr; Create(bitmap, paletteIndex); } wxMask::wxMask(const wxBitmap& bitmap) { - m_qtBitmap = NULL; + m_qtBitmap = nullptr; Create(bitmap); } @@ -515,7 +515,7 @@ wxMask::~wxMask() void wxMask::FreeData() { delete m_qtBitmap; - m_qtBitmap = NULL; + m_qtBitmap = nullptr; } bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) diff --git a/src/qt/brush.cpp b/src/qt/brush.cpp index 3e23b8f7a5..1b8eb04a2f 100644 --- a/src/qt/brush.cpp +++ b/src/qt/brush.cpp @@ -114,7 +114,7 @@ wxBrush::wxBrush(const wxBitmap& stipple) { m_refData = new wxBrushRefData(); M_BRUSHDATA.setTexture(*stipple.GetHandle()); - if (stipple.GetMask() != NULL) + if (stipple.GetMask() != nullptr) M_STYLEDATA = wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE; else M_STYLEDATA = wxBRUSHSTYLE_STIPPLE; @@ -145,7 +145,7 @@ void wxBrush::SetStipple(const wxBitmap& stipple) AllocExclusive(); M_BRUSHDATA.setTexture(*stipple.GetHandle()); - if (stipple.GetMask() != NULL) + if (stipple.GetMask() != nullptr) M_STYLEDATA = wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE; else M_STYLEDATA = wxBRUSHSTYLE_STIPPLE; diff --git a/src/qt/calctrl.cpp b/src/qt/calctrl.cpp index 2099ea08c4..25484d7944 100644 --- a/src/qt/calctrl.cpp +++ b/src/qt/calctrl.cpp @@ -38,11 +38,11 @@ private: void wxCalendarCtrl::Init() { - m_qtCalendar = NULL; + m_qtCalendar = nullptr; for ( size_t n = 0; n < WXSIZEOF(m_attrs); n++ ) { - m_attrs[n] = NULL; + m_attrs[n] = nullptr; } } @@ -296,7 +296,7 @@ void wxCalendarCtrl::SetHeaderColours(const wxColour& colFg, const wxColour& col wxCalendarDateAttr *wxCalendarCtrl::GetAttr(size_t day) const { - wxCHECK_MSG( day > 0 && day < 32, NULL, wxT("invalid day") ); + wxCHECK_MSG( day > 0 && day < 32, nullptr, wxT("invalid day") ); return m_attrs[day - 1]; } diff --git a/src/qt/checkbox.cpp b/src/qt/checkbox.cpp index 234462d642..89348045b9 100644 --- a/src/qt/checkbox.cpp +++ b/src/qt/checkbox.cpp @@ -47,7 +47,7 @@ void wxQtCheckBox::clicked( bool checked ) wxCheckBox::wxCheckBox() : - m_qtCheckBox(NULL) + m_qtCheckBox(nullptr) { } diff --git a/src/qt/checklst.cpp b/src/qt/checklst.cpp index a1d336c474..3411ef59f6 100644 --- a/src/qt/checklst.cpp +++ b/src/qt/checklst.cpp @@ -74,14 +74,14 @@ void wxCheckListBox::Init() bool wxCheckListBox::IsChecked(unsigned int n) const { QListWidgetItem* item = m_qtListWidget->item(n); - wxCHECK_MSG(item != NULL, false, wxT("wrong listbox index") ); + wxCHECK_MSG(item != nullptr, false, wxT("wrong listbox index") ); return item->checkState() == Qt::Checked; } void wxCheckListBox::Check(unsigned int n, bool check ) { QListWidgetItem* item = m_qtListWidget->item(n); - wxCHECK_RET(item != NULL, wxT("wrong listbox index") ); + wxCHECK_RET(item != nullptr, wxT("wrong listbox index") ); return item->setCheckState(check ? Qt::Checked : Qt::Unchecked); } diff --git a/src/qt/choice.cpp b/src/qt/choice.cpp index 1787fabfc5..2afbd74f88 100644 --- a/src/qt/choice.cpp +++ b/src/qt/choice.cpp @@ -73,7 +73,7 @@ void wxQtChoice::activated(int WXUNUSED(index)) wxChoice::wxChoice() : - m_qtComboBox(NULL) + m_qtComboBox(nullptr) { } @@ -118,7 +118,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name ) { - return Create( parent, id, pos, size, choices.size(), choices.size() ? &choices[ 0 ] : NULL, style, + return Create( parent, id, pos, size, choices.size(), choices.size() ? &choices[ 0 ] : nullptr, style, validator, name ); } diff --git a/src/qt/combobox.cpp b/src/qt/combobox.cpp index 87d44d1db0..d26fcdfc30 100644 --- a/src/qt/combobox.cpp +++ b/src/qt/combobox.cpp @@ -146,7 +146,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name ) { - const wxString *pChoices = choices.size() ? &choices[ 0 ] : NULL; + const wxString *pChoices = choices.size() ? &choices[ 0 ] : nullptr; return Create(parent, id, value, pos, size, choices.size(), pChoices, style, validator, name ); } @@ -294,7 +294,7 @@ void wxComboBox::SetSelection( long from, long to ) SetInsertionPoint( from ); // use the inner text entry widget (note that can be null if not editable) - if ( m_qtComboBox->lineEdit() != NULL ) + if ( m_qtComboBox->lineEdit() != nullptr ) { m_qtComboBox->lineEdit()->setSelection( from, to - from ); } @@ -322,7 +322,7 @@ long wxComboBox::GetInsertionPoint() const void wxComboBox::GetSelection(long* from, long* to) const { // use the inner text entry widget (note that can be null if not editable) - if ( m_qtComboBox->lineEdit() != NULL ) + if ( m_qtComboBox->lineEdit() != nullptr ) { *from = m_qtComboBox->lineEdit()->selectionStart(); if ( *from >= 0 ) diff --git a/src/qt/cursor.cpp b/src/qt/cursor.cpp index a52f5a8211..c90beb7fb4 100644 --- a/src/qt/cursor.cpp +++ b/src/qt/cursor.cpp @@ -34,7 +34,7 @@ void wxBeginBusyCursor(const wxCursor *cursor) bool wxIsBusy() { - return QApplication::overrideCursor() != 0; + return QApplication::overrideCursor() != nullptr; } void wxEndBusyCursor() diff --git a/src/qt/dataview.cpp b/src/qt/dataview.cpp index ca8661decb..365799cbe2 100644 --- a/src/qt/dataview.cpp +++ b/src/qt/dataview.cpp @@ -192,7 +192,7 @@ unsigned wxDataViewCtrl::GetColumnCount() const wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const { - return NULL; + return nullptr; } bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) @@ -212,7 +212,7 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const { - return NULL; + return nullptr; } wxDataViewItem wxDataViewCtrl::GetSelection() const diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp index 88215957f9..4a176a538c 100644 --- a/src/qt/dc.cpp +++ b/src/qt/dc.cpp @@ -46,8 +46,8 @@ wxIMPLEMENT_CLASS(wxQtDCImpl,wxDCImpl); wxQtDCImpl::wxQtDCImpl( wxDC *owner ) : wxDCImpl( owner ) { - m_qtPixmap = NULL; - m_qtPainter = NULL; + m_qtPixmap = nullptr; + m_qtPainter = nullptr; m_rasterColourOp = wxQtNONE; m_qtPenColor = new QColor; m_qtBrushColor = new QColor; @@ -72,9 +72,9 @@ wxQtDCImpl::~wxQtDCImpl() void wxQtDCImpl::QtPreparePainter( ) { //Do here all QPainter initialization (called after each begin()) - if ( m_qtPainter == NULL ) + if ( m_qtPainter == nullptr ) { - wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter is NULL!!!")); + wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter is null!!!")); } else if ( m_qtPainter->isActive() ) { @@ -373,25 +373,25 @@ void wxQtDCImpl::DoGetTextExtent(const wxString& string, const wxFont *theFont ) const { QFont f; - if (theFont != NULL) + if (theFont != nullptr) f = theFont->GetHandle(); else f = m_font.GetHandle(); QFontMetrics metrics(f); - if (x != NULL || y != NULL) + if (x != nullptr || y != nullptr) { // note that boundingRect doesn't return "advance width" for spaces - if (x != NULL) + if (x != nullptr) *x = metrics.width( wxQtConvertString(string) ); - if (y != NULL) + if (y != nullptr) *y = metrics.height(); } - if (descent != NULL) + if (descent != nullptr) *descent = metrics.descent(); - if (externalLeading != NULL) + if (externalLeading != nullptr) *externalLeading = metrics.leading(); } @@ -524,7 +524,7 @@ bool wxQtDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const if ( col ) { - wxCHECK_MSG( m_qtPixmap != NULL, false, "This DC doesn't support GetPixel()" ); + wxCHECK_MSG( m_qtPixmap != nullptr, false, "This DC doesn't support GetPixel()" ); QPixmap pixmap1px = m_qtPixmap->copy( x, y, 1, 1 ); QImage image = pixmap1px.toImage(); QColor pixel = image.pixel( 0, 0 ); diff --git a/src/qt/dcclient.cpp b/src/qt/dcclient.cpp index 8ad3093094..f0894ef192 100644 --- a/src/qt/dcclient.cpp +++ b/src/qt/dcclient.cpp @@ -37,7 +37,7 @@ public: ~QtPictureSetter() { - m_window->QtSetPicture( NULL ); + m_window->QtSetPicture( nullptr ); } private: @@ -53,7 +53,7 @@ wxIMPLEMENT_CLASS(wxWindowDCImpl,wxQtDCImpl); wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) : wxQtDCImpl( owner ) { - m_window = NULL; + m_window = nullptr; m_ok = false; m_qtPainter = new QPainter(); } @@ -64,7 +64,7 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *win ) m_window = win; m_qtPainter = m_window->QtGetPainter(); // if we're not inside a Paint event, painter will invalid - m_ok = m_qtPainter != NULL; + m_ok = m_qtPainter != nullptr; } wxWindowDCImpl::~wxWindowDCImpl() @@ -76,7 +76,7 @@ wxWindowDCImpl::~wxWindowDCImpl() if ( m_window ) { // do not destroy in base class as it is owned by the window - m_qtPainter = NULL; + m_qtPainter = nullptr; } } @@ -110,7 +110,7 @@ wxClientDCImpl::~wxClientDCImpl() m_qtPainter->end(); m_ok = false; - if ( m_window != NULL ) + if ( m_window != nullptr ) { QtPictureSetter pictureSetter(m_window, m_pict.get()); @@ -133,11 +133,11 @@ wxClientDCImpl::~wxClientDCImpl() else { // Not drawing anything, reset picture to avoid issues in handler - m_pict->setData( NULL, 0 ); + m_pict->setData( nullptr, 0 ); } // let destroy the m_qtPainter (see inherited classes destructors) - m_window = NULL; + m_window = nullptr; } } diff --git a/src/qt/dialog.cpp b/src/qt/dialog.cpp index fc9fcaba4f..7215fe4ed8 100644 --- a/src/qt/dialog.cpp +++ b/src/qt/dialog.cpp @@ -81,7 +81,7 @@ bool wxDialog::Create( wxWindow *parent, wxWindowID id, int wxDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); - wxCHECK_MSG( GetHandle() != NULL, -1, "Invalid dialog" ); + wxCHECK_MSG( GetHandle() != nullptr, -1, "Invalid dialog" ); QDialog *qDialog = GetDialogHandle(); qDialog->setModal(true); @@ -96,7 +96,7 @@ int wxDialog::ShowModal() void wxDialog::EndModal(int retCode) { - wxCHECK_RET( GetDialogHandle() != NULL, "Invalid dialog" ); + wxCHECK_RET( GetDialogHandle() != nullptr, "Invalid dialog" ); SetReturnCode(retCode); GetDialogHandle()->done( QDialog::Accepted ); @@ -104,7 +104,7 @@ void wxDialog::EndModal(int retCode) bool wxDialog::IsModal() const { - wxCHECK_MSG( GetDialogHandle() != NULL, false, "Invalid dialog" ); + wxCHECK_MSG( GetDialogHandle() != nullptr, false, "Invalid dialog" ); return GetDialogHandle()->isModal(); } diff --git a/src/qt/dnd.cpp b/src/qt/dnd.cpp index 37fddbb597..84fffbf930 100644 --- a/src/qt/dnd.cpp +++ b/src/qt/dnd.cpp @@ -114,7 +114,7 @@ public: ~PendingMimeDataSetter() { - m_targetMimeData = NULL; + m_targetMimeData = nullptr; } private: @@ -128,8 +128,8 @@ class wxDropTarget::Impl : public QObject public: explicit Impl(wxDropTarget* dropTarget) : m_dropTarget(dropTarget), - m_widget(NULL), - m_pendingMimeData(NULL) + m_widget(nullptr), + m_pendingMimeData(nullptr) { } @@ -144,7 +144,7 @@ public: m_widget = widget; - if ( m_widget != NULL ) + if ( m_widget != nullptr ) { m_widget->setAcceptDrops(true); m_widget->installEventFilter(this); @@ -153,17 +153,17 @@ public: void Disconnect() { - if ( m_widget != NULL ) + if ( m_widget != nullptr ) { m_widget->setAcceptDrops(false); m_widget->removeEventFilter(this); - m_widget = NULL; + m_widget = nullptr; } } virtual bool eventFilter(QObject* watched, QEvent* event) override { - if ( m_dropTarget != NULL ) + if ( m_dropTarget != nullptr ) { switch ( event->type() ) { @@ -313,7 +313,7 @@ bool wxDropTarget::GetData() wxDataFormat wxDropTarget::GetMatchingPair() { const QMimeData* mimeData = m_pImpl->GetMimeData(); - if ( mimeData == NULL || m_dataObject == NULL ) + if ( mimeData == nullptr || m_dataObject == nullptr ) return wxFormatInvalid; const QStringList formats = mimeData->formats(); @@ -363,11 +363,11 @@ wxDropSource::wxDropSource(wxDataObject& data, wxDragResult wxDropSource::DoDragDrop(int flags /*=wxDrag_CopyOnly*/) { - wxCHECK_MSG(m_data != NULL, wxDragNone, + wxCHECK_MSG(m_data != nullptr, wxDragNone, wxT("No data in wxDropSource!")); - wxCHECK_MSG(m_parentWindow != NULL, wxDragNone, - wxT("NULL parent window in wxDropSource!")); + wxCHECK_MSG(m_parentWindow != nullptr, wxDragNone, + wxT("null parent window in wxDropSource!")); QDrag drag(m_parentWindow->GetHandle()); drag.setMimeData(CreateMimeData(m_data)); diff --git a/src/qt/dvrenderers.cpp b/src/qt/dvrenderers.cpp index 66f70541be..56437797c1 100644 --- a/src/qt/dvrenderers.cpp +++ b/src/qt/dvrenderers.cpp @@ -94,7 +94,7 @@ wxSize wxDataViewCustomRenderer::GetSize() const wxDC *wxDataViewCustomRenderer::GetDC() { - return NULL; + return nullptr; } //============================================================================== @@ -185,7 +185,7 @@ wxSize wxDataViewIconTextRenderer::GetSize() const wxControl *wxDataViewIconTextRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { - return NULL; + return nullptr; } bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value ) diff --git a/src/qt/evtloop.cpp b/src/qt/evtloop.cpp index 818ed70b95..73e9536fb8 100644 --- a/src/qt/evtloop.cpp +++ b/src/qt/evtloop.cpp @@ -105,7 +105,7 @@ wxQtEventLoopBase::~wxQtEventLoopBase() { //Clear the shared timer if this is the only external reference to it if ( gs_idleTimer->GetRefCount() <= 2 ) - gs_idleTimer.reset(NULL); + gs_idleTimer.reset(nullptr); delete m_qtEventLoop; } @@ -208,19 +208,19 @@ public: m_reader = new wxQtSocketNotifier<&wxEventLoopSourceHandler::OnReadWaiting> (fd, QSocketNotifier::Read, handler); else - m_reader = NULL; + m_reader = nullptr; if ( flags & wxEVENT_SOURCE_OUTPUT ) m_writer = new wxQtSocketNotifier<&wxEventLoopSourceHandler::OnWriteWaiting> (fd, QSocketNotifier::Write, handler); else - m_writer = NULL; + m_writer = nullptr; if ( flags & wxEVENT_SOURCE_EXCEPTION ) m_exception = new wxQtSocketNotifier<&wxEventLoopSourceHandler::OnExceptionWaiting> (fd, QSocketNotifier::Exception, handler); else - m_exception = NULL; + m_exception = nullptr; } virtual ~wxQtEventLoopSource() diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp index 24682709ff..e953acbf8b 100644 --- a/src/qt/frame.cpp +++ b/src/qt/frame.cpp @@ -44,7 +44,7 @@ class wxQtCentralWidget : public wxQtEventSignalHandler< QScrollArea, wxFrame > wxFrame::~wxFrame() { // central widget should be deleted by qt when the main window is destroyed - QtStoreWindowPointer( GetQMainWindow()->centralWidget(), NULL ); + QtStoreWindowPointer( GetQMainWindow()->centralWidget(), nullptr ); } bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString& title, @@ -88,7 +88,7 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar ) { // The current status bar could be deleted by Qt when dereferencing it // TODO: add a mechanism like Detach in menus to avoid issues - if ( statusBar != NULL ) + if ( statusBar != nullptr ) { GetQMainWindow()->setStatusBar( statusBar->GetQStatusBar() ); // Update statusbar sizes now that it has a size @@ -97,14 +97,14 @@ void wxFrame::SetStatusBar( wxStatusBar *statusBar ) else { // Remove the current status bar - GetQMainWindow()->setStatusBar(NULL); + GetQMainWindow()->setStatusBar(nullptr); } wxFrameBase::SetStatusBar( statusBar ); } void wxFrame::SetToolBar(wxToolBar *toolbar) { - if ( toolbar != NULL ) + if ( toolbar != nullptr ) { int area = 0; if (toolbar->HasFlag(wxTB_LEFT)) { area = Qt::LeftToolBarArea; } @@ -119,10 +119,10 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) GetQMainWindow()->addToolBar((Qt::ToolBarArea)area, m_qtToolBar); } - else if ( m_frameToolBar != NULL ) + else if ( m_frameToolBar != nullptr ) { GetQMainWindow()->removeToolBar(m_qtToolBar); - m_qtToolBar = NULL; + m_qtToolBar = nullptr; } wxFrameBase::SetToolBar( toolbar ); } diff --git a/src/qt/gauge.cpp b/src/qt/gauge.cpp index 38df21aa35..b2852dfbb6 100644 --- a/src/qt/gauge.cpp +++ b/src/qt/gauge.cpp @@ -30,7 +30,7 @@ wxQtProgressBar::wxQtProgressBar( wxWindow *parent, wxGauge *handler ) wxGauge::wxGauge() : - m_qtProgressBar(NULL) + m_qtProgressBar(nullptr) { } diff --git a/src/qt/graphics.cpp b/src/qt/graphics.cpp index d440ce72a2..466c3408a9 100644 --- a/src/qt/graphics.cpp +++ b/src/qt/graphics.cpp @@ -658,7 +658,7 @@ protected: wxQtGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer), - m_qtPainter(NULL) + m_qtPainter(nullptr) { } @@ -1365,7 +1365,7 @@ wxGraphicsBitmap wxQtGraphicsRenderer::CreateBitmapFromNativeBitmap(void* bitmap) { wxGraphicsBitmap p; - if ( bitmap != NULL ) + if ( bitmap != nullptr ) { p.SetRefData(new wxQtBitmapData(this, (QPixmap*)bitmap)); } diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp index 1408f6f9d2..4ebc993462 100644 --- a/src/qt/listbox.cpp +++ b/src/qt/listbox.cpp @@ -66,7 +66,7 @@ void wxQtListWidget::itemChanged(QListWidgetItem *item) } wxListBox::wxListBox() : - m_qtListWidget(NULL) + m_qtListWidget(nullptr) { Init(); } @@ -203,14 +203,14 @@ unsigned wxListBox::GetCount() const wxString wxListBox::GetString(unsigned int n) const { QListWidgetItem* item = m_qtListWidget->item(n); - wxCHECK_MSG(item != NULL, wxString(), wxT("wrong listbox index") ); + wxCHECK_MSG(item != nullptr, wxString(), wxT("wrong listbox index") ); return wxQtConvertString( item->text() ); } void wxListBox::SetString(unsigned int n, const wxString& s) { QListWidgetItem* item = m_qtListWidget->item(n); - wxCHECK_RET(item != NULL, wxT("wrong listbox index") ); + wxCHECK_RET(item != nullptr, wxT("wrong listbox index") ); if ( m_hasCheckBoxes ) { item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index ce6d98a9df..fe3909c357 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -85,7 +85,7 @@ class wxQtStyledItemDelegate : public QStyledItemDelegate public: explicit wxQtStyledItemDelegate(wxWindow* parent) : m_parent(parent), - m_textCtrl(NULL) + m_textCtrl(nullptr) { } @@ -93,7 +93,7 @@ public: const QStyleOptionViewItem &WXUNUSED(option), const QModelIndex &index) const override { - if (m_textCtrl != NULL) + if (m_textCtrl != nullptr) destroyEditor(m_textCtrl->GetHandle(), m_currentModelIndex); m_currentModelIndex = index; @@ -105,11 +105,11 @@ public: void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const override { - if (m_textCtrl != NULL) + if (m_textCtrl != nullptr) { m_currentModelIndex = QModelIndex(); // invalidate the index wxTheApp->ScheduleForDestruction(m_textCtrl); - m_textCtrl = NULL; + m_textCtrl = nullptr; } } @@ -147,7 +147,7 @@ class wxQtListModel : public QAbstractTableModel { public: explicit wxQtListModel(wxListCtrl *listCtrl) : - m_view(NULL), + m_view(nullptr), m_listCtrl(listCtrl) { } @@ -187,7 +187,7 @@ public: case Qt::DecorationRole: { wxImageList *imageList = GetImageList(); - if ( imageList == NULL ) + if ( imageList == nullptr ) return QVariant(); int imageIndex = -1; @@ -782,14 +782,14 @@ private: struct RowItem { RowItem() : - m_data(NULL), + m_data(nullptr), m_checked(false) { } RowItem(int columnCount ) : m_columns(columnCount), - m_data(NULL), + m_data(nullptr), m_checked(false) { } @@ -866,7 +866,7 @@ public: if ( role == Qt::DecorationRole ) { wxImageList *imageList = GetImageList(); - if ( imageList == NULL ) + if ( imageList == nullptr ) return QVariant(); const int imageIndex = listCtrl->OnGetItemColumnImage(row, col); @@ -977,7 +977,7 @@ public: int GetHeaderHeight() const { - return header() != NULL ? header()->height() : 0; + return header() != nullptr ? header()->height() : 0; } private: @@ -1082,13 +1082,13 @@ bool wxListCtrl::Create(wxWindow *parent, void wxListCtrl::Init() { m_hasCheckBoxes = false; - m_model = NULL; - m_qtTreeWidget = NULL; + m_model = nullptr; + m_qtTreeWidget = nullptr; } wxListCtrl::~wxListCtrl() { - m_qtTreeWidget->setModel(NULL); + m_qtTreeWidget->setModel(nullptr); m_model->deleteLater(); } diff --git a/src/qt/menu.cpp b/src/qt/menu.cpp index b07a3478cd..be0a12a0b4 100644 --- a/src/qt/menu.cpp +++ b/src/qt/menu.cpp @@ -48,14 +48,14 @@ static wxMenuItem *GetMenuItemAt( const wxMenu *menu, size_t position ) if ( position < menu->GetMenuItemCount() ) return menu->FindItemByPosition( position ); else - return NULL; + return nullptr; } static void AddItemActionToGroup( const wxMenuItem *groupItem, QAction *itemAction ) { QAction *groupItemAction = groupItem->GetHandle(); QActionGroup *itemActionGroup = groupItemAction->actionGroup(); - wxASSERT_MSG( itemActionGroup != NULL, "An action group should have been setup" ); + wxASSERT_MSG( itemActionGroup != nullptr, "An action group should have been setup" ); itemActionGroup->addAction( itemAction ); } @@ -70,11 +70,11 @@ static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previous // If a neighbouring menu item is a radio item then add this item to the // same action group, otherwise start a new group: - if ( previousItem != NULL && previousItem->GetKind() == wxITEM_RADIO ) + if ( previousItem != nullptr && previousItem->GetKind() == wxITEM_RADIO ) { AddItemActionToGroup( previousItem, itemAction ); } - else if ( successiveItem != NULL && successiveItem->GetKind() == wxITEM_RADIO ) + else if ( successiveItem != nullptr && successiveItem->GetKind() == wxITEM_RADIO ) { AddItemActionToGroup( successiveItem, itemAction ); } @@ -119,7 +119,7 @@ static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previous break; } // Insert the action into the actual menu: - QAction *successiveItemAction = ( successiveItem != NULL ) ? successiveItem->GetHandle() : NULL; + QAction *successiveItemAction = ( successiveItem != nullptr ) ? successiveItem->GetHandle() : nullptr; qtMenu->insertAction( successiveItemAction, itemAction ); // Menu items in Qt can be part of multiple menus, so a menu will not take ownership // when one is added to it. Take it explicitly, otherwise it will create a memory leak. @@ -134,8 +134,8 @@ wxMenuItem *wxMenu::DoAppend(wxMenuItem *item) wxMenuItem *previousItem = GetMenuItemAt( this, GetMenuItemCount() - 1 ); wxMenuItem *successiveItem = GetMenuItemAt( this, GetMenuItemCount() ); - if ( wxMenuBase::DoAppend( item ) == NULL ) - return NULL; + if ( wxMenuBase::DoAppend( item ) == nullptr ) + return nullptr; InsertMenuItemAction( this, previousItem, item, successiveItem ); @@ -151,8 +151,8 @@ wxMenuItem *wxMenu::DoInsert(size_t insertPosition, wxMenuItem *item) wxMenuItem *previousItem = GetMenuItemAt( this, insertPosition - 1 ); wxMenuItem *successiveItem = GetMenuItemAt( this, insertPosition ); - if ( wxMenuBase::DoInsert( insertPosition, item ) == NULL ) - return NULL; + if ( wxMenuBase::DoInsert( insertPosition, item ) == nullptr ) + return nullptr; InsertMenuItemAction( this, previousItem, item, successiveItem ); @@ -162,8 +162,8 @@ wxMenuItem *wxMenu::DoInsert(size_t insertPosition, wxMenuItem *item) wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { - if ( wxMenuBase::DoRemove( item ) == NULL ) - return NULL; + if ( wxMenuBase::DoRemove( item ) == nullptr ) + return nullptr; m_qtMenu->removeAction( item->GetHandle() ); @@ -233,7 +233,7 @@ bool wxMenuBar::Append( wxMenu *menu, const wxString& title ) static QAction *GetActionAt( const QWidget *qtWidget, size_t pos ) { QList< QAction * > actions = qtWidget->actions(); - return pos < static_cast< unsigned >( actions.size() ) ? actions.at( pos ) : NULL; + return pos < static_cast< unsigned >( actions.size() ) ? actions.at( pos ) : nullptr; } @@ -256,8 +256,8 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu; - if (( menu = wxMenuBarBase::Remove( pos )) == NULL ) - return NULL; + if (( menu = wxMenuBarBase::Remove( pos )) == nullptr ) + return nullptr; m_qtMenuBar->removeAction( GetActionAt( m_qtMenuBar, pos )); return menu; @@ -301,7 +301,7 @@ void wxMenuBar::Attach(wxFrame *frame) void wxMenuBar::Detach() { // the QMenuBar probably was deleted by Qt as setMenuBar takes ownership - m_qtMenuBar = NULL; + m_qtMenuBar = nullptr; wxMenuBarBase::Detach(); } diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index f589389a4a..190bcb7a9b 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -147,7 +147,7 @@ wxQtAction::wxQtAction( wxMenu *parent, int id, const wxString &text, const wxSt { setStatusTip( wxQtConvertString( help )); - if ( subMenu != NULL ) + if ( subMenu != nullptr ) setMenu( subMenu->GetHandle() ); if ( id == wxID_SEPARATOR ) diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp index 06c5439436..094ac3af2b 100644 --- a/src/qt/notebook.cpp +++ b/src/qt/notebook.cpp @@ -52,7 +52,7 @@ void wxQtTabWidget::currentChanged(int index) wxNotebook::wxNotebook() : - m_qtTabWidget(NULL) + m_qtTabWidget(nullptr) { } diff --git a/src/qt/palette.cpp b/src/qt/palette.cpp index 8c87a3a9c1..05fe4508ee 100644 --- a/src/qt/palette.cpp +++ b/src/qt/palette.cpp @@ -38,11 +38,11 @@ int wxPalette::GetPixel(unsigned char WXUNUSED(red), unsigned char WXUNUSED(gree wxGDIRefData *wxPalette::CreateGDIRefData() const { - return NULL; + return nullptr; } wxGDIRefData *wxPalette::CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const { - return NULL; + return nullptr; } diff --git a/src/qt/pen.cpp b/src/qt/pen.cpp index e2bedad819..8e9052fce8 100644 --- a/src/qt/pen.cpp +++ b/src/qt/pen.cpp @@ -209,7 +209,7 @@ class wxPenRefData: public wxGDIRefData { m_qtPen.setCapStyle(Qt::RoundCap); m_qtPen.setJoinStyle(Qt::RoundJoin); - m_dashes = NULL; + m_dashes = nullptr; m_dashesSize = 0; } @@ -340,7 +340,7 @@ wxColour wxPen::GetColour() const wxBitmap *wxPen::GetStipple() const { - return NULL; + return nullptr; } wxPenStyle wxPen::GetStyle() const diff --git a/src/qt/printdlg.cpp b/src/qt/printdlg.cpp index a59890fc16..75ce90a11e 100644 --- a/src/qt/printdlg.cpp +++ b/src/qt/printdlg.cpp @@ -56,7 +56,7 @@ wxPrintData& wxQtPrintDialog::GetPrintData() wxDC *wxQtPrintDialog::GetPrintDC() { - return NULL; + return nullptr; } //############################################################################## diff --git a/src/qt/printqt.cpp b/src/qt/printqt.cpp index adf1d7b6d9..d0540bc0ca 100644 --- a/src/qt/printqt.cpp +++ b/src/qt/printqt.cpp @@ -26,7 +26,7 @@ bool wxQtPrinter::Print(wxWindow *WXUNUSED(parent), wxPrintout *WXUNUSED(printou wxDC* wxQtPrinter::PrintDialog(wxWindow *WXUNUSED(parent)) { - return NULL; + return nullptr; } //############################################################################## diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index 351251fb78..1062aa912d 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -57,9 +57,9 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); wxRadioBox::wxRadioBox() : - m_qtGroupBox(NULL), - m_qtButtonGroup(NULL), - m_qtGridLayout(NULL) + m_qtGroupBox(nullptr), + m_qtButtonGroup(nullptr), + m_qtGridLayout(nullptr) { } @@ -199,13 +199,13 @@ static QAbstractButton *GetButtonAt( const QButtonGroup *group, unsigned int n ) // should be fast enough. QList< QAbstractButton * > buttons = group->buttons(); - return n < static_cast< unsigned >( buttons.size() ) ? buttons.at( n ) : NULL; + return n < static_cast< unsigned >( buttons.size() ) ? buttons.at( n ) : nullptr; } #define INVALID_INDEX_MESSAGE wxT( "invalid radio box index" ) #define CHECK_BUTTON( button, rc ) \ - wxCHECK_MSG( button != NULL, rc, INVALID_INDEX_MESSAGE ) + wxCHECK_MSG( button != nullptr, rc, INVALID_INDEX_MESSAGE ) bool wxRadioBox::Enable(unsigned int n, bool enable) { @@ -329,7 +329,7 @@ wxString wxRadioBox::GetString(unsigned int n) const void wxRadioBox::SetString(unsigned int n, const wxString& s) { QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); - wxCHECK_RET( qtButton != NULL, INVALID_INDEX_MESSAGE ); + wxCHECK_RET( qtButton != nullptr, INVALID_INDEX_MESSAGE ); qtButton->setText( wxQtConvertString( s )); } @@ -337,14 +337,14 @@ void wxRadioBox::SetString(unsigned int n, const wxString& s) void wxRadioBox::SetSelection(int n) { QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n ); - wxCHECK_RET( qtButton != NULL, INVALID_INDEX_MESSAGE ); + wxCHECK_RET( qtButton != nullptr, INVALID_INDEX_MESSAGE ); qtButton->setChecked( true ); } int wxRadioBox::GetSelection() const { QAbstractButton *qtButton = m_qtButtonGroup->checkedButton(); - if ( qtButton != NULL ) + if ( qtButton != nullptr ) { QList< QAbstractButton * > buttons = m_qtButtonGroup->buttons(); return buttons.indexOf( qtButton ); diff --git a/src/qt/radiobut.cpp b/src/qt/radiobut.cpp index 4e9de1cdf5..53eced5ac7 100644 --- a/src/qt/radiobut.cpp +++ b/src/qt/radiobut.cpp @@ -74,7 +74,7 @@ public: void OnClicked(bool checked) { wxRadioButton* handler = GetHandler(); - if ( handler == NULL ) + if ( handler == nullptr ) return; wxCommandEvent event(wxEVT_RADIOBUTTON, handler->GetId()); @@ -84,7 +84,7 @@ public: }; wxRadioButton::wxRadioButton() : - m_qtRadioButton(NULL) + m_qtRadioButton(nullptr) { } diff --git a/src/qt/region.cpp b/src/qt/region.cpp index 0af8228d53..b835c56c47 100644 --- a/src/qt/region.cpp +++ b/src/qt/region.cpp @@ -57,7 +57,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject); wxRegion::wxRegion() { - m_refData = NULL; + m_refData = nullptr; } wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) @@ -91,7 +91,7 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle) wxRegion::wxRegion(const wxBitmap& bmp) { - if ( bmp.GetMask() != NULL ) + if ( bmp.GetMask() != nullptr ) m_refData = new wxRegionRefData( *bmp.GetMask()->GetHandle() ); else m_refData = new wxRegionRefData( QRect( 0, 0, bmp.GetWidth(), bmp.GetHeight() ) ); @@ -178,7 +178,7 @@ bool wxRegion::DoIsEqual(const wxRegion& region) const bool wxRegion::DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const { - if ( m_refData == NULL ) + if ( m_refData == nullptr ) { x = y = @@ -302,7 +302,7 @@ bool wxRegion::DoXor(const wxRegion& region) bool wxRegion::DoUnionWithRect(const wxRect& rect) { - if ( m_refData == NULL ) + if ( m_refData == nullptr ) { m_refData = new wxRegionRefData(wxQtConvertRect(rect)); return true; @@ -328,7 +328,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject); wxRegionIterator::wxRegionIterator() { - m_qtRects = NULL; + m_qtRects = nullptr; m_pos = 0; } @@ -375,7 +375,7 @@ void wxRegionIterator::Reset(const wxRegion& region) bool wxRegionIterator::HaveRects() const { - wxCHECK_MSG( m_qtRects != NULL, false, "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, false, "Invalid iterator" ); return m_pos < m_qtRects->size(); } @@ -400,7 +400,7 @@ wxRegionIterator wxRegionIterator::operator ++ (int) wxCoord wxRegionIterator::GetX() const { - wxCHECK_MSG( m_qtRects != NULL, 0, "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, 0, "Invalid iterator" ); wxCHECK_MSG( m_pos < m_qtRects->size(), 0, "Invalid position" ); return m_qtRects->at( m_pos ).x(); @@ -408,7 +408,7 @@ wxCoord wxRegionIterator::GetX() const wxCoord wxRegionIterator::GetY() const { - wxCHECK_MSG( m_qtRects != NULL, 0, "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, 0, "Invalid iterator" ); wxCHECK_MSG( m_pos < m_qtRects->size(), 0, "Invalid position" ); return m_qtRects->at( m_pos ).y(); @@ -421,7 +421,7 @@ wxCoord wxRegionIterator::GetW() const wxCoord wxRegionIterator::GetWidth() const { - wxCHECK_MSG( m_qtRects != NULL, 0, "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, 0, "Invalid iterator" ); wxCHECK_MSG( m_pos < m_qtRects->size(), 0, "Invalid position" ); return m_qtRects->at( m_pos ).width(); @@ -434,7 +434,7 @@ wxCoord wxRegionIterator::GetH() const wxCoord wxRegionIterator::GetHeight() const { - wxCHECK_MSG( m_qtRects != NULL, 0, "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, 0, "Invalid iterator" ); wxCHECK_MSG( m_pos < m_qtRects->size(), 0, "Invalid position" ); return m_qtRects->at( m_pos ).height(); @@ -442,7 +442,7 @@ wxCoord wxRegionIterator::GetHeight() const wxRect wxRegionIterator::GetRect() const { - wxCHECK_MSG( m_qtRects != NULL, wxRect(), "Invalid iterator" ); + wxCHECK_MSG( m_qtRects != nullptr, wxRect(), "Invalid iterator" ); wxCHECK_MSG( m_pos < m_qtRects->size(), wxRect(), "Invalid position" ); return wxQtConvertRect( m_qtRects->at( m_pos ) ); diff --git a/src/qt/scrolbar.cpp b/src/qt/scrolbar.cpp index d65beaa73b..7a2fcd9f98 100644 --- a/src/qt/scrolbar.cpp +++ b/src/qt/scrolbar.cpp @@ -28,7 +28,7 @@ class wxQtScrollBar : public wxQtEventSignalHandler< QScrollBar, wxScrollBar > wxScrollBar::wxScrollBar() : - m_qtScrollBar(NULL) + m_qtScrollBar(nullptr) { } diff --git a/src/qt/slider.cpp b/src/qt/slider.cpp index a97f78db60..657bf95d43 100644 --- a/src/qt/slider.cpp +++ b/src/qt/slider.cpp @@ -47,7 +47,7 @@ void wxQtSlider::valueChanged(int position) wxSlider::wxSlider() : - m_qtSlider(NULL) + m_qtSlider(nullptr) { } diff --git a/src/qt/spinbutt.cpp b/src/qt/spinbutt.cpp index 9e67818451..7cd44195af 100644 --- a/src/qt/spinbutt.cpp +++ b/src/qt/spinbutt.cpp @@ -61,7 +61,7 @@ void wxQtSpinButton::stepBy(int steps) wxSpinButton::wxSpinButton() : - m_qtSpinBox(NULL) + m_qtSpinBox(nullptr) { } diff --git a/src/qt/spinctrl.cpp b/src/qt/spinctrl.cpp index d1c4b628f4..ce927e2c2c 100644 --- a/src/qt/spinctrl.cpp +++ b/src/qt/spinctrl.cpp @@ -19,7 +19,7 @@ template< typename T, typename Widget > wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() : - m_qtSpinBox(NULL) + m_qtSpinBox(nullptr) { } @@ -243,7 +243,7 @@ void wxSpinCtrl::SetValue( const wxString &value ) { // valueFromText can be called if m_qtSpinBox is an instance of the helper class wxQtSpinBox * qtSpinBox = dynamic_cast ((QSpinBox *) m_qtSpinBox); - if (qtSpinBox != NULL) + if (qtSpinBox != nullptr) qtSpinBox->setValue( qtSpinBox->valueFromText( wxQtConvertString( value ))); } @@ -292,7 +292,7 @@ void wxSpinCtrlDouble::SetValue( const wxString &value ) { // valueFromText can be called if m_qtSpinBox is an instance of the helper class wxQtDoubleSpinBox * qtSpinBox = dynamic_cast ((QDoubleSpinBox *) m_qtSpinBox); - if (qtSpinBox != NULL) + if (qtSpinBox != nullptr) qtSpinBox->setValue( qtSpinBox->valueFromText( wxQtConvertString( value ))); } diff --git a/src/qt/statbmp.cpp b/src/qt/statbmp.cpp index 04b2bd7307..52ad0eafde 100644 --- a/src/qt/statbmp.cpp +++ b/src/qt/statbmp.cpp @@ -22,7 +22,7 @@ public: wxStaticBitmap::wxStaticBitmap() : - m_qtLabel(NULL) + m_qtLabel(nullptr) { } @@ -53,7 +53,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, static void SetPixmap( QLabel *label, const QPixmap *pixMap ) { - if ( pixMap != NULL ) + if ( pixMap != nullptr ) label->setPixmap( *pixMap ); } @@ -65,7 +65,7 @@ void wxStaticBitmap::SetBitmap(const wxBitmapBundle& bitmap) wxBitmap wxStaticBitmap::GetBitmap() const { const QPixmap* pix = m_qtLabel->pixmap(); - if ( pix != NULL ) + if ( pix != nullptr ) return wxBitmap( *pix ); else return wxBitmap(); diff --git a/src/qt/statbox.cpp b/src/qt/statbox.cpp index 9efdecb32a..9fb44e6f1b 100644 --- a/src/qt/statbox.cpp +++ b/src/qt/statbox.cpp @@ -24,7 +24,7 @@ public: wxStaticBox::wxStaticBox() : - m_qtGroupBox(NULL) + m_qtGroupBox(nullptr) { } diff --git a/src/qt/statline.cpp b/src/qt/statline.cpp index 82e52f01a8..0e427a939a 100644 --- a/src/qt/statline.cpp +++ b/src/qt/statline.cpp @@ -13,7 +13,7 @@ #include wxStaticLine::wxStaticLine() : - m_qtFrame(NULL) + m_qtFrame(nullptr) { } diff --git a/src/qt/stattext.cpp b/src/qt/stattext.cpp index 1aaa885277..5b30c56e47 100644 --- a/src/qt/stattext.cpp +++ b/src/qt/stattext.cpp @@ -23,7 +23,7 @@ public: wxStaticText::wxStaticText() : - m_qtLabel(NULL) + m_qtLabel(nullptr) { } diff --git a/src/qt/statusbar.cpp b/src/qt/statusbar.cpp index 729fa66535..c87f3fbd2f 100644 --- a/src/qt/statusbar.cpp +++ b/src/qt/statusbar.cpp @@ -104,7 +104,7 @@ void wxStatusBar::Refresh( bool eraseBackground, const wxRect *rect ) void wxStatusBar::Init() { - m_qtStatusBar = NULL; + m_qtStatusBar = nullptr; } void wxStatusBar::UpdateFields() diff --git a/src/qt/textctrl.cpp b/src/qt/textctrl.cpp index c7b908065a..2b2787fe4a 100644 --- a/src/qt/textctrl.cpp +++ b/src/qt/textctrl.cpp @@ -426,7 +426,7 @@ public: virtual QScrollArea *ScrollBarsContainer() const override { - return NULL; + return nullptr; } virtual void SetStyleFlags(long flags) override @@ -497,7 +497,7 @@ void wxQtTextEdit::textChanged() wxTextCtrl::wxTextCtrl() : - m_qtEdit(NULL) + m_qtEdit(nullptr) { } @@ -607,7 +607,7 @@ long wxTextCtrl::XYToPosition(long x, long y) const bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const { - if ( x == NULL || y == NULL || pos < 0 ) + if ( x == nullptr || y == nullptr || pos < 0 ) return false; return m_qtEdit->PositionToXY(pos, x, y); diff --git a/src/qt/textentry.cpp b/src/qt/textentry.cpp index b6266f14db..efc49506dc 100644 --- a/src/qt/textentry.cpp +++ b/src/qt/textentry.cpp @@ -108,6 +108,6 @@ void wxTextEntry::DoSetValue(const wxString &WXUNUSED(value), int WXUNUSED(flags wxWindow *wxTextEntry::GetEditableWindow() { - return NULL; + return nullptr; } diff --git a/src/qt/toolbar.cpp b/src/qt/toolbar.cpp index 034b5437a4..9bd4ac01e7 100644 --- a/src/qt/toolbar.cpp +++ b/src/qt/toolbar.cpp @@ -34,13 +34,13 @@ public: : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind, clientData, shortHelpString, longHelpString) { - m_qtToolButton = NULL; + m_qtToolButton = nullptr; } wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) : wxToolBarToolBase(tbar, control, label) { - m_qtToolButton = NULL; + m_qtToolButton = nullptr; } virtual void SetLabel( const wxString &label ) override; @@ -150,7 +150,7 @@ QWidget *wxToolBar::GetHandle() const void wxToolBar::Init() { - m_qtToolBar = NULL; + m_qtToolBar = nullptr; } wxToolBar::~wxToolBar() @@ -179,7 +179,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), { // actionAt(x, y); wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") ); - return NULL; + return nullptr; } void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) @@ -267,12 +267,12 @@ bool wxToolBar::Realize() QActionGroup* wxToolBar::GetActionGroup(size_t pos) { - QActionGroup *actionGroup = NULL; + QActionGroup *actionGroup = nullptr; if (pos > 0) actionGroup = m_qtToolBar->actions().at(pos-1)->actionGroup(); - if (actionGroup == NULL && (int)pos < m_qtToolBar->actions().size() - 1) + if (actionGroup == nullptr && (int)pos < m_qtToolBar->actions().size() - 1) actionGroup = m_qtToolBar->actions().at(pos+1)->actionGroup(); - if (actionGroup == NULL) + if (actionGroup == nullptr) actionGroup = new QActionGroup(m_qtToolBar); return actionGroup; } @@ -280,7 +280,7 @@ QActionGroup* wxToolBar::GetActionGroup(size_t pos) bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool* tool = static_cast(toolBase); - QAction *before = NULL; + QAction *before = nullptr; if (pos < (size_t)m_qtToolBar->actions().size()) before = m_qtToolBar->actions().at(pos); @@ -339,7 +339,7 @@ bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase *toolBase) { wxToolBarTool* tool = static_cast(toolBase); delete tool->m_qtToolButton; - tool->m_qtToolButton = NULL; + tool->m_qtToolButton = nullptr; InvalidateBestSize(); return true; diff --git a/src/qt/tooltip.cpp b/src/qt/tooltip.cpp index d2f9885f28..100f1b51e7 100644 --- a/src/qt/tooltip.cpp +++ b/src/qt/tooltip.cpp @@ -40,7 +40,7 @@ wxToolTip::wxToolTip(const wxString &tip) { - m_window = NULL; + m_window = nullptr; SetTip(tip); } @@ -60,7 +60,7 @@ const wxString &wxToolTip::GetTip() const void wxToolTip::SetWindow(wxWindow *win) { - wxCHECK_RET(win != NULL, "window should not be NULL"); + wxCHECK_RET(win != nullptr, "window should not be null"); m_window = win; m_window->QtApplyToolTip(m_text); } diff --git a/src/qt/treectrl.cpp b/src/qt/treectrl.cpp index 1a0ecb05ef..af65bc105a 100644 --- a/src/qt/treectrl.cpp +++ b/src/qt/treectrl.cpp @@ -161,7 +161,7 @@ public: { const QPoint qPos = event->pos(); QTreeWidgetItem *item = itemAt(qPos); - if ( item != NULL ) + if ( item != nullptr ) { const wxPoint pos(qPos.x(), qPos.y()); switch ( event->button() ) @@ -439,7 +439,7 @@ private: void OnTreeScrolled(int) { - if ( GetEditControl() != NULL ) + if ( GetEditControl() != nullptr ) closeEditor(GetEditControl()->GetHandle(), QAbstractItemDelegate::RevertModelCache); } @@ -555,7 +555,7 @@ private: }; wxTreeCtrl::wxTreeCtrl() : - m_qtTreeWidget(NULL) + m_qtTreeWidget(nullptr) { } @@ -586,7 +586,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, wxTreeCtrl::~wxTreeCtrl() { - if ( m_qtTreeWidget != NULL ) + if ( m_qtTreeWidget != nullptr ) m_qtTreeWidget->deleteLater(); } @@ -658,7 +658,7 @@ int wxTreeCtrl::GetItemImage( wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const { - wxCHECK_MSG(item.IsOk(), NULL, "invalid tree item"); + wxCHECK_MSG(item.IsOk(), nullptr, "invalid tree item"); const QTreeWidgetItem* qTreeItem = wxQtConvertTreeItem(item); const QVariant itemData = qTreeItem->data(0, Qt::UserRole); @@ -713,7 +713,7 @@ void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) { wxCHECK_RET(item.IsOk(), "invalid tree item"); - if ( data != NULL ) + if ( data != nullptr ) data->SetId(item); QTreeWidgetItem *qTreeItem = wxQtConvertTreeItem(item); @@ -889,7 +889,7 @@ void wxTreeCtrl::SetFocusedItem(const wxTreeItemId& item) void wxTreeCtrl::ClearFocusedItem() { - m_qtTreeWidget->setCurrentItem(NULL); + m_qtTreeWidget->setCurrentItem(nullptr); } wxTreeItemId wxTreeCtrl::GetFocusedItem() const @@ -910,7 +910,7 @@ wxTreeItemId wxTreeCtrl::GetFirstChild( wxTreeItemIdValue& cookie ) const { - cookie = 0; + cookie = nullptr; return GetNextChild(item, cookie); } @@ -953,7 +953,7 @@ wxTreeItemId wxTreeCtrl::GetNextSibling(const wxTreeItemId& item) const QTreeWidgetItem *qTreeItem = wxQtConvertTreeItem(item); QTreeWidgetItem *parent = qTreeItem->parent(); - if ( parent != NULL ) + if ( parent != nullptr ) { int index = parent->indexOfChild(qTreeItem); wxASSERT(index != -1); @@ -980,7 +980,7 @@ wxTreeItemId wxTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const QTreeWidgetItem *qTreeItem = wxQtConvertTreeItem(item); QTreeWidgetItem *parent = qTreeItem->parent(); - if ( parent != NULL ) + if ( parent != nullptr ) { int index = parent->indexOfChild(qTreeItem); wxASSERT(index != -1); @@ -1083,7 +1083,7 @@ wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, data ); - m_qtTreeWidget->setCurrentItem(NULL); + m_qtTreeWidget->setCurrentItem(nullptr); if ( (GetWindowStyleFlag() & wxTR_HIDE_ROOT) != 0 ) m_qtTreeWidget->setRootIndex(m_qtTreeWidget->model()->index(0, 0)); @@ -1102,7 +1102,7 @@ void wxTreeCtrl::Delete(const wxTreeItemId& item) DeleteChildren(qTreeItem); - if ( parent != NULL ) + if ( parent != nullptr ) { parent->removeChild(qTreeItem); } @@ -1193,7 +1193,7 @@ void wxTreeCtrl::Toggle(const wxTreeItemId& item) void wxTreeCtrl::Unselect() { QTreeWidgetItem *current = m_qtTreeWidget->currentItem(); - if ( current != NULL ) + if ( current != nullptr ) m_qtTreeWidget->select(current, QItemSelectionModel::Deselect); } @@ -1243,7 +1243,7 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) QTreeWidgetItem *qTreeItem = wxQtConvertTreeItem(item); QTreeWidgetItem *parent = qTreeItem->parent(); - while ( parent != NULL ) + while ( parent != nullptr ) { parent->setExpanded(true); parent = parent->parent(); @@ -1265,7 +1265,7 @@ wxTextCtrl *wxTreeCtrl::EditLabel( wxClassInfo* WXUNUSED(textCtrlClass) ) { - wxCHECK_MSG(item.IsOk(), NULL, "invalid tree item"); + wxCHECK_MSG(item.IsOk(), nullptr, "invalid tree item"); m_qtTreeWidget->editItem(wxQtConvertTreeItem(item)); return m_qtTreeWidget->GetEditControl(); } @@ -1357,7 +1357,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, wxTreeItemId wxItem = wxQtConvertTreeItem(newItem); - if ( data != NULL ) + if ( data != nullptr ) data->SetId(wxItem); if ( pos == static_cast(-1) ) @@ -1405,7 +1405,7 @@ wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const return wxTreeItemId(); QTreeWidgetItem *hitItem = m_qtTreeWidget->itemAt(wxQtConvertPoint(point)); - flags = hitItem == NULL ? wxTREE_HITTEST_NOWHERE : wxTREE_HITTEST_ONITEM; + flags = hitItem == nullptr ? wxTREE_HITTEST_NOWHERE : wxTREE_HITTEST_ONITEM; return wxQtConvertTreeItem(hitItem); } diff --git a/src/qt/uiaction.cpp b/src/qt/uiaction.cpp index 11938b3352..618cdaa36b 100644 --- a/src/qt/uiaction.cpp +++ b/src/qt/uiaction.cpp @@ -100,23 +100,23 @@ static bool SimulateMouseButton( MouseAction mouseAction, MouseButton mouseButto { QPoint mousePosition = QCursor::pos(); QWidget *widget = QApplication::widgetAt( mousePosition ); - if ( widget != NULL ) + if ( widget != nullptr ) mouseEvent( mouseAction, argForEvents(widget), mouseButton, NoModifier, mousePosition ); // If we found a widget then we successfully simulated an event: - return widget != NULL; + return widget != nullptr; } static bool SimulateKeyboardKey( KeyAction keyAction, Key key ) { QWidget *widget = QApplication::focusWidget(); - if ( widget != NULL ) + if ( widget != nullptr ) keyEvent( keyAction, argForEvents(widget), key ); // If we found a widget then we successfully simulated an event: - return widget != NULL; + return widget != nullptr; } bool wxUIActionSimulatorQtImpl::MouseDown( int button ) diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index f982a8b2e7..e723e4114c 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -126,7 +126,7 @@ wxWindow *wxGetActiveWindow() node = node->GetPrevious(); } - return NULL; + return nullptr; } bool wxLaunchDefaultApplication(const wxString& path, int WXUNUSED( flags ) ) diff --git a/src/qt/window.cpp b/src/qt/window.cpp index cf383c2007..e774253d8f 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -252,19 +252,19 @@ void wxWindowQt::QtSendSetCursorEvent(wxWindowQt* win, wxPoint posScreen) } w = w->GetParent(); - if ( w == NULL ) + if ( w == nullptr ) break; } win->SetCursor(wxCursor(wxCURSOR_ARROW)); } -static wxWindowQt *s_capturedWindow = NULL; +static wxWindowQt *s_capturedWindow = nullptr; /* static */ wxWindowQt *wxWindowBase::DoFindFocus() { - wxWindowQt *window = NULL; + wxWindowQt *window = nullptr; QWidget *qtWidget = QApplication::focusWidget(); - if ( qtWidget != NULL ) + if ( qtWidget != nullptr ) window = wxWindowQt::QtRetrieveWindowPointer( qtWidget ); return window; @@ -272,10 +272,10 @@ static wxWindowQt *s_capturedWindow = NULL; void wxWindowQt::Init() { - m_horzScrollBar = NULL; - m_vertScrollBar = NULL; + m_horzScrollBar = nullptr; + m_vertScrollBar = nullptr; - m_qtPicture = NULL; + m_qtPicture = nullptr; m_qtPainter.reset(new QPainter()); m_mouseInside = false; @@ -284,8 +284,8 @@ void wxWindowQt::Init() m_qtShortcutHandler.reset(new wxQtShortcutHandler(this)); m_processingShortcut = false; #endif - m_qtWindow = NULL; - m_qtContainer = NULL; + m_qtWindow = nullptr; + m_qtContainer = nullptr; } wxWindowQt::wxWindowQt() @@ -308,7 +308,7 @@ wxWindowQt::~wxWindowQt() { if ( !m_qtWindow ) { - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), GetName()); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is null"), GetName()); return; } @@ -327,15 +327,15 @@ wxWindowQt::~wxWindowQt() m_qtWindow->blockSignals(true); if ( s_capturedWindow == this ) - s_capturedWindow = NULL; + s_capturedWindow = nullptr; DestroyChildren(); // This also destroys scrollbars if (m_qtWindow) - QtStoreWindowPointer( GetHandle(), NULL ); + QtStoreWindowPointer( GetHandle(), nullptr ); #if wxUSE_DRAG_AND_DROP - SetDropTarget(NULL); + SetDropTarget(nullptr); #endif delete m_qtWindow; @@ -349,7 +349,7 @@ bool wxWindowQt::Create( wxWindowQt * parent, wxWindowID id, const wxPoint & pos // that a generic control, like wxPanel, is being created, so we need a very // simple control as a base: - if ( GetHandle() == NULL ) + if ( GetHandle() == nullptr ) { if ( style & (wxHSCROLL | wxVSCROLL) ) { @@ -383,7 +383,7 @@ bool wxWindowQt::Create( wxWindowQt * parent, wxWindowID id, const wxPoint & pos void wxWindowQt::PostCreation(bool generic) { - if ( m_qtWindow == NULL ) + if ( m_qtWindow == nullptr ) { // store pointer to the QWidget subclass (to be used in the destructor) m_qtWindow = GetHandle(); @@ -445,7 +445,7 @@ bool wxWindowQt::Show( bool show ) // Show can be called before the underlying window is created: QWidget *qtWidget = GetHandle(); - if ( qtWidget == NULL ) + if ( qtWidget == nullptr ) { return false; } @@ -552,9 +552,9 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect ) widget = GetHandle(); } - if ( widget != NULL ) + if ( widget != nullptr ) { - if ( rect != NULL ) + if ( rect != nullptr ) { wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s rect %d %d %d %d"), GetName(), @@ -611,30 +611,30 @@ int wxWindowQt::GetCharWidth() const void wxWindowQt::DoGetTextExtent(const wxString& string, int *x, int *y, int *descent, int *externalLeading, const wxFont *font ) const { - QFontMetrics fontMetrics( font != NULL ? font->GetHandle() : GetHandle()->font() ); + QFontMetrics fontMetrics( font != nullptr ? font->GetHandle() : GetHandle()->font() ); - if ( x != NULL ) + if ( x != nullptr ) *x = fontMetrics.width( wxQtConvertString( string )); - if ( y != NULL ) + if ( y != nullptr ) *y = fontMetrics.height(); - if ( descent != NULL ) + if ( descent != nullptr ) *descent = fontMetrics.descent(); - if ( externalLeading != NULL ) + if ( externalLeading != nullptr ) *externalLeading = fontMetrics.lineSpacing(); } QWidget *wxWindowQt::QtGetClientWidget() const { - QWidget *qtWidget = NULL; - if ( m_qtContainer != NULL ) + QWidget *qtWidget = nullptr; + if ( m_qtContainer != nullptr ) { qtWidget = m_qtContainer->viewport(); } - if ( qtWidget == NULL ) + if ( qtWidget == nullptr ) { // We don't have scrollbars or the QScrollArea has no children qtWidget = GetHandle(); @@ -643,11 +643,11 @@ QWidget *wxWindowQt::QtGetClientWidget() const return qtWidget; } -/* Returns a scrollbar for the given orientation, or NULL if the scrollbar +/* Returns a scrollbar for the given orientation, or nullptr if the scrollbar * has not been previously created and create is false */ QScrollBar *wxWindowQt::QtGetScrollBar( int orientation ) const { - QScrollBar *scrollBar = NULL; + QScrollBar *scrollBar = nullptr; if ( orientation == wxHORIZONTAL ) scrollBar = m_horzScrollBar; @@ -662,7 +662,7 @@ QScrollBar *wxWindowQt::QtGetScrollBar( int orientation ) const QScrollBar *wxWindowQt::QtSetScrollBar( int orientation, QScrollBar *scrollBar ) { QScrollArea *scrollArea = QtGetScrollBarsContainer(); - wxCHECK_MSG( scrollArea, NULL, "Window without scrolling area" ); + wxCHECK_MSG( scrollArea, nullptr, "Window without scrolling area" ); // Create a new scrollbar if needed if ( !scrollBar ) @@ -692,11 +692,11 @@ void wxWindowQt::SetScrollbar( int orientation, int pos, int thumbvisible, int r //If not exist, create the scrollbar QScrollBar *scrollBar = QtGetScrollBar( orientation ); - if ( scrollBar == NULL ) + if ( scrollBar == nullptr ) scrollBar = QtSetScrollBar( orientation ); // Configure the scrollbar if it exists. If range is zero we can get here with - // scrollBar == NULL and it is not a problem + // scrollBar == nullptr and it is not a problem if ( scrollBar ) { scrollBar->setRange( 0, range - thumbvisible ); @@ -758,7 +758,7 @@ void wxWindowQt::ScrollWindow( int dx, int dy, const wxRect *rect ) else widget = GetHandle(); // scroll the widget or the specified rect (not children) - if ( rect != NULL ) + if ( rect != nullptr ) widget->scroll( dx, dy, wxQtConvertRect( *rect )); else widget->scroll( dx, dy ); @@ -771,7 +771,7 @@ void wxWindowQt::SetDropTarget( wxDropTarget *dropTarget ) if ( m_dropTarget == dropTarget ) return; - if ( m_dropTarget != NULL ) + if ( m_dropTarget != nullptr ) { m_dropTarget->Disconnect(); delete m_dropTarget; @@ -779,7 +779,7 @@ void wxWindowQt::SetDropTarget( wxDropTarget *dropTarget ) m_dropTarget = dropTarget; - if ( m_dropTarget != NULL ) + if ( m_dropTarget != nullptr ) { m_dropTarget->ConnectTo(m_qtWindow); } @@ -937,7 +937,7 @@ void wxWindowQt::DoScreenToClient( int *x, int *y ) const void wxWindowQt::DoCaptureMouse() { - wxCHECK_RET( GetHandle() != NULL, wxT("invalid window") ); + wxCHECK_RET( GetHandle() != nullptr, wxT("invalid window") ); GetHandle()->grabMouse(); s_capturedWindow = this; } @@ -945,9 +945,9 @@ void wxWindowQt::DoCaptureMouse() void wxWindowQt::DoReleaseMouse() { - wxCHECK_RET( GetHandle() != NULL, wxT("invalid window") ); + wxCHECK_RET( GetHandle() != nullptr, wxT("invalid window") ); GetHandle()->releaseMouse(); - s_capturedWindow = NULL; + s_capturedWindow = nullptr; } wxWindowQt *wxWindowBase::GetCapture() @@ -1131,7 +1131,7 @@ bool wxWindowQt::QtSetBackgroundStyle() else widget = GetHandle(); // check if the control is created (wxGTK requires calling it before): - if ( widget != NULL ) + if ( widget != nullptr ) { if (m_backgroundStyle == wxBG_STYLE_PAINT) { @@ -1245,7 +1245,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) { bool handled; - if ( m_qtPicture == NULL ) + if ( m_qtPicture == nullptr ) { // Real paint event (not for wxClientDC), prepare the background switch ( GetBackgroundStyle() ) @@ -1312,7 +1312,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) // Data from wxClientDC, paint it m_qtPicture->play( m_qtPainter.get() ); // Reset picture - m_qtPicture->setData( NULL, 0 ); + m_qtPicture->setData( nullptr, 0 ); handled = true; } diff --git a/src/ribbon/art_aui.cpp b/src/ribbon/art_aui.cpp index 8ea8a9e4f1..3058924956 100644 --- a/src/ribbon/art_aui.cpp +++ b/src/ribbon/art_aui.cpp @@ -549,19 +549,19 @@ void wxRibbonAUIArtProvider::GetBarTabWidth( min += bitmap.GetLogicalWidth(); } - if(ideal != NULL) + if(ideal != nullptr) { *ideal = width + 16; } - if(small_begin_need_separator != NULL) + if(small_begin_need_separator != nullptr) { *small_begin_need_separator = min; } - if(small_must_have_separator != NULL) + if(small_must_have_separator != nullptr) { *small_must_have_separator = min; } - if(minimum != NULL) + if(minimum != nullptr) { *minimum = min; } @@ -897,12 +897,12 @@ void wxRibbonAUIArtProvider::DrawPartialPanelBackground(wxDC& dc, wxPoint offset(wnd->GetPosition()); wxWindow* parent = wnd->GetParent(); - wxRibbonPanel* panel = NULL; + wxRibbonPanel* panel = nullptr; for(; parent; parent = parent->GetParent()) { panel = wxDynamicCast(parent, wxRibbonPanel); - if(panel != NULL) + if(panel != nullptr) { if(!panel->IsHovered()) return; @@ -910,7 +910,7 @@ void wxRibbonAUIArtProvider::DrawPartialPanelBackground(wxDC& dc, } offset += parent->GetPosition(); } - if(panel == NULL) + if(panel == nullptr) return; wxRect background(panel->GetSize()); diff --git a/src/ribbon/art_msw.cpp b/src/ribbon/art_msw.cpp index a27195e893..7aae7105e1 100644 --- a/src/ribbon/art_msw.cpp +++ b/src/ribbon/art_msw.cpp @@ -307,11 +307,11 @@ void wxRibbonMSWArtProvider::GetColourScheme( wxColour* secondary, wxColour* tertiary) const { - if(primary != NULL) + if(primary != nullptr) *primary = m_primary_scheme_colour; - if(secondary != NULL) + if(secondary != nullptr) *secondary = m_secondary_scheme_colour; - if(tertiary != NULL) + if(tertiary != nullptr) *tertiary = m_tertiary_scheme_colour; } @@ -2249,7 +2249,7 @@ void wxRibbonMSWArtProvider::DrawMinimisedPanel( wxRect true_rect(rect); RemovePanelPadding(&true_rect); - if(wnd->GetExpandedPanel() != NULL) + if(wnd->GetExpandedPanel() != nullptr) { wxRect client_rect(true_rect); client_rect.x++; @@ -2417,15 +2417,15 @@ void wxRibbonMSWArtProvider::DrawPartialPageBackground( // hovered panel somewhere between the window and the page, as it causes // the background to change. wxPoint offset(wnd->GetPosition()); - wxRibbonPage* page = NULL; + wxRibbonPage* page = nullptr; wxWindow* parent = wnd->GetParent(); wxRibbonPanel* panel = wxDynamicCast(wnd, wxRibbonPanel); bool hovered = false; - if(panel != NULL) + if(panel != nullptr) { hovered = allow_hovered && panel->IsHovered(); - if(panel->GetExpandedDummy() != NULL) + if(panel->GetExpandedDummy() != nullptr) { offset = panel->GetExpandedDummy()->GetPosition(); parent = panel->GetExpandedDummy()->GetParent(); @@ -2433,26 +2433,26 @@ void wxRibbonMSWArtProvider::DrawPartialPageBackground( } for(; parent; parent = parent->GetParent()) { - if(panel == NULL) + if(panel == nullptr) { panel = wxDynamicCast(parent, wxRibbonPanel); - if(panel != NULL) + if(panel != nullptr) { hovered = allow_hovered && panel->IsHovered(); - if(panel->GetExpandedDummy() != NULL) + if(panel->GetExpandedDummy() != nullptr) { parent = panel->GetExpandedDummy(); } } } page = wxDynamicCast(parent, wxRibbonPage); - if(page != NULL) + if(page != nullptr) { break; } offset += parent->GetPosition(); } - if(page != NULL) + if(page != nullptr) { DrawPartialPageBackground(dc, wnd, rect, page, offset, hovered); return; @@ -2898,19 +2898,19 @@ void wxRibbonMSWArtProvider::GetBarTabWidth( min += bitmap.GetLogicalWidth(); } - if(ideal != NULL) + if(ideal != nullptr) { *ideal = width + 30; } - if(small_begin_need_separator != NULL) + if(small_begin_need_separator != nullptr) { *small_begin_need_separator = width + 20; } - if(small_must_have_separator != NULL) + if(small_must_have_separator != nullptr) { *small_must_have_separator = width + 10; } - if(minimum != NULL) + if(minimum != nullptr) { *minimum = min; } @@ -2975,7 +2975,7 @@ wxSize wxRibbonMSWArtProvider::GetPanelSize( else client_size.IncBy(6, 6); - if(client_offset != NULL) + if(client_offset != nullptr) { if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL) *client_offset = wxPoint(2, 3); @@ -3001,7 +3001,7 @@ wxSize wxRibbonMSWArtProvider::GetPanelClientSize( else size.DecBy(6, 6); - if(client_offset != NULL) + if(client_offset != nullptr) { if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL) *client_offset = wxPoint(2, 3); @@ -3076,13 +3076,13 @@ wxSize wxRibbonMSWArtProvider::GetGalleryClientSize( size.DecBy( 2, 1); } - if(client_offset != NULL) + if(client_offset != nullptr) *client_offset = wxPoint(2, 1); - if(scroll_up_button != NULL) + if(scroll_up_button != nullptr) *scroll_up_button = scroll_up; - if(scroll_down_button != NULL) + if(scroll_down_button != nullptr) *scroll_down_button = scroll_down; - if(extension_button != NULL) + if(extension_button != nullptr) *extension_button = extension; return size; @@ -3305,11 +3305,11 @@ wxSize wxRibbonMSWArtProvider::GetMinimisedPanelMinimumSize( wxSize* desired_bitmap_size, wxDirection* expanded_panel_direction) { - if(desired_bitmap_size != NULL) + if(desired_bitmap_size != nullptr) { *desired_bitmap_size = wxSize(16, 16); } - if(expanded_panel_direction != NULL) + if(expanded_panel_direction != nullptr) { if(m_flags & wxRIBBON_BAR_FLOW_VERTICAL) *expanded_panel_direction = wxEAST; diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index 340d3417ae..678bd56497 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -316,7 +316,7 @@ void wxRibbonBar::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) wxRibbonPage* wxRibbonBar::GetPage(int n) { if(n < 0 || (size_t)n >= m_pages.GetCount()) - return 0; + return nullptr; return m_pages.Item(n).page; } @@ -748,7 +748,7 @@ wxRibbonBar::wxRibbonBar(wxWindow* parent, wxRibbonBar::~wxRibbonBar() { - SetArtProvider(NULL); + SetArtProvider(nullptr); for ( size_t n = 0; n < m_image_lists.size(); ++n ) { @@ -792,7 +792,7 @@ void wxRibbonBar::CommonInit(long style) m_tab_scroll_buttons_shown = false; m_arePanelsShown = true; - if(m_art == NULL) + if(m_art == nullptr) { SetArtProvider(new wxRibbonDefaultArtProvider); } @@ -993,7 +993,7 @@ wxRibbonPageTabInfo* wxRibbonBar::HitTestTabs(wxPoint position, int* index) continue; if(info.rect.Contains(position)) { - if(index != NULL) + if(index != nullptr) { *index = (int)i; } @@ -1001,11 +1001,11 @@ wxRibbonPageTabInfo* wxRibbonBar::HitTestTabs(wxPoint position, int* index) } } } - if(index != NULL) + if(index != nullptr) { *index = -1; } - return NULL; + return nullptr; } void wxRibbonBar::OnMouseLeftDown(wxMouseEvent& evt) @@ -1044,7 +1044,7 @@ void wxRibbonBar::OnMouseLeftDown(wxMouseEvent& evt) ProcessWindowEvent(notification); } } - else if(tab == NULL) + else if(tab == nullptr) { if(m_tab_scroll_left_button_rect.Contains(evt.GetPosition())) { diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 98b559538e..22c801fb99 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -276,9 +276,9 @@ public: wxRibbonButtonBarButtonInstance* FindSimilarInstance( wxRibbonButtonBarButtonInstance* inst) { - if(inst == NULL) + if(inst == nullptr) { - return NULL; + return nullptr; } size_t btn_count = buttons.Count(); size_t btn_i; @@ -290,7 +290,7 @@ public: return &instance; } } - return NULL; + return nullptr; } }; @@ -473,7 +473,7 @@ wxRibbonButtonBar::SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* wxRibbonButtonBar::GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const { - wxCHECK_MSG( item, NULL, "Can't get client object for an invalid item" ); + wxCHECK_MSG( item, nullptr, "Can't get client object for an invalid item" ); return item->client_data.GetClientObject(); } @@ -490,7 +490,7 @@ wxRibbonButtonBar::SetItemClientData(wxRibbonButtonBarButtonBase* item, void* wxRibbonButtonBar::GetItemClientData(const wxRibbonButtonBarButtonBase* item) const { - wxCHECK_MSG( item, NULL, "Can't get client data for an invalid item" ); + wxCHECK_MSG( item, nullptr, "Can't get client data for an invalid item" ); return item->client_data.GetClientData(); } @@ -597,9 +597,9 @@ bool wxRibbonButtonBar::DeleteButton(int button_id) m_layouts_valid = false; m_buttons.RemoveAt(i); if (m_hovered_button && m_hovered_button->base == button) - m_hovered_button = NULL; + m_hovered_button = nullptr; if (m_active_button && m_active_button->base == button) - m_active_button = NULL; + m_active_button = nullptr; delete button; Realize(); Refresh(); @@ -677,7 +677,7 @@ void wxRibbonButtonBar::SetButtonIcon( const wxBitmap& bitmap_small_disabled) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; base->SetBitmaps(m_ribbonBar, m_bitmap_size_large, m_bitmap_size_small, bitmap, bitmap_disabled, bitmap_small, bitmap_small_disabled); @@ -687,7 +687,7 @@ void wxRibbonButtonBar::SetButtonIcon( void wxRibbonButtonBar::SetButtonText(int button_id, const wxString& label) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; base->label = label; @@ -703,7 +703,7 @@ void wxRibbonButtonBar::SetButtonTextMinWidth(int button_id, int min_width_medium, int min_width_large) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; base->text_min_width[0] = 0; base->text_min_width[1] = min_width_medium; @@ -719,7 +719,7 @@ void wxRibbonButtonBar::SetButtonTextMinWidth( int button_id, const wxString& label) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; wxClientDC temp_dc(this); base->text_min_width[wxRIBBON_BUTTONBAR_BUTTON_MEDIUM] = @@ -739,7 +739,7 @@ void wxRibbonButtonBar::SetButtonMinSizeClass(int button_id, wxRibbonButtonBarButtonState min_size_class) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; if(base->max_size_class < min_size_class) { @@ -754,7 +754,7 @@ void wxRibbonButtonBar::SetButtonMaxSizeClass(int button_id, wxRibbonButtonBarButtonState max_size_class) { wxRibbonButtonBarButtonBase* base = GetItemById(button_id); - if(base == NULL) + if(base == nullptr) return; if(base->min_size_class > max_size_class) { @@ -973,7 +973,7 @@ void wxRibbonButtonBar::OnSize(wxSizeEvent& evt) void wxRibbonButtonBar::CommonInit(long WXUNUSED(style)) { - // This can initialize it to NULL when we're called from the default ctor, + // This can initialize it to nullptr when we're called from the default ctor, // but will set it to the correct value when used from non-default ctor or // Create() later. m_ribbonBar = GetAncestorRibbonBar(); @@ -986,8 +986,8 @@ void wxRibbonButtonBar::CommonInit(long WXUNUSED(style)) m_layouts.Add(placeholder_layout); m_current_layout = 0; m_layout_offset = wxPoint(0, 0); - m_hovered_button = NULL; - m_active_button = NULL; + m_hovered_button = nullptr; + m_active_button = nullptr; m_lock_active_state = false; m_show_tooltips_for_disabled = false; @@ -1016,7 +1016,7 @@ wxSize wxRibbonButtonBar::DoGetBestSize() const void wxRibbonButtonBar::MakeLayouts() { - if(m_layouts_valid || m_art == NULL) + if(m_layouts_valid || m_art == nullptr) { return; } @@ -1025,12 +1025,12 @@ void wxRibbonButtonBar::MakeLayouts() if(m_hovered_button) { m_hovered_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK; - m_hovered_button = NULL; + m_hovered_button = nullptr; } if(m_active_button) { m_active_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK; - m_active_button = NULL; + m_active_button = nullptr; } size_t count = m_layouts.GetCount(); size_t i; @@ -1196,7 +1196,7 @@ void wxRibbonButtonBar::TryCollapseLayout(wxRibbonButtonBarLayout* original, { return; } - if(last_button != NULL) + if(last_button != nullptr) { *last_button = btn_i; } @@ -1253,8 +1253,8 @@ void wxRibbonButtonBar::TryCollapseLayout(wxRibbonButtonBarLayout* original, void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) { wxPoint cursor(evt.GetPosition()); - wxRibbonButtonBarButtonInstance* new_hovered = NULL; - wxRibbonButtonBarButtonInstance* tooltipButton = NULL; + wxRibbonButtonBarButtonInstance* new_hovered = nullptr; + wxRibbonButtonBarButtonInstance* tooltipButton = nullptr; long new_hovered_state = 0; wxRibbonButtonBarLayout* layout = m_layouts.Item(m_current_layout); @@ -1295,7 +1295,7 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) } #if wxUSE_TOOLTIPS - if(tooltipButton == NULL && GetToolTip()) + if(tooltipButton == nullptr && GetToolTip()) { UnsetToolTip(); } @@ -1309,15 +1309,15 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) wxUnusedVar(tooltipButton); #endif - if(new_hovered != m_hovered_button || (m_hovered_button != NULL && + if(new_hovered != m_hovered_button || (m_hovered_button != nullptr && new_hovered_state != m_hovered_button->base->state)) { - if(m_hovered_button != NULL) + if(m_hovered_button != nullptr) { m_hovered_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK; } m_hovered_button = new_hovered; - if(m_hovered_button != NULL) + if(m_hovered_button != nullptr) { m_hovered_button->base->state = new_hovered_state; } @@ -1357,7 +1357,7 @@ void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) void wxRibbonButtonBar::OnMouseDown(wxMouseEvent& evt) { wxPoint cursor(evt.GetPosition()); - m_active_button = NULL; + m_active_button = nullptr; wxRibbonButtonBarLayout* layout = m_layouts.Item(m_current_layout); size_t btn_count = layout->buttons.Count(); @@ -1437,7 +1437,7 @@ void wxRibbonButtonBar::OnMouseUp(wxMouseEvent& evt) if(m_active_button) // may have been NULLed by event handler { m_active_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK; - m_active_button = NULL; + m_active_button = nullptr; } Refresh(false); } @@ -1448,20 +1448,20 @@ void wxRibbonButtonBar::OnMouseEnter(wxMouseEvent& evt) { if(m_active_button && !evt.LeftIsDown()) { - m_active_button = NULL; + m_active_button = nullptr; } } void wxRibbonButtonBar::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) { bool repaint = false; - if(m_hovered_button != NULL) + if(m_hovered_button != nullptr) { m_hovered_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_HOVER_MASK; - m_hovered_button = NULL; + m_hovered_button = nullptr; repaint = true; } - if(m_active_button != NULL && !m_lock_active_state) + if(m_active_button != nullptr && !m_lock_active_state) { m_active_button->base->state &= ~wxRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK; repaint = true; @@ -1472,19 +1472,19 @@ void wxRibbonButtonBar::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) wxRibbonButtonBarButtonBase *wxRibbonButtonBar::GetActiveItem() const { - return m_active_button == NULL ? NULL : m_active_button->base; + return m_active_button == nullptr ? nullptr : m_active_button->base; } wxRibbonButtonBarButtonBase *wxRibbonButtonBar::GetHoveredItem() const { - return m_hovered_button == NULL ? NULL : m_hovered_button->base; + return m_hovered_button == nullptr ? nullptr : m_hovered_button->base; } wxRibbonButtonBarButtonBase *wxRibbonButtonBar::GetItem(size_t n) const { - wxCHECK_MSG(n < m_buttons.GetCount(), NULL, "wxRibbonButtonBar item's index is out of bound"); + wxCHECK_MSG(n < m_buttons.GetCount(), nullptr, "wxRibbonButtonBar item's index is out of bound"); return m_buttons.Item(n); } @@ -1498,13 +1498,13 @@ wxRibbonButtonBarButtonBase *wxRibbonButtonBar::GetItemById(int button_id) const return button; } - return NULL; + return nullptr; } int wxRibbonButtonBar::GetItemId(wxRibbonButtonBarButtonBase *item) const { - wxCHECK_MSG(item != NULL, wxNOT_FOUND, "wxRibbonButtonBar item should not be NULL"); + wxCHECK_MSG(item != nullptr, wxNOT_FOUND, "wxRibbonButtonBar item should not be null"); return item->id; } diff --git a/src/ribbon/control.cpp b/src/ribbon/control.cpp index 1eb88ee21f..fc7b9b2714 100644 --- a/src/ribbon/control.cpp +++ b/src/ribbon/control.cpp @@ -115,7 +115,7 @@ wxRibbonBar* wxRibbonControl::GetAncestorRibbonBar()const return bar; } - return NULL; + return nullptr; } #endif // wxUSE_RIBBON diff --git a/src/ribbon/gallery.cpp b/src/ribbon/gallery.cpp index a30cc58b5d..15db00f40b 100644 --- a/src/ribbon/gallery.cpp +++ b/src/ribbon/gallery.cpp @@ -114,13 +114,13 @@ bool wxRibbonGallery::Create(wxWindow* parent, void wxRibbonGallery::CommonInit(long WXUNUSED(style)) { - m_selected_item = NULL; - m_hovered_item = NULL; - m_active_item = NULL; + m_selected_item = nullptr; + m_hovered_item = nullptr; + m_active_item = nullptr; m_scroll_up_button_rect = wxRect(0, 0, 0, 0); m_scroll_down_button_rect = wxRect(0, 0, 0, 0); m_extension_button_rect = wxRect(0, 0, 0, 0); - m_mouse_active_rect = NULL; + m_mouse_active_rect = nullptr; m_bitmap_size = wxSize(64, 32); m_bitmap_padded_size = m_bitmap_size; m_item_separation_x = 0; @@ -138,10 +138,10 @@ void wxRibbonGallery::CommonInit(long WXUNUSED(style)) void wxRibbonGallery::OnMouseEnter(wxMouseEvent& evt) { m_hovered = true; - if(m_mouse_active_rect != NULL && !evt.LeftIsDown()) + if(m_mouse_active_rect != nullptr && !evt.LeftIsDown()) { - m_mouse_active_rect = NULL; - m_active_item = NULL; + m_mouse_active_rect = nullptr; + m_active_item = nullptr; } Refresh(false); } @@ -158,8 +158,8 @@ void wxRibbonGallery::OnMouseMove(wxMouseEvent& evt) if(TestButtonHover(m_extension_button_rect, pos, &m_extension_button_state)) refresh = true; - wxRibbonGalleryItem *hovered_item = NULL; - wxRibbonGalleryItem *active_item = NULL; + wxRibbonGalleryItem *hovered_item = nullptr; + wxRibbonGalleryItem *active_item = nullptr; if(m_client_rect.Contains(pos)) { if(m_art && m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL) @@ -236,16 +236,16 @@ bool wxRibbonGallery::TestButtonHover(const wxRect& rect, wxPoint pos, void wxRibbonGallery::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) { m_hovered = false; - m_active_item = NULL; + m_active_item = nullptr; if(m_up_button_state != wxRIBBON_GALLERY_BUTTON_DISABLED) m_up_button_state = wxRIBBON_GALLERY_BUTTON_NORMAL; if(m_down_button_state != wxRIBBON_GALLERY_BUTTON_DISABLED) m_down_button_state = wxRIBBON_GALLERY_BUTTON_NORMAL; if(m_extension_button_state != wxRIBBON_GALLERY_BUTTON_DISABLED) m_extension_button_state = wxRIBBON_GALLERY_BUTTON_NORMAL; - if(m_hovered_item != NULL) + if(m_hovered_item != nullptr) { - m_hovered_item = NULL; + m_hovered_item = nullptr; wxRibbonGalleryEvent notification( wxEVT_RIBBONGALLERY_HOVER_CHANGED, GetId()); notification.SetEventObject(this); @@ -258,7 +258,7 @@ void wxRibbonGallery::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) void wxRibbonGallery::OnMouseDown(wxMouseEvent& evt) { wxPoint pos = evt.GetPosition(); - m_mouse_active_rect = NULL; + m_mouse_active_rect = nullptr; if(m_client_rect.Contains(pos)) { if(m_art && m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL) @@ -306,13 +306,13 @@ void wxRibbonGallery::OnMouseDown(wxMouseEvent& evt) m_extension_button_state = wxRIBBON_GALLERY_BUTTON_ACTIVE; } } - if(m_mouse_active_rect != NULL) + if(m_mouse_active_rect != nullptr) Refresh(false); } void wxRibbonGallery::OnMouseUp(wxMouseEvent& evt) { - if(m_mouse_active_rect != NULL) + if(m_mouse_active_rect != nullptr) { wxPoint pos = evt.GetPosition(); if(m_active_item) @@ -342,7 +342,7 @@ void wxRibbonGallery::OnMouseUp(wxMouseEvent& evt) notification.SetEventObject(this); ProcessWindowEvent(notification); } - else if(m_active_item != NULL) + else if(m_active_item != nullptr) { if(m_selected_item != m_active_item) { @@ -363,8 +363,8 @@ void wxRibbonGallery::OnMouseUp(wxMouseEvent& evt) ProcessWindowEvent(notification); } } - m_mouse_active_rect = NULL; - m_active_item = NULL; + m_mouse_active_rect = nullptr; + m_active_item = nullptr; Refresh(false); } } @@ -401,7 +401,7 @@ void* wxRibbonGallery::GetItemClientData(const wxRibbonGalleryItem* itm) const bool wxRibbonGallery::ScrollLines(int lines) { - if(m_scroll_limit == 0 || m_art == NULL) + if(m_scroll_limit == 0 || m_art == nullptr) return false; return ScrollPixels(lines * GetScrollLineSize()); @@ -409,7 +409,7 @@ bool wxRibbonGallery::ScrollLines(int lines) int wxRibbonGallery::GetScrollLineSize() const { - if(m_art == NULL) + if(m_art == nullptr) return 32; int line_size = m_bitmap_padded_size.GetHeight(); @@ -421,7 +421,7 @@ int wxRibbonGallery::GetScrollLineSize() const bool wxRibbonGallery::ScrollPixels(int pixels) { - if(m_scroll_limit == 0 || m_art == NULL) + if(m_scroll_limit == 0 || m_art == nullptr) return false; if(pixels < 0) @@ -463,7 +463,7 @@ bool wxRibbonGallery::ScrollPixels(int pixels) void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem* item) { - if(item == NULL || !item->IsVisible() || IsEmpty()) + if(item == nullptr || !item->IsVisible() || IsEmpty()) return; if(m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL) @@ -495,7 +495,7 @@ void wxRibbonGallery::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) void wxRibbonGallery::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAutoBufferedPaintDC dc(this); - if(m_art == NULL) + if(m_art == nullptr) return; m_art->DrawGalleryBackground(dc, this, GetSize()); @@ -588,7 +588,7 @@ bool wxRibbonGallery::IsSizingContinuous() const void wxRibbonGallery::CalculateMinSize() { - if(m_art == NULL || !m_bitmap_size.IsFullySpecified()) + if(m_art == nullptr || !m_bitmap_size.IsFullySpecified()) { SetMinSize(wxSize(20, 20)); } @@ -619,7 +619,7 @@ bool wxRibbonGallery::Realize() bool wxRibbonGallery::Layout() { - if(m_art == NULL) + if(m_art == nullptr) return false; wxMemoryDC dc; @@ -702,13 +702,13 @@ wxSize wxRibbonGallery::DoGetBestSize() const wxSize wxRibbonGallery::DoGetNextSmallerSize(wxOrientation direction, wxSize relative_to) const { - if(m_art == NULL) + if(m_art == nullptr) return relative_to; wxMemoryDC dc; - wxSize client = m_art->GetGalleryClientSize(dc, this, relative_to, NULL, - NULL, NULL, NULL); + wxSize client = m_art->GetGalleryClientSize(dc, this, relative_to, nullptr, + nullptr, nullptr, nullptr); switch(direction) { case wxHORIZONTAL: @@ -754,13 +754,13 @@ wxSize wxRibbonGallery::DoGetNextSmallerSize(wxOrientation direction, wxSize wxRibbonGallery::DoGetNextLargerSize(wxOrientation direction, wxSize relative_to) const { - if(m_art == NULL) + if(m_art == nullptr) return relative_to; wxMemoryDC dc; - wxSize client = m_art->GetGalleryClientSize(dc, this, relative_to, NULL, - NULL, NULL, NULL); + wxSize client = m_art->GetGalleryClientSize(dc, this, relative_to, nullptr, + nullptr, nullptr, nullptr); // No need to grow if the given size can already display every item int nitems = (client.GetWidth() / m_bitmap_padded_size.x) * @@ -821,7 +821,7 @@ unsigned int wxRibbonGallery::GetCount() const wxRibbonGalleryItem* wxRibbonGallery::GetItem(unsigned int n) { if(n >= GetCount()) - return NULL; + return nullptr; return m_items.Item(n); } diff --git a/src/ribbon/page.cpp b/src/ribbon/page.cpp index b464eff9f0..4927581a84 100644 --- a/src/ribbon/page.cpp +++ b/src/ribbon/page.cpp @@ -153,8 +153,8 @@ wxEND_EVENT_TABLE() wxRibbonPage::wxRibbonPage() { - m_scroll_left_btn = NULL; - m_scroll_right_btn = NULL; + m_scroll_left_btn = nullptr; + m_scroll_right_btn = nullptr; m_scroll_amount = 0; m_scroll_buttons_visible = false; } @@ -196,9 +196,9 @@ void wxRibbonPage::CommonInit(const wxString& label, const wxBitmap& icon) SetLabel(label); m_icon = icon; - m_scroll_left_btn = NULL; - m_scroll_right_btn = NULL; - m_size_calc_array = NULL; + m_scroll_left_btn = nullptr; + m_scroll_right_btn = nullptr; + m_size_calc_array = nullptr; m_size_calc_array_size = 0; m_scroll_amount = 0; m_scroll_buttons_visible = false; @@ -603,7 +603,7 @@ bool wxRibbonPage::Realize() node = node->GetNext()) { wxRibbonControl* child = wxDynamicCast(node->GetData(), wxRibbonControl); - if(child == NULL) + if(child == nullptr) { continue; } @@ -836,10 +836,10 @@ bool wxRibbonPage::ShowScrollButtons() } else { - if(m_scroll_left_btn != NULL) + if(m_scroll_left_btn != nullptr) { m_scroll_left_btn->Destroy(); - m_scroll_left_btn = NULL; + m_scroll_left_btn = nullptr; reposition = true; } } @@ -878,10 +878,10 @@ bool wxRibbonPage::ShowScrollButtons() } else { - if(m_scroll_right_btn != NULL) + if(m_scroll_right_btn != nullptr) { m_scroll_right_btn->Destroy(); - m_scroll_right_btn = NULL; + m_scroll_right_btn = nullptr; reposition = true; } } @@ -911,15 +911,15 @@ bool wxRibbonPage::ExpandPanels(wxOrientation direction, int maximum_amount) while(maximum_amount > 0) { int smallest_size = INT_MAX; - wxRibbonPanel* smallest_panel = NULL; - wxSize* smallest_panel_size = NULL; + wxRibbonPanel* smallest_panel = nullptr; + wxSize* smallest_panel_size = nullptr; wxSize* panel_size = m_size_calc_array; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext(), ++panel_size ) { wxRibbonPanel* panel = wxDynamicCast(node->GetData(), wxRibbonPanel); - if(panel == NULL) + if(panel == nullptr) { continue; } @@ -953,7 +953,7 @@ bool wxRibbonPage::ExpandPanels(wxOrientation direction, int maximum_amount) } } } - if(smallest_panel != NULL) + if(smallest_panel != nullptr) { if(smallest_panel->IsSizingContinuous()) { @@ -1005,8 +1005,8 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount) { while(minimum_amount > 0) { - wxRibbonPanel* largest_panel = NULL; - wxSize* largest_panel_size = NULL; + wxRibbonPanel* largest_panel = nullptr; + wxSize* largest_panel_size = nullptr; wxSize* panel_size = m_size_calc_array; if(!m_collapse_stack.IsEmpty()) { @@ -1034,7 +1034,7 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount) node = node->GetNext(), ++panel_size ) { wxRibbonPanel* panel = wxDynamicCast(node->GetData(), wxRibbonPanel); - if(panel == NULL) + if(panel == nullptr) { continue; } @@ -1065,7 +1065,7 @@ bool wxRibbonPage::CollapsePanels(wxOrientation direction, int minimum_amount) } } } - if(largest_panel != NULL) + if(largest_panel != nullptr) { if(largest_panel->IsSizingContinuous()) { @@ -1110,11 +1110,11 @@ bool wxRibbonPage::DismissExpandedPanel() node = node->GetNext() ) { wxRibbonPanel* panel = wxDynamicCast(node->GetData(), wxRibbonPanel); - if(panel == NULL) + if(panel == nullptr) { continue; } - if(panel->GetExpandedPanel() != NULL) + if(panel->GetExpandedPanel() != nullptr) { return panel->HideExpanded(); } diff --git a/src/ribbon/panel.cpp b/src/ribbon/panel.cpp index 63148b6800..c3a21fc0c5 100644 --- a/src/ribbon/panel.cpp +++ b/src/ribbon/panel.cpp @@ -45,7 +45,7 @@ wxBEGIN_EVENT_TABLE(wxRibbonPanel, wxRibbonControl) EVT_SIZE(wxRibbonPanel::OnSize) wxEND_EVENT_TABLE() -wxRibbonPanel::wxRibbonPanel() : m_expanded_dummy(NULL), m_expanded_panel(NULL) +wxRibbonPanel::wxRibbonPanel() : m_expanded_dummy(nullptr), m_expanded_panel(nullptr) { } @@ -65,7 +65,7 @@ wxRibbonPanel::~wxRibbonPanel() { if(m_expanded_panel) { - m_expanded_panel->m_expanded_dummy = NULL; + m_expanded_panel->m_expanded_dummy = nullptr; m_expanded_panel->GetParent()->Destroy(); } } @@ -114,18 +114,18 @@ void wxRibbonPanel::CommonInit(const wxString& label, const wxBitmap& icon, long m_minimised_size = wxDefaultSize; // Unknown / none m_smallest_unminimised_size = wxDefaultSize;// Unknown / none for IsFullySpecified() m_preferred_expand_direction = wxSOUTH; - m_expanded_dummy = NULL; - m_expanded_panel = NULL; + m_expanded_dummy = nullptr; + m_expanded_panel = nullptr; m_flags = style; m_minimised_icon = icon; m_minimised = false; m_hovered = false; m_ext_button_hovered = false; - if(m_art == NULL) + if(m_art == nullptr) { wxRibbonControl* parent = wxDynamicCast(GetParent(), wxRibbonControl); - if(parent != NULL) + if(parent != nullptr) { m_art = parent->GetArtProvider(); } @@ -239,7 +239,7 @@ void wxRibbonPanel::RemoveChild(wxWindowBase *child) bool wxRibbonPanel::HasExtButton()const { wxRibbonBar* bar = GetAncestorRibbonBar(); - if(bar==NULL) + if(bar==nullptr) return false; return (m_flags & wxRIBBON_PANEL_EXT_BUTTON) && (bar->GetWindowStyleFlag() & wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS); @@ -315,7 +315,7 @@ void wxRibbonPanel::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAutoBufferedPaintDC dc(this); - if(m_art != NULL) + if(m_art != nullptr) { if(IsMinimised()) { @@ -350,9 +350,9 @@ wxSize wxRibbonPanel::GetBestSizeForParentSize(const wxSize& parentSize) const if (control) { wxClientDC temp_dc(const_cast(this)); - wxSize clientParentSize = m_art->GetPanelClientSize(temp_dc, this, parentSize, NULL); + wxSize clientParentSize = m_art->GetPanelClientSize(temp_dc, this, parentSize, nullptr); wxSize childSize = control->GetBestSizeForParentSize(clientParentSize); - wxSize overallSize = m_art->GetPanelSize(temp_dc, this, childSize, NULL); + wxSize overallSize = m_art->GetPanelSize(temp_dc, this, childSize, nullptr); return overallSize; } } @@ -362,17 +362,17 @@ wxSize wxRibbonPanel::GetBestSizeForParentSize(const wxSize& parentSize) const wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction, wxSize relative_to) const { - if(m_expanded_panel != NULL) + if(m_expanded_panel != nullptr) { // Next size depends upon children, who are currently in the // expanded panel return m_expanded_panel->DoGetNextSmallerSize(direction, relative_to); } - if(m_art != NULL) + if(m_art != nullptr) { wxClientDC dc(const_cast(this)); - wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, NULL); + wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, nullptr); wxSize smaller(-1, -1); bool minimise = false; @@ -399,7 +399,7 @@ wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction, // Simple (and common) case of single ribbon child or Sizer wxWindow* child = GetChildren().Item(0)->GetData(); wxRibbonControl* ribbon_child = wxDynamicCast(child, wxRibbonControl); - if(ribbon_child != NULL) + if(ribbon_child != nullptr) { smaller = ribbon_child->GetNextSmallerSize(direction, child_relative); minimise = (smaller == child_relative); @@ -431,7 +431,7 @@ wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction, } else if(smaller.IsFullySpecified()) // Use fallback if !(sizer/child = 1) { - return m_art->GetPanelSize(dc, this, smaller, NULL); + return m_art->GetPanelSize(dc, this, smaller, nullptr); } } @@ -460,7 +460,7 @@ wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction, wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction, wxSize relative_to) const { - if(m_expanded_panel != NULL) + if(m_expanded_panel != nullptr) { // Next size depends upon children, who are currently in the // expanded panel @@ -490,10 +490,10 @@ wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction, } } - if(m_art != NULL) + if(m_art != nullptr) { wxClientDC dc(const_cast(this)); - wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, NULL); + wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, nullptr); wxSize larger(-1, -1); if(GetSizer()) @@ -517,7 +517,7 @@ wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction, // Simple (and common) case of single ribbon child wxWindow* child = GetChildren().Item(0)->GetData(); wxRibbonControl* ribbon_child = wxDynamicCast(child, wxRibbonControl); - if(ribbon_child != NULL) + if(ribbon_child != nullptr) { larger = ribbon_child->GetNextLargerSize(direction, child_relative); } @@ -531,7 +531,7 @@ wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction, } else { - return m_art->GetPanelSize(dc, this, larger, NULL); + return m_art->GetPanelSize(dc, this, larger, nullptr); } } } @@ -562,7 +562,7 @@ bool wxRibbonPanel::CanAutoMinimise() const wxSize wxRibbonPanel::GetMinSize() const { - if(m_expanded_panel != NULL) + if(m_expanded_panel != nullptr) { // Minimum size depends upon children, who are currently in the // expanded panel @@ -585,14 +585,14 @@ wxSize wxRibbonPanel::GetMinNotMinimisedSize() const if(GetSizer()) { wxClientDC dc(const_cast(this)); - return m_art->GetPanelSize(dc, this, GetPanelSizerMinSize(), NULL); + return m_art->GetPanelSize(dc, this, GetPanelSizerMinSize(), nullptr); } else if(GetChildren().GetCount() == 1) { // Common case of single child taking up the entire panel wxWindow* child = GetChildren().Item(0)->GetData(); wxClientDC dc(const_cast(this)); - return m_art->GetPanelSize(dc, this, child->GetMinSize(), NULL); + return m_art->GetPanelSize(dc, this, child->GetMinSize(), nullptr); } return wxRibbonControl::GetMinSize(); @@ -616,7 +616,7 @@ wxSize wxRibbonPanel::GetPanelSizerMinSize() const return m_art->GetPanelClientSize(dc, this, m_smallest_unminimised_size, - NULL); + nullptr); } wxSize wxRibbonPanel::GetPanelSizerBestSize() const @@ -634,14 +634,14 @@ wxSize wxRibbonPanel::DoGetBestSize() const if( GetSizer()) { wxClientDC dc(const_cast(this)); - return m_art->GetPanelSize(dc, this, GetPanelSizerBestSize(), NULL); + return m_art->GetPanelSize(dc, this, GetPanelSizerBestSize(), nullptr); } else if(GetChildren().GetCount() == 1) { // Common case of no sizer and single child taking up the entire panel wxWindow* child = GetChildren().Item(0)->GetData(); wxClientDC dc(const_cast(this)); - return m_art->GetPanelSize(dc, this, child->GetBestSize(), NULL); + return m_art->GetPanelSize(dc, this, child->GetBestSize(), nullptr); } return wxRibbonControl::DoGetBestSize(); @@ -656,7 +656,7 @@ bool wxRibbonPanel::Realize() node = node->GetNext()) { wxRibbonControl* child = wxDynamicCast(node->GetData(), wxRibbonControl); - if(child == NULL) + if(child == nullptr) { continue; } @@ -682,12 +682,12 @@ bool wxRibbonPanel::Realize() minimum_children_size = GetChildren().GetFirst()->GetData()->GetMinSize(); } - if(m_art != NULL) + if(m_art != nullptr) { wxClientDC temp_dc(this); m_smallest_unminimised_size = - m_art->GetPanelSize(temp_dc, this, minimum_children_size, NULL); + m_art->GetPanelSize(temp_dc, this, minimum_children_size, nullptr); wxSize bitmap_size; wxSize panel_min_size = GetMinNotMinimisedSize(); @@ -769,7 +769,7 @@ void wxRibbonPanel::OnMouseClick(wxMouseEvent& WXUNUSED(evt)) { if(IsMinimised()) { - if(m_expanded_panel != NULL) + if(m_expanded_panel != nullptr) { HideExpanded(); } @@ -803,7 +803,7 @@ bool wxRibbonPanel::ShowExpanded() { return false; } - if(m_expanded_dummy != NULL || m_expanded_panel != NULL) + if(m_expanded_dummy != nullptr || m_expanded_panel != nullptr) { return false; } @@ -820,7 +820,7 @@ bool wxRibbonPanel::ShowExpanded() size, m_preferred_expand_direction).GetTopLeft(); // Need a top-level frame to contain the expanded panel - wxFrame *container = new wxFrame(NULL, wxID_ANY, GetLabel(), + wxFrame *container = new wxFrame(nullptr, wxID_ANY, GetLabel(), pos, size, wxFRAME_NO_TASKBAR | wxBORDER_NONE); m_expanded_panel = new wxRibbonPanel(container, wxID_ANY, @@ -848,7 +848,7 @@ bool wxRibbonPanel::ShowExpanded() if(GetSizer()) { wxSizer* sizer = GetSizer(); - SetSizer(NULL, false); + SetSizer(nullptr, false); m_expanded_panel->SetSizer(sizer); } @@ -888,7 +888,7 @@ bool wxRibbonPanel::TryAfter(wxEvent& evt) static bool IsAncestorOf(wxWindow *ancestor, wxWindow *window) { - while(window != NULL) + while(window != nullptr) { wxWindow *parent = window->GetParent(); if(parent == ancestor) @@ -910,7 +910,7 @@ void wxRibbonPanel::OnKillFocus(wxFocusEvent& evt) receiver->Bind(wxEVT_KILL_FOCUS, &wxRibbonPanel::OnChildKillFocus, this); } - else if(receiver == NULL || receiver != m_expanded_dummy) + else if(receiver == nullptr || receiver != m_expanded_dummy) { HideExpanded(); } @@ -919,12 +919,12 @@ void wxRibbonPanel::OnKillFocus(wxFocusEvent& evt) void wxRibbonPanel::OnChildKillFocus(wxFocusEvent& evt) { - if(m_child_with_focus == NULL) + if(m_child_with_focus == nullptr) return; // Should never happen, but a check can't hurt m_child_with_focus->Unbind(wxEVT_KILL_FOCUS, &wxRibbonPanel::OnChildKillFocus, this); - m_child_with_focus = NULL; + m_child_with_focus = nullptr; wxWindow *receiver = evt.GetWindow(); if(receiver == this || IsAncestorOf(this, receiver)) @@ -934,7 +934,7 @@ void wxRibbonPanel::OnChildKillFocus(wxFocusEvent& evt) &wxRibbonPanel::OnChildKillFocus, this); evt.Skip(); } - else if(receiver == NULL || receiver != m_expanded_dummy) + else if(receiver == nullptr || receiver != m_expanded_dummy) { HideExpanded(); // Do not skip event, as the panel has been de-expanded, causing the @@ -949,7 +949,7 @@ void wxRibbonPanel::OnChildKillFocus(wxFocusEvent& evt) bool wxRibbonPanel::HideExpanded() { - if(m_expanded_dummy == NULL) + if(m_expanded_dummy == nullptr) { if(m_expanded_panel) { @@ -975,11 +975,11 @@ bool wxRibbonPanel::HideExpanded() if(GetSizer()) { wxSizer* sizer = GetSizer(); - SetSizer(NULL, false); + SetSizer(nullptr, false); m_expanded_dummy->SetSizer(sizer); } - m_expanded_dummy->m_expanded_panel = NULL; + m_expanded_dummy->m_expanded_panel = nullptr; m_expanded_dummy->Realize(); m_expanded_dummy->Refresh(); wxWindow *parent = GetParent(); diff --git a/src/ribbon/toolbar.cpp b/src/ribbon/toolbar.cpp index f663fbdb22..5102b5dd7a 100644 --- a/src/ribbon/toolbar.cpp +++ b/src/ribbon/toolbar.cpp @@ -104,8 +104,8 @@ bool wxRibbonToolBar::Create(wxWindow* parent, void wxRibbonToolBar::CommonInit(long WXUNUSED(style)) { AppendGroup(); - m_hover_tool = NULL; - m_active_tool = NULL; + m_hover_tool = nullptr; + m_active_tool = nullptr; m_nrows_min = 1; m_nrows_max = 1; m_sizes = new wxSize[1]; @@ -137,7 +137,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::AddTool( const wxString& help_string, wxRibbonButtonKind kind) { - return AddTool(tool_id, bitmap, wxNullBitmap, help_string, kind, NULL); + return AddTool(tool_id, bitmap, wxNullBitmap, help_string, kind, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::AddDropdownTool( @@ -146,7 +146,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::AddDropdownTool( const wxString& help_string) { return AddTool(tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_DROPDOWN, NULL); + wxRIBBON_BUTTON_DROPDOWN, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::AddHybridTool( @@ -155,7 +155,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::AddHybridTool( const wxString& help_string) { return AddTool(tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_HYBRID, NULL); + wxRIBBON_BUTTON_HYBRID, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::AddToggleTool( @@ -164,7 +164,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::AddToggleTool( const wxString& help_string) { return AddTool(tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_TOGGLE, NULL); + wxRIBBON_BUTTON_TOGGLE, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::AddTool( @@ -182,7 +182,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::AddTool( wxRibbonToolBarToolBase* wxRibbonToolBar::AddSeparator() { if(m_groups.Last()->tools.IsEmpty()) - return NULL; + return nullptr; AppendGroup(); return &m_groups.Last()->dummy_tool; @@ -197,7 +197,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertTool( wxRibbonButtonKind kind) { return InsertTool(pos, tool_id, bitmap, wxNullBitmap, help_string, kind, - NULL); + nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::InsertDropdownTool( @@ -207,7 +207,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertDropdownTool( const wxString& help_string) { return InsertTool(pos, tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_DROPDOWN, NULL); + wxRIBBON_BUTTON_DROPDOWN, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::InsertHybridTool( @@ -217,7 +217,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertHybridTool( const wxString& help_string) { return InsertTool(pos, tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_HYBRID, NULL); + wxRIBBON_BUTTON_HYBRID, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::InsertToggleTool( @@ -227,7 +227,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertToggleTool( const wxString& help_string) { return InsertTool(pos, tool_id, bitmap, wxNullBitmap, help_string, - wxRIBBON_BUTTON_TOGGLE, NULL); + wxRIBBON_BUTTON_TOGGLE, nullptr); } wxRibbonToolBarToolBase* wxRibbonToolBar::InsertTool( @@ -274,7 +274,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertTool( pos -= tool_count + 1; } wxFAIL_MSG("Tool position out of toolbar bounds."); - return NULL; + return nullptr; } wxRibbonToolBarToolBase* wxRibbonToolBar::InsertSeparator(size_t pos) @@ -304,7 +304,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertSeparator(size_t pos) } // Add an empty group at the end of the bar. if(m_groups.Last()->tools.IsEmpty()) - return NULL; + return nullptr; AppendGroup(); return &m_groups.Last()->dummy_tool; } @@ -406,7 +406,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::FindById(int tool_id)const } } } - return NULL; + return nullptr; } wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(size_t pos)const @@ -423,10 +423,10 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(size_t pos)const } else if(pos==tool_count) { - return NULL; + return nullptr; } } - return NULL; + return nullptr; } wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(wxCoord x, wxCoord y)const @@ -446,7 +446,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(wxCoord x, wxCoord y)cons } } } - return NULL; + return nullptr; } size_t wxRibbonToolBar::GetToolCount() const @@ -466,40 +466,40 @@ size_t wxRibbonToolBar::GetToolCount() const int wxRibbonToolBar::GetToolId(const wxRibbonToolBarToolBase* tool)const { - wxCHECK_MSG(tool != NULL , wxNOT_FOUND, "The tool pointer must not be NULL"); + wxCHECK_MSG(tool != nullptr , wxNOT_FOUND, "The tool pointer must not be null"); return tool->id; } wxRibbonToolBarToolBase* wxRibbonToolBar::GetActiveTool() const { - return m_active_tool == NULL ? NULL : m_active_tool; + return m_active_tool == nullptr ? nullptr : m_active_tool; } wxObject* wxRibbonToolBar::GetToolClientData(int tool_id)const { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_MSG(tool != NULL , NULL, "Invalid tool id"); + wxCHECK_MSG(tool != nullptr , nullptr, "Invalid tool id"); return tool->client_data; } bool wxRibbonToolBar::GetToolEnabled(int tool_id)const { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_MSG(tool != NULL , false, "Invalid tool id"); + wxCHECK_MSG(tool != nullptr , false, "Invalid tool id"); return (tool->state & wxRIBBON_TOOLBAR_TOOL_DISABLED) == 0; } wxString wxRibbonToolBar::GetToolHelpString(int tool_id)const { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_MSG(tool != NULL , wxEmptyString, "Invalid tool id"); + wxCHECK_MSG(tool != nullptr , wxEmptyString, "Invalid tool id"); return tool->help_string; } wxRibbonButtonKind wxRibbonToolBar::GetToolKind(int tool_id)const { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_MSG(tool != NULL , wxRIBBON_BUTTON_NORMAL, "Invalid tool id"); + wxCHECK_MSG(tool != nullptr , wxRIBBON_BUTTON_NORMAL, "Invalid tool id"); return tool->kind; } @@ -552,7 +552,7 @@ wxRect wxRibbonToolBar::GetToolRect(int tool_id)const bool wxRibbonToolBar::GetToolState(int tool_id)const { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_MSG(tool != NULL , false, "Invalid tool id"); + wxCHECK_MSG(tool != nullptr , false, "Invalid tool id"); return (tool->state & wxRIBBON_TOOLBAR_TOOL_TOGGLED) != 0; } @@ -576,35 +576,35 @@ bool wxRibbonToolBar::IsSizingContinuous() const void wxRibbonToolBar::SetToolClientData(int tool_id, wxObject* clientData) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); tool->client_data = clientData; } void wxRibbonToolBar::SetToolDisabledBitmap(int tool_id, const wxBitmap &bitmap) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); tool->bitmap_disabled = bitmap; } void wxRibbonToolBar::SetToolHelpString(int tool_id, const wxString& helpString) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); tool->help_string = helpString; } void wxRibbonToolBar::SetToolNormalBitmap(int tool_id, const wxBitmap &bitmap) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); tool->bitmap = bitmap; } void wxRibbonToolBar::EnableTool(int tool_id, bool enable) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); if(enable) { if(tool->state & wxRIBBON_TOOLBAR_TOOL_DISABLED) @@ -626,7 +626,7 @@ void wxRibbonToolBar::EnableTool(int tool_id, bool enable) void wxRibbonToolBar::ToggleTool(int tool_id, bool checked) { wxRibbonToolBarToolBase* tool = FindById(tool_id); - wxCHECK_RET(tool != NULL , "Invalid tool id"); + wxCHECK_RET(tool != nullptr , "Invalid tool id"); if(checked) { if((tool->state & wxRIBBON_TOOLBAR_TOOL_TOGGLED) == 0) @@ -767,7 +767,7 @@ void wxRibbonToolBar::SetRows(int nMin, int nMax) bool wxRibbonToolBar::Realize() { - if(m_art == NULL) + if(m_art == nullptr) return false; // Calculate the size of each group and the position/size of each tool @@ -776,7 +776,7 @@ bool wxRibbonToolBar::Realize() size_t g, t; for(g = 0; g < group_count; ++g) { - wxRibbonToolBarToolBase* prev = NULL; + wxRibbonToolBarToolBase* prev = nullptr; wxRibbonToolBarToolGroup* group = m_groups.Item(g); size_t tool_count = group->tools.GetCount(); int tallest = 0; @@ -896,7 +896,7 @@ bool wxRibbonToolBar::Realize() void wxRibbonToolBar::OnSize(wxSizeEvent& evt) { - if(m_art == NULL) + if(m_art == nullptr) return; // Choose row count with largest possible area @@ -1019,7 +1019,7 @@ void wxRibbonToolBar::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) void wxRibbonToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAutoBufferedPaintDC dc(this); - if(m_art == NULL) + if(m_art == nullptr) return; m_art->DrawToolBarBackground(dc, this, GetSize()); @@ -1052,7 +1052,7 @@ void wxRibbonToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt) { wxPoint pos(evt.GetPosition()); - wxRibbonToolBarToolBase *new_hover = NULL; + wxRibbonToolBarToolBase *new_hover = nullptr; size_t group_count = m_groups.GetCount(); size_t g, t; @@ -1095,7 +1095,7 @@ void wxRibbonToolBar::OnMouseMove(wxMouseEvent& evt) if(new_hover && new_hover->state & wxRIBBON_TOOLBAR_TOOL_DISABLED) { m_hover_tool = new_hover; - new_hover = NULL; // A disabled tool can not be hilighted + new_hover = nullptr; // A disabled tool can not be hilighted } else if(new_hover != m_hover_tool) { @@ -1159,7 +1159,7 @@ void wxRibbonToolBar::OnMouseLeave(wxMouseEvent& WXUNUSED(evt)) if(m_hover_tool) { m_hover_tool->state &= ~wxRIBBON_TOOLBAR_TOOL_HOVER_MASK; - m_hover_tool = NULL; + m_hover_tool = nullptr; Refresh(false); } } @@ -1193,7 +1193,7 @@ void wxRibbonToolBar::OnMouseUp(wxMouseEvent& WXUNUSED(evt)) if (m_active_tool) { m_active_tool->state &= ~wxRIBBON_TOOLBAR_TOOL_ACTIVE_MASK; - m_active_tool = NULL; + m_active_tool = nullptr; Refresh(false); } } @@ -1203,7 +1203,7 @@ void wxRibbonToolBar::OnMouseEnter(wxMouseEvent& evt) { if(m_active_tool && !evt.LeftIsDown()) { - m_active_tool = NULL; + m_active_tool = nullptr; } } diff --git a/src/richtext/richtextbackgroundpage.cpp b/src/richtext/richtextbackgroundpage.cpp index b39b99d631..0616dc8725 100644 --- a/src/richtext/richtextbackgroundpage.cpp +++ b/src/richtext/richtextbackgroundpage.cpp @@ -105,24 +105,24 @@ wxRichTextBackgroundPage::~wxRichTextBackgroundPage() void wxRichTextBackgroundPage::Init() { ////@begin wxRichTextBackgroundPage member initialisation - m_backgroundColourCheckBox = NULL; - m_backgroundColourSwatch = NULL; - m_shadowBox = NULL; - m_useShadow = NULL; - m_offsetX = NULL; - m_unitsHorizontalOffset = NULL; - m_offsetY = NULL; - m_unitsVerticalOffset = NULL; - m_shadowColourCheckBox = NULL; - m_shadowColourSwatch = NULL; - m_useShadowSpread = NULL; - m_spread = NULL; - m_unitsShadowSpread = NULL; - m_useBlurDistance = NULL; - m_blurDistance = NULL; - m_unitsBlurDistance = NULL; - m_useShadowOpacity = NULL; - m_opacity = NULL; + m_backgroundColourCheckBox = nullptr; + m_backgroundColourSwatch = nullptr; + m_shadowBox = nullptr; + m_useShadow = nullptr; + m_offsetX = nullptr; + m_unitsHorizontalOffset = nullptr; + m_offsetY = nullptr; + m_unitsVerticalOffset = nullptr; + m_shadowColourCheckBox = nullptr; + m_shadowColourSwatch = nullptr; + m_useShadowSpread = nullptr; + m_spread = nullptr; + m_unitsShadowSpread = nullptr; + m_useBlurDistance = nullptr; + m_blurDistance = nullptr; + m_unitsBlurDistance = nullptr; + m_useShadowOpacity = nullptr; + m_opacity = nullptr; ////@end wxRichTextBackgroundPage member initialisation } @@ -383,15 +383,15 @@ bool wxRichTextBackgroundPage::TransferDataToWindow() if (!attr->GetTextBoxAttr().GetShadow().GetOffsetY().IsValid()) attr->GetTextBoxAttr().GetShadow().GetOffsetY().SetValue(0, wxTEXT_ATTR_UNITS_PIXELS); - wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, NULL, + wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, nullptr, & units); - wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, NULL, + wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, nullptr, & units); wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetSpread(), m_spread, m_unitsShadowSpread, m_useShadowSpread, & units); wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetBlurDistance(), m_blurDistance, m_unitsBlurDistance, m_useBlurDistance, & units); - wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, NULL, m_useShadowOpacity, + wxRichTextFormattingDialog::SetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, nullptr, m_useShadowOpacity, & percentUnits); if (!attr->GetTextBoxAttr().GetShadow().HasColour() || !attr->GetTextBoxAttr().GetShadow().IsValid()) @@ -434,15 +434,15 @@ bool wxRichTextBackgroundPage::TransferDataFromWindow() wxArrayInt percentUnits; percentUnits.Add(wxTEXT_ATTR_UNITS_PERCENTAGE); - wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, NULL, + wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetX(), m_offsetX, m_unitsHorizontalOffset, nullptr, & units); - wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, NULL, + wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOffsetY(), m_offsetY, m_unitsVerticalOffset, nullptr, & units); wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetSpread(), m_spread, m_unitsShadowSpread, m_useShadowSpread, & units); wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetBlurDistance(), m_blurDistance, m_unitsBlurDistance, m_useBlurDistance, & units); - wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, NULL, m_useShadowOpacity, + wxRichTextFormattingDialog::GetDimensionValue(attr->GetTextBoxAttr().GetShadow().GetOpacity(), m_opacity, nullptr, m_useShadowOpacity, & percentUnits); if (m_shadowColourCheckBox->GetValue()) diff --git a/src/richtext/richtextborderspage.cpp b/src/richtext/richtextborderspage.cpp index 3e05476c05..e7835eeab4 100644 --- a/src/richtext/richtextborderspage.cpp +++ b/src/richtext/richtextborderspage.cpp @@ -153,52 +153,52 @@ void wxRichTextBordersPage::Init() m_ignoreUpdates = false; ////@begin wxRichTextBordersPage member initialisation - m_leftBorderCheckbox = NULL; - m_leftBorderWidth = NULL; - m_leftBorderWidthUnits = NULL; - m_leftBorderStyle = NULL; - m_leftBorderColour = NULL; - m_rightBorderCheckbox = NULL; - m_rightBorderWidth = NULL; - m_rightBorderWidthUnits = NULL; - m_rightBorderStyle = NULL; - m_rightBorderColour = NULL; - m_topBorderCheckbox = NULL; - m_topBorderWidth = NULL; - m_topBorderWidthUnits = NULL; - m_topBorderStyle = NULL; - m_topBorderColour = NULL; - m_bottomBorderCheckbox = NULL; - m_bottomBorderWidth = NULL; - m_bottomBorderWidthUnits = NULL; - m_bottomBorderStyle = NULL; - m_bottomBorderColour = NULL; - m_borderSyncCtrl = NULL; - m_leftOutlineCheckbox = NULL; - m_leftOutlineWidth = NULL; - m_leftOutlineWidthUnits = NULL; - m_leftOutlineStyle = NULL; - m_leftOutlineColour = NULL; - m_rightOutlineCheckbox = NULL; - m_rightOutlineWidth = NULL; - m_rightOutlineWidthUnits = NULL; - m_rightOutlineStyle = NULL; - m_rightOutlineColour = NULL; - m_topOutlineCheckbox = NULL; - m_topOutlineWidth = NULL; - m_topOutlineWidthUnits = NULL; - m_topOutlineStyle = NULL; - m_topOutlineColour = NULL; - m_bottomOutlineCheckbox = NULL; - m_bottomOutlineWidth = NULL; - m_bottomOutlineWidthUnits = NULL; - m_bottomOutlineStyle = NULL; - m_bottomOutlineColour = NULL; - m_outlineSyncCtrl = NULL; - m_cornerRadiusCheckBox = NULL; - m_cornerRadiusText = NULL; - m_cornerRadiusUnits = NULL; - m_borderPreviewCtrl = NULL; + m_leftBorderCheckbox = nullptr; + m_leftBorderWidth = nullptr; + m_leftBorderWidthUnits = nullptr; + m_leftBorderStyle = nullptr; + m_leftBorderColour = nullptr; + m_rightBorderCheckbox = nullptr; + m_rightBorderWidth = nullptr; + m_rightBorderWidthUnits = nullptr; + m_rightBorderStyle = nullptr; + m_rightBorderColour = nullptr; + m_topBorderCheckbox = nullptr; + m_topBorderWidth = nullptr; + m_topBorderWidthUnits = nullptr; + m_topBorderStyle = nullptr; + m_topBorderColour = nullptr; + m_bottomBorderCheckbox = nullptr; + m_bottomBorderWidth = nullptr; + m_bottomBorderWidthUnits = nullptr; + m_bottomBorderStyle = nullptr; + m_bottomBorderColour = nullptr; + m_borderSyncCtrl = nullptr; + m_leftOutlineCheckbox = nullptr; + m_leftOutlineWidth = nullptr; + m_leftOutlineWidthUnits = nullptr; + m_leftOutlineStyle = nullptr; + m_leftOutlineColour = nullptr; + m_rightOutlineCheckbox = nullptr; + m_rightOutlineWidth = nullptr; + m_rightOutlineWidthUnits = nullptr; + m_rightOutlineStyle = nullptr; + m_rightOutlineColour = nullptr; + m_topOutlineCheckbox = nullptr; + m_topOutlineWidth = nullptr; + m_topOutlineWidthUnits = nullptr; + m_topOutlineStyle = nullptr; + m_topOutlineColour = nullptr; + m_bottomOutlineCheckbox = nullptr; + m_bottomOutlineWidth = nullptr; + m_bottomOutlineWidthUnits = nullptr; + m_bottomOutlineStyle = nullptr; + m_bottomOutlineColour = nullptr; + m_outlineSyncCtrl = nullptr; + m_cornerRadiusCheckBox = nullptr; + m_cornerRadiusText = nullptr; + m_cornerRadiusUnits = nullptr; + m_borderPreviewCtrl = nullptr; ////@end wxRichTextBordersPage member initialisation } @@ -756,7 +756,7 @@ bool wxRichTextBordersPage::TransferDataToWindow() units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetCornerRadius(), m_cornerRadiusText, m_cornerRadiusUnits, NULL, + wxRichTextFormattingDialog::SetDimensionValue(GetAttributes()->GetTextBoxAttr().GetCornerRadius(), m_cornerRadiusText, m_cornerRadiusUnits, nullptr, & units); if (GetAttributes()->GetTextBoxAttr().GetCornerRadius().GetValue() == 0) @@ -793,7 +793,7 @@ bool wxRichTextBordersPage::TransferDataFromWindow() units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetCornerRadius(), m_cornerRadiusText, m_cornerRadiusUnits, NULL, + wxRichTextFormattingDialog::GetDimensionValue(GetAttributes()->GetTextBoxAttr().GetCornerRadius(), m_cornerRadiusText, m_cornerRadiusUnits, nullptr, & units); if (m_cornerRadiusCheckBox->Get3StateValue() == wxCHK_UNDETERMINED) @@ -835,7 +835,7 @@ void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, NULL, + wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, nullptr, & units); int sel = borderStyles.Index(border.GetStyle()); @@ -860,7 +860,7 @@ void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, wxTextCtrl* units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, NULL, + wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, nullptr, & units); int sel = styleCtrl->GetSelection(); @@ -1001,8 +1001,8 @@ void wxRichTextBordersPage::OnRichtextBorderCheckboxClick( wxCommandEvent& event return; m_ignoreUpdates = true; - wxCheckBox* checkBox = NULL; - wxComboBox* comboBox = NULL; + wxCheckBox* checkBox = nullptr; + wxComboBox* comboBox = nullptr; if (event.GetId() == ID_RICHTEXT_OUTLINE_LEFT_CHECKBOX) { checkBox = m_leftOutlineCheckbox; @@ -1331,7 +1331,7 @@ wxRichTextBorderPreviewCtrl::wxRichTextBorderPreviewCtrl(wxWindow *parent, wxWin if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) style |= wxBORDER_THEME; - m_attributes = NULL; + m_attributes = nullptr; wxWindow::Create(parent, id, pos, sz, style); SetBackgroundColour(*wxWHITE); @@ -1368,6 +1368,6 @@ void wxRichTextBorderPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) rect.width -= 2*margin; rect.height -= 2*margin; - wxRichTextObject::DrawBoxAttributes(dc, NULL, attr, rect); + wxRichTextObject::DrawBoxAttributes(dc, nullptr, attr, rect); } } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index f6895f5112..1d9fe2198e 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -256,7 +256,7 @@ int wxRichTextFloatCollector::GetWidthFromFloatRect(const wxRichTextFloatRectMap wxRichTextFloatCollector::wxRichTextFloatCollector(const wxRect& rect) : m_left(wxRichTextFloatRectMapCmp), m_right(wxRichTextFloatRectMapCmp) , m_availableRect(rect) { - m_para = NULL; + m_para = nullptr; } void wxRichTextFloatCollector::FreeFloatRectMapArray(wxRichTextFloatRectMapArray& array) @@ -566,7 +566,7 @@ wxRichTextParagraphLayoutBox* wxRichTextObject::GetContainer() const } p = p->GetParent(); } - return NULL; + return nullptr; } void wxRichTextObject::SetMargins(int margin) @@ -1626,7 +1626,7 @@ wxRichTextObject* wxRichTextCompositeObject::GetChildAtPosition(long pos) const return child; node = node->GetNext(); } - return NULL; + return nullptr; } /// Recursively merge all pieces that can be merged. @@ -1781,7 +1781,7 @@ bool wxRichTextCompositeObject::GetRangeSize(const wxRichTextRange& range, wxSiz if (partialExtents) p = & childExtents; else - p = NULL; + p = nullptr; wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); while (node) @@ -1936,14 +1936,14 @@ wxRichTextParagraphLayoutBox::~wxRichTextParagraphLayoutBox() if (m_floatCollector) { delete m_floatCollector; - m_floatCollector = NULL; + m_floatCollector = nullptr; } } /// Initialize the object. void wxRichTextParagraphLayoutBox::Init() { - m_ctrl = NULL; + m_ctrl = nullptr; // For now, assume is the only box and has no initial size. m_range = wxRichTextRange(0, -1); @@ -1952,7 +1952,7 @@ void wxRichTextParagraphLayoutBox::Init() m_invalidRange = wxRICHTEXT_ALL; m_partialParagraph = false; - m_floatCollector = NULL; + m_floatCollector = nullptr; } void wxRichTextParagraphLayoutBox::Clear() @@ -1961,7 +1961,7 @@ void wxRichTextParagraphLayoutBox::Clear() if (m_floatCollector) delete m_floatCollector; - m_floatCollector = NULL; + m_floatCollector = nullptr; m_partialParagraph = false; } @@ -1981,7 +1981,7 @@ void wxRichTextParagraphLayoutBox::Copy(const wxRichTextParagraphLayoutBox& obj) // during layout. bool wxRichTextParagraphLayoutBox::UpdateFloatingObjects(const wxRect& availableRect, wxRichTextObject* untilObj) { - if (m_floatCollector != NULL) + if (m_floatCollector != nullptr) delete m_floatCollector; m_floatCollector = new wxRichTextFloatCollector(availableRect); wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); @@ -1989,7 +1989,7 @@ bool wxRichTextParagraphLayoutBox::UpdateFloatingObjects(const wxRect& available while (untilObj && node && node->GetData() != untilObj) { wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - wxASSERT (child != NULL); + wxASSERT (child != nullptr); if (child) m_floatCollector->CollectFloat(child); node = node->GetNext(); @@ -2001,7 +2001,7 @@ bool wxRichTextParagraphLayoutBox::UpdateFloatingObjects(const wxRect& available // Returns the style sheet associated with the overall buffer. wxRichTextStyleSheet* wxRichTextParagraphLayoutBox::GetStyleSheet() const { - return GetBuffer() ? GetBuffer()->GetStyleSheet() : (wxRichTextStyleSheet*) NULL; + return GetBuffer() ? GetBuffer()->GetStyleSheet() : (wxRichTextStyleSheet*) nullptr; } // Get the number of floating objects at this level @@ -2247,7 +2247,7 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, wxRichTextDrawingContext& co // Gather information about only those floating objects that will not be formatted, // after which floats will be gathered per-paragraph during layout. if (wxRichTextBuffer::GetFloatingLayoutMode()) - UpdateFloatingObjects(availableSpace, node ? node->GetData() : (wxRichTextObject*) NULL); + UpdateFloatingObjects(availableSpace, node ? node->GetData() : (wxRichTextObject*) nullptr); // A way to force speedy rest-of-buffer layout (the 'else' below) bool forceQuickLayout = false; @@ -2581,7 +2581,7 @@ wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphAtPosition(long p { // child is a paragraph wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (child != NULL); + // wxASSERT (child != nullptr); if (child) { @@ -2595,7 +2595,7 @@ wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphAtPosition(long p node = node->GetNext(); } - return NULL; + return nullptr; } /// Get the line at the given position @@ -2613,7 +2613,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtPosition(long pos, bool c { // child is a paragraph wxRichTextParagraph* child = wxDynamicCast(obj, wxRichTextParagraph); - // wxASSERT (child != NULL); + // wxASSERT (child != nullptr); if (child) { @@ -2643,7 +2643,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtPosition(long pos, bool c if (lineCount > 0) return GetLineForVisibleLineNumber(lineCount-1); else - return NULL; + return nullptr; } /// Get the line at the given y pixel position, or the last line. @@ -2653,7 +2653,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtYPosition(int y) const while (node) { wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (child != NULL); + // wxASSERT (child != nullptr); if (child) { @@ -2679,7 +2679,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineAtYPosition(int y) const if (lineCount > 0) return GetLineForVisibleLineNumber(lineCount-1); else - return NULL; + return nullptr; } /// Get the number of visible lines @@ -2691,7 +2691,7 @@ int wxRichTextParagraphLayoutBox::GetLineCount() const while (node) { wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (child != NULL); + // wxASSERT (child != nullptr); if (child) count += child->GetLines().size(); @@ -2779,8 +2779,8 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text wxRichTextAttr* pStyle = paraStyle ? paraStyle : (wxRichTextAttr*) & defaultParaStyle; wxRichTextAttr* cStyle = & defaultCharStyle; - wxRichTextParagraph* firstPara = NULL; - wxRichTextParagraph* lastPara = NULL; + wxRichTextParagraph* firstPara = nullptr; + wxRichTextParagraph* lastPara = nullptr; wxRichTextRange range(-1, -1); @@ -2897,7 +2897,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag // Iterate through the fragment paragraph inserting the content into this paragraph. wxRichTextParagraph* firstPara = wxDynamicCast(firstParaNode->GetData(), wxRichTextParagraph); - wxASSERT (firstPara != NULL); + wxASSERT (firstPara != nullptr); wxRichTextObjectList::compatibility_iterator objectNode = firstPara->GetChildren().GetFirst(); while (objectNode) @@ -2944,7 +2944,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag return false; wxRichTextParagraph* firstPara = wxDynamicCast(firstParaNode->GetData(), wxRichTextParagraph); - wxASSERT(firstPara != NULL); + wxASSERT(firstPara != nullptr); if (!(fragment.GetAttributes().GetFlags() & wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE)) { @@ -2974,7 +2974,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag // 3. Add remaining fragment paragraphs after the current paragraph. wxRichTextObjectList::compatibility_iterator nextParagraphNode = node->GetNext(); - wxRichTextObject* nextParagraph = NULL; + wxRichTextObject* nextParagraph = nullptr; if (nextParagraphNode) nextParagraph = nextParagraphNode->GetData(); @@ -2987,7 +2987,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag while (i) { wxRichTextParagraph* searchPara = wxDynamicCast(i->GetData(), wxRichTextParagraph); - wxASSERT( searchPara != NULL ); + wxASSERT( searchPara != nullptr ); finalPara = (wxRichTextParagraph*) searchPara->Clone(); @@ -3048,7 +3048,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag while (i) { wxRichTextParagraph* searchPara = wxDynamicCast(i->GetData(), wxRichTextParagraph); - wxASSERT( searchPara != NULL ); + wxASSERT( searchPara != nullptr ); AppendChild(searchPara->Clone()); @@ -3067,7 +3067,7 @@ bool wxRichTextParagraphLayoutBox::CopyFragment(const wxRichTextRange& range, wx while (i) { wxRichTextParagraph* para = wxDynamicCast(i->GetData(), wxRichTextParagraph); - wxASSERT( para != NULL ); + wxASSERT( para != nullptr ); if (!para->GetRange().IsOutside(range)) { @@ -3080,10 +3080,10 @@ bool wxRichTextParagraphLayoutBox::CopyFragment(const wxRichTextRange& range, wx if (!fragment.IsEmpty()) { wxRichTextParagraph* firstPara = wxDynamicCast(fragment.GetChildren().GetFirst()->GetData(), wxRichTextParagraph); - wxASSERT( firstPara != NULL ); + wxASSERT( firstPara != nullptr ); wxRichTextParagraph* lastPara = wxDynamicCast(fragment.GetChildren().GetLast()->GetData(), wxRichTextParagraph); - wxASSERT( lastPara != NULL ); + wxASSERT( lastPara != nullptr ); if (!firstPara || !lastPara) return false; @@ -3153,7 +3153,7 @@ long wxRichTextParagraphLayoutBox::GetVisibleLineNumber(long pos, bool caretPosi while (node) { wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT( child != NULL ); + // wxASSERT( child != nullptr ); if (child) { @@ -3204,7 +3204,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineForVisibleLineNumber(long l while (node) { wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT(child != NULL); + // wxASSERT(child != nullptr); if (child) { @@ -3231,7 +3231,7 @@ wxRichTextLine* wxRichTextParagraphLayoutBox::GetLineForVisibleLineNumber(long l } // Didn't find it - return NULL; + return nullptr; } /// Delete range from layout. @@ -3239,11 +3239,11 @@ bool wxRichTextParagraphLayoutBox::DeleteRange(const wxRichTextRange& range) { wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); - wxRichTextParagraph* firstPara = NULL; + wxRichTextParagraph* firstPara = nullptr; while (node) { wxRichTextParagraph* obj = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (obj != NULL); + // wxASSERT (obj != nullptr); wxRichTextObjectList::compatibility_iterator next = node->GetNext(); @@ -3265,7 +3265,7 @@ bool wxRichTextParagraphLayoutBox::DeleteRange(const wxRichTextRange& range) { // Delete the whole object RemoveChild(obj, true); - obj = NULL; + obj = nullptr; } else if (!firstPara) firstPara = obj; @@ -3277,7 +3277,7 @@ bool wxRichTextParagraphLayoutBox::DeleteRange(const wxRichTextRange& range) // We need to move the objects from the next paragraph // to this paragraph - wxRichTextParagraph* nextParagraph = NULL; + wxRichTextParagraph* nextParagraph = nullptr; if ((range.GetEnd() < thisRange.GetEnd()) && obj) nextParagraph = obj; else @@ -3384,7 +3384,7 @@ wxString wxRichTextParagraphLayoutBox::GetText() const wxRichTextParagraph* wxRichTextParagraphLayoutBox::GetParagraphAtLine(long paragraphNumber) const { if ((size_t) paragraphNumber >= GetChildCount()) - return NULL; + return nullptr; return (wxRichTextParagraph*) GetChild((size_t) paragraphNumber); } @@ -3466,7 +3466,7 @@ wxRichTextObject* wxRichTextParagraphLayoutBox::GetLeafObjectAtPosition(long pos if (position == para->GetRange().GetEnd() && para->GetChildCount() > 0) return para->GetChildren().GetLast()->GetData(); } - return NULL; + return nullptr; } /// Set character or paragraph text attributes: apply character styles only to immediate text nodes @@ -3513,13 +3513,13 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const // If we are associated with a control, make undoable; otherwise, apply immediately // to the data. - bool haveControl = (buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer->GetRichTextCtrl() != nullptr); - wxRichTextAction* action = NULL; + wxRichTextAction* action = nullptr; if (haveControl && withUndo) { - action = new wxRichTextAction(NULL, _("Change Style"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Change Style"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); action->SetRange(range); action->SetPosition(buffer->GetRichTextCtrl()->GetCaretPosition()); } @@ -3528,7 +3528,7 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para && para->GetChildCount() > 0) { @@ -3540,7 +3540,7 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const { // We'll be using a copy of the paragraph to make style changes, // not updating the buffer directly. - wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(NULL); + wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(nullptr); if (haveControl && withUndo) { @@ -3597,8 +3597,8 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const // we can start applying a different style. // TODO: check that the style actually changes or is different // from style outside of range - wxRichTextObject* firstObject wxDUMMY_INITIALIZE(NULL); - wxRichTextObject* lastObject wxDUMMY_INITIALIZE(NULL); + wxRichTextObject* firstObject wxDUMMY_INITIALIZE(nullptr); + wxRichTextObject* lastObject wxDUMMY_INITIALIZE(nullptr); if (childRange.GetStart() == newPara->GetRange().GetStart()) firstObject = newPara->GetChildren().GetFirst()->GetData(); @@ -3618,8 +3618,8 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const // returned as the object before the new object. (void) newPara->SplitAt(splitPoint, & lastObject); - wxASSERT(firstObject != NULL); - wxASSERT(lastObject != NULL); + wxASSERT(firstObject != nullptr); + wxASSERT(lastObject != nullptr); if (!firstObject || !lastObject) continue; @@ -3691,9 +3691,9 @@ void wxRichTextParagraphLayoutBox::SetStyle(wxRichTextObject* obj, const wxRichT wxRichTextBuffer* buffer = GetBuffer(); bool withUndo = flags & wxRICHTEXT_SETSTYLE_WITH_UNDO; bool resetExistingStyle = ((flags & wxRICHTEXT_SETSTYLE_RESET) != 0); - bool haveControl = (buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer->GetRichTextCtrl() != nullptr); - wxRichTextAction *action = NULL; + wxRichTextAction *action = nullptr; wxRichTextAttr newAttr = obj->GetAttributes(); if (resetExistingStyle) newAttr = textAttr; @@ -3702,7 +3702,7 @@ void wxRichTextParagraphLayoutBox::SetStyle(wxRichTextObject* obj, const wxRichT if (haveControl && withUndo) { - action = new wxRichTextAction(NULL, _("Change Object Style"), wxRICHTEXT_CHANGE_ATTRIBUTES, buffer, obj->GetContainer(), buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Change Object Style"), wxRICHTEXT_CHANGE_ATTRIBUTES, buffer, obj->GetContainer(), buffer->GetRichTextCtrl()); action->SetRange(obj->GetRange().FromInternal()); action->SetPosition(buffer->GetRichTextCtrl()->GetCaretPosition()); action->MakeObject(obj); @@ -3731,7 +3731,7 @@ bool wxRichTextParagraphLayoutBox::GetUncombinedStyle(long position, wxRichTextA /// context attributes. bool wxRichTextParagraphLayoutBox::DoGetStyle(long position, wxRichTextAttr& style, bool combineStyles) { - wxRichTextObject* obj wxDUMMY_INITIALIZE(NULL); + wxRichTextObject* obj wxDUMMY_INITIALIZE(nullptr); if (style.IsParagraphStyle()) { @@ -3863,7 +3863,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange& while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para) { @@ -3917,7 +3917,7 @@ bool wxRichTextParagraphLayoutBox::HasParagraphAttributes(const wxRichTextRange& while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para) { @@ -3969,13 +3969,13 @@ bool wxRichTextParagraphLayoutBox::SetProperties(const wxRichTextRange& range, c // If we are associated with a control, make undoable; otherwise, apply immediately // to the data. - bool haveControl = (buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer->GetRichTextCtrl() != nullptr); - wxRichTextAction* action = NULL; + wxRichTextAction* action = nullptr; if (haveControl && withUndo) { - action = new wxRichTextAction(NULL, _("Change Properties"), wxRICHTEXT_CHANGE_PROPERTIES, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Change Properties"), wxRICHTEXT_CHANGE_PROPERTIES, buffer, this, buffer->GetRichTextCtrl()); action->SetRange(range); action->SetPosition(buffer->GetRichTextCtrl()->GetCaretPosition()); } @@ -3984,7 +3984,7 @@ bool wxRichTextParagraphLayoutBox::SetProperties(const wxRichTextRange& range, c while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para && para->GetChildCount() > 0) { @@ -3996,7 +3996,7 @@ bool wxRichTextParagraphLayoutBox::SetProperties(const wxRichTextRange& range, c { // We'll be using a copy of the paragraph to make style changes, // not updating the buffer directly. - wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(NULL); + wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(nullptr); if (haveControl && withUndo) { @@ -4042,8 +4042,8 @@ bool wxRichTextParagraphLayoutBox::SetProperties(const wxRichTextRange& range, c // we can start applying different properties. // TODO: check that the properties actually change or are different // from properties outside of range - wxRichTextObject* firstObject wxDUMMY_INITIALIZE(NULL); - wxRichTextObject* lastObject wxDUMMY_INITIALIZE(NULL); + wxRichTextObject* firstObject wxDUMMY_INITIALIZE(nullptr); + wxRichTextObject* lastObject wxDUMMY_INITIALIZE(nullptr); if (childRange.GetStart() == newPara->GetRange().GetStart()) firstObject = newPara->GetChildren().GetFirst()->GetData(); @@ -4063,8 +4063,8 @@ bool wxRichTextParagraphLayoutBox::SetProperties(const wxRichTextRange& range, c // returned as the object before the new object. (void) newPara->SplitAt(splitPoint, & lastObject); - wxASSERT(firstObject != NULL); - wxASSERT(lastObject != NULL); + wxASSERT(firstObject != nullptr); + wxASSERT(lastObject != nullptr); if (!firstObject || !lastObject) continue; @@ -4207,7 +4207,7 @@ wxRichTextRange wxRichTextParagraphLayoutBox::GetInvalidRange(bool wholeParagrap /// Apply the style sheet to the buffer, for example if the styles have changed. bool wxRichTextParagraphLayoutBox::ApplyStyleSheet(wxRichTextStyleSheet* styleSheet) { - wxASSERT(styleSheet != NULL); + wxASSERT(styleSheet != nullptr); if (!styleSheet) return false; @@ -4240,7 +4240,7 @@ bool wxRichTextParagraphLayoutBox::ApplyStyleSheet(wxRichTextStyleSheet* styleSh while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para) { @@ -4341,13 +4341,13 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx // If we are associated with a control, make undoable; otherwise, apply immediately // to the data. - bool haveControl = (buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer->GetRichTextCtrl() != nullptr); - wxRichTextAction* action = NULL; + wxRichTextAction* action = nullptr; if (haveControl && withUndo) { - action = new wxRichTextAction(NULL, _("Change List Style"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Change List Style"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); action->SetRange(range); action->SetPosition(buffer->GetRichTextCtrl()->GetCaretPosition()); } @@ -4356,7 +4356,7 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para && para->GetChildCount() > 0) { @@ -4368,7 +4368,7 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx { // We'll be using a copy of the paragraph to make style changes, // not updating the buffer directly. - wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(NULL); + wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(nullptr); if (haveControl && withUndo) { @@ -4414,7 +4414,7 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx } else if (!newPara->GetAttributes().GetListStyleName().IsEmpty()) { - // if def is NULL, remove list style, applying any associated paragraph style + // if def is null, remove list style, applying any associated paragraph style // to restore the attributes newPara->GetAttributes().SetListStyleName(wxEmptyString); @@ -4462,7 +4462,7 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, co /// Clear list for given range bool wxRichTextParagraphLayoutBox::ClearListStyle(const wxRichTextRange& range, int flags) { - return SetListStyle(range, NULL, flags); + return SetListStyle(range, nullptr, flags); } /// Number/renumber any list elements in the given range @@ -4514,13 +4514,13 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co // If we are associated with a control, make undoable; otherwise, apply immediately // to the data. - bool haveControl = (buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer->GetRichTextCtrl() != nullptr); - wxRichTextAction* action = NULL; + wxRichTextAction* action = nullptr; if (haveControl && withUndo) { - action = new wxRichTextAction(NULL, _("Renumber List"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Renumber List"), wxRICHTEXT_CHANGE_STYLE, buffer, this, buffer->GetRichTextCtrl()); action->SetRange(range); action->SetPosition(buffer->GetRichTextCtrl()->GetCaretPosition()); } @@ -4529,7 +4529,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - // wxASSERT (para != NULL); + // wxASSERT (para != nullptr); if (para && para->GetChildCount() > 0) { @@ -4541,7 +4541,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co { // We'll be using a copy of the paragraph to make style changes, // not updating the buffer directly. - wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(NULL); + wxRichTextParagraph* newPara wxDUMMY_INITIALIZE(nullptr); if (haveControl && withUndo) { @@ -4658,7 +4658,7 @@ bool wxRichTextParagraphLayoutBox::NumberList(const wxRichTextRange& range, cons wxRichTextBuffer* buffer = GetBuffer(); if (buffer->GetStyleSheet()) { - wxRichTextListStyleDefinition* def = NULL; + wxRichTextListStyleDefinition* def = nullptr; if (!defName.IsEmpty()) def = buffer->GetStyleSheet()->FindListStyle(defName); return NumberList(range, def, flags, startFrom, specifiedLevel); @@ -4689,7 +4689,7 @@ bool wxRichTextParagraphLayoutBox::PromoteList(int promoteBy, const wxRichTextRa wxRichTextBuffer* buffer = GetBuffer(); if (buffer->GetStyleSheet()) { - wxRichTextListStyleDefinition* def = NULL; + wxRichTextListStyleDefinition* def = nullptr; if (!defName.IsEmpty()) def = buffer->GetStyleSheet()->FindListStyle(defName); return PromoteList(promoteBy, range, def, flags, specifiedLevel); @@ -4712,10 +4712,10 @@ bool wxRichTextParagraphLayoutBox::FindNextParagraphNumber(wxRichTextParagraph* if (node) previousParagraph = wxDynamicCast(node->GetData(), wxRichTextParagraph); else - previousParagraph = NULL; + previousParagraph = nullptr; } else - previousParagraph = NULL; + previousParagraph = nullptr; } if (!previousParagraph || !previousParagraph->GetAttributes().HasFlag(wxTEXT_ATTR_BULLET_STYLE) || previousParagraph->GetAttributes().GetBulletStyle() == wxTEXT_ATTR_BULLET_STYLE_NONE) @@ -4835,7 +4835,7 @@ bool wxRichTextParagraph::Draw(wxDC& dc, wxRichTextDrawingContext& context, cons wxRichTextAttr bulletAttr(attr); // Get line height from first line, if any - wxRichTextLine* line = m_cachedLines.empty() ? NULL : m_cachedLines[0]; + wxRichTextLine* line = m_cachedLines.empty() ? nullptr : m_cachedLines[0]; wxPoint linePos; int lineHeight wxDUMMY_INITIALIZE(0); @@ -4985,7 +4985,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co if (wxRichTextBuffer::GetFloatingLayoutMode()) { - wxASSERT(collector != NULL); + wxASSERT(collector != nullptr); if (collector) { if (m_impactedByFloatingObjects == -1) @@ -5619,7 +5619,7 @@ void wxRichTextParagraph::ApplyParagraphStyle(wxRichTextLine* line, const wxRich /// Insert text at the given position bool wxRichTextParagraph::InsertText(long pos, const wxString& text) { - wxRichTextObject* childToUse = NULL; + wxRichTextObject* childToUse = nullptr; wxRichTextObjectList::compatibility_iterator nodeToUse = wxRichTextObjectList::compatibility_iterator(); wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); @@ -5718,7 +5718,7 @@ bool wxRichTextParagraph::GetRangeSize(const wxRichTextRange& range, wxSize& siz if (partialExtents) p = & childExtents; else - p = NULL; + p = nullptr; int maxDescent = 0; int maxAscent = 0; @@ -5963,7 +5963,7 @@ bool wxRichTextParagraph::FindPosition(wxDC& dc, wxRichTextDrawingContext& conte if (index == GetRange().GetEnd()) { wxRichTextParagraphLayoutBox* parent = wxDynamicCast(GetParent(), wxRichTextParagraphLayoutBox); - wxASSERT( parent != NULL ); + wxASSERT( parent != nullptr ); // Find the height at the next paragraph, if any wxRichTextLine* line = parent->GetLineAtPosition(index + 1); @@ -6188,7 +6188,7 @@ int wxRichTextParagraph::HitTest(wxDC& dc, wxRichTextDrawingContext& context, co } /// Split an object at this position if necessary, and return -/// the previous object, or NULL if inserting at beginning. +/// the previous object, or nullptr if inserting at beginning. wxRichTextObject* wxRichTextParagraph::SplitAt(long pos, wxRichTextObject** previousObject) { wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst(); @@ -6203,7 +6203,7 @@ wxRichTextObject* wxRichTextParagraph::SplitAt(long pos, wxRichTextObject** prev if (node->GetPrevious()) *previousObject = node->GetPrevious()->GetData(); else - *previousObject = NULL; + *previousObject = nullptr; } return child; @@ -6240,8 +6240,8 @@ wxRichTextObject* wxRichTextParagraph::SplitAt(long pos, wxRichTextObject** prev node = node->GetNext(); } if (previousObject) - *previousObject = NULL; - return NULL; + *previousObject = nullptr; + return nullptr; } /// Move content to a list from obj on @@ -6295,7 +6295,7 @@ wxRichTextObject* wxRichTextParagraph::FindObjectAtPosition(long position) node = node->GetNext(); } - return NULL; + return nullptr; } /// Get the plain text searching from the start or end of the range. @@ -6795,7 +6795,7 @@ wxRichTextPlainText::wxRichTextPlainText(const wxString& text, wxRichTextObject* bool wxRichTextPlainText::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int WXUNUSED(style)) { wxRichTextParagraph* para = wxDynamicCast(GetParent(), wxRichTextParagraph); - wxASSERT (para != NULL); + wxASSERT (para != nullptr); wxRichTextAttr textAttr(para ? para->GetCombinedAttributes(GetAttributes(), false /* no box attributes */) : GetAttributes()); AdjustAttributes(textAttr, context); @@ -7209,7 +7209,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz return false; wxRichTextParagraph* para = wxDynamicCast(GetParent(), wxRichTextParagraph); - wxASSERT (para != NULL); + wxASSERT (para != nullptr); int relativeX = position.x - GetParent()->GetPosition().x; @@ -7420,7 +7420,7 @@ wxRichTextObject* wxRichTextPlainText::DoSplit(long pos) long index = pos - GetRange().GetStart(); if (index < 0 || index >= (int) m_text.length()) - return NULL; + return nullptr; wxString firstPart = m_text.Mid(0, index); wxString secondPart = m_text.Mid(index); @@ -7518,7 +7518,7 @@ bool wxRichTextPlainText::CanMerge(wxRichTextObject* object, wxRichTextDrawingCo bool wxRichTextPlainText::Merge(wxRichTextObject* object, wxRichTextDrawingContext& WXUNUSED(context)) { wxRichTextPlainText* textObject = wxDynamicCast(object, wxRichTextPlainText); - wxASSERT( textObject != NULL ); + wxASSERT( textObject != nullptr ); if (textObject) { @@ -7772,7 +7772,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRichTextBuffer, wxRichTextParagraphLayoutBox); wxList wxRichTextBuffer::sm_handlers; wxList wxRichTextBuffer::sm_drawingHandlers; wxRichTextFieldTypeHashMap wxRichTextBuffer::sm_fieldTypes; -wxRichTextRenderer* wxRichTextBuffer::sm_renderer = NULL; +wxRichTextRenderer* wxRichTextBuffer::sm_renderer = nullptr; int wxRichTextBuffer::sm_bulletRightMargin = 20; float wxRichTextBuffer::sm_bulletProportion = (float) 0.3; bool wxRichTextBuffer::sm_floatingLayoutMode = true; @@ -7781,10 +7781,10 @@ bool wxRichTextBuffer::sm_floatingLayoutMode = true; void wxRichTextBuffer::Init() { m_commandProcessor = new wxCommandProcessor; - m_styleSheet = NULL; + m_styleSheet = nullptr; m_modified = false; m_batchedCommandDepth = 0; - m_batchedCommand = NULL; + m_batchedCommand = nullptr; m_suppressUndo = 0; m_handlerFlags = 0; m_scale = 1.0; @@ -7822,7 +7822,7 @@ void wxRichTextBuffer::Copy(const wxRichTextBuffer& obj) m_batchedCommandDepth = 0; if (m_batchedCommand) delete m_batchedCommand; - m_batchedCommand = NULL; + m_batchedCommand = nullptr; m_suppressUndo = obj.m_suppressUndo; m_invalidRange = obj.m_invalidRange; m_dimensionScale = obj.m_dimensionScale; @@ -7852,7 +7852,7 @@ wxRichTextStyleSheet* wxRichTextBuffer::PopStyleSheet() return oldSheet; } else - return NULL; + return nullptr; } /// Submit command to insert paragraphs @@ -7864,7 +7864,7 @@ bool wxRichTextBuffer::InsertParagraphsWithUndo(long pos, const wxRichTextParagr /// Submit command to insert paragraphs bool wxRichTextParagraphLayoutBox::InsertParagraphsWithUndo(wxRichTextBuffer* buffer, long pos, const wxRichTextParagraphLayoutBox& paragraphs, wxRichTextCtrl* ctrl, int WXUNUSED(flags)) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); action->GetNewParagraphs() = paragraphs; @@ -7894,9 +7894,9 @@ bool wxRichTextBuffer::InsertTextWithUndo(long pos, const wxString& text, wxRich /// Submit command to insert the given text bool wxRichTextParagraphLayoutBox::InsertTextWithUndo(wxRichTextBuffer* buffer, long pos, const wxString& text, wxRichTextCtrl* ctrl, int flags) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); - wxRichTextAttr* p = NULL; + wxRichTextAttr* p = nullptr; wxRichTextAttr paraAttr; if (flags & wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE) { @@ -7936,9 +7936,9 @@ bool wxRichTextBuffer::InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int /// Submit command to insert the given text bool wxRichTextParagraphLayoutBox::InsertNewlineWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextCtrl* ctrl, int flags) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Text"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); - wxRichTextAttr* p = NULL; + wxRichTextAttr* p = nullptr; wxRichTextAttr paraAttr; if (flags & wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE) { @@ -8020,9 +8020,9 @@ bool wxRichTextParagraphLayoutBox::InsertImageWithUndo(wxRichTextBuffer* buffer, wxRichTextCtrl* ctrl, int flags, const wxRichTextAttr& textAttr) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Image"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Image"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); - wxRichTextAttr* p = NULL; + wxRichTextAttr* p = nullptr; wxRichTextAttr paraAttr; if (flags & wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE) { @@ -8067,9 +8067,9 @@ wxRichTextObject* wxRichTextBuffer::InsertObjectWithUndo(long pos, wxRichTextObj // Insert an object with no change of it wxRichTextObject* wxRichTextParagraphLayoutBox::InsertObjectWithUndo(wxRichTextBuffer* buffer, long pos, wxRichTextObject *object, wxRichTextCtrl* ctrl, int flags) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Object"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Object"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); - wxRichTextAttr* p = NULL; + wxRichTextAttr* p = nullptr; wxRichTextAttr paraAttr; if (flags & wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE) { @@ -8109,9 +8109,9 @@ wxRichTextField* wxRichTextParagraphLayoutBox::InsertFieldWithUndo(wxRichTextBuf wxRichTextCtrl* ctrl, int flags, const wxRichTextAttr& textAttr) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Field"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Field"), wxRICHTEXT_INSERT, buffer, this, ctrl, false); - wxRichTextAttr* p = NULL; + wxRichTextAttr* p = nullptr; wxRichTextAttr paraAttr; if (flags & wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE) { @@ -8155,12 +8155,12 @@ bool wxRichTextParagraphLayoutBox::SetObjectPropertiesWithUndo(wxRichTextObject& wxRichTextCtrl* rtc = buffer->GetRichTextCtrl(); wxCHECK_MSG(rtc, false, wxT("Invalid rtc")); - wxRichTextAction* action = NULL; - wxRichTextObject* clone = NULL; + wxRichTextAction* action = nullptr; + wxRichTextObject* clone = nullptr; // The object on which to set properties will usually be 'obj', but use objToSet if it's valid. // This is necessary e.g. on setting a wxRichTextCell's properties, when obj will be the parent table - if (objToSet == NULL) + if (objToSet == nullptr) objToSet = &obj; if (rtc->SuppressingUndo()) @@ -8171,7 +8171,7 @@ bool wxRichTextParagraphLayoutBox::SetObjectPropertiesWithUndo(wxRichTextObject& objToSet->SetProperties(properties); // The 'true' parameter in the next line says "Ignore first time"; otherwise the objects are prematurely switched - action = new wxRichTextAction(NULL, _("Change Properties"), wxRICHTEXT_CHANGE_OBJECT, buffer, obj.GetParentContainer(), rtc, true); + action = new wxRichTextAction(nullptr, _("Change Properties"), wxRICHTEXT_CHANGE_OBJECT, buffer, obj.GetParentContainer(), rtc, true); action->SetOldAndNewObjects(& obj, clone); action->SetPosition(obj.GetRange().GetStart()); action->SetRange(obj.GetRange()); @@ -8263,7 +8263,7 @@ bool wxRichTextBuffer::DeleteRangeWithUndo(const wxRichTextRange& range, wxRichT /// Submit command to delete this range bool wxRichTextParagraphLayoutBox::DeleteRangeWithUndo(const wxRichTextRange& range, wxRichTextCtrl* ctrl, wxRichTextBuffer* buffer) { - wxRichTextAction* action = new wxRichTextAction(NULL, _("Delete"), wxRICHTEXT_DELETE, buffer, this, ctrl); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Delete"), wxRICHTEXT_DELETE, buffer, this, ctrl); action->SetPosition(ctrl->GetCaretPosition()); @@ -8299,7 +8299,7 @@ bool wxRichTextBuffer::BeginBatchUndo(const wxString& cmdName) { if (m_batchedCommandDepth == 0) { - wxASSERT(m_batchedCommand == NULL); + wxASSERT(m_batchedCommand == nullptr); if (m_batchedCommand) { GetCommandProcessor()->Store(m_batchedCommand); @@ -8318,12 +8318,12 @@ bool wxRichTextBuffer::EndBatchUndo() m_batchedCommandDepth --; wxASSERT(m_batchedCommandDepth >= 0); - wxASSERT(m_batchedCommand != NULL); + wxASSERT(m_batchedCommand != nullptr); if (m_batchedCommandDepth == 0) { GetCommandProcessor()->Store(m_batchedCommand); - m_batchedCommand = NULL; + m_batchedCommand = nullptr; } return true; @@ -8690,7 +8690,7 @@ wxRichTextFileHandler *wxRichTextBuffer::FindHandlerFilenameOrType(const wxStrin return FindHandler(ext, imageType); } else - return NULL; + return nullptr; } @@ -8705,7 +8705,7 @@ wxRichTextFileHandler* wxRichTextBuffer::FindHandler(const wxString& name) node = node->GetNext(); } - return NULL; + return nullptr; } /// Finds a handler by extension and type @@ -8720,7 +8720,7 @@ wxRichTextFileHandler* wxRichTextBuffer::FindHandler(const wxString& extension, return handler; node = node->GetNext(); } - return 0; + return nullptr; } /// Finds a handler by type @@ -8733,7 +8733,7 @@ wxRichTextFileHandler* wxRichTextBuffer::FindHandler(wxRichTextFileType type) if (handler->GetType() == type) return handler; node = node->GetNext(); } - return NULL; + return nullptr; } void wxRichTextBuffer::InitStandardHandlers() @@ -8939,7 +8939,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position) if (richTextBuffer->GetStyleSheet()) { delete richTextBuffer->GetStyleSheet(); - richTextBuffer->SetStyleSheet(NULL); + richTextBuffer->SetStyleSheet(nullptr); } delete richTextBuffer; } @@ -8980,7 +8980,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position) wxBitmap bitmap(data.GetBitmap()); wxImage image(bitmap.ConvertToImage()); - wxRichTextAction* action = new wxRichTextAction(NULL, _("Insert Image"), wxRICHTEXT_INSERT, this, container, GetRichTextCtrl(), false); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Insert Image"), wxRICHTEXT_INSERT, this, container, GetRichTextCtrl(), false); action->GetNewParagraphs().AddImage(image); @@ -9120,7 +9120,7 @@ bool wxRichTextBuffer::SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet) SetStyleSheet(sheet); event.SetEventType(wxEVT_RICHTEXT_STYLESHEET_REPLACED); - event.SetOldStyleSheet(NULL); + event.SetOldStyleSheet(nullptr); event.Allow(); return SendEvent(event); @@ -9864,7 +9864,7 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon // We need to explicitly look at the spans, not just whether // the cell is visible, because that doesn't tell us which // cell to look at for border information. - wxRichTextCell* adjacentCellRight = NULL; + wxRichTextCell* adjacentCellRight = nullptr; int nextCol = col + GetColSpan(); if (nextCol >= table->GetColumnCount()) @@ -9911,7 +9911,7 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon } // Compute bottom border - wxRichTextCell* adjacentCellBelow = NULL; + wxRichTextCell* adjacentCellBelow = nullptr; int nextRow = row + GetRowSpan(); if (nextRow >= table->GetRowCount()) @@ -11010,7 +11010,7 @@ wxRichTextCell* wxRichTextTable::GetCell(long pos) const return GetCell(row, col); } else - return NULL; + return nullptr; } // Get the row/column for a given character position @@ -11168,7 +11168,7 @@ wxRichTextCell* wxRichTextTable::GetCell(int row, int col) const return wxDynamicCast(obj, wxRichTextCell); } else - return NULL; + return nullptr; } // Returns a selection object specifying the selections between start and end character positions. @@ -11258,7 +11258,7 @@ bool wxRichTextTable::SetCellStyle(const wxRichTextSelection& selection, const w return false; wxRichTextBuffer* buffer = GetBuffer(); - bool haveControl = (buffer && buffer->GetRichTextCtrl() != NULL); + bool haveControl = (buffer && buffer->GetRichTextCtrl() != nullptr); bool withUndo = haveControl && ((flags & wxRICHTEXT_SETSTYLE_WITH_UNDO) != 0); if (withUndo) @@ -11329,14 +11329,14 @@ bool wxRichTextTable::DeleteRows(int startRow, int noRows) wxRichTextBuffer* buffer = GetBuffer(); wxRichTextCtrl* rtc = buffer->GetRichTextCtrl(); - wxRichTextAction* action = NULL; - wxRichTextTable* clone = NULL; + wxRichTextAction* action = nullptr; + wxRichTextTable* clone = nullptr; if (!rtc->SuppressingUndo()) { // Create a clone containing the current state of the table. It will be used to Undo the action clone = wxStaticCast(this->Clone(), wxRichTextTable); clone->SetParent(GetParent()); - action = new wxRichTextAction(NULL, _("Delete Row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc); + action = new wxRichTextAction(nullptr, _("Delete Row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc); action->SetObject(this); action->SetPosition(GetRange().GetStart()); } @@ -11379,14 +11379,14 @@ bool wxRichTextTable::DeleteColumns(int startCol, int noCols) wxRichTextBuffer* buffer = GetBuffer(); wxRichTextCtrl* rtc = buffer->GetRichTextCtrl(); - wxRichTextAction* action = NULL; - wxRichTextTable* clone = NULL; + wxRichTextAction* action = nullptr; + wxRichTextTable* clone = nullptr; if (!rtc->SuppressingUndo()) { // Create a clone containing the current state of the table. It will be used to Undo the action clone = wxStaticCast(this->Clone(), wxRichTextTable); clone->SetParent(GetParent()); - action = new wxRichTextAction(NULL, _("Delete Column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc); + action = new wxRichTextAction(nullptr, _("Delete Column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, rtc); action->SetObject(this); action->SetPosition(GetRange().GetStart()); } @@ -11429,15 +11429,15 @@ bool wxRichTextTable::AddRows(int startRow, int noRows, const wxRichTextAttr& at return false; wxRichTextBuffer* buffer = GetBuffer(); - wxRichTextAction* action = NULL; - wxRichTextTable* clone = NULL; + wxRichTextAction* action = nullptr; + wxRichTextTable* clone = nullptr; if (!buffer->GetRichTextCtrl()->SuppressingUndo()) { // Create a clone containing the current state of the table. It will be used to Undo the action clone = wxStaticCast(this->Clone(), wxRichTextTable); clone->SetParent(GetParent()); - action = new wxRichTextAction(NULL, _("Add Row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Add Row"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, buffer->GetRichTextCtrl()); action->SetObject(this); action->SetPosition(GetRange().GetStart()); } @@ -11492,15 +11492,15 @@ bool wxRichTextTable::AddColumns(int startCol, int noCols, const wxRichTextAttr& return false; wxRichTextBuffer* buffer = GetBuffer(); - wxRichTextAction* action = NULL; - wxRichTextTable* clone = NULL; + wxRichTextAction* action = nullptr; + wxRichTextTable* clone = nullptr; if (!buffer->GetRichTextCtrl()->SuppressingUndo()) { // Create a clone containing the current state of the table. It will be used to Undo the action clone = wxStaticCast(this->Clone(), wxRichTextTable); clone->SetParent(GetParent()); - action = new wxRichTextAction(NULL, _("Add Column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, buffer->GetRichTextCtrl()); + action = new wxRichTextAction(nullptr, _("Add Column"), wxRICHTEXT_CHANGE_OBJECT, buffer, this, buffer->GetRichTextCtrl()); action->SetObject(this); action->SetPosition(GetRange().GetStart()); } @@ -11632,7 +11632,7 @@ bool wxRichTextTableBlock::IsWholeTable(wxRichTextTable* table) const wxRichTextCell* wxRichTextTableBlock::GetFocusedCell(wxRichTextCtrl* ctrl) { if (!ctrl) - return NULL; + return nullptr; wxRichTextCell* cell = wxDynamicCast(ctrl->GetFocusObject(), wxRichTextCell); return cell; @@ -11678,7 +11678,7 @@ public: wxRichTextDecimalToRoman(-1); wxRichTextParagraph::ClearDefaultTabs(); wxRichTextCtrl::ClearAvailableFontNames(); - wxRichTextBuffer::SetRenderer(NULL); + wxRichTextBuffer::SetRenderer(nullptr); } }; @@ -11776,7 +11776,7 @@ wxRichTextAction::wxRichTextAction(wxRichTextCommand* cmd, const wxString& name, wxRichTextCtrl* ctrl, bool ignoreFirstTime) { m_buffer = buffer; - m_object = NULL; + m_object = nullptr; m_containerAddress.Create(buffer, container); m_ignoreThis = ignoreFirstTime; m_cmdId = id; @@ -11811,7 +11811,7 @@ void wxRichTextAction::CalculateRefreshOptimizations(wxArrayInt& optimizationLin #if wxRICHTEXT_USE_OPTIMIZED_DRAWING wxRichTextParagraphLayoutBox* container = GetContainer(); - wxASSERT(container != NULL); + wxASSERT(container != nullptr); if (!container) return; @@ -11890,7 +11890,7 @@ bool wxRichTextAction::Do() m_buffer->Modify(true); wxRichTextParagraphLayoutBox* container = GetContainer(); - wxASSERT(container != NULL); + wxASSERT(container != nullptr); if (!container) return false; @@ -12122,7 +12122,7 @@ bool wxRichTextAction::Undo() m_buffer->Modify(true); wxRichTextParagraphLayoutBox* container = GetContainer(); - wxASSERT(container != NULL); + wxASSERT(container != nullptr); if (!container) return false; @@ -12245,7 +12245,7 @@ bool wxRichTextAction::Undo() void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent, const wxRect& oldFloatRect, wxArrayInt* optimizationLineCharPositions, wxArrayInt* optimizationLineYPositions, bool isDoCmd) { wxRichTextParagraphLayoutBox* container = GetContainer(); - wxASSERT(container != NULL); + wxASSERT(container != nullptr); if (!container) return; @@ -12429,7 +12429,7 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent void wxRichTextAction::ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragment) { wxRichTextParagraphLayoutBox* container = GetContainer(); - wxASSERT(container != NULL); + wxASSERT(container != nullptr); if (!container) return; @@ -12437,7 +12437,7 @@ void wxRichTextAction::ApplyParagraphs(const wxRichTextParagraphLayoutBox& fragm while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - wxASSERT (para != NULL); + wxASSERT (para != nullptr); // We'll replace the existing paragraph by finding the paragraph at this position, // delete its node data, and setting a copy as the new node data. @@ -13143,7 +13143,7 @@ wxRichTextImageBlock::~wxRichTextImageBlock() void wxRichTextImageBlock::Init() { - m_data = NULL; + m_data = nullptr; m_dataSize = 0; m_imageType = wxBITMAP_TYPE_INVALID; } @@ -13200,7 +13200,7 @@ bool wxRichTextImageBlock::MakeImageBlock(const wxString& filename, wxBitmapType if (removeFile) wxRemoveFile(filenameToRead); - return (m_data != NULL); + return (m_data != nullptr); } // Make an image block from the wxImage in the given @@ -13246,7 +13246,7 @@ bool wxRichTextImageBlock::DoMakeImageBlock(const wxImage& image, wxBitmapType i memStream.CopyTo(m_data, m_dataSize); - return (m_data != NULL); + return (m_data != nullptr); } // Write to a file @@ -13372,7 +13372,7 @@ unsigned char* wxRichTextImageBlock::ReadBlock(wxInputStream& stream, size_t siz { unsigned char* block = new unsigned char[size]; if (!block) - return NULL; + return nullptr; stream.Read(block, size); @@ -13383,7 +13383,7 @@ unsigned char* wxRichTextImageBlock::ReadBlock(const wxString& filename, size_t { wxFileInputStream stream(filename); if (!stream.IsOk()) - return NULL; + return nullptr; return ReadBlock(stream, size); } @@ -13445,7 +13445,7 @@ wxRichTextBufferDataObject::~wxRichTextBufferDataObject() wxRichTextBuffer* wxRichTextBufferDataObject::GetRichTextBuffer() { wxRichTextBuffer* richTextBuffer = m_richTextBuffer; - m_richTextBuffer = NULL; + m_richTextBuffer = nullptr; return richTextBuffer; } @@ -13783,7 +13783,7 @@ bool wxTextBoxAttr::EqPartial(const wxTextBoxAttr& attr, bool weakTest) const } // Merges the given attributes. If compareWith -// is non-NULL, then it will be used to mask out those attributes that are the same in style +// is non-null, then it will be used to mask out those attributes that are the same in style // and compareWith, for situations where we don't want to explicitly set inherited attributes. bool wxTextBoxAttr::Apply(const wxTextBoxAttr& attr, const wxTextBoxAttr* compareWith) { @@ -13828,18 +13828,18 @@ bool wxTextBoxAttr::Apply(const wxTextBoxAttr& attr, const wxTextBoxAttr* compar SetBoxStyleName(attr.GetBoxStyleName()); } - m_margins.Apply(attr.m_margins, compareWith ? (& compareWith->m_margins) : (const wxTextAttrDimensions*) NULL); - m_padding.Apply(attr.m_padding, compareWith ? (& compareWith->m_padding) : (const wxTextAttrDimensions*) NULL); - m_position.Apply(attr.m_position, compareWith ? (& compareWith->m_position) : (const wxTextAttrDimensions*) NULL); + m_margins.Apply(attr.m_margins, compareWith ? (& compareWith->m_margins) : (const wxTextAttrDimensions*) nullptr); + m_padding.Apply(attr.m_padding, compareWith ? (& compareWith->m_padding) : (const wxTextAttrDimensions*) nullptr); + m_position.Apply(attr.m_position, compareWith ? (& compareWith->m_position) : (const wxTextAttrDimensions*) nullptr); - m_size.Apply(attr.m_size, compareWith ? (& compareWith->m_size) : (const wxTextAttrSize*) NULL); - m_minSize.Apply(attr.m_minSize, compareWith ? (& compareWith->m_minSize) : (const wxTextAttrSize*) NULL); - m_maxSize.Apply(attr.m_maxSize, compareWith ? (& compareWith->m_maxSize) : (const wxTextAttrSize*) NULL); + m_size.Apply(attr.m_size, compareWith ? (& compareWith->m_size) : (const wxTextAttrSize*) nullptr); + m_minSize.Apply(attr.m_minSize, compareWith ? (& compareWith->m_minSize) : (const wxTextAttrSize*) nullptr); + m_maxSize.Apply(attr.m_maxSize, compareWith ? (& compareWith->m_maxSize) : (const wxTextAttrSize*) nullptr); - m_border.Apply(attr.m_border, compareWith ? (& compareWith->m_border) : (const wxTextAttrBorders*) NULL); - m_outline.Apply(attr.m_outline, compareWith ? (& compareWith->m_outline) : (const wxTextAttrBorders*) NULL); + m_border.Apply(attr.m_border, compareWith ? (& compareWith->m_border) : (const wxTextAttrBorders*) nullptr); + m_outline.Apply(attr.m_outline, compareWith ? (& compareWith->m_outline) : (const wxTextAttrBorders*) nullptr); - m_shadow.Apply(attr.m_shadow, compareWith ? (& compareWith->m_shadow) : (const wxTextAttrShadow*) NULL); + m_shadow.Apply(attr.m_shadow, compareWith ? (& compareWith->m_shadow) : (const wxTextAttrShadow*) nullptr); return true; } @@ -14099,13 +14099,13 @@ bool wxRichTextAttr::EqPartial(const wxRichTextAttr& attr, bool weakTest) const } // Merges the given attributes. If compareWith -// is non-NULL, then it will be used to mask out those attributes that are the same in style +// is non-null, then it will be used to mask out those attributes that are the same in style // and compareWith, for situations where we don't want to explicitly set inherited attributes. bool wxRichTextAttr::Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith) { wxTextAttr::Apply(style, compareWith); - return m_textBoxAttr.Apply(style.m_textBoxAttr, compareWith ? (& compareWith->m_textBoxAttr) : (const wxTextBoxAttr*) NULL); + return m_textBoxAttr.Apply(style.m_textBoxAttr, compareWith ? (& compareWith->m_textBoxAttr) : (const wxTextBoxAttr*) nullptr); } // Remove specified attributes from this object @@ -14244,10 +14244,10 @@ bool wxTextAttrBorders::EqPartial(const wxTextAttrBorders& borders, bool weakTes // Apply border to 'this', but not if the same as compareWith bool wxTextAttrBorders::Apply(const wxTextAttrBorders& borders, const wxTextAttrBorders* compareWith) { - m_left.Apply(borders.m_left, compareWith ? (& compareWith->m_left) : (const wxTextAttrBorder*) NULL); - m_right.Apply(borders.m_right, compareWith ? (& compareWith->m_right) : (const wxTextAttrBorder*) NULL); - m_top.Apply(borders.m_top, compareWith ? (& compareWith->m_top) : (const wxTextAttrBorder*) NULL); - m_bottom.Apply(borders.m_bottom, compareWith ? (& compareWith->m_bottom) : (const wxTextAttrBorder*) NULL); + m_left.Apply(borders.m_left, compareWith ? (& compareWith->m_left) : (const wxTextAttrBorder*) nullptr); + m_right.Apply(borders.m_right, compareWith ? (& compareWith->m_right) : (const wxTextAttrBorder*) nullptr); + m_top.Apply(borders.m_top, compareWith ? (& compareWith->m_top) : (const wxTextAttrBorder*) nullptr); + m_bottom.Apply(borders.m_bottom, compareWith ? (& compareWith->m_bottom) : (const wxTextAttrBorder*) nullptr); return true; } @@ -14458,10 +14458,10 @@ bool wxTextAttrDimensions::EqPartial(const wxTextAttrDimensions& dims, bool weak // Apply border to 'this', but not if the same as compareWith bool wxTextAttrDimensions::Apply(const wxTextAttrDimensions& dims, const wxTextAttrDimensions* compareWith) { - m_left.Apply(dims.m_left, compareWith ? (& compareWith->m_left) : (const wxTextAttrDimension*) NULL); - m_right.Apply(dims.m_right, compareWith ? (& compareWith->m_right): (const wxTextAttrDimension*) NULL); - m_top.Apply(dims.m_top, compareWith ? (& compareWith->m_top): (const wxTextAttrDimension*) NULL); - m_bottom.Apply(dims.m_bottom, compareWith ? (& compareWith->m_bottom): (const wxTextAttrDimension*) NULL); + m_left.Apply(dims.m_left, compareWith ? (& compareWith->m_left) : (const wxTextAttrDimension*) nullptr); + m_right.Apply(dims.m_right, compareWith ? (& compareWith->m_right): (const wxTextAttrDimension*) nullptr); + m_top.Apply(dims.m_top, compareWith ? (& compareWith->m_top): (const wxTextAttrDimension*) nullptr); + m_bottom.Apply(dims.m_bottom, compareWith ? (& compareWith->m_bottom): (const wxTextAttrDimension*) nullptr); return true; } @@ -14506,8 +14506,8 @@ bool wxTextAttrSize::EqPartial(const wxTextAttrSize& size, bool weakTest) const // Apply border to 'this', but not if the same as compareWith bool wxTextAttrSize::Apply(const wxTextAttrSize& size, const wxTextAttrSize* compareWith) { - m_width.Apply(size.m_width, compareWith ? (& compareWith->m_width) : (const wxTextAttrDimension*) NULL); - m_height.Apply(size.m_height, compareWith ? (& compareWith->m_height): (const wxTextAttrDimension*) NULL); + m_width.Apply(size.m_width, compareWith ? (& compareWith->m_width) : (const wxTextAttrDimension*) nullptr); + m_height.Apply(size.m_height, compareWith ? (& compareWith->m_height): (const wxTextAttrDimension*) nullptr); return true; } @@ -15230,7 +15230,7 @@ wxVariant* wxRichTextProperties::FindOrCreateProperty(const wxString& name) return & (*this)[idx]; } else - return NULL; + return nullptr; } const wxVariant& wxRichTextProperties::GetProperty(const wxString& name) const @@ -15339,7 +15339,7 @@ wxRichTextObject* wxRichTextObjectAddress::GetObject(wxRichTextParagraphLayoutBo int pos = m_address[i]; wxASSERT(pos >= 0 && pos < (int) p->GetChildren().GetCount()); if (pos < 0 || pos >= (int) p->GetChildren().GetCount()) - return NULL; + return nullptr; wxRichTextObject* p1 = p->GetChild(pos); if (i == (m_address.GetCount()-1)) @@ -15348,7 +15348,7 @@ wxRichTextObject* wxRichTextObjectAddress::GetObject(wxRichTextParagraphLayoutBo p = wxDynamicCast(p1, wxRichTextCompositeObject); i ++; } - return NULL; + return nullptr; } bool wxRichTextObjectAddress::Create(wxRichTextParagraphLayoutBox* topLevelContainer, wxRichTextObject* obj) @@ -15427,7 +15427,7 @@ wxRichTextRangeArray wxRichTextSelection::GetSelectionForObject(wxRichTextObject } else { - container = NULL; + container = nullptr; break; } } @@ -15648,7 +15648,7 @@ wxRichTextDrawingHandler* wxRichTextBuffer::FindDrawingHandler(const wxString& n node = node->GetNext(); } - return NULL; + return nullptr; } void wxRichTextBuffer::CleanUpDrawingHandlers() @@ -15688,7 +15688,7 @@ wxRichTextFieldType *wxRichTextBuffer::FindFieldType(const wxString& name) { wxRichTextFieldTypeHashMap::iterator it = sm_fieldTypes.find(name); if (it == sm_fieldTypes.end()) - return NULL; + return nullptr; else return it->second; } @@ -15766,11 +15766,11 @@ bool wxTextAttrShadow::EqPartial(const wxTextAttrShadow& shadow, bool weakTest) bool wxTextAttrShadow::Apply(const wxTextAttrShadow& shadow, const wxTextAttrShadow* compareWith) { - m_offsetX.Apply(shadow.m_offsetX, compareWith ? (& compareWith->m_offsetX) : NULL); - m_offsetY.Apply(shadow.m_offsetY, compareWith ? (& compareWith->m_offsetY) : NULL); - m_spread.Apply(shadow.m_spread, compareWith ? (& compareWith->m_spread) : NULL); - m_blurDistance.Apply(shadow.m_blurDistance, compareWith ? (& compareWith->m_blurDistance) : NULL); - m_opacity.Apply(shadow.m_opacity, compareWith ? (& compareWith->m_opacity) : NULL); + m_offsetX.Apply(shadow.m_offsetX, compareWith ? (& compareWith->m_offsetX) : nullptr); + m_offsetY.Apply(shadow.m_offsetY, compareWith ? (& compareWith->m_offsetY) : nullptr); + m_spread.Apply(shadow.m_spread, compareWith ? (& compareWith->m_spread) : nullptr); + m_blurDistance.Apply(shadow.m_blurDistance, compareWith ? (& compareWith->m_blurDistance) : nullptr); + m_opacity.Apply(shadow.m_opacity, compareWith ? (& compareWith->m_opacity) : nullptr); if (shadow.HasColour() && !(compareWith && (shadow.m_shadowColour == compareWith->m_shadowColour))) SetColour(shadow.m_shadowColour); diff --git a/src/richtext/richtextbulletspage.cpp b/src/richtext/richtextbulletspage.cpp index 47c3178f57..53dba93f84 100644 --- a/src/richtext/richtextbulletspage.cpp +++ b/src/richtext/richtextbulletspage.cpp @@ -88,16 +88,16 @@ void wxRichTextBulletsPage::Init() m_dontUpdate = false; ////@begin wxRichTextBulletsPage member initialisation - m_styleListBox = NULL; - m_periodCtrl = NULL; - m_parenthesesCtrl = NULL; - m_rightParenthesisCtrl = NULL; - m_bulletAlignmentCtrl = NULL; - m_symbolCtrl = NULL; - m_symbolFontCtrl = NULL; - m_bulletNameCtrl = NULL; - m_numberCtrl = NULL; - m_previewCtrl = NULL; + m_styleListBox = nullptr; + m_periodCtrl = nullptr; + m_parenthesesCtrl = nullptr; + m_rightParenthesisCtrl = nullptr; + m_bulletAlignmentCtrl = nullptr; + m_symbolCtrl = nullptr; + m_symbolFontCtrl = nullptr; + m_bulletNameCtrl = nullptr; + m_numberCtrl = nullptr; + m_previewCtrl = nullptr; ////@end wxRichTextBulletsPage member initialisation } diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 70ea272e9d..c317d6c7e5 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -357,11 +357,11 @@ wxRichTextCtrl::~wxRichTextCtrl() /// Member initialisation void wxRichTextCtrl::Init() { - m_contextMenu = NULL; - m_caret = NULL; + m_contextMenu = nullptr; + m_caret = nullptr; m_caretPosition = -1; m_selectionAnchor = -2; - m_selectionAnchorObject = NULL; + m_selectionAnchorObject = nullptr; m_selectionState = wxRichTextCtrlSelectionState_Normal; m_editable = true; m_useVirtualAttributes = false; @@ -612,8 +612,8 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event) // TODO: detect change of focus object long position = 0; - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); int hit = GetBuffer().HitTest(dc, context, GetUnscaledPoint(event.GetLogicalPosition(dc)), position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); @@ -691,8 +691,8 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event) long position = 0; wxPoint logicalPt = event.GetLogicalPosition(dc); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); // Only get objects at this level, not nested, because otherwise we couldn't swipe text at a single level. int hit = GetFocusObject()->HitTest(dc, context, GetUnscaledPoint(logicalPt), position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS|wxRICHTEXT_HITTEST_HONOUR_ATOMIC); @@ -705,8 +705,8 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event) // Do the actions that would have been done in OnLeftClick if we hadn't tried to drag long prePosition = 0; - wxRichTextObject* preHitObj = NULL; - wxRichTextObject* preContextObj = NULL; + wxRichTextObject* preHitObj = nullptr; + wxRichTextObject* preContextObj = nullptr; int preHit = GetBuffer().HitTest(dc, context, GetUnscaledPoint(event.GetLogicalPosition(dc)), prePosition, & preHitObj, & preContextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); wxRichTextParagraphLayoutBox* oldFocusObject = GetFocusObject(); wxRichTextParagraphLayoutBox* container = wxDynamicCast(preContextObj, wxRichTextParagraphLayoutBox); @@ -892,8 +892,8 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event) long position = 0; wxPoint logicalPt = event.GetLogicalPosition(dc); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; int flags = 0; @@ -934,13 +934,13 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event) #endif ) { - wxRichTextParagraphLayoutBox* commonAncestor = NULL; - wxRichTextParagraphLayoutBox* otherContainer = NULL; - wxRichTextParagraphLayoutBox* firstContainer = NULL; + wxRichTextParagraphLayoutBox* commonAncestor = nullptr; + wxRichTextParagraphLayoutBox* otherContainer = nullptr; + wxRichTextParagraphLayoutBox* firstContainer = nullptr; // Check for dragging across multiple containers long position2 = 0; - wxRichTextObject* hitObj2 = NULL, *contextObj2 = NULL; + wxRichTextObject* hitObj2 = nullptr, *contextObj2 = nullptr; int hit2 = GetBuffer().HitTest(dc, context, GetUnscaledPoint(logicalPt), position2, & hitObj2, & contextObj2, 0); if (hit2 != wxRICHTEXT_HITTEST_NONE && hitObj2 && hitObj != hitObj2) { @@ -1030,8 +1030,8 @@ void wxRichTextCtrl::OnRightClick(wxMouseEvent& event) long position = 0; wxPoint logicalPt = event.GetLogicalPosition(dc); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); int hit = GetFocusObject()->HitTest(dc, context, GetUnscaledPoint(logicalPt), position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); @@ -1080,8 +1080,8 @@ void wxRichTextCtrl::OnLeftDClick(wxMouseEvent& event) long position = 0; wxPoint logicalPt = event.GetLogicalPosition(dc); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); int hit = GetFocusObject()->HitTest(dc, context, GetUnscaledPoint(logicalPt), position, & hitObj, & contextObj, wxRICHTEXT_HITTEST_HONOUR_ATOMIC); wxUnusedVar(hit); @@ -1097,7 +1097,7 @@ void wxRichTextCtrl::OnLeftDClick(wxMouseEvent& event) wxRichTextSelection oldSelection = m_selection; m_selectionAnchor = from-1; - m_selectionAnchorObject = NULL; + m_selectionAnchorObject = nullptr; m_selection.Set(wxRichTextRange(from, to-1), GetFocusObject()); RefreshForSelectionChange(oldSelection, m_selection); } @@ -1304,7 +1304,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) wxRichTextRange numberedListRange = FindRangeForList(newPos+1, isNumberedList); if (isNumberedList && numberedListRange != wxRichTextRange(-1, -1)) { - NumberList(numberedListRange, NULL, wxRICHTEXT_SETSTYLE_RENUMBER|wxRICHTEXT_SETSTYLE_WITH_UNDO); + NumberList(numberedListRange, nullptr, wxRICHTEXT_SETSTYLE_RENUMBER|wxRICHTEXT_SETSTYLE_WITH_UNDO); } EndBatchUndo(); @@ -1478,7 +1478,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) int promoteBy = event.ShiftDown() ? 1 : -1; - PromoteList(promoteBy, range, NULL); + PromoteList(promoteBy, range, nullptr); GetEventHandler()->ProcessEvent(cmdEvent); @@ -1560,7 +1560,7 @@ bool wxRichTextCtrl::ProcessBackKey(wxKeyEvent& event, int flags) wxRichTextParagraph* newPara = wxDynamicCast(para->Clone(), wxRichTextParagraph); newPara->GetAttributes().SetBulletStyle(newPara->GetAttributes().GetBulletStyle() | wxTEXT_ATTR_BULLET_STYLE_CONTINUATION); - wxRichTextAction* action = new wxRichTextAction(NULL, _("Remove Bullet"), wxRICHTEXT_CHANGE_STYLE, & GetBuffer(), GetFocusObject(), this); + wxRichTextAction* action = new wxRichTextAction(nullptr, _("Remove Bullet"), wxRICHTEXT_CHANGE_STYLE, & GetBuffer(), GetFocusObject(), this); action->SetRange(newPara->GetRange()); action->SetPosition(GetCaretPosition()); action->GetNewParagraphs().AppendChild(newPara); @@ -1575,7 +1575,7 @@ bool wxRichTextCtrl::ProcessBackKey(wxKeyEvent& event, int flags) wxRichTextRange numberedListRange = FindRangeForList(m_caretPosition, isNumberedList); if (isNumberedList && numberedListRange != wxRichTextRange(-1, -1)) { - NumberList(numberedListRange, NULL, wxRICHTEXT_SETSTYLE_RENUMBER|wxRICHTEXT_SETSTYLE_WITH_UNDO); + NumberList(numberedListRange, nullptr, wxRICHTEXT_SETSTYLE_RENUMBER|wxRICHTEXT_SETSTYLE_WITH_UNDO); } Update(); @@ -2139,8 +2139,8 @@ bool wxRichTextCtrl::MoveRight(int noPositions, int flags) PrepareDC(dc); dc.SetFont(GetFont()); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); int hitTest = GetBuffer().HitTest(dc, context, pt, newPos, & hitObj, & contextObj, hitTestFlags); @@ -2336,8 +2336,8 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags) PrepareDC(dc); dc.SetFont(GetFont()); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); int hitTest = container->HitTest(dc, context, pt, newPos, & hitObj, & contextObj, hitTestFlags); @@ -3140,7 +3140,7 @@ void wxRichTextCtrl::SelectNone() RefreshForSelectionChange(oldSelection, m_selection); } m_selectionAnchor = -2; - m_selectionAnchorObject = NULL; + m_selectionAnchorObject = nullptr; m_selectionState = wxRichTextCtrlSelectionState_Normal; } @@ -3243,8 +3243,8 @@ wxRichTextCtrl::HitTest(const wxPoint& pt, // so convert wxPoint pt2 = GetLogicalPoint(pt); - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(const_cast(&GetBuffer())); int hit = const_cast(this)->GetFocusObject()->HitTest(dc, context, pt2, *pos, &hitObj, &contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS); @@ -3267,7 +3267,7 @@ wxRichTextCtrl::FindContainerAtPoint(const wxPoint& pt, long& position, int& hit wxPoint logicalPt = GetLogicalPoint(pt); - wxRichTextObject* contextObj = NULL; + wxRichTextObject* contextObj = nullptr; wxRichTextDrawingContext context(& GetBuffer()); hit = GetBuffer().HitTest(dc, context, GetUnscaledPoint(logicalPt), position, &hitObj, &contextObj, flags); wxRichTextParagraphLayoutBox* container = wxDynamicCast(contextObj, wxRichTextParagraphLayoutBox); @@ -3404,7 +3404,7 @@ wxRichTextBox* wxRichTextCtrl::WriteTextBox(const wxRichTextAttr& textAttr) textBox->SetAttributes(textAttr); textBox->SetParent(& GetBuffer()); // set parent temporarily for AddParagraph to use correct style textBox->AddParagraph(wxEmptyString); - textBox->SetParent(NULL); + textBox->SetParent(nullptr); // If the box has an invalid foreground colour, its text will mimic any upstream value (see #15224) if (!textBox->GetAttributes().GetTextColour().IsOk()) @@ -3432,7 +3432,7 @@ wxRichTextTable* wxRichTextCtrl::WriteTable(int rows, int cols, const wxRichText wxASSERT(rows > 0 && cols > 0); if (rows <= 0 || cols <= 0) - return NULL; + return nullptr; wxRichTextTable* table = new wxRichTextTable; table->SetAttributes(tableAttr); @@ -3441,7 +3441,7 @@ wxRichTextTable* wxRichTextCtrl::WriteTable(int rows, int cols, const wxRichText table->CreateTable(rows, cols); - table->SetParent(NULL); + table->SetParent(nullptr); // If cells have an invalid foreground colour, their text will mimic any upstream value (see #15224) wxRichTextAttr attr = cellAttr; @@ -3654,7 +3654,7 @@ void wxRichTextCtrl::SetSelection(long from, long to) wxRichTextSelection oldSelection = m_selection; m_selectionAnchor = from-1; - m_selectionAnchorObject = NULL; + m_selectionAnchorObject = nullptr; m_selection.Set(wxRichTextRange(from, to-1), GetFocusObject()); m_caretPosition = wxMax(-1, to-1); @@ -3926,8 +3926,8 @@ int wxRichTextCtrl::PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool add m_contextMenuPropertiesInfo.Clear(); long position = 0; - wxRichTextObject* hitObj = NULL; - wxRichTextObject* contextObj = NULL; + wxRichTextObject* hitObj = nullptr; + wxRichTextObject* contextObj = nullptr; if (pt != wxDefaultPosition) { wxPoint logicalPt = GetLogicalPoint(ScreenToClient(pt)); @@ -3957,7 +3957,7 @@ int wxRichTextCtrl::PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool add else { if (addPropertyCommands) - m_contextMenuPropertiesInfo.AddItems(this, GetFocusObject(), NULL); + m_contextMenuPropertiesInfo.AddItems(this, GetFocusObject(), nullptr); } } else @@ -3979,7 +3979,7 @@ int wxRichTextCtrl::PrepareContextMenu(wxMenu* menu, const wxPoint& pt, bool add else { if (addPropertyCommands) - m_contextMenuPropertiesInfo.AddItems(this, GetFocusObject(), NULL); + m_contextMenuPropertiesInfo.AddItems(this, GetFocusObject(), nullptr); } } @@ -4996,7 +4996,7 @@ bool wxRichTextCtrl::SetFocusObject(wxRichTextParagraphLayoutBox* obj, bool setC { m_selection.Reset(); m_selectionAnchor = -2; - m_selectionAnchorObject = NULL; + m_selectionAnchorObject = nullptr; m_selectionState = wxRichTextCtrlSelectionState_Normal; long pos = -1; @@ -5104,11 +5104,11 @@ void wxRichTextCtrl::OnDrop(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResu #if wxUSE_DRAG_AND_DROP bool wxRichTextDropSource::GiveFeedback(wxDragResult WXUNUSED(effect)) { - wxCHECK_MSG(m_rtc, false, wxT("NULL m_rtc")); + wxCHECK_MSG(m_rtc, false, wxT("null m_rtc")); long position = 0; int hit = 0; - wxRichTextObject* hitObj = NULL; + wxRichTextObject* hitObj = nullptr; wxRichTextParagraphLayoutBox* container = m_rtc->FindContainerAtPoint(m_rtc->GetUnscaledPoint(m_rtc->ScreenToClient(wxGetMousePosition())), position, hit, hitObj); if (!(hit & wxRICHTEXT_HITTEST_NONE) && container && container->AcceptsFocus()) @@ -5343,7 +5343,7 @@ void wxRichTextCaret::Init() m_xOld = m_yOld = -1; - m_richTextCtrl = NULL; + m_richTextCtrl = nullptr; m_needsUpdate = false; m_flashOn = true; } diff --git a/src/richtext/richtextfontpage.cpp b/src/richtext/richtextfontpage.cpp index 2951b64698..0230966901 100644 --- a/src/richtext/richtextfontpage.cpp +++ b/src/richtext/richtextfontpage.cpp @@ -77,30 +77,30 @@ void wxRichTextFontPage::Init() m_bgColourPresent = false; ////@begin wxRichTextFontPage member initialisation - m_innerSizer = NULL; - m_faceTextCtrl = NULL; - m_sizeTextCtrl = NULL; - m_fontSizeSpinButtons = NULL; - m_sizeUnitsCtrl = NULL; - m_fontListBoxParent = NULL; - m_faceListBox = NULL; - m_sizeListBox = NULL; - m_styleCtrl = NULL; - m_weightCtrl = NULL; - m_underliningCtrl = NULL; - m_textColourLabel = NULL; - m_colourCtrl = NULL; - m_bgColourLabel = NULL; - m_bgColourCtrl = NULL; - m_strikethroughCtrl = NULL; - m_capitalsCtrl = NULL; - m_smallCapitalsCtrl = NULL; - m_superscriptCtrl = NULL; - m_subscriptCtrl = NULL; - m_rtlParentSizer = NULL; - m_rtlCtrl = NULL; - m_suppressHyphenationCtrl = NULL; - m_previewCtrl = NULL; + m_innerSizer = nullptr; + m_faceTextCtrl = nullptr; + m_sizeTextCtrl = nullptr; + m_fontSizeSpinButtons = nullptr; + m_sizeUnitsCtrl = nullptr; + m_fontListBoxParent = nullptr; + m_faceListBox = nullptr; + m_sizeListBox = nullptr; + m_styleCtrl = nullptr; + m_weightCtrl = nullptr; + m_underliningCtrl = nullptr; + m_textColourLabel = nullptr; + m_colourCtrl = nullptr; + m_bgColourLabel = nullptr; + m_bgColourCtrl = nullptr; + m_strikethroughCtrl = nullptr; + m_capitalsCtrl = nullptr; + m_smallCapitalsCtrl = nullptr; + m_superscriptCtrl = nullptr; + m_subscriptCtrl = nullptr; + m_rtlParentSizer = nullptr; + m_rtlCtrl = nullptr; + m_suppressHyphenationCtrl = nullptr; + m_previewCtrl = nullptr; ////@end wxRichTextFontPage member initialisation } diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index 032b08933e..52a9d289f6 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -88,14 +88,14 @@ wxEND_EVENT_TABLE() IMPLEMENT_HELP_PROVISION(wxRichTextFormattingDialog) -wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = NULL; +wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = nullptr; wxColourData wxRichTextFormattingDialog::sm_colourData; void wxRichTextFormattingDialog::Init() { - m_styleDefinition = NULL; - m_styleSheet = NULL; - m_object = NULL; + m_styleDefinition = nullptr; + m_styleSheet = nullptr; + m_object = nullptr; m_options = 0; m_ignoreUpdates = false; } @@ -282,7 +282,7 @@ wxWindow* wxRichTextFormattingDialog::FindPage(wxClassInfo* info) const if (w && w->GetClassInfo() == info) return w; } - return NULL; + return nullptr; } @@ -306,7 +306,7 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat { wxString title; wxPanel* panel = CreatePage(pageId, title, dialog); - wxASSERT( panel != NULL ); + wxASSERT( panel != nullptr ); if (panel) { int imageIndex = GetPageImage(pageId); @@ -324,7 +324,7 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat /// Create a page, given a page identifier wxPanel* wxRichTextFormattingDialogFactory::CreatePage(int page, wxString& title, wxRichTextFormattingDialog* dialog) { - wxPanel* panel = NULL; + wxPanel* panel = nullptr; if (page == wxRICHTEXT_FORMAT_STYLE_EDITOR) { @@ -447,7 +447,7 @@ bool wxRichTextFormattingDialogFactory::CreateButtons(wxRichTextFormattingDialog // Invoke help for the dialog bool wxRichTextFormattingDialogFactory::ShowHelp(int WXUNUSED(page), wxRichTextFormattingDialog* dialog) { - wxRichTextDialogPage* window = NULL; + wxRichTextDialogPage* window = nullptr; int sel = dialog->GetBookCtrl()->GetSelection(); if (sel != -1) window = wxDynamicCast(dialog->GetBookCtrl()->GetPage(sel), wxRichTextDialogPage); @@ -476,7 +476,7 @@ class wxRichTextFormattingDialogModule: public wxModule public: wxRichTextFormattingDialogModule() {} bool OnInit() override { wxRichTextFormattingDialog::SetFormattingDialogFactory(new wxRichTextFormattingDialogFactory); return true; } - void OnExit() override { wxRichTextFormattingDialog::SetFormattingDialogFactory(NULL); } + void OnExit() override { wxRichTextFormattingDialog::SetFormattingDialogFactory(nullptr); } }; wxIMPLEMENT_DYNAMIC_CLASS(wxRichTextFormattingDialogModule, wxModule); @@ -562,7 +562,7 @@ wxRichTextAttr* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win) if (dialog) return & dialog->GetAttributes(); else - return NULL; + return nullptr; } #if 0 @@ -573,7 +573,7 @@ wxRichTextAttr* wxRichTextFormattingDialog::GetDialogResetAttributes(wxWindow* w if (dialog) return & dialog->GetResetAttributes(); else - return NULL; + return nullptr; } #endif @@ -584,7 +584,7 @@ wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition( if (dialog) return dialog->GetStyleDefinition(); else - return NULL; + return nullptr; } void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox, wxArrayInt* units) @@ -751,7 +751,7 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) if (event.LeftDown()) { wxWindow* parent = GetParent(); - while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame)) + while (parent != nullptr && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame)) parent = parent->GetParent(); wxRichTextFormattingDialog* dlg = wxDynamicCast(parent, wxRichTextFormattingDialog); diff --git a/src/richtext/richtexthtml.cpp b/src/richtext/richtexthtml.cpp index 953980f75d..1a2ac53b73 100644 --- a/src/richtext/richtexthtml.cpp +++ b/src/richtext/richtexthtml.cpp @@ -34,7 +34,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRichTextHTMLHandler, wxRichTextFileHandler); int wxRichTextHTMLHandler::sm_fileCounter = 1; wxRichTextHTMLHandler::wxRichTextHTMLHandler(const wxString& name, const wxString& ext, int type) - : wxRichTextFileHandler(name, ext, type), m_buffer(NULL), m_font(false), m_inTable(false) + : wxRichTextFileHandler(name, ext, type), m_buffer(nullptr), m_font(false), m_inTable(false) { m_fontSizeMapping.Add(8); m_fontSizeMapping.Add(10); @@ -75,8 +75,8 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& buffer->Defragment(context); #if wxUSE_UNICODE - wxCSConv* customEncoding = NULL; - wxMBConv* conv = NULL; + wxCSConv* customEncoding = nullptr; + wxMBConv* conv = nullptr; if (!GetEncoding().IsEmpty()) { customEncoding = new wxCSConv(GetEncoding()); @@ -116,7 +116,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& while (node) { wxRichTextParagraph* para = wxDynamicCast(node->GetData(), wxRichTextParagraph); - wxASSERT (para != NULL); + wxASSERT (para != nullptr); if (para) { @@ -177,7 +177,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& delete customEncoding; #endif - m_buffer = NULL; + m_buffer = nullptr; return true; } diff --git a/src/richtext/richtextindentspage.cpp b/src/richtext/richtextindentspage.cpp index ae0d6576c1..75180a4c3b 100644 --- a/src/richtext/richtextindentspage.cpp +++ b/src/richtext/richtextindentspage.cpp @@ -67,20 +67,20 @@ void wxRichTextIndentsSpacingPage::Init() m_dontUpdate = false; ////@begin wxRichTextIndentsSpacingPage member initialisation - m_alignmentLeft = NULL; - m_alignmentRight = NULL; - m_alignmentJustified = NULL; - m_alignmentCentred = NULL; - m_alignmentIndeterminate = NULL; - m_indentLeft = NULL; - m_indentLeftFirst = NULL; - m_indentRight = NULL; - m_outlineLevelCtrl = NULL; - m_spacingBefore = NULL; - m_spacingAfter = NULL; - m_spacingLine = NULL; - m_pageBreakCtrl = NULL; - m_previewCtrl = NULL; + m_alignmentLeft = nullptr; + m_alignmentRight = nullptr; + m_alignmentJustified = nullptr; + m_alignmentCentred = nullptr; + m_alignmentIndeterminate = nullptr; + m_indentLeft = nullptr; + m_indentLeftFirst = nullptr; + m_indentRight = nullptr; + m_outlineLevelCtrl = nullptr; + m_spacingBefore = nullptr; + m_spacingAfter = nullptr; + m_spacingLine = nullptr; + m_pageBreakCtrl = nullptr; + m_previewCtrl = nullptr; ////@end wxRichTextIndentsSpacingPage member initialisation } diff --git a/src/richtext/richtextliststylepage.cpp b/src/richtext/richtextliststylepage.cpp index 4296f566bb..7b85d63cc9 100644 --- a/src/richtext/richtextliststylepage.cpp +++ b/src/richtext/richtextliststylepage.cpp @@ -138,27 +138,27 @@ void wxRichTextListStylePage::Init() m_currentLevel = 1; ////@begin wxRichTextListStylePage member initialisation - m_levelCtrl = NULL; - m_styleListBox = NULL; - m_periodCtrl = NULL; - m_parenthesesCtrl = NULL; - m_rightParenthesisCtrl = NULL; - m_bulletAlignmentCtrl = NULL; - m_symbolCtrl = NULL; - m_symbolFontCtrl = NULL; - m_bulletNameCtrl = NULL; - m_alignmentLeft = NULL; - m_alignmentRight = NULL; - m_alignmentJustified = NULL; - m_alignmentCentred = NULL; - m_alignmentIndeterminate = NULL; - m_indentLeft = NULL; - m_indentLeftFirst = NULL; - m_indentRight = NULL; - m_spacingBefore = NULL; - m_spacingAfter = NULL; - m_spacingLine = NULL; - m_previewCtrl = NULL; + m_levelCtrl = nullptr; + m_styleListBox = nullptr; + m_periodCtrl = nullptr; + m_parenthesesCtrl = nullptr; + m_rightParenthesisCtrl = nullptr; + m_bulletAlignmentCtrl = nullptr; + m_symbolCtrl = nullptr; + m_symbolFontCtrl = nullptr; + m_bulletNameCtrl = nullptr; + m_alignmentLeft = nullptr; + m_alignmentRight = nullptr; + m_alignmentJustified = nullptr; + m_alignmentCentred = nullptr; + m_alignmentIndeterminate = nullptr; + m_indentLeft = nullptr; + m_indentLeftFirst = nullptr; + m_indentRight = nullptr; + m_spacingBefore = nullptr; + m_spacingAfter = nullptr; + m_spacingLine = nullptr; + m_previewCtrl = nullptr; ////@end wxRichTextListStylePage member initialisation } @@ -880,7 +880,7 @@ wxRichTextAttr* wxRichTextListStylePage::GetAttributesForSelection() if (def) return def->GetLevelAttributes(value-1); else - return NULL; + return nullptr; } /// Just transfer from the window and update the preview diff --git a/src/richtext/richtextmarginspage.cpp b/src/richtext/richtextmarginspage.cpp index 51a3145cc4..960cdd5f23 100644 --- a/src/richtext/richtextmarginspage.cpp +++ b/src/richtext/richtextmarginspage.cpp @@ -122,30 +122,30 @@ void wxRichTextMarginsPage::Init() m_ignoreUpdates = false; ////@begin wxRichTextMarginsPage member initialisation - m_leftMarginCheckbox = NULL; - m_marginLeft = NULL; - m_unitsMarginLeft = NULL; - m_rightMarginCheckbox = NULL; - m_marginRight = NULL; - m_unitsMarginRight = NULL; - m_topMarginCheckbox = NULL; - m_marginTop = NULL; - m_unitsMarginTop = NULL; - m_bottomMarginCheckbox = NULL; - m_marginBottom = NULL; - m_unitsMarginBottom = NULL; - m_leftPaddingCheckbox = NULL; - m_paddingLeft = NULL; - m_unitsPaddingLeft = NULL; - m_rightPaddingCheckbox = NULL; - m_paddingRight = NULL; - m_unitsPaddingRight = NULL; - m_topPaddingCheckbox = NULL; - m_paddingTop = NULL; - m_unitsPaddingTop = NULL; - m_bottomPaddingCheckbox = NULL; - m_paddingBottom = NULL; - m_unitsPaddingBottom = NULL; + m_leftMarginCheckbox = nullptr; + m_marginLeft = nullptr; + m_unitsMarginLeft = nullptr; + m_rightMarginCheckbox = nullptr; + m_marginRight = nullptr; + m_unitsMarginRight = nullptr; + m_topMarginCheckbox = nullptr; + m_marginTop = nullptr; + m_unitsMarginTop = nullptr; + m_bottomMarginCheckbox = nullptr; + m_marginBottom = nullptr; + m_unitsMarginBottom = nullptr; + m_leftPaddingCheckbox = nullptr; + m_paddingLeft = nullptr; + m_unitsPaddingLeft = nullptr; + m_rightPaddingCheckbox = nullptr; + m_paddingRight = nullptr; + m_unitsPaddingRight = nullptr; + m_topPaddingCheckbox = nullptr; + m_paddingTop = nullptr; + m_unitsPaddingTop = nullptr; + m_bottomPaddingCheckbox = nullptr; + m_paddingBottom = nullptr; + m_unitsPaddingBottom = nullptr; ////@end wxRichTextMarginsPage member initialisation } diff --git a/src/richtext/richtextprint.cpp b/src/richtext/richtextprint.cpp index 9c7b5ee496..6fd7f88842 100644 --- a/src/richtext/richtextprint.cpp +++ b/src/richtext/richtextprint.cpp @@ -70,14 +70,14 @@ void wxRichTextPrintout::OnPreparePrinting() int yOffset = 0; - wxRichTextLine* lastLine = NULL; + wxRichTextLine* lastLine = nullptr; wxRichTextObjectList::compatibility_iterator node = GetRichTextBuffer()->GetChildren().GetFirst(); while (node) { // child is a paragraph wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - wxASSERT (child != NULL); + wxASSERT (child != nullptr); if (child) { wxRichTextLineVector::const_iterator it = child->GetLines().begin(); @@ -447,11 +447,11 @@ wxRichTextPrinting::wxRichTextPrinting(const wxString& name, wxWindow *parentWin : m_title(name) , m_previewRect(100, 100, 800, 800) { - m_richTextBufferPrinting = NULL; - m_richTextBufferPreview = NULL; + m_richTextBufferPrinting = nullptr; + m_richTextBufferPreview = nullptr; m_parentWindow = parentWindow; - m_printData = NULL; + m_printData = nullptr; m_pageSetupData = new wxPageSetupDialogData; m_pageSetupData->EnableMargins(true); @@ -469,7 +469,7 @@ wxRichTextPrinting::~wxRichTextPrinting() wxPrintData *wxRichTextPrinting::GetPrintData() { - if (m_printData == NULL) + if (m_printData == nullptr) m_printData = new wxPrintData(); return m_printData; } @@ -491,7 +491,7 @@ void wxRichTextPrinting::SetRichTextBufferPrinting(wxRichTextBuffer* buf) if (m_richTextBufferPrinting) { delete m_richTextBufferPrinting; - m_richTextBufferPrinting = NULL; + m_richTextBufferPrinting = nullptr; } m_richTextBufferPrinting = buf; } @@ -501,7 +501,7 @@ void wxRichTextPrinting::SetRichTextBufferPreview(wxRichTextBuffer* buf) if (m_richTextBufferPreview) { delete m_richTextBufferPreview; - m_richTextBufferPreview = NULL; + m_richTextBufferPreview = nullptr; } m_richTextBufferPreview = buf; } @@ -513,7 +513,7 @@ bool wxRichTextPrinting::PreviewFile(const wxString& richTextFile) if (!m_richTextBufferPreview->LoadFile(richTextFile)) { - SetRichTextBufferPreview(NULL); + SetRichTextBufferPreview(nullptr); return false; } else @@ -549,7 +549,7 @@ bool wxRichTextPrinting::PrintFile(const wxString& richTextFile, bool showPrintD if (!m_richTextBufferPrinting->LoadFile(richTextFile)) { - SetRichTextBufferPrinting(NULL); + SetRichTextBufferPrinting(nullptr); return false; } diff --git a/src/richtext/richtextsizepage.cpp b/src/richtext/richtextsizepage.cpp index 7ace91a0bb..5e361a1b1e 100644 --- a/src/richtext/richtextsizepage.cpp +++ b/src/richtext/richtextsizepage.cpp @@ -133,68 +133,68 @@ void wxRichTextSizePage::Init() { ////@begin wxRichTextSizePage member initialisation m_positionMode = 0; - m_parentSizer = NULL; - m_floatingAlignmentSizer = NULL; - m_floatingSizer = NULL; - m_float = NULL; - m_alignmentSizer = NULL; - m_verticalAlignmentCheckbox = NULL; - m_verticalAlignmentComboBox = NULL; - m_sizeSizer = NULL; - m_widthSizer = NULL; - m_widthCheckbox = NULL; - m_widthLabel = NULL; - m_width = NULL; - m_unitsW = NULL; - m_heightSizer = NULL; - m_heightCheckbox = NULL; - m_heightLabel = NULL; - m_height = NULL; - m_unitsH = NULL; - m_minWidthCheckbox = NULL; - m_minWidthSizer = NULL; - m_minWidth = NULL; - m_unitsMinW = NULL; - m_minHeightCheckbox = NULL; - m_minHeightSizer = NULL; - m_minHeight = NULL; - m_unitsMinH = NULL; - m_maxWidthCheckbox = NULL; - m_maxWidthSizer = NULL; - m_maxWidth = NULL; - m_unitsMaxW = NULL; - m_maxHeightCheckbox = NULL; - m_maxHeightSizer = NULL; - m_maxHeight = NULL; - m_unitsMaxH = NULL; - m_positionControls = NULL; - m_moveObjectParentSizer = NULL; - m_positionModeSizer = NULL; - m_positionModeCtrl = NULL; - m_positionGridSizer = NULL; - m_leftSizer = NULL; - m_positionLeftCheckbox = NULL; - m_leftLabel = NULL; - m_left = NULL; - m_unitsLeft = NULL; - m_topSizer = NULL; - m_positionTopCheckbox = NULL; - m_topLabel = NULL; - m_top = NULL; - m_unitsTop = NULL; - m_rightSizer = NULL; - m_positionRightCheckbox = NULL; - m_rightLabel = NULL; - m_rightPositionSizer = NULL; - m_right = NULL; - m_unitsRight = NULL; - m_bottomSizer = NULL; - m_positionBottomCheckbox = NULL; - m_bottomLabel = NULL; - m_bottomPositionSizer = NULL; - m_bottom = NULL; - m_unitsBottom = NULL; - m_moveObjectSizer = NULL; + m_parentSizer = nullptr; + m_floatingAlignmentSizer = nullptr; + m_floatingSizer = nullptr; + m_float = nullptr; + m_alignmentSizer = nullptr; + m_verticalAlignmentCheckbox = nullptr; + m_verticalAlignmentComboBox = nullptr; + m_sizeSizer = nullptr; + m_widthSizer = nullptr; + m_widthCheckbox = nullptr; + m_widthLabel = nullptr; + m_width = nullptr; + m_unitsW = nullptr; + m_heightSizer = nullptr; + m_heightCheckbox = nullptr; + m_heightLabel = nullptr; + m_height = nullptr; + m_unitsH = nullptr; + m_minWidthCheckbox = nullptr; + m_minWidthSizer = nullptr; + m_minWidth = nullptr; + m_unitsMinW = nullptr; + m_minHeightCheckbox = nullptr; + m_minHeightSizer = nullptr; + m_minHeight = nullptr; + m_unitsMinH = nullptr; + m_maxWidthCheckbox = nullptr; + m_maxWidthSizer = nullptr; + m_maxWidth = nullptr; + m_unitsMaxW = nullptr; + m_maxHeightCheckbox = nullptr; + m_maxHeightSizer = nullptr; + m_maxHeight = nullptr; + m_unitsMaxH = nullptr; + m_positionControls = nullptr; + m_moveObjectParentSizer = nullptr; + m_positionModeSizer = nullptr; + m_positionModeCtrl = nullptr; + m_positionGridSizer = nullptr; + m_leftSizer = nullptr; + m_positionLeftCheckbox = nullptr; + m_leftLabel = nullptr; + m_left = nullptr; + m_unitsLeft = nullptr; + m_topSizer = nullptr; + m_positionTopCheckbox = nullptr; + m_topLabel = nullptr; + m_top = nullptr; + m_unitsTop = nullptr; + m_rightSizer = nullptr; + m_positionRightCheckbox = nullptr; + m_rightLabel = nullptr; + m_rightPositionSizer = nullptr; + m_right = nullptr; + m_unitsRight = nullptr; + m_bottomSizer = nullptr; + m_positionBottomCheckbox = nullptr; + m_bottomLabel = nullptr; + m_bottomPositionSizer = nullptr; + m_bottom = nullptr; + m_unitsBottom = nullptr; + m_moveObjectSizer = nullptr; ////@end wxRichTextSizePage member initialisation } @@ -791,7 +791,7 @@ bool wxRichTextSizePage::TransferDataToWindow() } } - wxRichTextImage* imageObj = NULL; + wxRichTextImage* imageObj = nullptr; if (dialog) imageObj = wxDynamicCast(dialog->GetObject(), wxRichTextImage); diff --git a/src/richtext/richtextstyledlg.cpp b/src/richtext/richtextstyledlg.cpp index eec303cec1..f8a7196117 100644 --- a/src/richtext/richtextstyledlg.cpp +++ b/src/richtext/richtextstyledlg.cpp @@ -81,32 +81,32 @@ wxRichTextStyleOrganiserDialog::wxRichTextStyleOrganiserDialog( int flags, wxRic void wxRichTextStyleOrganiserDialog::Init() { - m_richTextStyleSheet = NULL; - m_richTextCtrl = NULL; + m_richTextStyleSheet = nullptr; + m_richTextCtrl = nullptr; m_dontUpdate = false; m_flags = 0; m_restartNumbering = true; ////@begin wxRichTextStyleOrganiserDialog member initialisation - m_innerSizer = NULL; - m_buttonSizerParent = NULL; - m_stylesListBox = NULL; - m_previewCtrl = NULL; - m_buttonSizer = NULL; - m_newCharacter = NULL; - m_newParagraph = NULL; - m_newList = NULL; - m_newBox = NULL; - m_applyStyle = NULL; - m_renameStyle = NULL; - m_editStyle = NULL; - m_deleteStyle = NULL; - m_closeButton = NULL; - m_bottomButtonSizer = NULL; - m_restartNumberingCtrl = NULL; - m_stdButtonSizer = NULL; - m_okButton = NULL; - m_cancelButton = NULL; + m_innerSizer = nullptr; + m_buttonSizerParent = nullptr; + m_stylesListBox = nullptr; + m_previewCtrl = nullptr; + m_buttonSizer = nullptr; + m_newCharacter = nullptr; + m_newParagraph = nullptr; + m_newList = nullptr; + m_newBox = nullptr; + m_applyStyle = nullptr; + m_renameStyle = nullptr; + m_editStyle = nullptr; + m_deleteStyle = nullptr; + m_closeButton = nullptr; + m_bottomButtonSizer = nullptr; + m_restartNumberingCtrl = nullptr; + m_stdButtonSizer = nullptr; + m_okButton = nullptr; + m_cancelButton = nullptr; ////@end wxRichTextStyleOrganiserDialog member initialisation } @@ -497,7 +497,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); text.Replace(wxT("\n"), wxEmptyString); m_previewCtrl->WriteText(text); m_previewCtrl->EndStyle(); - m_previewCtrl->SetFocusObject(NULL); // Set the focus back to the main buffer + m_previewCtrl->SetFocusObject(nullptr); // Set the focus back to the main buffer m_previewCtrl->SetInsertionPointEnd(); m_previewCtrl->SetDefaultStyle(wxRichTextAttr()); } diff --git a/src/richtext/richtextstylepage.cpp b/src/richtext/richtextstylepage.cpp index 35aac07bb4..0b981847ed 100644 --- a/src/richtext/richtextstylepage.cpp +++ b/src/richtext/richtextstylepage.cpp @@ -57,9 +57,9 @@ void wxRichTextStylePage::Init() m_nameIsEditable = false; ////@begin wxRichTextStylePage member initialisation - m_styleName = NULL; - m_basedOn = NULL; - m_nextStyle = NULL; + m_styleName = nullptr; + m_basedOn = nullptr; + m_nextStyle = nullptr; ////@end wxRichTextStylePage member initialisation } @@ -313,7 +313,7 @@ wxIcon wxRichTextStylePage::GetIconResource( const wxString& name ) void wxRichTextStylePage::OnNextStyleUpdate( wxUpdateUIEvent& event ) { wxRichTextStyleDefinition* def = wxRichTextFormattingDialog::GetDialogStyleDefinition(this); - event.Enable(wxDynamicCast(def, wxRichTextParagraphStyleDefinition) != NULL); + event.Enable(wxDynamicCast(def, wxRichTextParagraphStyleDefinition) != nullptr); } #endif // wxUSE_RICHTEXT diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index d99fd039ab..cbb73fa810 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -86,7 +86,7 @@ wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTex def = sheet->FindStyle(baseStyleName); } else - def = NULL; + def = nullptr; } wxRichTextAttr attr; @@ -94,7 +94,7 @@ wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTex while (node) { wxRichTextStyleDefinition* nodeDef = (wxRichTextStyleDefinition*) node->GetData(); - attr.Apply(nodeDef->GetStyle(), NULL); + attr.Apply(nodeDef->GetStyle(), nullptr); node = node->GetNext(); } @@ -170,7 +170,7 @@ const wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) c if (i >= 0 && i < 10) return & m_levelStyles[i]; else - return NULL; + return nullptr; } wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) @@ -179,7 +179,7 @@ wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) if (i >= 0 && i < 10) return & m_levelStyles[i]; else - return NULL; + return nullptr; } /// Convenience function for setting the major attributes for a list level specification @@ -299,15 +299,15 @@ wxRichTextStyleSheet::~wxRichTextStyleSheet() if (m_previousSheet) m_previousSheet->m_nextSheet = m_nextSheet; - m_previousSheet = NULL; - m_nextSheet = NULL; + m_previousSheet = nullptr; + m_nextSheet = nullptr; } /// Initialisation void wxRichTextStyleSheet::Init() { - m_previousSheet = NULL; - m_nextSheet = NULL; + m_previousSheet = nullptr; + m_nextSheet = nullptr; } /// Add a definition to one of the style lists @@ -361,7 +361,7 @@ wxRichTextStyleDefinition* wxRichTextStyleSheet::FindStyle(const wxList& list, c if (m_nextSheet && recurse) return m_nextSheet->FindStyle(list, name, recurse); - return NULL; + return nullptr; } /// Delete all styles @@ -411,8 +411,8 @@ void wxRichTextStyleSheet::Unlink() if (m_nextSheet) m_nextSheet->m_previousSheet = m_previousSheet; - m_previousSheet = NULL; - m_nextSheet = NULL; + m_previousSheet = nullptr; + m_nextSheet = nullptr; } /// Add a definition to the character style list @@ -484,7 +484,7 @@ wxRichTextStyleDefinition* wxRichTextStyleSheet::FindStyle(const wxString& name, if (boxDef) return boxDef; - return NULL; + return nullptr; } /// Copy @@ -593,10 +593,10 @@ wxString wxRichTextStyleListBox::OnGetItem(size_t n) const wxRichTextStyleDefinition* wxRichTextStyleListBox::GetStyle(size_t i) const { if (!GetStyleSheet()) - return NULL; + return nullptr; if (i >= m_styleNames.GetCount() /* || i < 0 */ ) - return NULL; + return nullptr; wxString styleType = wxGetRichTextStyleType(m_styleNames[i]); wxString style = wxGetRichTextStyle(m_styleNames[i]); @@ -1168,7 +1168,7 @@ wxRichTextStyleSheet* wxRichTextStyleListCtrl::GetStyleSheet() const if (m_styleListBox) return m_styleListBox->GetStyleSheet(); else - return NULL; + return nullptr; } /// Associates the control with a wxRichTextCtrl @@ -1183,7 +1183,7 @@ wxRichTextCtrl* wxRichTextStyleListCtrl::GetRichTextCtrl() const if (m_styleListBox) return m_styleListBox->GetRichTextCtrl(); else - return NULL; + return nullptr; } /// Set/get the style type to display diff --git a/src/richtext/richtextsymboldlg.cpp b/src/richtext/richtextsymboldlg.cpp index e3f2bea715..cef53330a0 100644 --- a/src/richtext/richtextsymboldlg.cpp +++ b/src/richtext/richtextsymboldlg.cpp @@ -354,17 +354,17 @@ void wxSymbolPickerDialog::Init() { ////@begin wxSymbolPickerDialog member initialisation m_fromUnicode = true; - m_fontCtrl = NULL; + m_fontCtrl = nullptr; #if defined(__UNICODE__) - m_subsetCtrl = NULL; + m_subsetCtrl = nullptr; #endif - m_symbolsCtrl = NULL; - m_symbolStaticCtrl = NULL; - m_characterCodeCtrl = NULL; + m_symbolsCtrl = nullptr; + m_symbolStaticCtrl = nullptr; + m_characterCodeCtrl = nullptr; #if defined(__UNICODE__) - m_fromUnicodeCtrl = NULL; + m_fromUnicodeCtrl = nullptr; #endif - m_stdButtonSizer = NULL; + m_stdButtonSizer = nullptr; ////@end wxSymbolPickerDialog member initialisation m_dontUpdate = false; } @@ -767,7 +767,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxSymbolListCtrl, wxVScrolledWindow); void wxSymbolListCtrl::Init() { m_current = wxNOT_FOUND; - m_doubleBuffer = NULL; + m_doubleBuffer = nullptr; m_cellSize = wxSize(40, 40); m_minSymbolValue = 0; m_maxSymbolValue = 255; diff --git a/src/richtext/richtexttabspage.cpp b/src/richtext/richtexttabspage.cpp index cf4f9f82da..39a9195b95 100644 --- a/src/richtext/richtexttabspage.cpp +++ b/src/richtext/richtexttabspage.cpp @@ -62,8 +62,8 @@ void wxRichTextTabsPage::Init() m_tabsPresent = false; ////@begin wxRichTextTabsPage member initialisation - m_tabEditCtrl = NULL; - m_tabListCtrl = NULL; + m_tabEditCtrl = nullptr; + m_tabListCtrl = nullptr; ////@end wxRichTextTabsPage member initialisation } diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index 4a9ca032b4..b7e6428ead 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -130,7 +130,7 @@ wxRichTextObject* wxRichTextXMLHandler::CreateObjectForXMLName(wxRichTextObject* // The standard node to class mappings are added in wxRichTextModule::OnInit in richtextbuffer.cpp wxStringToStringHashMap::const_iterator it = sm_nodeNameToClassMap.find(name); if (it == sm_nodeNameToClassMap.end()) - return NULL; + return nullptr; else return wxDynamicCast(wxCreateDynamicObject(it->second), wxRichTextObject); } @@ -248,7 +248,7 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& #endif } delete doc; - doc = NULL; + doc = nullptr; #else // !(wxRICHTEXT_HAVE_XMLDOCUMENT_OUTPUT && wxRICHTEXT_USE_XMLDOCUMENT_OUTPUT) @@ -429,7 +429,7 @@ bool wxRichTextPlainText::ImportFromXML(wxRichTextBuffer* buffer, wxXmlNode* nod if ((n->GetType() == wxXML_ELEMENT_NODE) && n->GetName() == wxT("properties")) { textChild = n->GetNext(); - n = NULL; + n = nullptr; // Skip past the whitespace after the properties while (textChild && (textChild->GetType() == wxXML_TEXT_NODE)) @@ -1063,8 +1063,8 @@ void wxRichTextXMLHelper::Init() { #if wxRICHTEXT_HAVE_DIRECT_OUTPUT m_deleteConvFile = false; - m_convMem = NULL; - m_convFile = NULL; + m_convMem = nullptr; + m_convFile = nullptr; #endif m_flags = 0; } @@ -1074,8 +1074,8 @@ void wxRichTextXMLHelper::Clear() #if wxRICHTEXT_HAVE_DIRECT_OUTPUT if (m_deleteConvFile) delete m_convFile; - m_convFile = NULL; - m_convMem = NULL; + m_convFile = nullptr; + m_convMem = nullptr; m_deleteConvFile = false; #endif m_fileEncoding.clear(); @@ -1129,7 +1129,7 @@ void wxRichTextXMLHelper::SetupForSaving(const wxString& enc) #if !wxUSE_UNICODE m_convMem = wxConvCurrent; #else - m_convMem = NULL; + m_convMem = nullptr; #endif #endif } @@ -1162,12 +1162,12 @@ wxColour wxRichTextXMLHelper::HexStringToColour(const wxString& hex) bool wxRichTextXMLHelper::HasParam(wxXmlNode* node, const wxString& param) { - return (GetParamNode(node, param) != NULL); + return (GetParamNode(node, param) != nullptr); } wxXmlNode *wxRichTextXMLHelper::GetParamNode(wxXmlNode* node, const wxString& param) { - wxCHECK_MSG(node, NULL, wxT("You can't access node data before it was initialized!")); + wxCHECK_MSG(node, nullptr, wxT("You can't access node data before it was initialized!")); wxXmlNode *n = node->GetChildren(); @@ -1177,13 +1177,13 @@ wxXmlNode *wxRichTextXMLHelper::GetParamNode(wxXmlNode* node, const wxString& pa return n; n = n->GetNext(); } - return NULL; + return nullptr; } wxString wxRichTextXMLHelper::GetNodeContent(wxXmlNode *node) { wxXmlNode *n = node; - if (n == NULL) return wxEmptyString; + if (n == nullptr) return wxEmptyString; n = n->GetChildren(); while (n) @@ -1225,7 +1225,7 @@ wxXmlNode* wxRichTextXMLHelper::FindNode(wxXmlNode* node, const wxString& name) return child; child = child->GetNext(); } - return NULL; + return nullptr; } wxString wxRichTextXMLHelper::AttributeToXML(const wxString& str) @@ -1931,7 +1931,7 @@ void wxRichTextXMLHelper::OutputString(wxOutputStream& stream, const wxString& s stream.Write((const char*)buf, strlen((const char*)buf)); } #else - if ( convFile == NULL ) + if ( convFile == nullptr ) stream.Write(str.mb_str(), str.Len()); else { @@ -1946,7 +1946,7 @@ void wxRichTextXMLHelper::OutputIndentation(wxOutputStream& stream, int indent) wxString str = wxT("\n"); for (int i = 0; i < indent; i++) str << wxT(' ') << wxT(' '); - OutputString(stream, str, NULL, NULL); + OutputString(stream, str, nullptr, nullptr); } // Same as above, but create entities first. @@ -1975,16 +1975,16 @@ void wxRichTextXMLHelper::OutputStringEnt(wxOutputStream& stream, const wxString switch (c) { case wxT('<'): - OutputString(stream, wxT("<"), NULL, NULL); + OutputString(stream, wxT("<"), nullptr, nullptr); break; case wxT('>'): - OutputString(stream, wxT(">"), NULL, NULL); + OutputString(stream, wxT(">"), nullptr, nullptr); break; case wxT('&'): - OutputString(stream, wxT("&"), NULL, NULL); + OutputString(stream, wxT("&"), nullptr, nullptr); break; case wxT('"'): - OutputString(stream, wxT("""), NULL, NULL); + OutputString(stream, wxT("""), nullptr, nullptr); break; default: break; } @@ -2001,7 +2001,7 @@ void wxRichTextXMLHelper::OutputStringEnt(wxOutputStream& stream, const wxString s << (int) wxUChar(c); #endif s << wxT(";"); - OutputString(stream, s, NULL, NULL); + OutputString(stream, s, nullptr, nullptr); last = i + 1; } } diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 6c9eb39a42..5ebdad57f8 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -109,7 +109,7 @@ public: explicit wxFontWithAscent(const wxFont &font) : wxFont(font), m_ascent(0), - m_surfaceFontData(NULL) + m_surfaceFontData(nullptr) { } @@ -147,7 +147,7 @@ int GetAscent(Font& f) } // anonymous namespace Font::Font() { - fid = 0; + fid = nullptr; } Font::~Font() { @@ -195,7 +195,7 @@ void Font::Create(const FontParameters &fp) { void Font::Release() { if (fid) delete wxFontWithAscent::FromFID(fid); - fid = 0; + fid = nullptr; } //---------------------------------------------------------------------- @@ -262,7 +262,7 @@ public: SurfaceImpl::SurfaceImpl() : - hdc(0), hdcOwned(0), bitmap(0), + hdc(nullptr), hdcOwned(0), bitmap(nullptr), x(0), y(0), unicodeMode(0) {} @@ -279,7 +279,7 @@ void SurfaceImpl::Init(WindowID wid) { // On Mac and GTK the DC is not really valid until it has a bitmap // selected into it. So instead of just creating the DC with no bitmap, // go ahead and give it one. - InitPixMap(1,1,NULL,wid); + InitPixMap(1,1,nullptr,wid); #endif } @@ -307,18 +307,18 @@ void SurfaceImpl::Release() { if (bitmap) { ((wxMemoryDC*)hdc)->SelectObject(wxNullBitmap); delete bitmap; - bitmap = 0; + bitmap = nullptr; } if (hdcOwned) { delete hdc; - hdc = 0; + hdc = nullptr; hdcOwned = false; } } bool SurfaceImpl::Initialised() { - return hdc != 0; + return hdc != nullptr; } @@ -753,7 +753,7 @@ SurfaceFontDataD2D::SurfaceFontDataD2D(const FontParameters& fp) hr = pDWriteFactory->CreateTextFormat( faceName.wc_str(), - NULL, + nullptr, static_cast(fp.weight), fontStyle, DWRITE_FONT_STRETCH_NORMAL, @@ -821,7 +821,7 @@ SurfaceFontDataD2D::SurfaceFontDataD2D(const FontParameters& fp) bool SurfaceFontDataD2D::Initialised() const { - return (m_pTextFormat.get() != NULL); + return (m_pTextFormat.get() != nullptr); } //---------------------------------------------------------------------- @@ -863,7 +863,7 @@ SurfaceDataD2D::SurfaceDataD2D(ScintillaWX* editor) bool SurfaceDataD2D::Initialised() const { - return (m_pD2DFactory.get() != NULL && m_pDWriteFactory.get() != NULL); + return (m_pD2DFactory.get() != nullptr && m_pDWriteFactory.get() != nullptr); } void SurfaceDataD2D::DiscardGraphicsResources() @@ -876,7 +876,7 @@ void SurfaceDataD2D::DiscardGraphicsResources() HRESULT SurfaceDataD2D::CreateGraphicsResources() { HRESULT hr = S_OK; - if ( m_pRenderTarget.get() == NULL ) + if ( m_pRenderTarget.get() == nullptr ) { D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties = D2D1::RenderTargetProperties( @@ -1041,8 +1041,8 @@ SurfaceD2D::SurfaceD2D() m_yInternalLeading = 0; m_averageCharWidth = 1; - m_surfaceData = NULL; - m_curFontID = NULL; + m_surfaceData = nullptr; + m_curFontID = nullptr; } SurfaceD2D::~SurfaceD2D() @@ -1112,7 +1112,7 @@ void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID) desiredFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; HRESULT hr = psurfOther->m_pRenderTarget->CreateCompatibleRenderTarget( - &desiredSize, NULL, &desiredFormat, + &desiredSize, nullptr, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pCompatibleRenderTarget); if ( SUCCEEDED(hr) ) { @@ -1147,12 +1147,12 @@ void SurfaceD2D::Release() m_pSolidBrush.reset(); m_pPatternBrush.reset(); m_pTextFormat.reset(); - m_curFontID = NULL; + m_curFontID = nullptr; } bool SurfaceD2D::Initialised() { - return m_pRenderTarget.get() != NULL; + return m_pRenderTarget.get() != nullptr; } void SurfaceD2D::PenColour(ColourDesired fore) @@ -1850,7 +1850,7 @@ void Window::Destroy() { Show(false); GETWIN(wid)->Destroy(); } - wid = 0; + wid = nullptr; } bool Window::HasFocus() { @@ -2052,7 +2052,7 @@ PRectangle Window::GetMonitorRect(Point pt) { void wxSTCPopupBase::RestoreSTCCursor() { - if ( m_stc != NULL && m_cursorSetByPopup ) + if ( m_stc != nullptr && m_cursorSetByPopup ) m_stc->SetSTCCursor(m_prevCursor); m_cursorSetByPopup = false; @@ -2071,7 +2071,7 @@ PRectangle Window::GetMonitorRect(Point pt) { void wxSTCPopupBase::OnParentDestroy(wxWindowDestroyEvent& WXUNUSED(event)) { - m_stc = NULL; + m_stc = nullptr; } #elif wxUSE_POPUPWIN @@ -2378,7 +2378,7 @@ wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d), m_hasListCtrlAppearance(true), m_useDefaultCurrentBgColour(true), m_useDefaultCurrentTextColour(true), - m_listType(NULL), m_posStart(NULL), m_startLen(NULL) + m_listType(nullptr), m_posStart(nullptr), m_startLen(nullptr) { ComputeColours(); } @@ -2474,7 +2474,7 @@ const wxBitmap* wxSTCListBoxVisualData::GetImage(int i) const if ( it != m_imgList.end() ) return &(it->second); else - return NULL; + return nullptr; } int wxSTCListBoxVisualData::GetImageAreaWidth() const @@ -2708,7 +2708,7 @@ protected: wxSTCListBox::wxSTCListBox(wxWindow* parent, wxSTCListBoxVisualData* v, int ht) :wxSystemThemedControl(), m_visualData(v), m_maxStrWidth(0), m_currentRow(wxNOT_FOUND), - m_doubleClickAction(NULL), m_doubleClickActionData(NULL), + m_doubleClickAction(nullptr), m_doubleClickActionData(nullptr), m_aveCharWidth(8), m_textHeight(ht), m_itemHeight(ht), m_textTopGap(0) { @@ -3125,7 +3125,7 @@ class wxSTCListBoxD2D : public wxSTCListBox public: wxSTCListBoxD2D(wxWindow* parent, wxSTCListBoxVisualData* v, int ht) : wxSTCListBox(parent, v, ht) - , m_surfaceFontData(NULL) + , m_surfaceFontData(nullptr) { } @@ -3272,7 +3272,7 @@ void wxSTCListBoxWin::OnPaint(wxPaintEvent& WXUNUSED(evt)) //---------------------------------------------------------------------- ListBoxImpl::ListBoxImpl() - :m_listBox(NULL), m_visualData(new wxSTCListBoxVisualData(5)) + :m_listBox(nullptr), m_visualData(new wxSTCListBoxVisualData(5)) { } @@ -3403,7 +3403,7 @@ ListBox *ListBox::Allocate() { //---------------------------------------------------------------------- -Menu::Menu() : mid(0) { +Menu::Menu() : mid(nullptr) { } void Menu::CreatePopUp() { @@ -3414,7 +3414,7 @@ void Menu::CreatePopUp() { void Menu::Destroy() { if (mid) delete (wxMenu*)mid; - mid = 0; + mid = nullptr; } void Menu::Show(Point pt, Window &w) { @@ -3439,10 +3439,10 @@ public: if(status) return fn_address; else - return NULL; + return nullptr; } else - return NULL; + return nullptr; } virtual bool IsValid() override { diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index f10a279f0a..36196d1266 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -125,9 +125,9 @@ public: delete surfaceWindow; } - virtual void Refresh(bool eraseBg=true, const wxRect *rect=NULL) override + virtual void Refresh(bool eraseBg=true, const wxRect *rect=nullptr) override { - if ( rect == NULL ) + if ( rect == nullptr ) DrawBack(GetSize()); wxSTCPopupWindow::Refresh(eraseBg, rect); @@ -244,7 +244,7 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) { timers[tickWiden] = new wxSTCTimer(this,tickWiden); timers[tickDwell] = new wxSTCTimer(this,tickDwell); - m_surfaceData = NULL; + m_surfaceData = nullptr; } @@ -254,7 +254,7 @@ ScintillaWX::~ScintillaWX() { } timers.clear(); - if ( m_surfaceData != NULL ) { + if ( m_surfaceData != nullptr ) { delete m_surfaceData; } @@ -372,7 +372,7 @@ void ScintillaWX::ScrollText(int linesToMove) { } void ScintillaWX::SetVerticalScrollPos() { - if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar + if (stc->m_vScrollBar == nullptr) { // Use built-in scrollbar stc->SetScrollPos(wxVERTICAL, topLine); } else { // otherwise use the one that's been given to us @@ -381,7 +381,7 @@ void ScintillaWX::SetVerticalScrollPos() { } void ScintillaWX::SetHorizontalScrollPos() { - if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar + if (stc->m_hScrollBar == nullptr) { // Use built-in scrollbar stc->SetScrollPos(wxHORIZONTAL, xOffset); } else { // otherwise use the one that's been given to us @@ -400,7 +400,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) { nPage = vertEnd + 1; // Check the vertical scrollbar - if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar + if (stc->m_vScrollBar == nullptr) { // Use built-in scrollbar int sbMax = stc->GetScrollRange(wxVERTICAL); int sbThumb = stc->GetScrollThumb(wxVERTICAL); int sbPos = stc->GetScrollPos(wxVERTICAL); @@ -429,7 +429,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) { if (!horizontalScrollBarVisible || Wrapping()) pageWidth = horizEnd + 1; - if (stc->m_hScrollBar == NULL) { // Use built-in scrollbar + if (stc->m_hScrollBar == nullptr) { // Use built-in scrollbar int sbMax = stc->GetScrollRange(wxHORIZONTAL); int sbThumb = stc->GetScrollThumb(wxHORIZONTAL); int sbPos = stc->GetScrollPos(wxHORIZONTAL); @@ -806,7 +806,7 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) case SCI_SETTECHNOLOGY: if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) { if (technology != static_cast(wParam)) { - SurfaceDataD2D* newSurfaceData(NULL); + SurfaceDataD2D* newSurfaceData(nullptr); if (static_cast(wParam) > SC_TECHNOLOGY_DEFAULT) { newSurfaceData = new SurfaceDataD2D(this); diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index db88540bfd..891f49da1a 100755 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -175,7 +175,7 @@ methodOverrideMap = { 'GetCurLine' : (0, - '#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=NULL);\n#endif', + '#ifdef SWIG\n wxString %s(int* OUTPUT);\n#else\n wxString GetCurLine(int* linePos=nullptr);\n#endif', '''wxString %s(int* linePos) { int len = LineLength(GetCurrentLine()); @@ -544,7 +544,7 @@ methodOverrideMap = { 'FindText' : (0, '''int %s(int minPos, int maxPos, const wxString& text, int flags=0, - int* findEnd=NULL);''', + int* findEnd=nullptr);''', '''int %s(int minPos, int maxPos, const wxString& text, int flags, int* findEnd) { @@ -864,7 +864,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -892,7 +892,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -909,7 +909,7 @@ methodOverrideMap = { '''wxString %s(int tagNumber) const { const int msg = %s; - long len = SendMsg(msg, tagNumber, (sptr_t)NULL); + long len = SendMsg(msg, tagNumber, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -923,7 +923,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -941,7 +941,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -959,7 +959,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -976,7 +976,7 @@ methodOverrideMap = { '''wxString %s(const wxString& name) const { const int msg = %s; const wxWX2MBbuf nameBuf = wx2stc(name); - long len = SendMsg(msg, (uptr_t)(const char*)nameBuf, (sptr_t)NULL); + long len = SendMsg(msg, (uptr_t)(const char*)nameBuf, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -992,7 +992,7 @@ methodOverrideMap = { '''wxString %s() const { const int msg = %s; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -1035,7 +1035,7 @@ methodOverrideMap = { '''wxString %s(const wxString& encodedCharacter) const { const int msg = %s; const wxWX2MBbuf encCharBuf = wx2stc(encodedCharacter); - long len = SendMsg(msg, (sptr_t)(const char*)encCharBuf, (sptr_t)NULL); + long len = SendMsg(msg, (sptr_t)(const char*)encCharBuf, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -1055,7 +1055,7 @@ methodOverrideMap = { 'wxString %s() const;', '''wxString %s() const { const int msg = %s; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -1300,7 +1300,7 @@ def processMethods(methods): print('warning: ' + name + ' is undocumented.') if name == 'GetCurLine': - intrflines.append(' wxString GetCurLine(int* linePos=NULL);') + intrflines.append(' wxString GetCurLine(int* linePos=nullptr);') else: intrflines.append(theDef) diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index d7eeeb70cf..15824a7334 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -183,7 +183,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent, long style, const wxString& name) { - m_swx = NULL; + m_swx = nullptr; Create(parent, id, pos, size, style, name); } @@ -207,8 +207,8 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, m_swx = new ScintillaWX(this); m_stopWatch.Start(); m_lastKeyDownConsumed = false; - m_vScrollBar = NULL; - m_hScrollBar = NULL; + m_vScrollBar = nullptr; + m_hScrollBar = nullptr; #if wxUSE_UNICODE // Put Scintilla into unicode (UTF-8) mode SetCodePage(wxSTC_CP_UTF8); @@ -258,7 +258,7 @@ wxIntPtr wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const // Set the vertical scrollbar to use instead of the one that's built-in. void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) { m_vScrollBar = bar; - if (bar != NULL) { + if (bar != nullptr) { // ensure that the built-in scrollbar is not visible SetScrollbar(wxVERTICAL, 0, 0, 0); } @@ -268,7 +268,7 @@ void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) { // Set the horizontal scrollbar to use instead of the one that's built-in. void wxStyledTextCtrl::SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; - if (bar != NULL) { + if (bar != nullptr) { // ensure that the built-in scrollbar is not visible SetScrollbar(wxHORIZONTAL, 0, 0, 0); } @@ -1134,7 +1134,7 @@ void wxStyledTextCtrl::SetWordChars(const wxString& characters) // Get the set of characters making up words for when moving or selecting by word. wxString wxStyledTextCtrl::GetWordChars() const { const int msg = SCI_GETWORDCHARS; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -2548,7 +2548,7 @@ int wxStyledTextCtrl::GetMultiPaste() const // Retrieve the value of a tag from a regular expression search. wxString wxStyledTextCtrl::GetTag(int tagNumber) const { const int msg = SCI_GETTAG; - long len = SendMsg(msg, tagNumber, (sptr_t)NULL); + long len = SendMsg(msg, tagNumber, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -3546,7 +3546,7 @@ void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters) // Get the set of characters making up whitespace for when moving or selecting by word. wxString wxStyledTextCtrl::GetWhitespaceChars() const { const int msg = SCI_GETWHITESPACECHARS; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -3567,7 +3567,7 @@ void wxStyledTextCtrl::SetPunctuationChars(const wxString& characters) // Get the set of characters making up punctuation characters wxString wxStyledTextCtrl::GetPunctuationChars() const { const int msg = SCI_GETPUNCTUATIONCHARS; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxMemoryBuffer mbuf(len+1); @@ -4524,7 +4524,7 @@ void wxStyledTextCtrl::SetRepresentation(const wxString& encodedCharacter, const wxString wxStyledTextCtrl::GetRepresentation(const wxString& encodedCharacter) const { const int msg = SCI_GETREPRESENTATION; const wxWX2MBbuf encCharBuf = wx2stc(encodedCharacter); - long len = SendMsg(msg, (sptr_t)(const char*)encCharBuf, (sptr_t)NULL); + long len = SendMsg(msg, (sptr_t)(const char*)encCharBuf, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4632,7 +4632,7 @@ int wxStyledTextCtrl::GetStyleBitsNeeded() const // Retrieve the lexing language of the document. wxString wxStyledTextCtrl::GetLexerLanguage() const { const int msg = SCI_GETLEXERLANGUAGE; - int len = SendMsg(msg, 0, (sptr_t)NULL); + int len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4648,7 +4648,7 @@ void* wxStyledTextCtrl::PrivateLexerCall(int operation, void* pointer) { // Retrieve a '\\n' separated list of properties understood by the current lexer. wxString wxStyledTextCtrl::PropertyNames() const { const int msg = SCI_PROPERTYNAMES; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4666,7 +4666,7 @@ int wxStyledTextCtrl::PropertyType(const wxString& name) wxString wxStyledTextCtrl::DescribeProperty(const wxString& name) const { const int msg = SCI_DESCRIBEPROPERTY; const wxWX2MBbuf nameBuf = wx2stc(name); - long len = SendMsg(msg, (uptr_t)(const char*)nameBuf, (sptr_t)NULL); + long len = SendMsg(msg, (uptr_t)(const char*)nameBuf, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4677,7 +4677,7 @@ wxString wxStyledTextCtrl::DescribeProperty(const wxString& name) const { // Retrieve a '\\n' separated list of descriptions of the keyword sets understood by the current lexer. wxString wxStyledTextCtrl::DescribeKeyWordSets() const { const int msg = SCI_DESCRIBEKEYWORDSETS; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4744,7 +4744,7 @@ int wxStyledTextCtrl::DistanceToSecondaryStyles() const // Get the set of base styles that can be extended with sub styles wxString wxStyledTextCtrl::GetSubStyleBases() const { const int msg = SCI_GETSUBSTYLEBASES; - long len = SendMsg(msg, 0, (sptr_t)NULL); + long len = SendMsg(msg, 0, (sptr_t)nullptr); if (!len) return wxEmptyString; wxCharBuffer buf(len); @@ -4839,7 +4839,7 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, const wxFont& font) { #ifdef __WXGTK__ // Ensure that the native font is initialized int x, y; - GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font); + GetTextExtent(wxT("X"), &x, &y, nullptr, nullptr, &font); #endif int size = font.GetPointSize(); wxString faceName = font.GetFaceName(); @@ -5034,7 +5034,7 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() { } void wxStyledTextCtrl::AnnotationClearLine(int line) { - SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL); + SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)nullptr); } void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, @@ -5296,7 +5296,7 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) if ( !GetMouseWheelCaptures() && !GetRect().Contains(evt.GetPosition()) ) { wxWindow* parent = GetParent(); - if ( parent != NULL ) + if ( parent != nullptr ) { wxMouseEvent newevt(evt); newevt.SetPosition( @@ -5311,7 +5311,7 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) // First try to find the list. It will be a wxVListBox named // "AutoCompListBox". - wxWindow* curWin = this, *acListBox = NULL; + wxWindow* curWin = this, *acListBox = nullptr; wxStack windows; windows.push(curWin); diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 6eb183b181..34f9d9571f 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -183,7 +183,7 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent, long style, const wxString& name) { - m_swx = NULL; + m_swx = nullptr; Create(parent, id, pos, size, style, name); } @@ -207,8 +207,8 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, m_swx = new ScintillaWX(this); m_stopWatch.Start(); m_lastKeyDownConsumed = false; - m_vScrollBar = NULL; - m_hScrollBar = NULL; + m_vScrollBar = nullptr; + m_hScrollBar = nullptr; #if wxUSE_UNICODE // Put Scintilla into unicode (UTF-8) mode SetCodePage(wxSTC_CP_UTF8); @@ -258,7 +258,7 @@ wxIntPtr wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const // Set the vertical scrollbar to use instead of the one that's built-in. void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) { m_vScrollBar = bar; - if (bar != NULL) { + if (bar != nullptr) { // ensure that the built-in scrollbar is not visible SetScrollbar(wxVERTICAL, 0, 0, 0); } @@ -268,7 +268,7 @@ void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) { // Set the horizontal scrollbar to use instead of the one that's built-in. void wxStyledTextCtrl::SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; - if (bar != NULL) { + if (bar != nullptr) { // ensure that the built-in scrollbar is not visible SetScrollbar(wxHORIZONTAL, 0, 0, 0); } @@ -366,7 +366,7 @@ void wxStyledTextCtrl::StyleSetFont(int styleNum, const wxFont& font) { #ifdef __WXGTK__ // Ensure that the native font is initialized int x, y; - GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font); + GetTextExtent(wxT("X"), &x, &y, nullptr, nullptr, &font); #endif int size = font.GetPointSize(); wxString faceName = font.GetFaceName(); @@ -561,7 +561,7 @@ bool wxStyledTextCtrl::GetUseAntiAliasing() { } void wxStyledTextCtrl::AnnotationClearLine(int line) { - SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)NULL); + SendMsg(SCI_ANNOTATIONSETTEXT, line, (sptr_t)nullptr); } void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, @@ -823,7 +823,7 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) if ( !GetMouseWheelCaptures() && !GetRect().Contains(evt.GetPosition()) ) { wxWindow* parent = GetParent(); - if ( parent != NULL ) + if ( parent != nullptr ) { wxMouseEvent newevt(evt); newevt.SetPosition( @@ -838,7 +838,7 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) // First try to find the list. It will be a wxVListBox named // "AutoCompListBox". - wxWindow* curWin = this, *acListBox = NULL; + wxWindow* curWin = this, *acListBox = nullptr; wxStack windows; windows.push(curWin); diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 3782673292..03535770c8 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -176,7 +176,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxSTCNameStr); - wxStyledTextCtrl() { m_swx = NULL; } + wxStyledTextCtrl() { m_swx = nullptr; } ~wxStyledTextCtrl(); #endif @@ -331,7 +331,7 @@ public: #ifdef SWIG wxCharBuffer GetCurLineRaw(int* OUTPUT); #else - wxCharBuffer GetCurLineRaw(int* linePos=NULL); + wxCharBuffer GetCurLineRaw(int* linePos=nullptr); #endif // Retrieve the contents of a line. @@ -856,42 +856,42 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define wxStyledTextEventHandler( func ) \ wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func ) -#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), -#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), +#define EVT_STC_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_STYLENEEDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CHARADDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_SAVEPOINTREACHED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_SAVEPOINTLEFT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_ROMODIFYATTEMPT(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_KEY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DOUBLECLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_UPDATEUI(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MODIFIED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MACRORECORD(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MARGINCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_NEEDSHOWN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_PAINTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_USERLISTSELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_URIDROPPED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DWELLSTART(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DWELLEND(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_START_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DRAG_OVER(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_DO_DROP(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_ZOOM(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_DCLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CALLTIP_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_INDICATOR_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CLIPBOARD_COPY(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), +#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) nullptr ), #endif #endif // wxUSE_STC diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index ed22fe1d19..ee7b9651af 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -313,7 +313,7 @@ public: Retrieve the text of the line containing the caret. Returns the index of the caret on the line. */ - wxCharBuffer GetCurLineRaw(int* linePos=NULL); + wxCharBuffer GetCurLineRaw(int* linePos=nullptr); /** Retrieve the contents of a line. diff --git a/src/univ/anybutton.cpp b/src/univ/anybutton.cpp index e1412ab3dd..b87cf0823c 100644 --- a/src/univ/anybutton.cpp +++ b/src/univ/anybutton.cpp @@ -171,7 +171,7 @@ bool wxAnyButton::DoDrawBackground(wxDC& dc) wxStdAnyButtonInputHandler::wxStdAnyButtonInputHandler(wxInputHandler *handler) : wxStdInputHandler(handler) { - m_winCapture = NULL; + m_winCapture = nullptr; m_winHasMouse = false; } @@ -216,7 +216,7 @@ bool wxStdAnyButtonInputHandler::HandleMouse(wxInputConsumer *consumer, if ( m_winCapture ) { m_winCapture->ReleaseMouse(); - m_winCapture = NULL; + m_winCapture = nullptr; } if ( m_winHasMouse ) diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 7390107c9d..3cccdfd1b1 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -117,7 +117,7 @@ bool wxComboListBox::Create(wxWindow* parent) { if ( !wxListBox::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, wxBORDER_SIMPLE | ( m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0 ) ) ) return false; @@ -199,7 +199,7 @@ wxSize wxComboListBox::GetAdjustedSize(int minWidth, void wxComboBox::Init() { - m_lbox = NULL; + m_lbox = nullptr; } wxComboBox::wxComboBox(wxWindow *parent, @@ -448,7 +448,7 @@ void *wxComboBox::DoGetItemClientData(unsigned int n) const bool wxComboBox::IsEditable() const { - return GetTextCtrl() != NULL && (!HasFlag(wxCB_READONLY) || GetTextCtrl()->IsEditable() ); + return GetTextCtrl() != nullptr && (!HasFlag(wxCB_READONLY) || GetTextCtrl()->IsEditable() ); } void wxComboBox::Undo() @@ -470,7 +470,7 @@ void wxComboBox::SelectAll() bool wxComboBox::CanCopy() const { - if (GetTextCtrl() != NULL) + if (GetTextCtrl() != nullptr) return GetTextCtrl()->CanCopy(); else return false; @@ -478,7 +478,7 @@ bool wxComboBox::CanCopy() const bool wxComboBox::CanCut() const { - if (GetTextCtrl() != NULL) + if (GetTextCtrl() != nullptr) return GetTextCtrl()->CanCut(); else return false; diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index 5a11d0c78e..0b55d6aefe 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -41,8 +41,8 @@ wxEND_EVENT_TABLE() void wxDialog::Init() { m_returnCode = 0; - m_windowDisabler = NULL; - m_eventLoop = NULL; + m_windowDisabler = nullptr; + m_eventLoop = nullptr; m_isShowingModal = false; } diff --git a/src/univ/inpcons.cpp b/src/univ/inpcons.cpp index 0408b1b2c2..bf29089eb6 100644 --- a/src/univ/inpcons.cpp +++ b/src/univ/inpcons.cpp @@ -58,7 +58,7 @@ void wxInputConsumer::OnActivate(wxActivateEvent& event) wxInputHandler * wxInputConsumer::DoGetStdInputHandler(wxInputHandler * WXUNUSED(handlerDef)) { - return NULL; + return nullptr; } void wxInputConsumer::CreateInputHandler(const wxString& inphandler) diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 9d1ce699d4..0859586e60 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -102,7 +102,7 @@ void wxListBox::Init() m_maxWidth = 0; m_scrollRangeY = 0; m_maxWidthItem = -1; - m_strings.unsorted = NULL; + m_strings.unsorted = nullptr; // no items hence no current item m_current = -1; @@ -204,7 +204,7 @@ wxListBox::~wxListBox() else delete m_strings.unsorted; - m_strings.sorted = NULL; + m_strings.sorted = nullptr; } // ---------------------------------------------------------------------------- @@ -247,7 +247,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, idx = IsSorted() ? m_strings.sorted->Add(item) : (m_strings.unsorted->Insert(item, pos), pos++); - m_itemsClientData.Insert(NULL, idx); + m_itemsClientData.Insert(nullptr, idx); AssignNewItemClientData(idx, clientData, i, type); // call the wxCheckListBox hook @@ -284,7 +284,7 @@ void wxListBox::SetString(unsigned int n, const wxString& s) // horz scrollbar [dis]appear wxCoord width; - GetTextExtent(s, &width, NULL); + GetTextExtent(s, &width, nullptr); // it might have increased if the new string is long if ( width > m_maxWidth ) @@ -640,7 +640,7 @@ void wxListBox::UpdateItems() // we don't need to calculate x position as we always refresh the // entire line(s) - CalcScrolledPosition(0, rect.y, NULL, &rect.y); + CalcScrolledPosition(0, rect.y, nullptr, &rect.y); wxLogTrace(wxT("listbox"), wxT("Refreshing items %d..%d (%d-%d)"), m_updateFrom, m_updateFrom + m_updateCount - 1, @@ -696,8 +696,8 @@ void wxListBox::DoDraw(wxControlRenderer *renderer) wxRect rectUpdate = GetUpdateClientRect(); int yTop, yBottom; - CalcUnscrolledPosition(0, rectUpdate.GetTop(), NULL, &yTop); - CalcUnscrolledPosition(0, rectUpdate.GetBottom(), NULL, &yBottom); + CalcUnscrolledPosition(0, rectUpdate.GetTop(), nullptr, &yTop); + CalcUnscrolledPosition(0, rectUpdate.GetBottom(), nullptr, &yBottom); // get the items which must be redrawn wxCoord lineHeight = GetLineHeight(); @@ -775,7 +775,7 @@ wxCoord wxListBox::GetMaxWidth() const unsigned int count = GetCount(); for ( unsigned int n = 0; n < count; n++ ) { - GetTextExtent(this->GetString(n), &width, NULL); + GetTextExtent(this->GetString(n), &width, nullptr); if ( width > m_maxWidth ) { self->m_maxWidth = width; @@ -984,7 +984,7 @@ void wxListBox::DoEnsureVisible(int n) } int first; - GetViewStart(0, &first); + GetViewStart(nullptr, &first); if ( first > n ) { // we need to scroll upwards, so make the current item appear on top @@ -1109,7 +1109,7 @@ int wxListBox::DoListHitTest(const wxPoint& point) const int y, index; - CalcUnscrolledPosition(0, point.y, NULL, &y); + CalcUnscrolledPosition(0, point.y, nullptr, &y); index = y / GetLineHeight(); // mouse is above the first item or below the last item diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index d6d019c68b..a2c67a3b5d 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -126,7 +126,7 @@ public: virtual ~wxPopupMenuWindow(); // override the base class version to select the first item initially - virtual void Popup(wxWindow *focus = NULL); + virtual void Popup(wxWindow *focus = nullptr); // override the base class version to dismiss any open submenus virtual void Dismiss(); @@ -141,10 +141,10 @@ public: void OnIdle(wxIdleEvent& WXUNUSED(event)) { } #endif - // get the currently selected item (may be NULL) + // get the currently selected item (may be null) wxMenuItem *GetCurrentItem() const { - return m_nodeCurrent ? m_nodeCurrent->GetData() : NULL; + return m_nodeCurrent ? m_nodeCurrent->GetData() : nullptr; } // find the menu item at given position @@ -326,9 +326,9 @@ wxPopupMenuWindow::~wxPopupMenuWindow() // When m_popupMenu in wxMenu is deleted because it // is a child of an old menu bar being deleted (note: it does // not get destroyed by the wxMenu destructor, but - // by DestroyChildren()), m_popupMenu should be reset to NULL. + // by DestroyChildren()), m_popupMenu should be reset to nullptr. - m_menu->m_popupMenu = NULL; + m_menu->m_popupMenu = nullptr; } // ---------------------------------------------------------------------------- @@ -547,7 +547,7 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const void wxPopupMenuWindow::RefreshItem(wxMenuItem *item) { - wxCHECK_RET( item, wxT("can't refresh NULL item") ); + wxCHECK_RET( item, wxT("can't refresh null item") ); wxASSERT_MSG( IsShown(), wxT("can't refresh menu which is not shown") ); @@ -642,7 +642,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer) void wxPopupMenuWindow::ClickItem(wxMenuItem *item) { - wxCHECK_RET( item, wxT("can't click NULL item") ); + wxCHECK_RET( item, wxT("can't click null item") ); wxASSERT_MSG( !item->IsSeparator() && !item->IsSubMenu(), wxT("can't click this item") ); @@ -657,7 +657,7 @@ void wxPopupMenuWindow::ClickItem(wxMenuItem *item) void wxPopupMenuWindow::OpenSubmenu(wxMenuItem *item, InputMethod how) { - wxCHECK_RET( item, wxT("can't open NULL submenu") ); + wxCHECK_RET( item, wxT("can't open null submenu") ); wxMenu *submenu = item->GetSubMenu(); wxCHECK_RET( submenu, wxT("can only open submenus!") ); @@ -791,7 +791,7 @@ void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt) { wxMenuItemIter node = GetMenuItemFromPoint(pt); - // don't reset current to NULL here, we only do it when the mouse leaves + // don't reset current to nullptr here, we only do it when the mouse leaves // the window (see below) if ( node ) { @@ -1088,9 +1088,9 @@ void wxPopupMenuWindow::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) void wxMenu::Init() { - m_geometry = NULL; + m_geometry = nullptr; - m_popupMenu = NULL; + m_popupMenu = nullptr; m_startRadioGroup = -1; } @@ -1167,7 +1167,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) item->SetRadioGroupEnd(m_startRadioGroup); if ( !wxMenuBase::DoAppend(item) ) - return NULL; + return nullptr; item->Check(true); } @@ -1187,7 +1187,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) } if ( !wxMenuBase::DoAppend(item) ) - return NULL; + return nullptr; } } else // not a radio item @@ -1195,7 +1195,7 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) EndRadioGroup(); if ( !wxMenuBase::DoAppend(item) ) - return NULL; + return nullptr; } OnItemAdded(item); @@ -1220,7 +1220,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) item->SetRadioGroupEnd(m_startRadioGroup); if ( !wxMenuBase::DoInsert(pos, item) ) - return NULL; + return nullptr; item->Check(true); } @@ -1260,13 +1260,13 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) } if ( !wxMenuBase::DoInsert(pos, item) ) - return NULL; + return nullptr; } } else { if ( !wxMenuBase::DoInsert(pos, item) ) - return NULL; + return nullptr; } OnItemAdded(item); @@ -1298,7 +1298,7 @@ void wxMenu::Attach(wxMenuBarBase *menubar) { wxMenuBase::Attach(menubar); - wxCHECK_RET( m_menuBar, wxT("menubar can't be NULL after attaching") ); + wxCHECK_RET( m_menuBar, wxT("menubar can't be null after attaching") ); // unfortunately, we can't use m_menuBar->GetEventHandler() here because, // if the menubar is currently showing a menu, its event handler is a @@ -1315,7 +1315,7 @@ void wxMenu::Detach() { // After the menu is detached from the menu bar, it shouldn't send its // events to it. - SetNextHandler(NULL); + SetNextHandler(nullptr); wxMenuBase::Detach(); } @@ -1332,7 +1332,7 @@ wxWindow *wxMenu::GetRootWindow() const wxRenderer *wxMenu::GetRenderer() const { // we're going to crash without renderer! - wxCHECK_MSG( m_popupMenu, NULL, wxT("neither popup nor menubar menu?") ); + wxCHECK_MSG( m_popupMenu, nullptr, wxT("neither popup nor menubar menu?") ); return m_popupMenu->GetRenderer(); } @@ -1725,11 +1725,11 @@ int wxMenuItem::GetRadioGroupEnd() void wxMenuBar::Init() { - m_frameLast = NULL; + m_frameLast = nullptr; m_current = -1; - m_menuShown = NULL; + m_menuShown = nullptr; m_shouldShowMenu = false; } @@ -1745,7 +1745,7 @@ wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long WX void wxMenuBar::Attach(wxFrame *frame) { // maybe you really wanted to call Detach()? - wxCHECK_RET( frame, wxT("wxMenuBar::Attach(NULL) called") ); + wxCHECK_RET( frame, wxT("wxMenuBar::Attach(nullptr) called") ); wxMenuBarBase::Attach(frame); @@ -2524,7 +2524,7 @@ void wxMenuBar::PopupCurrentMenu(bool selectFirst) else { // reset it back as no menu is shown - m_menuShown = NULL; + m_menuShown = nullptr; } } //else: don't show disabled menu @@ -2541,7 +2541,7 @@ void wxMenuBar::DismissMenu() void wxMenuBar::OnDismissMenu(bool dismissMenuBar) { m_shouldShowMenu = false; - m_menuShown = NULL; + m_menuShown = nullptr; if ( dismissMenuBar ) { OnDismiss(); @@ -2612,7 +2612,7 @@ void wxMenuBar::GiveAwayFocus() // popup menu support // ---------------------------------------------------------------------------- -wxEventLoop *wxWindow::ms_evtLoopPopup = NULL; +wxEventLoop *wxWindow::ms_evtLoopPopup = nullptr; bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) { diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index a272e08071..77fd3abc25 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -116,7 +116,7 @@ void wxNotebook::Init() m_offset = 0; - m_spinbtn = NULL; + m_spinbtn = nullptr; } bool wxNotebook::Create(wxWindow *parent, @@ -373,7 +373,7 @@ bool wxNotebook::DeleteAllPages() wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, wxT("invalid notebook page") ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), nullptr, wxT("invalid notebook page") ); wxNotebookPage *page = m_pages[nPage]; m_pages.erase(m_pages.begin() + nPage); @@ -779,7 +779,7 @@ wxRect wxNotebook::GetTabsPart() const void wxNotebook::GetTabSize(int page, wxCoord *w, wxCoord *h) const { - wxCHECK_RET( w && h, wxT("NULL pointer in GetTabSize") ); + wxCHECK_RET( w && h, wxT("null pointer in GetTabSize") ); if ( IsVertical() ) { diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index 4db3b47510..3838f50c48 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -358,7 +358,7 @@ void wxRadioBox::DoSetToolTip(wxToolTip *tooltip) if (tooltip) m_buttons[n]->SetToolTip(tooltip->GetTip()); else - m_buttons[n]->SetToolTip(NULL); + m_buttons[n]->SetToolTip(nullptr); } } #endif // wxUSE_TOOLTIPS diff --git a/src/univ/scrarrow.cpp b/src/univ/scrarrow.cpp index e53456b76b..12b7243fdb 100644 --- a/src/univ/scrarrow.cpp +++ b/src/univ/scrarrow.cpp @@ -41,10 +41,10 @@ struct wxScrollArrowCaptureData wxScrollArrowCaptureData() { m_arrowPressed = wxScrollArrows::Arrow_None; - m_window = NULL; + m_window = nullptr; m_btnCapture = -1; #if wxUSE_TIMER - m_timerScroll = NULL; + m_timerScroll = nullptr; #endif // wxUSE_TIMER } @@ -114,7 +114,7 @@ protected: wxScrollArrows::wxScrollArrows(wxControlWithArrows *control) { m_control = control; - m_captureData = NULL; + m_captureData = nullptr; } wxScrollArrows::~wxScrollArrows() @@ -284,7 +284,7 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const Arrow arrow = m_captureData->m_arrowPressed; delete m_captureData; - wxConstCast(this, wxScrollArrows)->m_captureData = NULL; + wxConstCast(this, wxScrollArrows)->m_captureData = nullptr; m_control->SetArrowFlag(arrow, wxCONTROL_PRESSED, false); } diff --git a/src/univ/scrolbar.cpp b/src/univ/scrolbar.cpp index c75626ac92..17ab395afd 100644 --- a/src/univ/scrolbar.cpp +++ b/src/univ/scrolbar.cpp @@ -872,14 +872,14 @@ wxStdScrollBarInputHandler::wxStdScrollBarInputHandler(wxRenderer *renderer, : wxStdInputHandler(handler) { m_renderer = renderer; - m_winCapture = NULL; + m_winCapture = nullptr; m_htLast = wxHT_NOWHERE; - m_timerScroll = NULL; + m_timerScroll = nullptr; } wxStdScrollBarInputHandler::~wxStdScrollBarInputHandler() { - // normally, it's NULL by now but just in case the user somehow managed to + // normally, it's null by now but just in case the user somehow managed to // keep the mouse captured until now... delete m_timerScroll; } @@ -922,7 +922,7 @@ void wxStdScrollBarInputHandler::StopScrolling(wxScrollBar *control) if ( m_winCapture ) { m_winCapture->ReleaseMouse(); - m_winCapture = NULL; + m_winCapture = nullptr; } m_btnCapture = -1; diff --git a/src/univ/scrthumb.cpp b/src/univ/scrthumb.cpp index 53778ab039..caa78131ca 100644 --- a/src/univ/scrthumb.cpp +++ b/src/univ/scrthumb.cpp @@ -42,7 +42,7 @@ struct WXDLLEXPORT wxScrollThumbCaptureData { m_shaftPart = part; m_btnCapture = btn; - m_timerScroll = NULL; + m_timerScroll = nullptr; m_window = control->GetWindow(); m_window->CaptureMouse(); @@ -135,7 +135,7 @@ wxScrollThumb::wxScrollThumb(wxControlWithThumb *control) { m_shaftPart = Shaft_None; m_control = control; - m_captureData = NULL; + m_captureData = nullptr; } wxScrollThumb::~wxScrollThumb() @@ -143,7 +143,7 @@ wxScrollThumb::~wxScrollThumb() // make sure the mouse capture data will be released // when destroy the thumb. delete m_captureData; - wxConstCast(this, wxScrollThumb)->m_captureData = NULL; + wxConstCast(this, wxScrollThumb)->m_captureData = nullptr; } // ---------------------------------------------------------------------------- @@ -220,7 +220,7 @@ bool wxScrollThumb::HandleMouse(const wxMouseEvent& event) const // release the mouse and free capture data delete m_captureData; - wxConstCast(this, wxScrollThumb)->m_captureData = NULL; + wxConstCast(this, wxScrollThumb)->m_captureData = nullptr; m_control->SetShaftPartState(shaftPart, wxCONTROL_PRESSED, false); } diff --git a/src/univ/slider.cpp b/src/univ/slider.cpp index 90e9099ed9..369cb3d409 100644 --- a/src/univ/slider.cpp +++ b/src/univ/slider.cpp @@ -855,7 +855,7 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const { wxRect rectShaft = GetShaftRect(); wxRect rectThumb; - CalcThumbRect(&rectShaft, &rectThumb, NULL); + CalcThumbRect(&rectShaft, &rectThumb, nullptr); // check for possible shaft or thumb hit if (!rectShaft.Contains(pt) && !rectThumb.Contains(pt)) @@ -899,7 +899,7 @@ wxScrollThumb::Shaft wxSlider::HitTest(const wxPoint& pt) const wxCoord wxSlider::ThumbPosToPixel() const { wxRect rectThumb; - CalcThumbRect(NULL, &rectThumb, NULL); + CalcThumbRect(nullptr, &rectThumb, nullptr); return IsVert() ? rectThumb.y : rectThumb.x; } diff --git a/src/univ/stdrend.cpp b/src/univ/stdrend.cpp index 8e694120e3..debadce8b7 100644 --- a/src/univ/stdrend.cpp +++ b/src/univ/stdrend.cpp @@ -285,7 +285,7 @@ void wxStdRenderer::DrawButtonLabel(wxDC& dc, { rectLabel.Inflate(-1); - DrawFocusRect(NULL, dc, rectLabel); + DrawFocusRect(nullptr, dc, rectLabel); } } @@ -583,7 +583,7 @@ void wxStdRenderer::DrawFrame(wxDC& dc, { // the text should touch the top border of the rect, so the frame // itself should be lower - dc.GetTextExtent(label, NULL, &height); + dc.GetTextExtent(label, nullptr, &height); rectFrame.y += height / 2; rectFrame.height -= height / 2; @@ -632,7 +632,7 @@ void wxStdRenderer::DrawItem(wxDC& dc, if ( flags & wxCONTROL_FOCUSED ) { - DrawFocusRect(NULL, dc, rect, flags); + DrawFocusRect(nullptr, dc, rect, flags); } } @@ -708,7 +708,7 @@ void wxStdRenderer::DrawCheckOrRadioButton(wxDC& dc, yBmp = rect.y + (rect.height - heightBmp) / 2; wxRect rectLabel; - dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height); + dc.GetMultiLineTextExtent(label, nullptr, &rectLabel.height); rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2; // align label vertically with the bitmap - looks nicer like this @@ -759,7 +759,7 @@ void wxStdRenderer::DrawTextLine(wxDC& dc, { dc.DrawText(s, x, rect.y); - dc.GetTextExtent(s, &width, NULL); + dc.GetTextExtent(s, &width, nullptr); x += width; } @@ -774,7 +774,7 @@ void wxStdRenderer::DrawTextLine(wxDC& dc, dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID); dc.DrawText(s, x, rect.y); - dc.GetTextExtent(s, &width, NULL); + dc.GetTextExtent(s, &width, nullptr); x += width; dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); @@ -1105,14 +1105,14 @@ void wxStdRenderer::DrawFrameTitle(wxDC& dc, wxString s; wxCoord textW; - dc.GetTextExtent(title, &textW, NULL); + dc.GetTextExtent(title, &textW, nullptr); if ( textW > r.width ) { // text is too big, let's shorten it and add "..." after it: size_t len = title.length(); wxCoord WSoFar, letterW; - dc.GetTextExtent(wxT("..."), &WSoFar, NULL); + dc.GetTextExtent(wxT("..."), &WSoFar, nullptr); if ( WSoFar > r.width ) { // not enough space to draw anything @@ -1122,7 +1122,7 @@ void wxStdRenderer::DrawFrameTitle(wxDC& dc, s.Alloc(len); for (size_t i = 0; i < len; i++) { - dc.GetTextExtent(title[i], &letterW, NULL); + dc.GetTextExtent(title[i], &letterW, nullptr); if ( letterW + WSoFar > r.width ) break; WSoFar += letterW; diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index a0abcad84f..8618cd64b3 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -608,7 +608,7 @@ protected: { return ((wxTextCtrlCommand &)cmd).Undo(m_text); } // check if this command is a wxTextCtrlInsertCommand and return it casted - // to the right type if it is or NULL otherwise + // to the right type if it is or nullptr otherwise wxTextCtrlInsertCommand *IsInsertCommand(wxCommand *cmd); private: @@ -659,7 +659,7 @@ void wxTextCtrl::Init() m_cmdProcessor = new wxTextCtrlCommandProcessor(this); // no data yet - m_data.data = NULL; + m_data.data = nullptr; } bool wxTextCtrl::Create(wxWindow *parent, @@ -1364,7 +1364,7 @@ wxTextPos wxTextCtrl::GetInsertionPoint() const // else should be current cursor position long from; if ( HasSelection() ) - GetSelection(&from, NULL); + GetSelection(&from, nullptr); else from = m_curPos; return from; @@ -2231,7 +2231,7 @@ wxTextCtrlCommandProcessor::IsInsertCommand(wxCommand *command) { return (wxTextCtrlInsertCommand *) (command && (command->GetName() == wxTEXT_COMMAND_INSERT) - ? command : NULL); + ? command : nullptr); } void wxTextCtrlCommandProcessor::Store(wxCommand *command) @@ -2407,7 +2407,7 @@ wxSize wxTextCtrl::DoGetBestClientSize() const void wxTextCtrl::UpdateTextRect() { wxRect rectTotal(GetClientSize()); - wxCoord *extraSpace = WrapLines() ? &WData().m_widthMark : NULL; + wxCoord *extraSpace = WrapLines() ? &WData().m_widthMark : nullptr; m_rectText = GetRenderer()->GetTextClientArea(this, rectTotal, extraSpace); // code elsewhere is confused by negative rect size @@ -2556,14 +2556,14 @@ void wxTextCtrl::SetMaxLength(unsigned long len) wxCoord wxTextCtrl::GetTotalWidth() const { wxCoord w; - CalcUnscrolledPosition(m_rectText.width, 0, &w, NULL); + CalcUnscrolledPosition(m_rectText.width, 0, &w, nullptr); return w; } wxCoord wxTextCtrl::GetTextWidth(const wxString& text) const { wxCoord w; - GetTextExtent(GetTextToShow(text), &w, NULL); + GetTextExtent(GetTextToShow(text), &w, nullptr); return w; } @@ -2824,7 +2824,7 @@ size_t wxTextCtrl::GetPartOfWrappedLine(const wxChar* text, { wOld = w; str += *text++; - dc.GetTextExtent(str, &w, NULL); + dc.GetTextExtent(str, &w, nullptr); } if ( w > widthMax ) @@ -2877,7 +2877,7 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line, self->DoPrepareDC(dc); wxCoord width; - dc.GetTextExtent(line, &width, NULL); + dc.GetTextExtent(line, &width, nullptr); if ( x >= width ) { col = line.length(); @@ -2898,7 +2898,7 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line, // and this should give us much better approximation in such case // // OPT: maybe using (cache) m_widthAvg would be still faster? profile! - dc.GetTextExtent(line[0], &width, NULL); + dc.GetTextExtent(line[0], &width, nullptr); col = x / width; if ( col < 0 ) @@ -2933,7 +2933,7 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line, } wxString strBefore(line, (size_t)col); - dc.GetTextExtent(strBefore, &width, NULL); + dc.GetTextExtent(strBefore, &width, nullptr); if ( width > x ) { if ( matchDir == Match_Right ) @@ -2985,13 +2985,13 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTestLine(const wxString& line, { wxCoord width1; wxString text = line.Left(col); - dc.GetTextExtent(text, &width1, NULL); + dc.GetTextExtent(text, &width1, nullptr); if ( (size_t)col < line.length() ) { wxCoord width2; text += line[col]; - dc.GetTextExtent(text, &width2, NULL); + dc.GetTextExtent(text, &width2, nullptr); wxASSERT_MSG( (width1 <= x) && (x < width2), wxT("incorrect HitTestLine() result") ); @@ -3025,14 +3025,14 @@ wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pos, wxTextCoord *colOut, wxTextCoord *rowOut) const { - return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL); + return HitTest2(pos.y, pos.x, 0, rowOut, colOut, nullptr, nullptr); } wxTextCtrlHitTestResult wxTextCtrl::HitTestLogical(const wxPoint& pos, wxTextCoord *colOut, wxTextCoord *rowOut) const { - return HitTest2(pos.y, pos.x, 0, rowOut, colOut, NULL, NULL, false); + return HitTest2(pos.y, pos.x, 0, rowOut, colOut, nullptr, nullptr, false); } wxTextCtrlHitTestResult wxTextCtrl::HitTest2(wxCoord y0, @@ -3500,7 +3500,7 @@ void wxTextCtrl::UpdateMaxWidth(wxTextCoord line) // check if the max width changes after this line was modified wxCoord widthMaxOld = MData().m_widthMax, width; - GetTextExtent(GetLineText(line), &width, NULL); + GetTextExtent(GetLineText(line), &width, nullptr); if ( line == MData().m_lineLongest ) { @@ -3561,7 +3561,7 @@ wxCoord wxTextCtrl::GetMaxWidth() const for ( size_t n = 0; n < count; n++ ) { wxCoord width; - dc.GetTextExtent(GetLines()[n], &width, NULL); + dc.GetTextExtent(GetLines()[n], &width, nullptr); if ( width > MData().m_widthMax ) { // remember the width and the line which has it @@ -4013,10 +4013,10 @@ void wxTextCtrl::DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate) else // multiline { wxPoint pt = rectUpdate.GetPosition(); - (void)HitTest(pt, NULL, &lineStart); + (void)HitTest(pt, nullptr, &lineStart); pt.y += rectUpdate.height; - (void)HitTest(pt, NULL, &lineEnd); + (void)HitTest(pt, nullptr, &lineEnd); } // prepare for drawing @@ -4041,7 +4041,7 @@ void wxTextCtrl::DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate) } else // multiline, adjust for scrolling { - CalcUnscrolledPosition(0, yClient, NULL, &rectText.y); + CalcUnscrolledPosition(0, yClient, nullptr, &rectText.y); } wxRenderer *renderer = GetRenderer(); @@ -4168,14 +4168,14 @@ void wxTextCtrl::DoDrawLineWrapMarks(wxDC& dc, const wxRect& rectUpdate) rectMark.x = rectUpdate.x; rectMark.width = rectUpdate.width; wxCoord yTop = GetClientAreaOrigin().y; - CalcUnscrolledPosition(0, rectUpdate.y - yTop, NULL, &rectMark.y); + CalcUnscrolledPosition(0, rectUpdate.y - yTop, nullptr, &rectMark.y); wxCoord hLine = GetLineHeight(); rectMark.height = hLine; wxTextCoord line, rowInLine; wxCoord yBottom; - CalcUnscrolledPosition(0, rectUpdate.GetBottom() - yTop, NULL, &yBottom); + CalcUnscrolledPosition(0, rectUpdate.GetBottom() - yTop, nullptr, &yBottom); for ( ; rectMark.y < yBottom; rectMark.y += hLine ) { if ( !GetLineAndRow(rectMark.y / hLine, &line, &rowInLine) ) @@ -4336,7 +4336,7 @@ void wxTextCtrl::CreateCaret() else { // read only controls don't have the caret - caret = NULL; + caret = nullptr; } // SetCaret() will delete the old caret if any @@ -4450,9 +4450,9 @@ bool wxTextCtrl::PerformAction(const wxControlAction& actionOrig, // for example) we shouldn't do it - as indicated by this flag bool rememberAbscissa = false; - // the command this action corresponds to or NULL if this action doesn't + // the command this action corresponds to or nullptr if this action doesn't // change text at all or can't be undone - wxTextCtrlCommand *command = NULL; + wxTextCtrlCommand *command = nullptr; wxString action; bool del = false, @@ -4611,11 +4611,11 @@ bool wxTextCtrl::PerformAction(const wxControlAction& actionOrig, MoveInsertionPoint(newPos); - PositionToLogicalXY(pos, NULL, &y); + PositionToLogicalXY(pos, nullptr, &y); } else // scrolled down { - PositionToLogicalXY(newPos, NULL, &y); + PositionToLogicalXY(newPos, nullptr, &y); } // scroll vertically only @@ -4834,7 +4834,7 @@ wxInputHandler *wxTextCtrl::GetStdInputHandler(wxInputHandler *handlerDef) wxStdTextCtrlInputHandler::wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) { - m_winCapture = NULL; + m_winCapture = nullptr; } /* static */ @@ -5025,7 +5025,7 @@ bool wxStdTextCtrlInputHandler::HandleMouse(wxInputConsumer *consumer, m_winCapture->ShowCaret(); m_winCapture->ReleaseMouse(); - m_winCapture = NULL; + m_winCapture = nullptr; } } diff --git a/src/univ/theme.cpp b/src/univ/theme.cpp index ca4cd80f4d..0fc4318c20 100644 --- a/src/univ/theme.cpp +++ b/src/univ/theme.cpp @@ -35,8 +35,8 @@ // implementation // ============================================================================ -wxThemeInfo *wxTheme::ms_allThemes = NULL; -wxTheme *wxTheme::ms_theme = NULL; +wxThemeInfo *wxTheme::ms_allThemes = nullptr; +wxTheme *wxTheme::ms_theme = nullptr; // ---------------------------------------------------------------------------- // "dynamic" theme creation @@ -66,7 +66,7 @@ wxThemeInfo::wxThemeInfo(Constructor c, info = info->next; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- @@ -152,7 +152,7 @@ wxTheme::~wxTheme() wxDelegateTheme::wxDelegateTheme(const wxString& theme) { m_themeName = theme; - m_theme = NULL; + m_theme = nullptr; } wxDelegateTheme::~wxDelegateTheme() @@ -164,13 +164,13 @@ bool wxDelegateTheme::GetOrCreateTheme() { if ( !m_theme ) m_theme = wxTheme::Create(m_themeName); - return m_theme != NULL; + return m_theme != nullptr; } wxRenderer *wxDelegateTheme::GetRenderer() { if ( !GetOrCreateTheme() ) - return NULL; + return nullptr; return m_theme->GetRenderer(); } @@ -178,7 +178,7 @@ wxRenderer *wxDelegateTheme::GetRenderer() wxArtProvider *wxDelegateTheme::GetArtProvider() { if ( !GetOrCreateTheme() ) - return NULL; + return nullptr; return m_theme->GetArtProvider(); } @@ -187,7 +187,7 @@ wxInputHandler *wxDelegateTheme::GetInputHandler(const wxString& control, wxInputConsumer *consumer) { if ( !GetOrCreateTheme() ) - return NULL; + return nullptr; return m_theme->GetInputHandler(control, consumer); } @@ -195,7 +195,7 @@ wxInputHandler *wxDelegateTheme::GetInputHandler(const wxString& control, wxColourScheme *wxDelegateTheme::GetColourScheme() { if ( !GetOrCreateTheme() ) - return NULL; + return nullptr; return m_theme->GetColourScheme(); } diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index f0005e7946..91c856bd44 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -84,7 +84,7 @@ public: wxBorder border, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL); + wxRect *rectIn = nullptr); virtual void DrawButtonLabel(wxDC& dc, const wxString& label, const wxBitmap& image, @@ -96,7 +96,7 @@ public: virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL); + wxRect *rectIn = nullptr); virtual void DrawArrow(wxDC& dc, wxDirection dir, const wxRect& rect, @@ -145,7 +145,7 @@ public: wxOrientation orient, int flags = 0, long style = 0, - wxRect *rectShaft = NULL); + wxRect *rectShaft = nullptr); virtual void DrawSliderThumb(wxDC& dc, const wxRect& rect, wxOrientation orient, @@ -332,7 +332,7 @@ protected: int indexAccel, const wxString& accel = wxEmptyString, const wxBitmap& bitmap = wxNullBitmap, - const wxGTKMenuGeometryInfo *geometryInfo = NULL); + const wxGTKMenuGeometryInfo *geometryInfo = nullptr); // initialize the combo bitmaps void InitComboBitmaps(); @@ -527,9 +527,9 @@ WX_IMPLEMENT_THEME(wxGTKTheme, gtk, wxTRANSLATE("GTK+ theme")); wxGTKTheme::wxGTKTheme() { - m_scheme = NULL; - m_renderer = NULL; - m_artProvider = NULL; + m_scheme = nullptr; + m_renderer = nullptr; + m_artProvider = nullptr; } wxGTKTheme::~wxGTKTheme() @@ -571,7 +571,7 @@ wxColourScheme *wxGTKTheme::GetColourScheme() wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control, wxInputConsumer *consumer) { - wxInputHandler *handler = NULL; + wxInputHandler *handler = nullptr; int n = m_handlerNames.Index(control); if ( n == wxNOT_FOUND ) { @@ -1770,14 +1770,14 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win, h = heightText; wxCoord widthLabel; - dc.GetTextExtent(item->GetItemLabelText(), &widthLabel, NULL); + dc.GetTextExtent(item->GetItemLabelText(), &widthLabel, nullptr); if ( widthLabel > widthLabelMax ) { widthLabelMax = widthLabel; } wxCoord widthAccel; - dc.GetTextExtent(item->GetAccelString(), &widthAccel, NULL); + dc.GetTextExtent(item->GetAccelString(), &widthAccel, nullptr); if ( widthAccel > widthAccelMax ) { widthAccelMax = widthAccel; diff --git a/src/univ/themes/metal.cpp b/src/univ/themes/metal.cpp index efd72b0709..0338228bce 100644 --- a/src/univ/themes/metal.cpp +++ b/src/univ/themes/metal.cpp @@ -142,7 +142,7 @@ private: class wxMetalTheme : public wxDelegateTheme { public: - wxMetalTheme() : wxDelegateTheme(wxT("win32")), m_renderer(NULL) {} + wxMetalTheme() : wxDelegateTheme(wxT("win32")), m_renderer(nullptr) {} ~wxMetalTheme() { delete m_renderer; } protected: diff --git a/src/univ/themes/mono.cpp b/src/univ/themes/mono.cpp index e028eae0cb..e4723cc64c 100644 --- a/src/univ/themes/mono.cpp +++ b/src/univ/themes/mono.cpp @@ -56,7 +56,7 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL); + wxRect *rectBounds = nullptr); virtual void DrawButtonLabel(wxDC& dc, const wxString& label, const wxBitmap& image, @@ -64,14 +64,14 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL); + wxRect *rectBounds = nullptr); virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL); + wxRect *rectIn = nullptr); virtual void DrawHorizontalLine(wxDC& dc, wxCoord y, wxCoord x1, wxCoord x2); @@ -119,7 +119,7 @@ public: wxOrientation orient, int flags = 0, long style = 0, - wxRect *rectShaft = NULL); + wxRect *rectShaft = nullptr); virtual void DrawSliderThumb(wxDC& dc, const wxRect& rect, @@ -518,9 +518,9 @@ WX_IMPLEMENT_THEME(wxMonoTheme, mono, wxTRANSLATE("Simple monochrome theme")); wxMonoTheme::wxMonoTheme() { - m_scheme = NULL; - m_renderer = NULL; - m_artProvider = NULL; + m_scheme = nullptr; + m_renderer = nullptr; + m_artProvider = nullptr; } wxMonoTheme::~wxMonoTheme() @@ -564,7 +564,7 @@ wxInputHandler *wxMonoTheme::GetInputHandler(const wxString& WXUNUSED(control), wxInputConsumer *consumer) { // no special input handlers so far - return consumer->DoGetStdInputHandler(NULL); + return consumer->DoGetStdInputHandler(nullptr); } // ============================================================================ @@ -939,7 +939,7 @@ wxMenuGeometryInfo *wxMonoRenderer::GetMenuGeometry(wxWindow *WXUNUSED(win), { wxFAIL_MSG(wxT("TODO")); - return NULL; + return nullptr; } #endif // wxUSE_MENUS diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 0e0642064e..5ea598c2ea 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -96,7 +96,7 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL); + wxRect *rectBounds = nullptr); virtual void DrawButtonLabel(wxDC& dc, const wxString& label, const wxBitmap& image, @@ -104,11 +104,11 @@ public: int flags = 0, int alignment = wxALIGN_LEFT | wxALIGN_TOP, int indexAccel = -1, - wxRect *rectBounds = NULL); + wxRect *rectBounds = nullptr); virtual void DrawButtonBorder(wxDC& dc, const wxRect& rect, int flags = 0, - wxRect *rectIn = NULL); + wxRect *rectIn = nullptr); virtual void DrawArrow(wxDC& dc, wxDirection dir, @@ -150,7 +150,7 @@ public: wxOrientation orient, int flags = 0, long style = 0, - wxRect *rectShaft = NULL); + wxRect *rectShaft = nullptr); virtual void DrawSliderThumb(wxDC& dc, const wxRect& rect, wxOrientation orient, @@ -1061,28 +1061,28 @@ const char **wxWin32Renderer::ms_xpmIndicators[IndicatorType_Max] // radio { // normal state - { checked_radio_xpm, unchecked_radio_xpm, NULL }, + { checked_radio_xpm, unchecked_radio_xpm, nullptr }, // pressed state - { pressed_checked_radio_xpm, pressed_unchecked_radio_xpm, NULL }, + { pressed_checked_radio_xpm, pressed_unchecked_radio_xpm, nullptr }, // disabled state - { pressed_disabled_checked_radio_xpm, pressed_unchecked_radio_xpm, NULL }, + { pressed_disabled_checked_radio_xpm, pressed_unchecked_radio_xpm, nullptr }, }, // menu { // normal state - { checked_menu_xpm, NULL, NULL }, + { checked_menu_xpm, nullptr, nullptr }, // selected state - { selected_checked_menu_xpm, NULL, NULL }, + { selected_checked_menu_xpm, nullptr, nullptr }, // disabled state - { disabled_checked_menu_xpm, NULL, NULL }, + { disabled_checked_menu_xpm, nullptr, nullptr }, // disabled selected state - { selected_disabled_checked_menu_xpm, NULL, NULL }, + { selected_disabled_checked_menu_xpm, nullptr, nullptr }, } }; @@ -1104,9 +1104,9 @@ WX_IMPLEMENT_THEME(wxWin32Theme, win32, wxTRANSLATE("Win32 theme")); wxWin32Theme::wxWin32Theme() { - m_scheme = NULL; - m_renderer = NULL; - m_artProvider = NULL; + m_scheme = nullptr; + m_renderer = nullptr; + m_artProvider = nullptr; } wxWin32Theme::~wxWin32Theme() @@ -1140,7 +1140,7 @@ wxInputHandler * wxWin32Theme::GetInputHandler(const wxString& control, wxInputConsumer *consumer) { - wxInputHandler *handler = NULL; + wxInputHandler *handler = nullptr; int n = m_handlerNames.Index(control); if ( n == wxNOT_FOUND ) { @@ -1763,7 +1763,7 @@ void wxWin32Renderer::DrawToolBarButton(wxDC& dc, { int xpoint = (rect.GetLeft() + rect.GetRight() + 1 - bitmap.GetWidth()) / 2; int ypoint = (rect.GetTop() + rect.GetBottom() + 1 - bitmap.GetHeight()) / 2; - dc.DrawBitmap(bitmap, xpoint, ypoint, bitmap.GetMask() != NULL); + dc.DrawBitmap(bitmap, xpoint, ypoint, bitmap.GetMask() != nullptr); } } else if (style == wxTOOL_STYLE_SEPARATOR) @@ -2087,7 +2087,7 @@ void wxWin32Renderer::DrawSliderShaft(wxDC& dc, */ if (flags & wxCONTROL_FOCUSED) - DrawFocusRect(NULL, dc, rectOrig); + DrawFocusRect(nullptr, dc, rectOrig); wxRect rect = GetSliderShaftRect(rectOrig, lenThumb, orient, style); @@ -2518,14 +2518,14 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win, h = heightText; wxCoord widthLabel; - dc.GetTextExtent(item->GetItemLabelText(), &widthLabel, NULL); + dc.GetTextExtent(item->GetItemLabelText(), &widthLabel, nullptr); if ( widthLabel > widthLabelMax ) { widthLabelMax = widthLabel; } wxCoord widthAccel; - dc.GetTextExtent(item->GetAccelString(), &widthAccel, NULL); + dc.GetTextExtent(item->GetAccelString(), &widthAccel, nullptr); if ( widthAccel > widthAccelMax ) { widthAccelMax = widthAccel; @@ -3616,12 +3616,12 @@ wxWin32SystemMenuEvtHandler:: wxWin32SystemMenuEvtHandler(wxWin32FrameInputHandler *handler) { m_inputHnd = handler; - m_wnd = NULL; + m_wnd = nullptr; } void wxWin32SystemMenuEvtHandler::Attach(wxInputConsumer *consumer) { - wxASSERT_MSG( m_wnd == NULL, wxT("can't attach the handler twice!") ); + wxASSERT_MSG( m_wnd == nullptr, wxT("can't attach the handler twice!") ); m_wnd = wxStaticCast(consumer->GetInputWindow(), wxTopLevelWindow); m_wnd->PushEventHandler(this); @@ -3645,7 +3645,7 @@ void wxWin32SystemMenuEvtHandler::Detach() m_wnd->SetAcceleratorTable(m_oldAccelTable); #endif m_wnd->RemoveEventHandler(this); - m_wnd = NULL; + m_wnd = nullptr; } } @@ -3679,7 +3679,7 @@ void wxWin32SystemMenuEvtHandler::OnCloseFrame(wxCommandEvent &WXUNUSED(event)) void wxWin32SystemMenuEvtHandler::OnClose(wxCloseEvent &event) { - m_wnd = NULL; + m_wnd = nullptr; event.Skip(); } diff --git a/src/univ/toolbar.cpp b/src/univ/toolbar.cpp index fce33ce6fc..49039ae5a2 100644 --- a/src/univ/toolbar.cpp +++ b/src/univ/toolbar.cpp @@ -219,7 +219,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const if ( IsVertical() ) { if ( x < 0 || x > m_maxWidth ) - return NULL; + return nullptr; // we always use x, even for a vertical toolbar, this makes the code // below simpler @@ -228,7 +228,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const else // horizontal { if ( y < 0 || y > m_maxHeight ) - return NULL; + return nullptr; } for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); @@ -245,11 +245,11 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const { // don't return the separators from here, they don't accept any // input anyhow - return tool->IsSeparator() ? NULL : tool; + return tool->IsSeparator() ? nullptr : tool; } } - return NULL; + return nullptr; } void wxToolBar::SetToolShortHelp(int id, const wxString& help) @@ -340,7 +340,7 @@ wxRect wxToolBar::GetToolRect(wxToolBarToolBase *toolBase) const wxRect rect; - wxCHECK_MSG( tool, rect, wxT("GetToolRect: NULL tool") ); + wxCHECK_MSG( tool, rect, wxT("GetToolRect: null tool") ); // ensure that we always have the valid tool position if ( m_needsLayout ) @@ -573,7 +573,7 @@ void wxToolBar::GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const { - wxCHECK_RET( start && end, wxT("NULL pointer in GetRectLimits") ); + wxCHECK_RET( start && end, wxT("null pointer in GetRectLimits") ); if ( IsVertical() ) { @@ -802,9 +802,9 @@ wxInputHandler *wxToolBar::GetStdInputHandler(wxInputHandler *handlerDef) wxStdToolbarInputHandler::wxStdToolbarInputHandler(wxInputHandler *handler) : wxStdInputHandler(handler) { - m_winCapture = NULL; - m_toolCapture = NULL; - m_toolLast = NULL; + m_winCapture = nullptr; + m_toolCapture = nullptr; + m_toolLast = nullptr; } bool wxStdToolbarInputHandler::HandleKey(wxInputConsumer *consumer, @@ -844,7 +844,7 @@ bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer, if ( m_winCapture ) { m_winCapture->ReleaseMouse(); - m_winCapture = NULL; + m_winCapture = nullptr; } if (m_toolCapture) @@ -855,7 +855,7 @@ bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer, consumer->PerformAction( wxACTION_TOOLBAR_LEAVE, m_toolCapture->GetId() ); } - m_toolCapture = NULL; + m_toolCapture = nullptr; return true; } @@ -877,7 +877,7 @@ bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer, { // We cannot possibly be over a tool when // leaving the toolbar - tool = NULL; + tool = nullptr; } else { @@ -888,7 +888,7 @@ bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer, { // During capture we only care of the captured tool if (tool && (tool != m_toolCapture)) - tool = NULL; + tool = nullptr; if (tool == m_toolLast) return true; diff --git a/src/univ/topluniv.cpp b/src/univ/topluniv.cpp index 555cc4c0f8..2e7d7953fe 100644 --- a/src/univ/topluniv.cpp +++ b/src/univ/topluniv.cpp @@ -46,7 +46,7 @@ public: virtual bool HandleActivation(wxInputConsumer *consumer, bool activated); private: - // the window (button) which has capture or NULL and the last hittest result + // the window (button) which has capture or nullptr and the last hittest result wxTopLevelWindow *m_winCapture; long m_winHitTest; long m_winPressed; @@ -81,7 +81,7 @@ void wxTopLevelWindow::Init() { ms_drawDecorations = !wxSystemSettings::HasFeature(wxSYS_CAN_DRAW_FRAME_DECORATIONS) || - wxGetEnv(wxT("WXDECOR"), NULL); + wxGetEnv(wxT("WXDECOR"), nullptr); } m_usingNativeDecorations = ms_drawDecorations == 0; @@ -824,7 +824,7 @@ wxTopLevelWindow::GetStdInputHandler(wxInputHandler *handlerDef) wxStdTLWInputHandler::wxStdTLWInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) { - m_winCapture = NULL; + m_winCapture = nullptr; m_winHitTest = 0; m_winPressed = 0; m_borderCursorOn = false; @@ -875,7 +875,7 @@ bool wxStdTLWInputHandler::HandleMouse(wxInputConsumer *consumer, if ( m_winCapture ) { m_winCapture->ReleaseMouse(); - m_winCapture = NULL; + m_winCapture = nullptr; if ( m_winHitTest == m_winPressed ) { diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 5d76e44a8d..7bffdeca74 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -123,7 +123,7 @@ void wxWindow::Init() { #if wxUSE_SCROLLBAR m_scrollbarVert = - m_scrollbarHorz = NULL; + m_scrollbarHorz = nullptr; #endif // wxUSE_SCROLLBAR m_isCurrent = false; @@ -225,7 +225,7 @@ wxWindow::~wxWindow() // children and so will be deleted by DestroyChildren() call below and if // any code using the scrollbars would be called in the process or from // ~wxWindowBase, the app would crash: - m_scrollbarVert = m_scrollbarHorz = NULL; + m_scrollbarVert = m_scrollbarHorz = nullptr; #endif // we have to destroy our children before we're destroyed because our @@ -523,7 +523,7 @@ bool wxWindow::Enable(bool enable) return false; // disabled window can't keep focus - if ( FindFocus() == this && GetParent() != NULL ) + if ( FindFocus() == this && GetParent() != nullptr ) { GetParent()->SetFocus(); } @@ -969,9 +969,9 @@ void wxWindow::SetScrollbar(int orient, delete scrollbar; if ( orient & wxVERTICAL ) - m_scrollbarVert = NULL; + m_scrollbarVert = nullptr; else - m_scrollbarHorz = NULL; + m_scrollbarHorz = nullptr; // the client area increased as we removed a scrollbar hasClientSizeChanged = true; @@ -1096,7 +1096,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) continue; #endif // wxUSE_SCROLLBAR - // VS: Scrolling children has non-trivial semantics. If rect=NULL then + // VS: Scrolling children has non-trivial semantics. If rect=nullptr then // it is easy: we scroll all children. Otherwise it gets // complicated: // 1. if scrolling in one direction only, scroll only @@ -1121,7 +1121,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) } // else: child outside of scrolling shaft, don't move } - else // scrolling in both axes or rect=NULL + else // scrolling in both axes or rect=nullptr { shouldMove = true; } @@ -1292,7 +1292,7 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal) #if wxUSE_MENUS // the last window over which Alt was pressed (used by OnKeyUp) - wxWindow *wxWindow::ms_winLastAltPress = NULL; + wxWindow *wxWindow::ms_winLastAltPress = nullptr; #endif // wxUSE_MENUS #if wxUSE_ACCEL || wxUSE_MENUS @@ -1309,7 +1309,7 @@ void wxWindow::OnKeyDown(wxKeyEvent& event) return; } - ms_winLastAltPress = NULL; + ms_winLastAltPress = nullptr; #endif // wxUSE_MENUS #if wxUSE_ACCEL @@ -1391,7 +1391,7 @@ wxMenuBar *wxWindow::GetParentFrameMenuBar() const } } - return NULL; + return nullptr; } void wxWindow::OnChar(wxKeyEvent& event) @@ -1459,7 +1459,7 @@ void wxWindow::OnKeyUp(wxKeyEvent& event) } // in any case reset it - ms_winLastAltPress = NULL; + ms_winLastAltPress = nullptr; } #endif // wxUSE_MENUS diff --git a/src/unix/appunix.cpp b/src/unix/appunix.cpp index c13c2f15cc..a9fb317c6a 100644 --- a/src/unix/appunix.cpp +++ b/src/unix/appunix.cpp @@ -73,7 +73,7 @@ private: wxAppConsole::wxAppConsole() { - m_signalWakeUpPipe = NULL; + m_signalWakeUpPipe = nullptr; } wxAppConsole::~wxAppConsole() @@ -129,7 +129,7 @@ void wxAppConsole::CheckSignal() wxFDIOHandler* wxAppConsole::RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatcher) { - wxCHECK_MSG( m_signalWakeUpPipe, NULL, "Should be allocated" ); + wxCHECK_MSG( m_signalWakeUpPipe, nullptr, "Should be allocated" ); // we need a bridge to wxFDIODispatcher // @@ -143,7 +143,7 @@ wxFDIOHandler* wxAppConsole::RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatch fdioHandler.get(), wxFDIO_INPUT ) ) - return NULL; + return nullptr; return fdioHandler.release(); } @@ -173,7 +173,7 @@ bool wxAppConsole::SetSignalHandler(int signal, SignalHandler handler) memset(&sa, 0, sizeof(sa)); sa.sa_handler = (SignalHandler_t)&wxAppConsole::HandleSignal; sa.sa_flags = SA_RESTART; - int res = sigaction(signal, &sa, 0); + int res = sigaction(signal, &sa, nullptr); if ( res != 0 ) { wxLogSysError(_("Failed to install signal handler")); diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index 36a1f0ad91..69ceeb8fad 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -111,7 +111,7 @@ public: // returns true if (async) dialing is in progress virtual bool IsDialing() const override - { return m_DialProcess != NULL; } + { return m_DialProcess != nullptr; } // cancel dialing the number initiated with Dial(async = true) // NB: this won't result in DISCONNECTED event being sent @@ -264,12 +264,12 @@ public: { m_DupMan = dupman; } - void Disconnect() { m_DupMan = NULL; } + void Disconnect() { m_DupMan = nullptr; } virtual void OnTerminate(int WXUNUSED(pid), int WXUNUSED(status)) override { if(m_DupMan) { - m_DupMan->m_DialProcess = NULL; + m_DupMan->m_DialProcess = nullptr; m_DupMan->CheckStatus(true); } } @@ -290,8 +290,8 @@ wxDialUpManagerImpl::wxDialUpManagerImpl() { m_IsOnline = m_connCard = Net_Unknown; - m_DialProcess = NULL; - m_timer = NULL; + m_DialProcess = nullptr; + m_timer = nullptr; m_CanUseIfconfig = -1; // unknown m_CanUsePing = -1; // unknown m_BeaconPort = 80; @@ -382,7 +382,7 @@ bool wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) void wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() { - if(m_timer != NULL) + if(m_timer != nullptr) { m_timer->Stop(); wxDELETE(m_timer); @@ -552,7 +552,7 @@ wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckConnect() struct hostent *hp; struct sockaddr_in serv_addr; - if((hp = gethostbyname(m_BeaconHost.mb_str())) == NULL) + if((hp = gethostbyname(m_BeaconHost.mb_str())) == nullptr) return Net_No; // no DNS no net serv_addr.sin_family = hp->h_addrtype; @@ -596,14 +596,14 @@ wxDialUpManagerImpl::CheckProcNet() // cannot use wxFile::Length because file doesn't support seeking, so // use stdio directly FILE *f = fopen("/proc/net/route", "rt"); - if (f != NULL) + if (f != nullptr) { // now we know that we will find all devices we may have netDevice = NetDevice_None; char output[256]; - while (fgets(output, 256, f) != NULL) + while (fgets(output, 256, f) != nullptr) { // Test for the known network interface names if ( strstr(output, "eth") @@ -718,17 +718,17 @@ wxDialUpManagerImpl::CheckIfconfig() #if defined(__SOLARIS__) || defined (__SUNOS__) // dialup device under SunOS/Solaris - hasModem = strstr(output.fn_str(),"ipdptp") != NULL; - hasLAN = strstr(output.fn_str(), "hme") != NULL; + hasModem = strstr(output.fn_str(),"ipdptp") != nullptr; + hasLAN = strstr(output.fn_str(), "hme") != nullptr; #elif defined(__LINUX__) || defined (__FREEBSD__) || defined (__QNX__) || \ defined(__OPENBSD__) || defined(__DARWIN__) hasModem = strstr(output.fn_str(),"ppp") // ppp || strstr(output.fn_str(),"sl") // slip || strstr(output.fn_str(),"pl"); // plip - hasLAN = strstr(output.fn_str(), "eth") != NULL - || strstr(output.fn_str(),"en") != NULL; // en0, en1 osx + hasLAN = strstr(output.fn_str(), "eth") != nullptr + || strstr(output.fn_str(),"en") != nullptr; // en0, en1 osx #elif defined(__SGI__) // IRIX - hasModem = strstr(output.fn_str(), "ppp") != NULL; // PPP + hasModem = strstr(output.fn_str(), "ppp") != nullptr; // PPP #elif defined(__HPUX__) // if could run ifconfig on interface, then it exists hasModem = true; diff --git a/src/unix/dir.cpp b/src/unix/dir.cpp index b4230a3262..9f2038464a 100644 --- a/src/unix/dir.cpp +++ b/src/unix/dir.cpp @@ -52,7 +52,7 @@ public: wxDirData(const wxString& dirname); ~wxDirData(); - bool IsOk() const { return m_dir != NULL; } + bool IsOk() const { return m_dir != nullptr; } void SetFileSpec(const wxString& filespec) { m_filespec = filespec; } void SetFlags(int flags) { m_flags = flags; } @@ -84,7 +84,7 @@ private: wxDirData::wxDirData(const wxString& dirname) : m_dirname(dirname) { - m_dir = NULL; + m_dir = nullptr; // throw away the trailing slashes size_t n = m_dirname.length(); @@ -112,7 +112,7 @@ wxDirData::~wxDirData() bool wxDirData::Read(wxString *filename) { - dirent *de = NULL; // just to silence compiler warnings + dirent *de = nullptr; // just to silence compiler warnings bool matches = false; // speed up string concatenation in the loop a bit @@ -207,7 +207,7 @@ bool wxDirData::Read(wxString * WXUNUSED(filename)) wxDir::wxDir(const wxString& dirname) { - m_data = NULL; + m_data = nullptr; (void)Open(dirname); } @@ -220,7 +220,7 @@ bool wxDir::Open(const wxString& dirname) if ( !M_DIR->IsOk() ) { delete M_DIR; - m_data = NULL; + m_data = nullptr; return false; } @@ -230,7 +230,7 @@ bool wxDir::Open(const wxString& dirname) bool wxDir::IsOpened() const { - return m_data != NULL; + return m_data != nullptr; } wxString wxDir::GetName() const @@ -257,7 +257,7 @@ void wxDir::Close() if ( m_data ) { delete m_data; - m_data = NULL; + m_data = nullptr; } } diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 65948751fd..ee6f731f44 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -206,7 +206,7 @@ wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n) { ScreensInfo screens; - return n < screens.GetCount() ? new wxDisplayImplX11(n, screens[n]) : NULL; + return n < screens.GetCount() ? new wxDisplayImplX11(n, screens[n]) : nullptr; } // ============================================================================ diff --git a/src/unix/dlunix.cpp b/src/unix/dlunix.cpp index 08af31f4f3..65df99bfe2 100644 --- a/src/unix/dlunix.cpp +++ b/src/unix/dlunix.cpp @@ -61,7 +61,7 @@ wxDllType wxDynamicLibrary::GetProgramHandle() { - return dlopen(0, RTLD_LAZY); + return dlopen(nullptr, RTLD_LAZY); } /* static */ @@ -177,8 +177,8 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() { // details of the module currently being parsed wxString pathCur; - void *startCur = NULL, - *endCur = NULL; + void *startCur = nullptr, + *endCur = nullptr; char path[1024]; char buf[1024]; @@ -246,7 +246,7 @@ void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) // At least under Solaris dladdr() takes non-const void*. if ( dladdr(const_cast(addr), &di) == 0 ) - return NULL; + return nullptr; if ( path ) *path = di.dli_fname; @@ -257,7 +257,7 @@ void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) wxUnusedVar(path); #endif // HAVE_DLADDR - return NULL; + return nullptr; } diff --git a/src/unix/epolldispatcher.cpp b/src/unix/epolldispatcher.cpp index 1efc707d00..db3cdee37a 100644 --- a/src/unix/epolldispatcher.cpp +++ b/src/unix/epolldispatcher.cpp @@ -82,7 +82,7 @@ wxEpollDispatcher *wxEpollDispatcher::Create() if ( epollDescriptor == -1 ) { wxLogSysError(_("Failed to create epoll descriptor")); - return NULL; + return nullptr; } wxLogTrace(wxEpollDispatcher_Trace, wxT("Epoll fd %d created"), epollDescriptor); @@ -148,7 +148,7 @@ bool wxEpollDispatcher::UnregisterFD(int fd) { epoll_event ev; ev.events = 0; - ev.data.ptr = NULL; + ev.data.ptr = nullptr; if ( epoll_ctl(m_epollDescriptor, EPOLL_CTL_DEL, fd, &ev) != 0 ) { @@ -221,7 +221,7 @@ int wxEpollDispatcher::Dispatch(int timeout) wxFDIOHandler * const handler = (wxFDIOHandler *)(p->data.ptr); if ( !handler ) { - wxFAIL_MSG( wxT("NULL handler in epoll_event?") ); + wxFAIL_MSG( wxT("null handler in epoll_event?") ); continue; } diff --git a/src/unix/evtloopunix.cpp b/src/unix/evtloopunix.cpp index f1414bb15e..0c1e72ce41 100644 --- a/src/unix/evtloopunix.cpp +++ b/src/unix/evtloopunix.cpp @@ -56,9 +56,9 @@ wxConsoleEventLoop::wxConsoleEventLoop() { // Be pessimistic initially and assume that we failed to initialize. - m_dispatcher = NULL; - m_wakeupPipe = NULL; - m_wakeupSource = NULL; + m_dispatcher = nullptr; + m_wakeupPipe = nullptr; + m_wakeupSource = nullptr; // Create the pipe. wxScopedPtr wakeupPipe(new wxWakeUpPipeMT); @@ -111,7 +111,7 @@ public: wxEventLoopSourceHandler *handler, int flags) override { - wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); + wxCHECK_MSG( fd != -1, nullptr, "can't monitor invalid fd" ); wxLogTrace(wxTRACE_EVT_SOURCE, "Adding event loop source for fd=%d", fd); @@ -123,7 +123,7 @@ public: fdioHandler(new wxFDIOEventLoopSourceHandler(handler)); if ( !wxFDIODispatcher::Get()->RegisterFD(fd, fdioHandler.get(), flags) ) - return NULL; + return nullptr; return new wxUnixEventLoopSource(wxFDIODispatcher::Get(), fdioHandler.release(), fd, handler, flags); diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index 04d6db448c..a6827288ab 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -73,7 +73,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, return false; } - PangoFontFamily **families = NULL; + PangoFontFamily **families = nullptr; gint n_families = 0; PangoContext* context = wxGetPangoContext(); pango_context_list_families(context, &families, &n_families); @@ -196,7 +196,7 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This, char *dash = strchr(font + 1, '-'); char *family = dash + 1; dash = strchr(family, '-'); - *dash = '\0'; // !NULL because Matches() above succeeded + *dash = '\0'; // not-null because Matches() above succeeded wxString fam(family); if ( families.Index(fam) == wxNOT_FOUND ) @@ -310,7 +310,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) char *dash = strchr(font + 1, '-'); char *familyFont = dash + 1; dash = strchr(familyFont, '-'); - *dash = '\0'; // !NULL because Matches() above succeeded + *dash = '\0'; // not-null because Matches() above succeeded if ( !family.empty() && (family != familyFont) ) { diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index ea2270ef31..793e26fd2d 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -61,7 +61,7 @@ PangoContext* wxGetPangoContext(); void wxNativeFontInfo::Init() { - description = NULL; + description = nullptr; m_underlined = false; m_strikethrough = false; } @@ -76,7 +76,7 @@ void wxNativeFontInfo::Init(const wxNativeFontInfo& info) } else { - description = NULL; + description = nullptr; m_underlined = false; m_strikethrough = false; } @@ -163,7 +163,7 @@ wxFontFamily wxNativeFontInfo::GetFamily() const else { PangoFontFamily **families; - PangoFontFamily *family = NULL; + PangoFontFamily *family = nullptr; int n_families; PangoContext* context = wxGetPangoContext(); pango_context_list_families(context, &families, &n_families); @@ -186,17 +186,17 @@ wxFontFamily wxNativeFontInfo::GetFamily() const // don't assert until wxSystemSettings::GetFont is checked for this - MR // wxASSERT_MSG( family, "No appropriate PangoFontFamily found for ::description" ); - if (family != NULL && pango_font_family_is_monospace( family )) + if (family != nullptr && pango_font_family_is_monospace( family )) ret = wxFONTFAMILY_TELETYPE; // is deemed a monospace font by pango } #endif // GTK+ 2 || HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE if (ret == wxFONTFAMILY_UNKNOWN) { - if (strstr( family_text, "sans" ) != NULL || strstr( family_text, "Sans" ) != NULL) + if (strstr( family_text, "sans" ) != nullptr || strstr( family_text, "Sans" ) != nullptr) // checked before serif, so that "* Sans Serif" fonts are detected correctly ret = wxFONTFAMILY_SWISS; // contains "Sans" - else if (strstr( family_text, "serif" ) != NULL || strstr( family_text, "Serif" ) != NULL) + else if (strstr( family_text, "serif" ) != nullptr || strstr( family_text, "Serif" ) != nullptr) ret = wxFONTFAMILY_ROMAN; // contains "Serif" else if (wxStrnicmp( family_text, "times", 5 ) == 0) ret = wxFONTFAMILY_ROMAN; // begins with "Times" @@ -447,7 +447,7 @@ wxString wxNativeFontInfo::ToUserString() const // private data // ---------------------------------------------------------------------------- -static wxHashTable *g_fontHash = NULL; +static wxHashTable *g_fontHash = nullptr; // ---------------------------------------------------------------------------- // private functions @@ -1195,7 +1195,7 @@ wxNativeFont wxLoadQueryNearestFont(double pointSize, // this should never happen as we had tested for it in the // very beginning, but if it does, do return something non - // NULL or we'd crash in wxFont code + // null or we'd crash in wxFont code if ( !font ) { wxFAIL_MSG( wxT("this encoding should be available!") ); diff --git a/src/unix/fswatcher_inotify.cpp b/src/unix/fswatcher_inotify.cpp index 2902d10bd7..a0a381dfea 100644 --- a/src/unix/fswatcher_inotify.cpp +++ b/src/unix/fswatcher_inotify.cpp @@ -41,7 +41,7 @@ class wxFSWatcherImplUnix : public wxFSWatcherImpl public: wxFSWatcherImplUnix(wxFileSystemWatcherBase* watcher) : wxFSWatcherImpl(watcher), - m_source(NULL), + m_source(nullptr), m_ifd(-1) { m_handler = new wxFSWSourceHandler(this); @@ -79,7 +79,7 @@ public: wxEVENT_SOURCE_INPUT | wxEVENT_SOURCE_EXCEPTION ); - return m_source != NULL; + return m_source != nullptr; } void Close() @@ -202,7 +202,7 @@ public: bool IsOk() const { - return m_source != NULL; + return m_source != nullptr; } protected: diff --git a/src/unix/fswatcher_kqueue.cpp b/src/unix/fswatcher_kqueue.cpp index 28da973957..55e3541411 100644 --- a/src/unix/fswatcher_kqueue.cpp +++ b/src/unix/fswatcher_kqueue.cpp @@ -82,7 +82,7 @@ class wxFSWatcherImplKqueue : public wxFSWatcherImpl public: wxFSWatcherImplKqueue(wxFileSystemWatcherBase* watcher) : wxFSWatcherImpl(watcher), - m_source(NULL), + m_source(nullptr), m_kfd(-1) { m_handler = new wxFSWSourceHandler(this); @@ -118,7 +118,7 @@ public: // create source m_source = wxEventLoopBase::AddSourceForFD(m_kfd, m_handler, wxEVENT_SOURCE_INPUT); - return m_source != NULL; + return m_source != nullptr; } void Close() @@ -147,7 +147,7 @@ public: // TODO more error conditions according to man // TODO best deal with the error here - int ret = kevent(m_kfd, &event, 1, NULL, 0, NULL); + int ret = kevent(m_kfd, &event, 1, nullptr, 0, nullptr); if (ret == -1) { wxLogSysError(_("Unable to add kqueue watch")); @@ -196,7 +196,7 @@ public: { struct kevent event; struct timespec timeout = {0, 0}; - int ret = kevent(m_kfd, NULL, 0, &event, 1, &timeout); + int ret = kevent(m_kfd, nullptr, 0, &event, 1, &timeout); if (ret == -1) { wxLogSysError(_("Unable to get events from kqueue")); @@ -219,7 +219,7 @@ public: bool IsOk() const { - return m_source != NULL; + return m_source != nullptr; } protected: diff --git a/src/unix/glegl.cpp b/src/unix/glegl.cpp index 582fdfba7b..ca7c90c1b3 100644 --- a/src/unix/glegl.cpp +++ b/src/unix/glegl.cpp @@ -285,9 +285,9 @@ wxIMPLEMENT_CLASS(wxGLContext, wxObject); wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other, const wxGLContextAttrs *ctxAttrs) - : m_glContext(NULL) + : m_glContext(nullptr) { - const int* contextAttribs = NULL; + const int* contextAttribs = nullptr; if ( ctxAttrs ) { @@ -345,16 +345,16 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const wxGLCanvasEGL::wxGLCanvasEGL() { - m_config = NULL; - m_display = NULL; + m_config = nullptr; + m_display = nullptr; m_surface = EGL_NO_SURFACE; - m_wlCompositor = NULL; - m_wlSubcompositor = NULL; - m_wlFrameCallbackHandler = NULL; - m_wlEGLWindow = NULL; - m_wlSurface = NULL; - m_wlRegion = NULL; - m_wlSubsurface = NULL; + m_wlCompositor = nullptr; + m_wlSubcompositor = nullptr; + m_wlFrameCallbackHandler = nullptr; + m_wlEGLWindow = nullptr; + m_wlSurface = nullptr; + m_wlRegion = nullptr; + m_wlSubsurface = nullptr; m_readyToDraw = false; } @@ -365,7 +365,7 @@ bool wxGLCanvasEGL::InitVisual(const wxGLAttributes& dispAttrs) { wxFAIL_MSG("Failed to get an EGLConfig for the requested attributes."); } - return m_config != NULL; + return m_config != nullptr; } /* static */ @@ -385,7 +385,7 @@ EGLDisplay wxGLCanvasEGL::GetDisplay() return EGL_NO_DISPLAY; } - return eglGetPlatformDisplay(platform, info.dpy, NULL); + return eglGetPlatformDisplay(platform, info.dpy, nullptr); } #ifdef GDK_WINDOWING_WAYLAND @@ -470,7 +470,7 @@ bool wxGLCanvasEGL::CreateSurface() { m_xwindow = GDK_WINDOW_XID(window); m_surface = eglCreatePlatformWindowSurface(m_display, *m_config, - &m_xwindow, NULL); + &m_xwindow, nullptr); m_readyToDraw = true; } #endif @@ -502,7 +502,7 @@ bool wxGLCanvasEGL::CreateSurface() m_wlEGLWindow = wl_egl_window_create(m_wlSurface, w * scale, h * scale); m_surface = eglCreatePlatformWindowSurface(m_display, *m_config, - m_wlEGLWindow, NULL); + m_wlEGLWindow, nullptr); m_wlFrameCallbackHandler = wl_surface_frame(surface); wl_callback_add_listener(m_wlFrameCallbackHandler, &wl_frame_listener, this); @@ -554,22 +554,22 @@ EGLConfig *wxGLCanvasEGL::InitConfig(const wxGLAttributes& dispAttrs) if ( !attrsList ) { wxFAIL_MSG("wxGLAttributes object is empty."); - return NULL; + return nullptr; } EGLDisplay dpy = GetDisplay(); if ( dpy == EGL_NO_DISPLAY ) { wxFAIL_MSG("Unable to get EGL Display"); - return NULL; + return nullptr; } - if ( !eglInitialize(dpy, NULL, NULL) ) + if ( !eglInitialize(dpy, nullptr, nullptr) ) { wxFAIL_MSG("eglInitialize failed"); - return NULL; + return nullptr; } if ( !eglBindAPI(EGL_OPENGL_API) ) { wxFAIL_MSG("eglBindAPI failed"); - return NULL; + return nullptr; } EGLConfig *config = new EGLConfig; @@ -582,7 +582,7 @@ EGLConfig *wxGLCanvasEGL::InitConfig(const wxGLAttributes& dispAttrs) else { delete config; - return NULL; + return nullptr; } } @@ -590,7 +590,7 @@ EGLConfig *wxGLCanvasEGL::InitConfig(const wxGLAttributes& dispAttrs) bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) { wxScopedPtr config(wxGLCanvasEGL::InitConfig(dispAttrs)); - return config != NULL; + return config != nullptr; } /* static */ @@ -606,7 +606,7 @@ bool wxGLCanvasBase::IsDisplaySupported(const int *attribList) // default visual management // ---------------------------------------------------------------------------- -EGLConfig *wxGLCanvasEGL::ms_glEGLConfig = NULL; +EGLConfig *wxGLCanvasEGL::ms_glEGLConfig = nullptr; /* static */ bool wxGLCanvasEGL::InitDefaultConfig(const int *attribList) @@ -616,7 +616,7 @@ bool wxGLCanvasEGL::InitDefaultConfig(const int *attribList) ParseAttribList(attribList, dispAttrs); ms_glEGLConfig = InitConfig(dispAttrs); - return ms_glEGLConfig != NULL; + return ms_glEGLConfig != nullptr; } /* static */ @@ -625,7 +625,7 @@ void wxGLCanvasEGL::FreeDefaultConfig() if ( ms_glEGLConfig ) { delete ms_glEGLConfig; - ms_glEGLConfig = NULL; + ms_glEGLConfig = nullptr; } } diff --git a/src/unix/glx11.cpp b/src/unix/glx11.cpp index f25716e33e..0a9c7a52fc 100644 --- a/src/unix/glx11.cpp +++ b/src/unix/glx11.cpp @@ -453,9 +453,9 @@ wxIMPLEMENT_CLASS(wxGLContext, wxObject); wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other, const wxGLContextAttrs *ctxAttrs) - : m_glContext(NULL) + : m_glContext(nullptr) { - const int* contextAttribs = NULL; + const int* contextAttribs = nullptr; Bool x11Direct = True; int renderType = GLX_RGBA_TYPE; bool needsARB = false; @@ -485,7 +485,7 @@ wxGLContext::wxGLContext(wxGLCanvas *win, // We need to create a temporary context to get the // glXCreateContextAttribsARB function - GLXContext tempContext = glXCreateContext(dpy, vi, NULL, x11Direct); + GLXContext tempContext = glXCreateContext(dpy, vi, nullptr, x11Direct); wxCHECK_RET(tempContext, "glXCreateContext failed" ); GLXFBConfig* const fbc = win->GetGLXFBConfig(); @@ -517,12 +517,12 @@ wxGLContext::wxGLContext(wxGLCanvas *win, x11Direct, contextAttribs ); // Some old hardware may accept the use of this ARB, but may fail. - // In case of NULL attributes we'll try creating the context old-way. + // In case of null attributes we'll try creating the context old-way. XSync( dpy, False ); if ( g_ctxErrorOccurred && (!contextAttribs || !needsARB) ) { g_ctxErrorOccurred = false; //Reset - m_glContext = NULL; + m_glContext = nullptr; } } @@ -561,7 +561,7 @@ wxGLContext::~wxGLContext() return; if ( m_glContext == glXGetCurrentContext() ) - MakeCurrent(None, NULL); + MakeCurrent(None, nullptr); glXDestroyContext( wxGetX11Display(), m_glContext ); } @@ -603,13 +603,13 @@ static bool InitXVisualInfo( wxGLCanvasX11::wxGLCanvasX11() { - m_fbc = NULL; - m_vi = NULL; + m_fbc = nullptr; + m_vi = nullptr; } bool wxGLCanvasX11::InitVisual(const wxGLAttributes& dispAttrs) { - XVisualInfo* vi = NULL; + XVisualInfo* vi = nullptr; bool ret = InitXVisualInfo(dispAttrs, &m_fbc, &vi); m_vi = vi; if ( !ret ) @@ -678,25 +678,25 @@ static bool InitXVisualInfo(const wxGLAttributes& dispAttrs, if ( !*pXVisual ) { XFree(*pFBC); - *pFBC = NULL; + *pFBC = nullptr; } } } else // GLX <= 1.2 { - *pFBC = NULL; + *pFBC = nullptr; *pXVisual = glXChooseVisual(dpy, DefaultScreen(dpy), const_cast(attrsListGLX) ); } - return *pXVisual != NULL; + return *pXVisual != nullptr; } /* static */ bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) { - GLXFBConfig *fbc = NULL; - XVisualInfo *vi = NULL; + GLXFBConfig *fbc = nullptr; + XVisualInfo *vi = nullptr; bool isSupported = InitXVisualInfo(dispAttrs, &fbc, &vi); @@ -726,12 +726,12 @@ static void FreeDefaultVisualInfo() if (gs_glFBCInfo) { XFree(gs_glFBCInfo); - gs_glFBCInfo = NULL; + gs_glFBCInfo = nullptr; } if (gs_glVisualInfo) { XFree(gs_glVisualInfo); - gs_glVisualInfo = NULL; + gs_glVisualInfo = nullptr; } } diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index 29efb0dab4..5eaaddd2ac 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -85,7 +85,7 @@ wxJoystickThread::wxJoystickThread(int device, int joystick) m_joystick(joystick), m_lastposition(wxDefaultPosition), m_buttons(0), - m_catchwin(NULL), + m_catchwin(nullptr), m_polling(0), m_threshold(0) { @@ -125,7 +125,7 @@ void* wxJoystickThread::Entry() time_out.tv_usec = 10 * 1000; // check at least every 10 msec in blocking case wxFD_SET(m_device, &read_fds); - select(m_device+1, &read_fds, NULL, NULL, &time_out); + select(m_device+1, &read_fds, nullptr, nullptr, &time_out); if (wxFD_ISSET(m_device, &read_fds)) { memset(&j_evt, 0, sizeof(j_evt)); @@ -184,7 +184,7 @@ void* wxJoystickThread::Entry() } } - return NULL; + return nullptr; } @@ -193,7 +193,7 @@ void* wxJoystickThread::Entry() wxJoystick::wxJoystick(int joystick) : m_device(-1), m_joystick(joystick), - m_thread(NULL) + m_thread(nullptr) { wxString dev_name; @@ -524,7 +524,7 @@ bool wxJoystick::ReleaseCapture() { if (m_thread) { - m_thread->m_catchwin = NULL; + m_thread->m_catchwin = nullptr; m_thread->m_polling = 0; return true; } diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp index b1e15f7ab7..17c67a830f 100644 --- a/src/unix/mediactrl.cpp +++ b/src/unix/mediactrl.cpp @@ -424,7 +424,7 @@ static gboolean gst_bus_async_callback(GstBus* WXUNUSED(bus), GError* error; gchar* debug; gst_message_parse_error(message, &error, &debug); - gst_error_callback(NULL, NULL, error, debug, be); + gst_error_callback(nullptr, nullptr, error, debug, be); return FALSE; } @@ -445,7 +445,7 @@ static gboolean gst_bus_async_callback(GstBus* WXUNUSED(bus), } case GST_MESSAGE_EOS: { - gst_finish_callback(NULL, be); + gst_finish_callback(nullptr, be); break; } @@ -543,18 +543,18 @@ void wxGStreamerMediaBackend::HandleStateChange(GstState oldstate, //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) { - const GList *list = NULL; - g_object_get (G_OBJECT (element), "stream-info", &list, NULL); + const GList *list = nullptr; + g_object_get (G_OBJECT (element), "stream-info", &list, nullptr); - for ( ; list != NULL; list = list->next) + for ( ; list != nullptr; list = list->next) { GObject *info = (GObject *) list->data; gint type; GParamSpec *pspec; GEnumValue *val; - GstPad *pad = NULL; + GstPad *pad = nullptr; - g_object_get (info, "type", &type, NULL); + g_object_get (info, "type", &type, nullptr); pspec = g_object_class_find_property ( G_OBJECT_GET_CLASS (info), "type"); val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type); @@ -568,9 +568,9 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) G_OBJECT_GET_CLASS (info), "object"); if (!pspec) - g_object_get (info, "pad", &pad, NULL); + g_object_get (info, "pad", &pad, nullptr); else - g_object_get (info, "object", &pad, NULL); + g_object_get (info, "object", &pad, nullptr); if(!QueryVideoSizeFromPad(pad)) { @@ -586,7 +586,7 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) }// end searching through info list // no video (or extremely delayed stream-info) - if(list == NULL) + if(list == nullptr) { m_videoSize = wxSize(0,0); return false; @@ -728,7 +728,7 @@ bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, #if 1 // NB: The GStreamer gst_bus_poll is unfortunately broken and // throws silly critical internal errors (for instance - // "message != NULL" when the whole point of it is to + // "message != nullptr" when the whole point of it is to // poll for the message in the first place!) so we implement // our own "waiting mechinism" if(gst_bus_have_pending(bus) == FALSE) @@ -769,7 +769,7 @@ bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, GError* error; gchar* debug; gst_message_parse_error(message, &error, &debug); - gst_error_callback(NULL, NULL, error, debug, this); + gst_error_callback(nullptr, nullptr, error, debug, this); bBreak = true; break; } @@ -918,11 +918,11 @@ void wxGStreamerMediaEventHandler::NotifyMovieSizeChanged() //----------------------------------------------------------------------------- // wxGStreamerMediaBackend Constructor // -// Sets m_playbin to NULL signifying we havn't loaded anything yet +// Sets m_playbin to nullptr signifying we havn't loaded anything yet //----------------------------------------------------------------------------- wxGStreamerMediaBackend::wxGStreamerMediaBackend() - : m_playbin(NULL), - m_eventHandler(NULL) + : m_playbin(nullptr), + m_eventHandler(nullptr) { } @@ -998,7 +998,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, argvGST[i] = wxStrdupA(wxTheApp->argv[i].utf8_str()); } - argvGST[wxTheApp->argc] = NULL; + argvGST[wxTheApp->argc] = nullptr; int argcGST = wxTheApp->argc; #else @@ -1008,7 +1008,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, //Really init gstreamer gboolean bInited; - GError* error = NULL; + GError* error = nullptr; bInited = gst_init_check(&argcGST, &argvGST, &error); // Cleanup arguments for unicode case @@ -1084,7 +1084,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, (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); + (GstBusSyncHandler) gst_bus_sync_callback, this, nullptr); #else gst_bus_set_sync_handler(gst_element_get_bus(m_playbin), (GstBusSyncHandler) gst_bus_sync_callback, this); @@ -1163,7 +1163,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, g_object_set (G_OBJECT (m_playbin), "video-sink", videosink, "audio-sink", audiosink, - NULL); + nullptr); m_eventHandler = new wxGStreamerMediaEventHandler(this); return true; @@ -1246,7 +1246,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) wxASSERT(gst_uri_is_valid(locstring.mb_str())); g_object_set (G_OBJECT (m_playbin), "uri", - (const char*)locstring.mb_str(), NULL); + (const char*)locstring.mb_str(), nullptr); // Try to pause media as gstreamer won't let us query attributes // such as video size unless it is paused or playing @@ -1575,9 +1575,9 @@ bool wxGStreamerMediaBackend::SetVolume(double dVolume) { if(g_object_class_find_property( G_OBJECT_GET_CLASS(G_OBJECT(m_playbin)), - "volume") != NULL) + "volume") != nullptr) { - g_object_set(G_OBJECT(m_playbin), "volume", dVolume, NULL); + g_object_set(G_OBJECT(m_playbin), "volume", dVolume, nullptr); return true; } else @@ -1595,9 +1595,9 @@ double wxGStreamerMediaBackend::GetVolume() if(g_object_class_find_property( G_OBJECT_GET_CLASS(G_OBJECT(m_playbin)), - "volume") != NULL) + "volume") != nullptr) { - g_object_get(G_OBJECT(m_playbin), "volume", &dVolume, NULL); + g_object_get(G_OBJECT(m_playbin), "volume", &dVolume, nullptr); } else { diff --git a/src/unix/mediactrl_gstplayer.cpp b/src/unix/mediactrl_gstplayer.cpp index ab731c850a..7f53a07f0b 100644 --- a/src/unix/mediactrl_gstplayer.cpp +++ b/src/unix/mediactrl_gstplayer.cpp @@ -229,10 +229,10 @@ wxGStreamerMediaBackend::wxGStreamerMediaBackend() wxGStreamerMediaBackend::~wxGStreamerMediaBackend() { - m_video_renderer = NULL; + m_video_renderer = nullptr; if (m_player) gst_object_unref(m_player); - m_player = NULL; + m_player = nullptr; } extern "C" { @@ -254,7 +254,7 @@ static void end_of_stream_callback(GstPlayer * WXUNUSED(player), wxGStreamerMedi #define GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE "GstWaylandDisplayHandleContextType" static GstBusSyncReply bus_sync_handler(GstBus * WXUNUSED(bus), GstMessage* msg, gpointer WXUNUSED(user_data)) { - const gchar *type = NULL; + const gchar *type = nullptr; if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_NEED_CONTEXT && gst_message_parse_context_type(msg, &type) && @@ -268,8 +268,8 @@ static GstBusSyncReply bus_sync_handler(GstBus * WXUNUSED(bus), GstMessage* msg, * "display" will likely remain as the normal way of doing for gst 1.19+ * but there is no harm in setting both for compatibility */ - gst_structure_set(s, "handle", G_TYPE_POINTER, display_info.dpy, NULL); - gst_structure_set(s, "display", G_TYPE_POINTER, display_info.dpy, NULL); + gst_structure_set(s, "handle", G_TYPE_POINTER, display_info.dpy, nullptr); + gst_structure_set(s, "display", G_TYPE_POINTER, display_info.dpy, nullptr); gst_element_set_context(GST_ELEMENT(msg->src), context); return GST_BUS_DROP; @@ -301,7 +301,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, argvGST[i] = wxStrdupA(wxTheApp->argv[i].utf8_str()); } - argvGST[wxTheApp->argc] = NULL; + argvGST[wxTheApp->argc] = nullptr; int argcGST = wxTheApp->argc; #else @@ -311,7 +311,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, //Really init gstreamer gboolean bInited; - GError* error = NULL; + GError* error = nullptr; bInited = gst_init_check(&argcGST, &argvGST, &error); // Cleanup arguments for unicode case @@ -372,7 +372,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, m_ctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); // Tell gstreamer to play in our window - gpointer window_handle = NULL; + gpointer window_handle = nullptr; #ifdef __WXGTK__ if (!gtk_widget_get_realized(m_ctrl->m_wxwindow)) { @@ -398,7 +398,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, #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)); + m_player = gst_player_new(m_video_renderer, gst_player_g_main_context_signal_dispatcher_new(nullptr)); wxDisplayInfo info = wxGetDisplayInfo(); if (info.type == wxDisplayWayland) @@ -406,7 +406,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // wayland needs a specific handler to pass display to gstreamer GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(gst_player_get_pipeline(m_player))); gst_bus_add_signal_watch(bus); - gst_bus_set_sync_handler(bus, bus_sync_handler, this, NULL); + gst_bus_set_sync_handler(bus, bus_sync_handler, this, nullptr); gst_object_unref(bus); // xvimagesink is known to crash gstreamer with a wayland window diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 07d0c54e88..84c27ca27a 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -261,7 +261,7 @@ void wxMimeTypesManagerImpl::LoadXDGGlobs(const wxString& filename) wxString icon = GetIconFromMimeType(mime); - AddToMimeData(mime, icon, NULL, exts, wxEmptyString, true ); + AddToMimeData(mime, icon, nullptr, exts, wxEmptyString, true ); } } @@ -706,7 +706,7 @@ wxFileType * wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) } if ( !DoAssociation(strType, strIcon, entry, sA_Exts, strDesc) ) - return NULL; + return nullptr; return GetFileTypeFromMimeType(strType); } @@ -855,11 +855,11 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType, wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) { if (ext.empty() ) - return NULL; + return nullptr; InitIfNeeded(); - wxFileType* fileTypeFallback = NULL; + wxFileType* fileTypeFallback = nullptr; size_t count = m_aExtensions.GetCount(); for ( size_t n = 0; n < count; n++ ) { @@ -906,7 +906,7 @@ wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mim { InitIfNeeded(); - wxFileType * fileType = NULL; + wxFileType * fileType = nullptr; // mime types are not case-sensitive wxString mimetype(mimeType); mimetype.MakeLower(); @@ -1008,7 +1008,7 @@ void wxMimeTypesManagerImpl::AddMimeTypeInfo(const wxString& strMimeType, sTmp = sTmp.BeforeLast(wxT(' ')); } - AddToMimeData(strMimeType, strIcon, NULL, sExts, strDesc, true); + AddToMimeData(strMimeType, strIcon, nullptr, sExts, strDesc, true); } size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) diff --git a/src/unix/net.cpp b/src/unix/net.cpp index 1b6531c96b..ea865bbf30 100644 --- a/src/unix/net.cpp +++ b/src/unix/net.cpp @@ -67,7 +67,7 @@ public: : m_BeaconHost(WXDIALUP_MANAGER_DEFAULT_BEACONHOST) { m_IsOnline = -1; // unknown - m_timer = NULL; + m_timer = nullptr; m_CanUseIfconfig = -1; // unknown m_BeaconPort = 80; } @@ -230,7 +230,7 @@ wxDialUpManagerImpl::HangUp(void) bool wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) { - wxASSERT(m_timer == NULL); + wxASSERT(m_timer == nullptr); m_timer = new AutoCheckTimer(this); bool rc = m_timer->Start(nSeconds*1000); if(! rc) @@ -243,7 +243,7 @@ wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds) void wxDialUpManagerImpl::DisableAutoCheckOnlineStatus() { - wxASSERT(m_timer != NULL); + wxASSERT(m_timer != nullptr); m_timer->Stop(); wxDELETE(m_timer); } @@ -343,7 +343,7 @@ wxDialUpManagerImpl::CheckStatusInternal(void) // verify well behaved unix behaviour: wxASSERT(output_fd == STDOUT_FILENO); wxASSERT(null_fd == STDERR_FILENO); - int rc = wxExecute(m_IfconfigPath,TRUE /* sync */,NULL ,wxEXECUTE_DONT_CLOSE_FDS); + int rc = wxExecute(m_IfconfigPath,TRUE /* sync */,nullptr ,wxEXECUTE_DONT_CLOSE_FDS); close(null_fd); close(output_fd); // restore old stdout, stderr: int test; @@ -387,7 +387,7 @@ wxDialUpManagerImpl::CheckStatusInternal(void) int sockfd; m_IsOnline = 0; // assume false - if((hp = gethostbyname(m_BeaconHost)) == NULL) + if((hp = gethostbyname(m_BeaconHost)) == nullptr) return; // no DNS no net serv_addr.sin_family = hp->h_addrtype; diff --git a/src/unix/secretstore.cpp b/src/unix/secretstore.cpp index 7c69233ed6..6f76b55ff9 100644 --- a/src/unix/secretstore.cpp +++ b/src/unix/secretstore.cpp @@ -104,7 +104,7 @@ public: virtual const void *GetData() const override { - return secret_value_get(m_value, NULL); + return secret_value_get(m_value, nullptr); } SecretValue* GetValue() const @@ -176,13 +176,13 @@ public: SecretService* const service = secret_service_get_sync ( SECRET_SERVICE_OPEN_SESSION, - NULL, // No cancellation + nullptr, // No cancellation error.Out() ); if ( !service ) { errmsg = error.GetMessage(); - return NULL; + return nullptr; } // This passes ownership of service to the new object. @@ -210,7 +210,7 @@ public: SECRET_COLLECTION_DEFAULT, service.utf8_str(), static_cast(secret).GetValue(), - NULL, // Can't be cancelled + nullptr, // Can't be cancelled error.Out() ) ) { @@ -237,7 +237,7 @@ public: SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS ), - NULL, // Can't be cancelled + nullptr, // Can't be cancelled error.Out() ); @@ -276,7 +276,7 @@ public: m_service, GetSchema(), BuildAttributes(service), - NULL, // Can't be cancelled + nullptr, // Can't be cancelled error.Out() ) ) { @@ -310,7 +310,7 @@ private: { { FIELD_SERVICE, SECRET_SCHEMA_ATTRIBUTE_STRING }, { FIELD_USER, SECRET_SCHEMA_ATTRIBUTE_STRING }, - { NULL } + { nullptr } } }; @@ -326,7 +326,7 @@ private: ( GetSchema(), FIELD_SERVICE, service.utf8_str().data(), - NULL + nullptr )); } @@ -338,7 +338,7 @@ private: GetSchema(), FIELD_SERVICE, service.utf8_str().data(), FIELD_USER, user.utf8_str().data(), - NULL + nullptr )); } diff --git a/src/unix/sound.cpp b/src/unix/sound.cpp index 9edfd29fa7..7a3a62a2aa 100644 --- a/src/unix/sound.cpp +++ b/src/unix/sound.cpp @@ -341,7 +341,7 @@ wxThread::ExitCode wxSoundAsyncPlaybackThread::Entry() m_adapt->m_status.m_playing = false; wxLogTrace(wxT("sound"), wxT("terminated async playback thread")); - return 0; + return nullptr; } #endif @@ -403,27 +403,27 @@ bool wxSoundSyncOnlyAdaptor::IsPlaying() const // wxSound // ---------------------------------------------------------------------------- -wxSoundBackend *wxSound::ms_backend = NULL; +wxSoundBackend *wxSound::ms_backend = nullptr; // FIXME - temporary, until we have plugins architecture #if wxUSE_LIBSDL #if wxUSE_PLUGINS - wxDynamicLibrary *wxSound::ms_backendSDL = NULL; + wxDynamicLibrary *wxSound::ms_backendSDL = nullptr; #else extern "C" wxSoundBackend *wxCreateSoundBackendSDL(); #endif #endif -wxSound::wxSound() : m_data(NULL) +wxSound::wxSound() : m_data(nullptr) { } -wxSound::wxSound(const wxString& sFileName, bool isResource) : m_data(NULL) +wxSound::wxSound(const wxString& sFileName, bool isResource) : m_data(nullptr) { Create(sFileName, isResource); } -wxSound::wxSound(size_t size, const void* data) : m_data(NULL) +wxSound::wxSound(size_t size, const void* data) : m_data(nullptr) { Create(size, data); } @@ -473,7 +473,7 @@ bool wxSound::Create(const wxString& fileName, bool wxSound::Create(size_t size, const void* data) { - wxASSERT( data != NULL ); + wxASSERT( data != nullptr ); Free(); if (!LoadWAV(data, size, true)) diff --git a/src/unix/sound_sdl.cpp b/src/unix/sound_sdl.cpp index a12eaf29ac..c8e239bd64 100644 --- a/src/unix/sound_sdl.cpp +++ b/src/unix/sound_sdl.cpp @@ -49,7 +49,7 @@ wxDECLARE_EVENT(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotificat -1, \ -1, \ wxEVENT_HANDLER_CAST( wxSoundBackendSDLNotificationFunction, func ), \ - NULL ), + nullptr ), wxIMPLEMENT_DYNAMIC_CLASS(wxSoundBackendSDLNotification, wxEvtHandler); wxDEFINE_EVENT( wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotification ); @@ -66,7 +66,7 @@ class wxSoundBackendSDL : public wxSoundBackend public: wxSoundBackendSDL() : m_initialized(false), m_playing(false), m_audioOpen(false), - m_data(NULL), m_evtHandler(NULL) {} + m_data(nullptr), m_evtHandler(nullptr) {} virtual ~wxSoundBackendSDL(); wxString GetName() const override { return wxT("Simple DirectMedia Layer"); } @@ -205,7 +205,7 @@ bool wxSoundBackendSDL::OpenAudio() m_spec.userdata = (void*)this; wxLogTrace(wxT("sound"), wxT("opening SDL audio...")); - if (SDL_OpenAudio(&m_spec, NULL) >= 0) + if (SDL_OpenAudio(&m_spec, nullptr) >= 0) { #if wxUSE_LOG_DEBUG char driver[256]; @@ -320,7 +320,7 @@ void wxSoundBackendSDL::Stop() if (m_data) { m_data->DecRef(); - m_data = NULL; + m_data = nullptr; } SDL_UnlockAudio(); } diff --git a/src/unix/stackwalk.cpp b/src/unix/stackwalk.cpp index 7cd6ae1f35..719b9d0697 100644 --- a/src/unix/stackwalk.cpp +++ b/src/unix/stackwalk.cpp @@ -106,8 +106,8 @@ void wxStackFrame::OnGetName() char *cppfunc = __cxxabiv1::__cxa_demangle ( m_name.mb_str(), - NULL, // output buffer (none, alloc it) - NULL, // [out] len of output buffer + nullptr, // output buffer (none, alloc it) + nullptr, // [out] len of output buffer &rc ); if ( rc == 0 ) @@ -154,7 +154,7 @@ void wxStackFrame::OnGetName() // static data void *wxStackWalker::ms_addresses[MAX_FRAMES]; -char **wxStackWalker::ms_symbols = NULL; +char **wxStackWalker::ms_symbols = nullptr; int wxStackWalker::m_depth = 0; wxString wxStackWalker::ms_exepath; static char g_buf[BUFSIZE]; @@ -199,7 +199,7 @@ void wxStackWalker::FreeStack() // of the caller, i.e. us, to free that pointer if (ms_symbols) free( ms_symbols ); - ms_symbols = NULL; + ms_symbols = nullptr; m_depth = 0; } diff --git a/src/unix/taskbarx11.cpp b/src/unix/taskbarx11.cpp index 11a9dd6ab3..e8825f5888 100644 --- a/src/unix/taskbarx11.cpp +++ b/src/unix/taskbarx11.cpp @@ -51,7 +51,7 @@ { public: wxTaskBarIconAreaBase() - : wxFrame(NULL, wxID_ANY, wxT("systray icon"), + : wxFrame(nullptr, wxID_ANY, wxT("systray icon"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR | wxSIMPLE_BORDER | wxFRAME_SHAPED) {} @@ -233,7 +233,7 @@ bool wxTaskBarIconBase::IsAvailable() wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); -wxTaskBarIcon::wxTaskBarIcon() : m_iconWnd(NULL) +wxTaskBarIcon::wxTaskBarIcon() : m_iconWnd(nullptr) { } @@ -253,7 +253,7 @@ bool wxTaskBarIcon::IsOk() const bool wxTaskBarIcon::IsIconInstalled() const { - return m_iconWnd != NULL; + return m_iconWnd != nullptr; } // Destroy event from wxTaskBarIconArea @@ -261,7 +261,7 @@ void wxTaskBarIcon::OnDestroy(wxWindowDestroyEvent&) { // prevent crash if wxTaskBarIconArea is destroyed by something else, // for example if panel/kicker is killed - m_iconWnd = NULL; + m_iconWnd = nullptr; } bool wxTaskBarIcon::SetIcon(const wxBitmapBundle& icon, const wxString& tooltip) @@ -277,7 +277,7 @@ bool wxTaskBarIcon::SetIcon(const wxBitmapBundle& icon, const wxString& tooltip) else { m_iconWnd->Destroy(); - m_iconWnd = NULL; + m_iconWnd = nullptr; return false; } } @@ -290,7 +290,7 @@ bool wxTaskBarIcon::SetIcon(const wxBitmapBundle& icon, const wxString& tooltip) if (!tooltip.empty()) m_iconWnd->SetToolTip(tooltip); else - m_iconWnd->SetToolTip(NULL); + m_iconWnd->SetToolTip(nullptr); #else wxUnusedVar(tooltip); #endif @@ -302,7 +302,7 @@ bool wxTaskBarIcon::RemoveIcon() if (!m_iconWnd) return false; m_iconWnd->Destroy(); - m_iconWnd = NULL; + m_iconWnd = nullptr; return true; } diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index ab0e28cbb2..dc56df969c 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -134,7 +134,7 @@ WX_DEFINE_ARRAY_PTR(wxThread *, wxArrayThread); static wxArrayThread gs_allThreads; // a mutex to protect gs_allThreads -static wxMutex *gs_mutexAllThreads = NULL; +static wxMutex *gs_mutexAllThreads = nullptr; // the id of the main thread // @@ -151,17 +151,17 @@ static pthread_key_t gs_keySelf; static size_t gs_nThreadsBeingDeleted = 0; // a mutex to protect gs_nThreadsBeingDeleted -static wxMutex *gs_mutexDeleteThread = NULL; +static wxMutex *gs_mutexDeleteThread = nullptr; // and a condition variable which will be signaled when all // gs_nThreadsBeingDeleted will have been deleted -static wxCondition *gs_condAllDeleted = NULL; +static wxCondition *gs_condAllDeleted = nullptr; #ifndef __DARWIN__ // this mutex must be acquired before any call to a GUI function // (it's not inside #if wxUSE_GUI because this file is compiled as part // of wxBase) -static wxMutex *gs_mutexGui = NULL; +static wxMutex *gs_mutexGui = nullptr; #endif // when we wait for a thread to exit, we're blocking on a condition which the @@ -261,7 +261,7 @@ wxMutexInternal::wxMutexInternal(wxMutexType mutexType) wxFALLTHROUGH; case wxMUTEX_DEFAULT: - err = pthread_mutex_init(&m_mutex, NULL); + err = pthread_mutex_init(&m_mutex, nullptr); break; } @@ -323,7 +323,7 @@ wxMutexError wxMutexInternal::Lock(unsigned long ms) #endif else // fall back on system timer { - ts.tv_sec = time(NULL); + ts.tv_sec = time(nullptr); } ts.tv_sec += seconds; @@ -462,7 +462,7 @@ private: wxConditionInternal::wxConditionInternal(wxMutex& mutex) : m_mutex(mutex) { - int err = pthread_cond_init(&m_cond, NULL /* default attributes */); + int err = pthread_cond_init(&m_cond, nullptr /* default attributes */); m_isOk = err == 0; @@ -955,7 +955,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) wxFAIL_MSG(wxT("wxThread::Exit() can't return.")); - return NULL; + return nullptr; } } @@ -969,7 +969,7 @@ extern "C" void wxPthreadCleanup(void *ptr) void wxThreadInternal::Cleanup(wxThread *thread) { - if (pthread_getspecific(gs_keySelf) == 0) + if (pthread_getspecific(gs_keySelf) == nullptr) return; { @@ -998,7 +998,7 @@ wxThreadInternal::wxThreadInternal() m_cancelled = false; m_prio = wxPRIORITY_DEFAULT; m_threadId = 0; - m_exitcode = 0; + m_exitcode = nullptr; // set to true only when the thread starts waiting on m_semSuspend m_isPaused = false; @@ -1752,7 +1752,7 @@ void wxThread::Exit(ExitCode status) // we make it a global object, but this would mean that we can // only call one thread function at a time :-( DeleteThread(this); - pthread_setspecific(gs_keySelf, 0); + pthread_setspecific(gs_keySelf, nullptr); } else { @@ -1875,7 +1875,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule); bool wxThreadModule::OnInit() { - int rc = pthread_key_create(&gs_keySelf, NULL /* dtor function */); + int rc = pthread_key_create(&gs_keySelf, nullptr /* dtor function */); if ( rc != 0 ) { wxLogSysError(rc, _("Thread module initialization failed: failed to create thread key")); diff --git a/src/unix/timerunx.cpp b/src/unix/timerunx.cpp index 73b1b7f969..025c51a8d6 100644 --- a/src/unix/timerunx.cpp +++ b/src/unix/timerunx.cpp @@ -48,7 +48,7 @@ WX_DEFINE_LIST(wxTimerList) // wxTimerScheduler implementation // ============================================================================ -wxTimerScheduler *wxTimerScheduler::ms_instance = NULL; +wxTimerScheduler *wxTimerScheduler::ms_instance = nullptr; wxTimerScheduler::~wxTimerScheduler() { @@ -109,7 +109,7 @@ bool wxTimerScheduler::GetNext(wxUsecClock_t *remaining) const if ( m_timers.empty() ) return false; - wxCHECK_MSG( remaining, false, wxT("NULL pointer") ); + wxCHECK_MSG( remaining, false, wxT("null pointer") ); *remaining = (*m_timers.begin())->m_expiration - wxGetUTCTimeUSec(); if ( *remaining < 0 ) diff --git a/src/unix/uiactionx11.cpp b/src/unix/uiactionx11.cpp index 13ba71023a..da40245e68 100644 --- a/src/unix/uiactionx11.cpp +++ b/src/unix/uiactionx11.cpp @@ -376,7 +376,7 @@ bool wxUIActionSimulatorXTestImpl::DoX11MouseMove(long x, long y) // "device pixels" for the X call below, so scale them if we have the // required support at both compile- and run-time. #if GTK_CHECK_VERSION(3,10,0) - if ( gtk_check_version(3, 10, 0) == NULL ) + if ( gtk_check_version(3, 10, 0) == nullptr ) { // For multi-monitor support we would need to determine to which // monitor the point (x, y) belongs, for now just use the scale @@ -440,9 +440,9 @@ bool wxUIActionSimulatorX11Impl::MouseMove(long x, long y) GdkDisplay* const display = gdk_window_get_display(wxGetTopLevelGDK()); GdkDevice* const device = wx_get_gdk_device_from_display(display); #endif - GdkWindow* const gdkwin1 = wx_gdk_device_get_window_at_position(device, NULL, NULL); + GdkWindow* const gdkwin1 = wx_gdk_device_get_window_at_position(device, nullptr, nullptr); const bool ret = DoX11MouseMove(x, y); - GdkWindow* const gdkwin2 = wx_gdk_device_get_window_at_position(device, NULL, NULL); + GdkWindow* const gdkwin2 = wx_gdk_device_get_window_at_position(device, nullptr, nullptr); if ( gdkwin1 != gdkwin2 ) { diff --git a/src/unix/uilocale.cpp b/src/unix/uilocale.cpp index 8e27bd2d0f..794f770871 100644 --- a/src/unix/uilocale.cpp +++ b/src/unix/uilocale.cpp @@ -166,11 +166,11 @@ bool GetLocaleFromEnvironment(wxString& langFull, wxString& modifier) class wxUILocaleImplUnix : public wxUILocaleImpl { public: - // If "loc" is non-NULL, this object takes ownership of it and will free it, + // If "loc" is non-null, this object takes ownership of it and will free it, // otherwise it creates its own locale_t corresponding to locId. explicit wxUILocaleImplUnix(wxLocaleIdent locId #ifdef HAVE_LOCALE_T - , locale_t loc = NULL + , locale_t loc = nullptr #endif // HAVE_LOCALE_T ); ~wxUILocaleImplUnix() override; @@ -226,14 +226,14 @@ private: // Simple wrapper around newlocale(). inline locale_t TryCreateLocale(const wxLocaleIdent& locId) { - return newlocale(LC_ALL_MASK, locId.GetName().mb_str(), NULL); + return newlocale(LC_ALL_MASK, locId.GetName().mb_str(), nullptr); } // Wrapper around newlocale() also trying to append UTF-8 codeset (and // modifying its wxLocaleIdent argument if it succeeds). locale_t TryCreateLocaleWithUTF8(wxLocaleIdent& locId) { - locale_t loc = NULL; + locale_t loc = nullptr; #if wxUSE_UNICODE if ( locId.GetCharset().empty() ) @@ -352,7 +352,7 @@ wxString wxLocaleIdent::GetName() const // with and without UTF-8 suffix. Don't use this one directly. static const char *wxSetlocaleTryUTF8(int c, const wxLocaleIdent& locId) { - const char *l = NULL; + const char *l = nullptr; // NB: We prefer to set UTF-8 locale if it's possible and only fall back to // non-UTF-8 locale if it fails. @@ -609,7 +609,7 @@ wxUILocaleImplUnix::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) const // that the current locale is still the same as was set in the ctor. // // If this assumption turns out to be wrong, we could use wxLocaleSetter to - // temporarily change the locale here (maybe only if setlocale(NULL) result + // temporarily change the locale here (maybe only if setlocale(nullptr) result // differs from the expected one). return wxLocale::GetInfo(index, cat); #endif // HAVE_LANGINFO_H/!HAVE_LANGINFO_H @@ -746,7 +746,7 @@ wxUILocaleImpl* wxUILocaleImpl::CreateForLocale(const wxLocaleIdent& locIdOrig) const locale_t loc = TryCreateMatchingLocale(locId); if ( !loc ) - return NULL; + return nullptr; return new wxUILocaleImplUnix(locId, loc); #else // !HAVE_LOCALE_T diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 0da4f598d8..80ee5d1738 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -188,7 +188,7 @@ void wxMicroSleep(unsigned long microseconds) tmReq.tv_nsec = (microseconds % 1000000) * 1000; // we're not interested in remaining time nor in return value - (void)nanosleep(&tmReq, NULL); + (void)nanosleep(&tmReq, nullptr); #elif defined(HAVE_USLEEP) // uncomment this if you feel brave or if you are sure that your version // of Solaris has a safe usleep() function but please notice that usleep() @@ -330,7 +330,7 @@ bool wxPipeInputStream::CanRead() const wxFD_ZERO(&readfds); wxFD_SET(fd, &readfds); - switch ( select(fd + 1, &readfds, NULL, NULL, &tv) ) + switch ( select(fd + 1, &readfds, nullptr, nullptr, &tv) ) { case -1: wxLogSysError(_("Impossible to get child process input")); @@ -476,7 +476,7 @@ private: { m_argc = argc; m_argv = new char *[m_argc + 1]; - m_argv[m_argc] = NULL; + m_argv[m_argc] = nullptr; } int m_argc; @@ -913,19 +913,19 @@ const wxChar* wxGetHomeDir( wxString *home ) wxString wxGetUserHome( const wxString &user ) { - struct passwd *who = (struct passwd *) NULL; + struct passwd *who = (struct passwd *) nullptr; if ( !user ) { wxChar *ptr; - if ((ptr = wxGetenv(wxT("HOME"))) != NULL) + if ((ptr = wxGetenv(wxT("HOME"))) != nullptr) { return ptr; } - if ((ptr = wxGetenv(wxT("USER"))) != NULL || - (ptr = wxGetenv(wxT("LOGNAME"))) != NULL) + if ((ptr = wxGetenv(wxT("USER"))) != nullptr || + (ptr = wxGetenv(wxT("LOGNAME"))) != nullptr) { who = getpwnam(wxSafeConvertWX2MB(ptr)); } @@ -941,7 +941,7 @@ wxString wxGetUserHome( const wxString &user ) who = getpwnam (user.mb_str()); } - return wxSafeConvertMB2WX(who ? who->pw_dir : 0); + return wxSafeConvertMB2WX(who ? who->pw_dir : nullptr); } // ---------------------------------------------------------------------------- @@ -996,7 +996,7 @@ wxGetCommandOutput(const wxString &cmd, wxMBConv& conv = wxConvISO8859_1) // private use only) static bool wxGetHostNameInternal(wxChar *buf, int sz) { - wxCHECK_MSG( buf, false, wxT("NULL pointer in wxGetHostNameInternal") ); + wxCHECK_MSG( buf, false, wxT("null pointer in wxGetHostNameInternal") ); *buf = wxT('\0'); @@ -1080,7 +1080,7 @@ bool wxGetUserId(wxChar *buf, int sz) struct passwd *who; *buf = wxT('\0'); - if ((who = getpwuid(getuid ())) != NULL) + if ((who = getpwuid(getuid ())) != nullptr) { wxStrlcpy (buf, wxSafeConvertMB2WX(who->pw_name), sz); return true; @@ -1095,7 +1095,7 @@ bool wxGetUserName(wxChar *buf, int sz) struct passwd *who; *buf = wxT('\0'); - if ((who = getpwuid (getuid ())) != NULL) + if ((who = getpwuid (getuid ())) != nullptr) { char *comma = strchr(who->pw_gecos, ','); if (comma) @@ -1136,7 +1136,7 @@ wxString wxGetNativeCpuArchitectureName() // macOS on ARM will report an x86_64 process as translated, assume the native CPU is arm64 int translated; size_t translated_size = sizeof(translated); - if (sysctlbyname("sysctl.proc_translated", &translated, &translated_size, NULL, 0) == 0) + if (sysctlbyname("sysctl.proc_translated", &translated, &translated_size, nullptr, 0) == 0) return "arm64"; else #endif @@ -1423,7 +1423,7 @@ static bool wxDoSetEnv(const wxString& variable, const char *value) unsetenv(variable.mb_str()); return true; #else - value = ""; // we can't pass NULL to setenv() + value = ""; // we can't pass nullptr to setenv() #endif } @@ -1464,7 +1464,7 @@ bool wxSetEnv(const wxString& variable, const wxString& value) bool wxUnsetEnv(const wxString& variable) { - return wxDoSetEnv(variable, NULL); + return wxDoSetEnv(variable, nullptr); } // ---------------------------------------------------------------------------- @@ -1524,10 +1524,10 @@ bool wxHandleFatalExceptions(bool doit) else if ( s_savedHandlers ) { // uninstall the signal handler - ok &= sigaction(SIGFPE, &s_handlerFPE, NULL) == 0; - ok &= sigaction(SIGILL, &s_handlerILL, NULL) == 0; - ok &= sigaction(SIGBUS, &s_handlerBUS, NULL) == 0; - ok &= sigaction(SIGSEGV, &s_handlerSEGV, NULL) == 0; + ok &= sigaction(SIGFPE, &s_handlerFPE, nullptr) == 0; + ok &= sigaction(SIGILL, &s_handlerILL, nullptr) == 0; + ok &= sigaction(SIGBUS, &s_handlerBUS, nullptr) == 0; + ok &= sigaction(SIGSEGV, &s_handlerSEGV, nullptr) == 0; if ( !ok ) { wxLogDebug(wxT("Failed to uninstall our signal handler.")); diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp index 2f8625fecd..5401a90f14 100644 --- a/src/unix/utilsx11.cpp +++ b/src/unix/utilsx11.cpp @@ -330,7 +330,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature) _NET_SUPPORTED, 0, LONG_MAX, False, XA_ATOM, &type, &format, &natoms, &after, (unsigned char **)&atoms); - if ( type != XA_ATOM || atoms == NULL ) + if ( type != XA_ATOM || atoms == nullptr ) return false; // Lookup the feature we want: @@ -2602,7 +2602,7 @@ static bool wxGetKeyStateX11(wxKeyCode key) static bool wxGetKeyStateGTK(wxKeyCode key) { - if (gtk_check_version(3,4,0) != NULL) + if (gtk_check_version(3,4,0) != nullptr) return false; GdkDisplay* display = gdk_window_get_display(wxGetTopLevelGDK()); @@ -2636,7 +2636,7 @@ static bool wxGetKeyStateGTK(wxKeyCode key) bool wxGetKeyState(wxKeyCode key) { #ifdef wxHAS_GETKEYSTATE_GTK - if (!wxGTKImpl::IsX11(NULL)) + if (!wxGTKImpl::IsX11(nullptr)) { return wxGetKeyStateGTK(key); } @@ -2670,7 +2670,7 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) const char* argv[3]; argv[0] = xdg_open.fn_str(); argv[1] = document.fn_str(); - argv[2] = NULL; + argv[2] = nullptr; if (wxExecute(argv)) return true; } @@ -2688,7 +2688,7 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) #ifdef __WXGTK__ #ifdef __WXGTK4__ if (gtk_show_uri_on_window((GtkWindow*)wxGetTopLevelGTK(), - params.url.utf8_str(), GDK_CURRENT_TIME, NULL)) + params.url.utf8_str(), GDK_CURRENT_TIME, nullptr)) { return true; } @@ -2697,7 +2697,7 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK()); wxGCC_WARNING_SUPPRESS(deprecated-declarations) - if (gtk_show_uri(screen, params.url.utf8_str(), GDK_CURRENT_TIME, NULL)) + if (gtk_show_uri(screen, params.url.utf8_str(), GDK_CURRENT_TIME, nullptr)) return true; wxGCC_WARNING_RESTORE() } @@ -2706,7 +2706,7 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) const char* argv[4]; argv[1] = params.GetPathOrURL().fn_str(); - argv[2] = NULL; + argv[2] = nullptr; // Our best best is to use xdg-open from freedesktop.org cross-desktop // compatibility suite xdg-utils @@ -2748,7 +2748,7 @@ wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) argv[2] = argv[1]; argv[0] = "kfmclient"; argv[1] = "openURL"; - argv[3] = NULL; + argv[3] = nullptr; if (wxExecute(argv)) return true; } diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 7a90cfb967..f43c0d6e66 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -47,8 +47,8 @@ // global data //------------------------------------------------------------------------ -wxWindowHash *wxWidgetHashTable = NULL; -wxWindowHash *wxClientWidgetHashTable = NULL; +wxWindowHash *wxWidgetHashTable = nullptr; +wxWindowHash *wxClientWidgetHashTable = nullptr; static bool g_showIconic = false; static wxSize g_initialSize = wxDefaultSize; @@ -57,8 +57,8 @@ static wxSize g_initialSize = wxDefaultSize; // work for focus events which we provoke ourselves (by calling // SetFocus()). It will not work for those events, which X11 // generates itself. -static wxWindow *g_nextFocus = NULL; -static wxWindow *g_prevFocus = NULL; +static wxWindow *g_nextFocus = nullptr; +static wxWindow *g_prevFocus = nullptr; //------------------------------------------------------------------------ // X11 clipboard event handling @@ -71,7 +71,7 @@ extern "C" void wxClipboardHandleSelectionRequest(XEvent event); typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *); -XErrorHandlerFunc gs_pfnXErrorHandler = 0; +XErrorHandlerFunc gs_pfnXErrorHandler = nullptr; static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent) { @@ -107,11 +107,11 @@ bool wxApp::Initialize(int& argC, wxChar **argV) { if (i < (argCOrig - 1)) { - argV[i++] = NULL; + argV[i++] = nullptr; displayName = argV[i]; - argV[i] = NULL; + argV[i] = nullptr; argC -= 2; } } @@ -119,7 +119,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV) { if (i < (argCOrig - 1)) { - argV[i++] = NULL; + argV[i++] = nullptr; int w, h; if (wxSscanf(argV[i], wxT("%dx%d"), &w, &h) != 2) @@ -132,7 +132,7 @@ bool wxApp::Initialize(int& argC, wxChar **argV) g_initialSize = wxSize(w, h); } - argV[i] = NULL; + argV[i] = nullptr; argC -= 2; } } @@ -140,14 +140,14 @@ bool wxApp::Initialize(int& argC, wxChar **argV) { syncDisplay = true; - argV[i] = NULL; + argV[i] = nullptr; argC--; } else if (wxStrcmp( argV[i], wxT("-iconic") ) == 0) { g_showIconic = true; - argV[i] = NULL; + argV[i] = nullptr; argC--; } } @@ -211,14 +211,14 @@ void wxApp::CleanUp() wxApp::wxApp() { - m_mainColormap = NULL; - m_topLevelWidget = NULL; + m_mainColormap = nullptr; + m_topLevelWidget = nullptr; m_maxRequestSize = 0; m_showIconic = false; m_initialSize = wxDefaultSize; #if !wxUSE_NANOX - m_visualInfo = NULL; + m_visualInfo = nullptr; #endif } @@ -274,7 +274,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event) { XEvent* event = (XEvent*) _event; - wxWindow* win = NULL; + wxWindow* win = nullptr; Window window = XEventGetWindow(event); #if 0 Window actualWindow = window; @@ -628,7 +628,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event) { // Ignore this, this can be a spurious FocusIn // caused by a child having its focus set. - g_GettingFocus = NULL; + g_GettingFocus = nullptr; wxLogTrace( wxT("focus"), wxT("FocusIn from %s of type %s being deliberately ignored"), win->GetName(), win->GetClassInfo()->GetClassName() ); return true; } @@ -637,7 +637,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event) wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId()); focusEvent.SetEventObject(win); focusEvent.SetWindow( g_prevFocus ); - g_prevFocus = NULL; + g_prevFocus = nullptr; return win->HandleWindowEvent(focusEvent); } @@ -655,7 +655,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event) wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId()); focusEvent.SetEventObject(win); focusEvent.SetWindow( g_nextFocus ); - g_nextFocus = NULL; + g_nextFocus = nullptr; return win->HandleWindowEvent(focusEvent); } return false; @@ -715,7 +715,7 @@ bool wxApp::OnInitGui() PangoContext* wxApp::GetPangoContext() { - static PangoContext *s_pangoContext = NULL; + static PangoContext *s_pangoContext = nullptr; if ( !s_pangoContext ) { Display *dpy = wxGlobalDisplay(); @@ -750,7 +750,7 @@ PangoContext* wxGetPangoContext() WXColormap wxApp::GetMainColormap(WXDisplay* display) { - if (!display) /* Must be called first with non-NULL display */ + if (!display) /* Must be called first with non-null display */ return m_mainColormap; int defaultScreen = DefaultScreen((Display*) display); @@ -778,7 +778,7 @@ Window wxGetWindowParent(Window window) #else unsigned int noChildren = 0; #endif - Window* children = NULL; + Window* children = nullptr; // #define XQueryTree(d,w,r,p,c,nc) GrQueryTree(w,p,c,nc) int res = 1; diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index 1dfcd2f14d..745429f5ed 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -54,8 +54,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject); wxMask::wxMask() { - m_bitmap = NULL; - m_display = NULL; + m_bitmap = nullptr; + m_display = nullptr; } wxMask::wxMask(const wxMask& mask) @@ -63,7 +63,7 @@ wxMask::wxMask(const wxMask& mask) m_display = mask.m_display; if ( !mask.m_bitmap ) { - m_bitmap = NULL; + m_bitmap = nullptr; return; } @@ -78,19 +78,19 @@ wxMask::wxMask(const wxMask& mask) wxMask::wxMask( const wxBitmap& bitmap, const wxColour& colour ) { - m_bitmap = NULL; + m_bitmap = nullptr; Create( bitmap, colour ); } wxMask::wxMask( const wxBitmap& bitmap, int paletteIndex ) { - m_bitmap = NULL; + m_bitmap = nullptr; Create( bitmap, paletteIndex ); } wxMask::wxMask( const wxBitmap& bitmap ) { - m_bitmap = NULL; + m_bitmap = nullptr; Create( bitmap ); } @@ -109,7 +109,7 @@ bool wxMask::Create( const wxBitmap& bitmap, if (m_bitmap) { XFreePixmap( (Display*) m_display, (Pixmap) m_bitmap ); - m_bitmap = NULL; + m_bitmap = nullptr; } m_display = bitmap.GetDisplay(); @@ -124,7 +124,7 @@ bool wxMask::Create( const wxBitmap& bitmap, Window xroot = RootWindow( xdisplay, xscreen ); m_bitmap = (WXPixmap) XCreatePixmap( xdisplay, xroot, image.GetWidth(), image.GetHeight(), 1 ); - GC gc = XCreateGC( xdisplay, (Pixmap) m_bitmap, 0, NULL ); + GC gc = XCreateGC( xdisplay, (Pixmap) m_bitmap, 0, nullptr ); XSetForeground( xdisplay, gc, WhitePixel(xdisplay,xscreen) ); XSetFillStyle( xdisplay, gc, FillSolid ); @@ -216,7 +216,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) if (m_bitmap) { XFreePixmap( (Display*) m_display, (Pixmap) m_bitmap ); - m_bitmap = NULL; + m_bitmap = nullptr; } if (!bitmap.IsOk()) return false; @@ -232,7 +232,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) if (!m_bitmap) return false; - GC gc = XCreateGC( (Display*) m_display, (Pixmap) m_bitmap, 0, NULL ); + GC gc = XCreateGC( (Display*) m_display, (Pixmap) m_bitmap, 0, nullptr ); XCopyPlane( (Display*) m_display, (Pixmap) bitmap.GetBitmap(), (Pixmap) m_bitmap, gc, 0, 0, bitmap.GetWidth(), bitmap.GetHeight(), 0, 0, 1 ); @@ -276,12 +276,12 @@ wxBitmapRefData::wxBitmapRefData() { m_pixmap = 0; m_bitmap = 0; - m_display = NULL; - m_mask = NULL; + m_display = nullptr; + m_mask = nullptr; m_width = 0; m_height = 0; m_bpp = 0; - m_palette = NULL; + m_palette = nullptr; } wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) @@ -289,8 +289,8 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) m_pixmap = 0; m_bitmap = 0; m_display = data.m_display; - m_mask = NULL; // FIXME: should copy - m_palette = NULL; // FIXME: should copy + m_mask = nullptr; // FIXME: should copy + m_palette = nullptr; // FIXME: should copy Create(data.m_width, data.m_height, data.m_bpp); } @@ -314,7 +314,7 @@ bool wxBitmapRefData::Create(int width, int height, int depth) wxT("invalid bitmap depth") ); #if wxUSE_NANOX - m_pixmap = (WXPixmap) GrNewPixmap(width, height, NULL); + m_pixmap = (WXPixmap) GrNewPixmap(width, height, nullptr); #else // !wxUSE_NANOX Window xroot = RootWindow(m_display, xscreen); @@ -352,13 +352,13 @@ static WXPixmap wxGetSubPixmap( WXDisplay* xdisplay, WXPixmap xpixmap, Visual* xvisual = DefaultVisual( dpy, xscreen ); XImage* ximage = XCreateImage( dpy, xvisual, depth, - ZPixmap, 0, 0, width, height, 32, 0 ); + ZPixmap, 0, nullptr, width, height, 32, 0 ); ximage->data = (char*)malloc( ximage->bytes_per_line * ximage->height ); ximage = XGetSubImage( dpy, (Pixmap)xpixmap, x, y, width, height, AllPlanes, ZPixmap, ximage, 0, 0 ); - GC gc = XCreateGC( dpy, (Pixmap)xpixmap, 0, NULL ); + GC gc = XCreateGC( dpy, (Pixmap)xpixmap, 0, nullptr ); Pixmap ret = XCreatePixmap( dpy, xroot, width, height, depth ); @@ -397,7 +397,7 @@ bool wxBitmap::Create(const void* data, wxBitmapType type, wxBitmapHandler *handler = FindHandler(type); - if ( handler == NULL ) { + if ( handler == nullptr ) { wxLogWarning(wxT("no data bitmap handler for type %ld defined."), (long)type); @@ -424,7 +424,7 @@ bool wxBitmap::Create(WXPixmap pixmap) &width, &height, &border, &depth ); Pixmap copy = XCreatePixmap( xdisplay, xroot, width, height, depth ); - GC gc = XCreateGC( xdisplay, copy, 0, NULL ); + GC gc = XCreateGC( xdisplay, copy, 0, nullptr ); XCopyArea( xdisplay, xpixmap, copy, gc, 0, 0, width, height, 0, 0 ); XFreeGC( xdisplay, gc ); @@ -603,10 +603,10 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) { // Create image - XImage *data_image = XCreateImage( xdisplay, xvisual, bpp, ZPixmap, 0, 0, width, height, 32, 0 ); + XImage *data_image = XCreateImage( xdisplay, xvisual, bpp, ZPixmap, 0, nullptr, width, height, 32, 0 ); data_image->data = (char*) malloc( data_image->bytes_per_line * data_image->height ); - if (data_image->data == NULL) + if (data_image->data == nullptr) { wxLogError( wxT("Out of memory.") ); // TODO clean return false; @@ -617,13 +617,13 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) // Create mask if necessary const bool hasMask = image.HasMask(); - XImage *mask_image = NULL; + XImage *mask_image = nullptr; if ( hasMask ) { - mask_image = XCreateImage( xdisplay, xvisual, 1, ZPixmap, 0, 0, width, height, 32, 0 ); + mask_image = XCreateImage( xdisplay, xvisual, 1, ZPixmap, 0, nullptr, width, height, 32, 0 ); mask_image->data = (char*) malloc( mask_image->bytes_per_line * mask_image->height ); - if (mask_image->data == NULL) + if (mask_image->data == nullptr) { wxLogError( wxT("Out of memory.") ); // TODO clean return false; @@ -766,7 +766,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) // Blit picture - GC gc = XCreateGC( xdisplay, (Pixmap) M_BMPDATA->m_pixmap, 0, NULL ); + GC gc = XCreateGC( xdisplay, (Pixmap) M_BMPDATA->m_pixmap, 0, nullptr ); XPutImage( xdisplay, (Pixmap) M_BMPDATA->m_pixmap, gc, data_image, 0, 0, 0, 0, width, height ); XDestroyImage( data_image ); XFreeGC( xdisplay, gc ); @@ -775,7 +775,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (image.HasMask()) { - GC gc = XCreateGC( xdisplay, (Pixmap) GetMask()->GetBitmap(), 0, NULL ); + GC gc = XCreateGC( xdisplay, (Pixmap) GetMask()->GetBitmap(), 0, nullptr ); XPutImage( xdisplay, (Pixmap) GetMask()->GetBitmap(), gc, mask_image, 0, 0, 0, 0, width, height ); XDestroyImage( mask_image ); @@ -804,7 +804,7 @@ wxImage wxBitmap::ConvertToImage() const #else // !wxUSE_NANOX int bpp = wxTheApp->GetVisualInfo(M_BMPDATA->m_display)->m_visualDepth; - XImage *x_image = NULL; + XImage *x_image = nullptr; if (GetPixmap()) { x_image = XGetImage( xdisplay, (Pixmap) GetPixmap(), @@ -835,7 +835,7 @@ wxImage wxBitmap::ConvertToImage() const return wxNullImage; } - XImage *x_image_mask = NULL; + XImage *x_image_mask = nullptr; if (GetMask()) { x_image_mask = XGetImage( xdisplay, (Pixmap) GetMask()->GetBitmap(), @@ -978,7 +978,7 @@ int wxBitmap::GetDepth() const wxMask *wxBitmap::GetMask() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BMPDATA->m_mask; } @@ -1046,7 +1046,7 @@ bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type, wxBitmapHandler *handler = FindHandler(type); // Try to save the bitmap via wxImage handlers: - if (handler == NULL) + if (handler == nullptr) { wxImage image(this->ConvertToImage()); if (image.IsOk()) return image.SaveFile( name, type ); @@ -1065,7 +1065,7 @@ bool wxBitmap::LoadFile( const wxString &name, wxBitmapType type ) wxBitmapHandler *handler = FindHandler(type); - if (handler == NULL) + if (handler == nullptr) { wxImage image; if (!image.LoadFile( name, type )) @@ -1098,7 +1098,7 @@ void wxBitmap::SetPalette(const wxPalette& palette) wxPalette *wxBitmap::GetPalette() const { - if (!IsOk()) return NULL; + if (!IsOk()) return nullptr; return M_BMPDATA->m_palette; } @@ -1142,21 +1142,21 @@ void wxBitmap::SetBitmap( WXPixmap bitmap ) WXPixmap wxBitmap::GetPixmap() const { - wxCHECK_MSG( IsOk(), (WXPixmap) NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), (WXPixmap) nullptr, wxT("invalid bitmap") ); return (WXPixmap)M_BMPDATA->m_pixmap; } WXPixmap wxBitmap::GetBitmap() const { - wxCHECK_MSG( IsOk(), (WXPixmap) NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), (WXPixmap) nullptr, wxT("invalid bitmap") ); return (WXPixmap)M_BMPDATA->m_bitmap; } WXPixmap wxBitmap::GetDrawable() const { - wxCHECK_MSG( IsOk(), (WXPixmap) NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), (WXPixmap) nullptr, wxT("invalid bitmap") ); return (WXPixmap)(M_BMPDATA->m_bpp == 1 ? M_BMPDATA->m_bitmap : M_BMPDATA->m_pixmap); @@ -1164,7 +1164,7 @@ WXPixmap wxBitmap::GetDrawable() const WXDisplay *wxBitmap::GetDisplay() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid bitmap") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid bitmap") ); return M_BMPDATA->m_display; } @@ -1176,7 +1176,7 @@ bool wxGetImageFromDrawable(GR_DRAW_ID drawable, int srcX, int srcY, int width, GR_SCREEN_INFO sinfo; int x, y; GR_PIXELVAL *pixels; - GR_PALETTE* palette = NULL; + GR_PALETTE* palette = nullptr; unsigned char rgb[3], *pp; GrGetScreenInfo(&sinfo); @@ -1336,7 +1336,7 @@ public: virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, wxBitmapType type, - const wxPalette *palette = NULL) const; + const wxPalette *palette = nullptr) const; virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data), @@ -1460,7 +1460,7 @@ public: virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), wxBitmapType WXUNUSED(type), - const wxPalette *WXUNUSED(palette) = NULL) const + const wxPalette *WXUNUSED(palette) = nullptr) const { return false; } virtual bool Create(wxBitmap *bitmap, const void* data, wxBitmapType flags, @@ -1474,7 +1474,7 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits, int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) { #if wxHAVE_LIB_XPM - wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") ); + wxCHECK_MSG( bits != nullptr, false, wxT("invalid bitmap data") ); if (!bitmap->GetRefData()) bitmap->SetRefData( new wxBitmapRefData() ); @@ -1566,7 +1566,7 @@ public: virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), wxBitmapType WXUNUSED(type), - const wxPalette *WXUNUSED(palette) = NULL) const + const wxPalette *WXUNUSED(palette) = nullptr) const { return false; } virtual bool Create(wxBitmap *bitmap, const void* data, wxBitmapType type, @@ -1590,7 +1590,7 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, const void* bits, int xscreen = DefaultScreen( xdisplay ); Window xroot = RootWindow( xdisplay, xscreen ); - M_BMPHANDLERDATA->m_mask = NULL; + M_BMPHANDLERDATA->m_mask = nullptr; M_BMPHANDLERDATA->m_bitmap = XCreateBitmapFromData(xdisplay, xroot, (char *) bits, width, height ); diff --git a/src/x11/brush.cpp b/src/x11/brush.cpp index 48b186bdf5..9808b86313 100644 --- a/src/x11/brush.cpp +++ b/src/x11/brush.cpp @@ -123,7 +123,7 @@ wxColour wxBrush::GetColour() const wxBitmap *wxBrush::GetStipple() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid brush") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") ); return &M_BRUSHDATA->m_stipple; } diff --git a/src/x11/clipbrd.cpp b/src/x11/clipbrd.cpp index a8c1a300bd..4253e315fa 100644 --- a/src/x11/clipbrd.cpp +++ b/src/x11/clipbrd.cpp @@ -213,7 +213,7 @@ unsigned char *GetClipboardDataByFormat(Display* disp, Window win, Atom clipbrdT unsigned long *length) { // some variables that used to get the data in window property - unsigned char *clipbrddata = NULL; + unsigned char *clipbrddata = nullptr; int read_bytes = 1024; Atom type; int format, result; @@ -223,10 +223,10 @@ unsigned char *GetClipboardDataByFormat(Display* disp, Window win, Atom clipbrdT do { - if ( clipbrddata != 0 ) + if ( clipbrddata != nullptr ) { XFree(clipbrddata); - clipbrddata = NULL; + clipbrddata = nullptr; } result = XGetWindowProperty(disp, win, clipbrdType, 0, read_bytes, False, AnyPropertyType, @@ -238,13 +238,13 @@ unsigned char *GetClipboardDataByFormat(Display* disp, Window win, Atom clipbrdT if ( result == Success && clipbrddata ) return clipbrddata; - return NULL; + return nullptr; } // get the data for a specific wxDataFormat that stored as a property in Root window void GetClipboardData(Display* disp, Window win, wxDataObject &data, wxDataFormat dfFormat) { - unsigned char *clipbrdData = NULL; + unsigned char *clipbrdData = nullptr; // some variables that used to get the data in window property unsigned long len; @@ -270,7 +270,7 @@ void GetClipboardData(Display* disp, Window win, wxDataObject &data, wxDataForma clipbrdData = GetClipboardDataByFormat(disp, win, XA_CLIPBOARD, atomVector.at(i), &len); - if ( clipbrdData != NULL ) + if ( clipbrdData != nullptr ) break; } // if we got any data, copy it. @@ -414,8 +414,8 @@ wxClipboard::wxClipboard() m_ownsClipboard = false; m_ownsPrimarySelection = false; - m_data = NULL; - m_receivedData = NULL; + m_data = nullptr; + m_receivedData = nullptr; /* we use m_targetsWidget to query what formats are available */ diff --git a/src/x11/colour.cpp b/src/x11/colour.cpp index 7f9e2878c1..b222d2d124 100644 --- a/src/x11/colour.cpp +++ b/src/x11/colour.cpp @@ -33,7 +33,7 @@ public: m_color.green = 0; m_color.blue = 0; m_color.pixel = 0; - m_colormap = NULL; + m_colormap = nullptr; m_hasPixel = false; } @@ -238,7 +238,7 @@ unsigned long wxColour::GetPixel() const WXColor *wxColour::GetColor() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid colour") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid colour") ); return (WXColor*) &M_COLDATA->m_color; } diff --git a/src/x11/cursor.cpp b/src/x11/cursor.cpp index 8fe903b05e..5e46991f81 100644 --- a/src/x11/cursor.cpp +++ b/src/x11/cursor.cpp @@ -49,8 +49,8 @@ private: wxCursorRefData::wxCursorRefData() { - m_cursor = NULL; - m_display = NULL; + m_cursor = nullptr; + m_display = nullptr; } wxCursorRefData::~wxCursorRefData() diff --git a/src/x11/dcclient.cpp b/src/x11/dcclient.cpp index 140f5c6a6e..fe3da17a35 100644 --- a/src/x11/dcclient.cpp +++ b/src/x11/dcclient.cpp @@ -63,7 +63,7 @@ #define IS_16_PIX_HATCH(s) ((s)!=wxBRUSHSTYLE_CROSSDIAG_HATCH && (s)!=wxBRUSHSTYLE_HORIZONTAL_HATCH && (s)!=wxBRUSHSTYLE_VERTICAL_HATCH) static Pixmap hatches[num_hatches]; -static Pixmap *hatch_bitmap = NULL; +static Pixmap *hatch_bitmap = nullptr; //----------------------------------------------------------------------------- // constants @@ -130,7 +130,7 @@ static GC wxGetPoolGC( Window window, wxPoolGCType type ) { if (!wxGCPool[i].m_gc) { - wxGCPool[i].m_gc = XCreateGC( wxGlobalDisplay(), window, 0, NULL ); + wxGCPool[i].m_gc = XCreateGC( wxGlobalDisplay(), window, 0, nullptr ); XSetGraphicsExposures( wxGlobalDisplay(), wxGCPool[i].m_gc, FALSE ); wxGCPool[i].m_type = type; wxGCPool[i].m_used = false; @@ -144,7 +144,7 @@ static GC wxGetPoolGC( Window window, wxPoolGCType type ) wxFAIL_MSG( wxT("No GC available") ); - return (GC) NULL; + return (GC) nullptr; } static void wxFreePoolGC( GC gc ) @@ -221,19 +221,19 @@ wxWindowDCImpl::~wxWindowDCImpl() void wxWindowDCImpl::Init() { - m_display = NULL; - m_penGC = NULL; - m_brushGC = NULL; - m_textGC = NULL; - m_bgGC = NULL; - m_cmap = NULL; + m_display = nullptr; + m_penGC = nullptr; + m_brushGC = nullptr; + m_textGC = nullptr; + m_bgGC = nullptr; + m_cmap = nullptr; m_isMemDC = false; m_isScreenDC = false; - m_x11window = NULL; + m_x11window = nullptr; #if wxUSE_UNICODE m_context = wxTheApp->GetPangoContext(); - m_fontdesc = NULL; + m_fontdesc = nullptr; #endif } @@ -1028,7 +1028,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, wxCHECK_RET( bitmap.IsOk(), wxT("invalid bitmap") ); - bool is_mono = (bitmap.GetBitmap() != NULL); + bool is_mono = (bitmap.GetBitmap() != nullptr); /* scale/translate size and position */ int xx = XLOG2DEV(x); @@ -1072,7 +1072,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, } /* apply mask if any */ - WXPixmap mask = NULL; + WXPixmap mask = nullptr; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); @@ -1146,7 +1146,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, wxCHECK_RET( bitmap.IsOk(), wxT("invalid bitmap") ); - bool is_mono = (bitmap.GetBitmap() != NULL); + bool is_mono = (bitmap.GetBitmap() != nullptr); // scale/translate size and position int xx = XLOG2DEV(x); @@ -1190,7 +1190,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, } // apply mask if any - WXPixmap mask = NULL; + WXPixmap mask = nullptr; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); bool setClipMask = false; @@ -1209,7 +1209,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, Window xroot = RootWindow( xdisplay, xscreen ); new_pixmap = XCreatePixmap( xdisplay, xroot, ww, hh, 1 ); - GC gc = XCreateGC( xdisplay, new_pixmap, 0, NULL ); + GC gc = XCreateGC( xdisplay, new_pixmap, 0, nullptr ); XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); @@ -1426,12 +1426,12 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoor } // apply mask if any - WXPixmap mask = NULL; + WXPixmap mask = nullptr; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); if (useMask && mask) { - WXPixmap new_mask = NULL; + WXPixmap new_mask = nullptr; #if 0 if (!m_currentClippingRegion.IsNull()) { @@ -1945,7 +1945,7 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) default: { lineStyle = LineSolid; - req_dash = NULL; + req_dash = nullptr; req_nb_dash = 0; break; } @@ -2337,13 +2337,13 @@ void wxWindowDCImpl::DestroyClippingRegion() void wxWindowDCImpl::Destroy() { if (m_penGC) wxFreePoolGC( (GC) m_penGC ); - m_penGC = NULL; + m_penGC = nullptr; if (m_brushGC) wxFreePoolGC( (GC) m_brushGC ); - m_brushGC = NULL; + m_brushGC = nullptr; if (m_textGC) wxFreePoolGC( (GC) m_textGC ); - m_textGC = NULL; + m_textGC = nullptr; if (m_bgGC) wxFreePoolGC( (GC) m_bgGC ); - m_bgGC = NULL; + m_bgGC = nullptr; } void wxWindowDCImpl::ComputeScaleAndOrigin() @@ -2387,7 +2387,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl); wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) : wxWindowDCImpl( owner, window ) { - wxCHECK_RET( window, wxT("NULL window in wxClientDC::wxClientDC") ); + wxCHECK_RET( window, wxT("null window in wxClientDC::wxClientDC") ); m_x11window = (WXWindow*) window->GetClientAreaWindow(); diff --git a/src/x11/dcmemory.cpp b/src/x11/dcmemory.cpp index 2679dde525..c670a3f041 100644 --- a/src/x11/dcmemory.cpp +++ b/src/x11/dcmemory.cpp @@ -79,7 +79,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) else { m_ok = false; - m_x11window = NULL; + m_x11window = nullptr; } } diff --git a/src/x11/dnd.cpp b/src/x11/dnd.cpp index 709df89478..df1dcda35b 100644 --- a/src/x11/dnd.cpp +++ b/src/x11/dnd.cpp @@ -129,7 +129,7 @@ wxDropSource::wxDropSource( wxWindow *win ) { #if 0 m_window = win; - m_data = NULL; + m_data = nullptr; m_retValue = wxDragCancel; m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY ); diff --git a/src/x11/evtloop.cpp b/src/x11/evtloop.cpp index 8260a31b70..04119e76bf 100644 --- a/src/x11/evtloop.cpp +++ b/src/x11/evtloop.cpp @@ -220,7 +220,7 @@ bool wxGUIEventLoop::Dispatch() wxFD_ZERO(&writeset); wxFD_SET(fd, &readset); - if (select( fd+1, &readset, &writeset, NULL, &tv ) != 0) + if (select( fd+1, &readset, &writeset, nullptr, &tv ) != 0) { // An X11 event was pending, get it if (wxFD_ISSET( fd, &readset )) diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 8c6c6983af..7e8d70c28d 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -591,7 +591,7 @@ bool wxFont::Create(const wxString& fontname, wxFontEncoding enc) tmp = tn.GetNextToken(); // pointsize if (tmp != wxT("*")) { - long num = wxStrtol (tmp.c_str(), (wxChar **) NULL, 10); + long num = wxStrtol (tmp.c_str(), (wxChar **) nullptr, 10); M_FONTDATA->m_pointSize = (int)(num / 10); } @@ -761,7 +761,7 @@ wxFontEncoding wxFont::GetEncoding() const const wxNativeFontInfo *wxFont::GetNativeFontInfo() const { - wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") ); + wxCHECK_MSG( IsOk(), nullptr, wxT("invalid font") ); #if wxUSE_UNICODE #else @@ -906,7 +906,7 @@ bool wxFont::SetPangoAttrs(PangoLayout* layout) const wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const { if ( !IsOk() ) - return NULL; + return nullptr; long intScale = long(scale * 100.0 + 0.5); // key for wxXFont int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; @@ -941,7 +941,7 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const { wxFAIL_MSG( wxT("Could not allocate even a default font -- something is wrong.") ); - return NULL; + return nullptr; } wxXFont* f = new wxXFont; diff --git a/src/x11/palette.cpp b/src/x11/palette.cpp index 52196caa33..064096bebf 100644 --- a/src/x11/palette.cpp +++ b/src/x11/palette.cpp @@ -63,10 +63,10 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject); wxXPalette::wxXPalette() { - m_cmap = (WXColormap) 0; + m_cmap = (WXColormap) nullptr; m_pix_array_n = 0; - m_pix_array = (unsigned long*) 0; - m_display = (WXDisplay*) 0; + m_pix_array = (unsigned long*) nullptr; + m_display = (WXDisplay*) nullptr; m_destroyable = false; } @@ -76,7 +76,7 @@ wxPaletteRefData::wxPaletteRefData() wxPaletteRefData::~wxPaletteRefData() { - Display *display = NULL; + Display *display = nullptr; wxList::compatibility_iterator node, next; @@ -384,7 +384,7 @@ bool wxPalette::TransferBitmap8(unsigned char *data, unsigned long sz, unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n) { if (!M_PALETTEDATA) - return (unsigned long*) 0; + return (unsigned long*) nullptr; wxList::compatibility_iterator node; for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; node = node->GetNext()) @@ -402,7 +402,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n) if (GetXColormap(display)) return GetXPixArray(display, n); else - return (unsigned long*) 0; + return (unsigned long*) nullptr; } void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp) @@ -414,7 +414,7 @@ void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp) wxXPalette *c = new wxXPalette; c->m_pix_array_n = 0; - c->m_pix_array = (unsigned long*) NULL; + c->m_pix_array = (unsigned long*) nullptr; c->m_display = display; c->m_cmap = cm; c->m_destroyable = dp; diff --git a/src/x11/pango_x.cpp b/src/x11/pango_x.cpp index ead07fc387..5916dc19f9 100644 --- a/src/x11/pango_x.cpp +++ b/src/x11/pango_x.cpp @@ -99,7 +99,7 @@ x11_draw_layout_line_with_colors( Drawable drawable, gint x_off = 0; gint rise = 0; - pango_layout_line_get_extents (line,NULL, &overall_rect); + pango_layout_line_get_extents (line,nullptr, &overall_rect); GSList *tmp_list = line->runs; while (tmp_list) @@ -122,7 +122,7 @@ x11_draw_layout_line_with_colors( Drawable drawable, if (!shape_set) { if (uline == PANGO_UNDERLINE_NONE) - pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &logical_rect); + pango_glyph_string_extents (run->glyphs, run->item->analysis.font, nullptr, &logical_rect); else pango_glyph_string_extents (run->glyphs, run->item->analysis.font, &ink_rect, &logical_rect); } @@ -171,7 +171,7 @@ x11_draw_layout_with_colors( Drawable drawable, PangoLayoutLine *line = pango_layout_iter_get_line (iter); PangoRectangle logical_rect; - pango_layout_iter_get_line_extents (iter, NULL, &logical_rect); + pango_layout_iter_get_line_extents (iter, nullptr, &logical_rect); int baseline = pango_layout_iter_get_baseline (iter); diff --git a/src/x11/pen.cpp b/src/x11/pen.cpp index 007c35fe25..d54553e9d2 100644 --- a/src/x11/pen.cpp +++ b/src/x11/pen.cpp @@ -32,7 +32,7 @@ public: m_style = wxPENSTYLE_SOLID; m_joinStyle = wxJOIN_ROUND; m_capStyle = wxCAP_ROUND; - m_dash = NULL; + m_dash = nullptr; m_countDashes = 0; } diff --git a/src/x11/region.cpp b/src/x11/region.cpp index dca34a1f53..6d32e2ab0e 100644 --- a/src/x11/region.cpp +++ b/src/x11/region.cpp @@ -35,7 +35,7 @@ class wxRegionRefData : public wxGDIRefData public: wxRegionRefData() { - m_region = NULL; + m_region = nullptr; } wxRegionRefData(const wxRegionRefData& refData) @@ -326,7 +326,7 @@ wxRegionContain wxRegion::DoContainsRect(const wxRect& r) const WXRegion *wxRegion::GetX11Region() const { if (!m_refData) - return NULL; + return nullptr; return (WXRegion*) M_REGIONDATA->m_region; } @@ -354,7 +354,7 @@ class wxRIRefData: public wxGDIRefData { public: - wxRIRefData() : m_rects(0), m_numRects(0){} + wxRIRefData() : m_rects(nullptr), m_numRects(0){} virtual ~wxRIRefData(); wxRect *m_rects; @@ -373,7 +373,7 @@ void wxRIRefData::CreateRects( const wxRegion& region ) if (m_rects) delete [] m_rects; - m_rects = 0; + m_rects = nullptr; m_numRects = 0; if (region.IsEmpty()) return; diff --git a/src/x11/reparent.cpp b/src/x11/reparent.cpp index e53b0bab8f..47663050ae 100644 --- a/src/x11/reparent.cpp +++ b/src/x11/reparent.cpp @@ -60,8 +60,8 @@ wxAdoptedWindow::~wxAdoptedWindow() static bool Xerror; static Atom WM_STATE = 0; bool wxReparenter::sm_done = false; -wxAdoptedWindow* wxReparenter::sm_toReparent = NULL; -wxWindow* wxReparenter::sm_newParent = NULL; +wxAdoptedWindow* wxReparenter::sm_toReparent = nullptr; +wxWindow* wxReparenter::sm_newParent = nullptr; wxString wxReparenter::sm_name; bool wxReparenter::sm_exactMatch = false; @@ -189,7 +189,7 @@ bool wxReparenter::ProcessXEvent(WXEvent* event) (client = (Window) FindAClientWindow((WXWindow) xevent->xmap.window, sm_name))) { wxLogDebug(wxT("Found a client window, about to reparent")); - wxASSERT(sm_toReparent->GetParent() == NULL); + wxASSERT(sm_toReparent->GetParent() == nullptr); sm_toReparent->SetHandle((WXWindow) client); sm_newParent->AddChild(sm_toReparent); @@ -202,7 +202,7 @@ bool wxReparenter::ProcessXEvent(WXEvent* event) wxLogDebug(wxT("Found an override redirect window, about to reparent")); sm_toReparent->SetHandle((WXWindow) xevent->xmap.window); sm_newParent->AddChild(sm_toReparent); - wxASSERT(sm_toReparent->GetParent() == NULL); + wxASSERT(sm_toReparent->GetParent() == nullptr); sm_done = Reparent(sm_newParent, sm_toReparent); return sm_done; @@ -259,7 +259,7 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name) if (matches) return (WXWindow) window; else - return NULL; + return nullptr; } old = XSetErrorHandler(ErrorHandler); @@ -267,7 +267,7 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name) &children, &numchildren) || Xerror) { XSetErrorHandler(old); - return NULL; + return nullptr; } XSetErrorHandler(old); diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index 4c65e0cc8f..a811846c9c 100644 --- a/src/x11/textctrl.cpp +++ b/src/x11/textctrl.cpp @@ -305,7 +305,7 @@ void wxTextCtrl::DoSetValue(const wxString& value, int flags) // if (sl->m_text.Len() > m_longestLine) // m_longestLine = sl->m_text.Len(); int ww = 0; - GetTextExtent( sl->m_text, &ww, NULL, NULL, NULL ); + GetTextExtent( sl->m_text, &ww, nullptr, nullptr, nullptr ); ww /= m_charWidth; if (ww > m_longestLine) m_longestLine = ww; @@ -320,7 +320,7 @@ void wxTextCtrl::DoSetValue(const wxString& value, int flags) // if (sl->m_text.Len() > m_longestLine) // m_longestLine = sl->m_text.Len(); int ww = 0; - GetTextExtent( sl->m_text, &ww, NULL, NULL, NULL ); + GetTextExtent( sl->m_text, &ww, nullptr, nullptr, nullptr ); ww /= m_charWidth; if (ww > m_longestLine) m_longestLine = ww; @@ -440,7 +440,7 @@ int wxTextCtrl::PosToPixel( int line, int pos ) int w = 0; - GetTextExtent( text, &w, NULL, NULL, NULL ); + GetTextExtent( text, &w, nullptr, nullptr, nullptr ); return w; } @@ -457,7 +457,7 @@ int wxTextCtrl::PixelToPos( int line, int pixel ) int res = text.Len(); while (res > 0) { - GetTextExtent( text, &w, NULL, NULL, NULL ); + GetTextExtent( text, &w, nullptr, nullptr, nullptr ); if (w < pixel) return res; @@ -1168,7 +1168,7 @@ void wxTextCtrl::DoChar( char c ) // } int ww = 0; - GetTextExtent( tmp, &ww, NULL, NULL, NULL ); + GetTextExtent( tmp, &ww, nullptr, nullptr, nullptr ); ww /= m_charWidth; if (ww > m_longestLine) { @@ -1499,7 +1499,7 @@ void wxTextCtrl::DrawLinePart( wxDC &dc, int x, int y, const wxString &toDraw, c int xx = 0; wxString tmp = origin.Left( start ); - GetTextExtent( tmp, &xx, NULL, NULL, NULL ); + GetTextExtent( tmp, &xx, nullptr, nullptr, nullptr ); xx += x; int yy = y; dc.DrawText( current, xx, yy ); @@ -1699,7 +1699,7 @@ void wxTextCtrl::OnPaint( wxPaintEvent &event ) dc.SetFont( m_sourceFont ); int scroll_y = 0; - GetViewStart( NULL, &scroll_y ); + GetViewStart( nullptr, &scroll_y ); // We have a inner border of two pixels // around the text, so scroll units do @@ -2285,7 +2285,7 @@ void wxTextCtrl::MyAdjustScrollbars() int y_range = m_lines.GetCount(); int height = 0; - GetClientSize( NULL, &height ); + GetClientSize( nullptr, &height ); height -= 4; if (height >= (int)m_lines.GetCount() *m_lineHeight) y_range = 0; diff --git a/src/x11/toplevel.cpp b/src/x11/toplevel.cpp index feb1b1a8fa..0460da9cd4 100644 --- a/src/x11/toplevel.cpp +++ b/src/x11/toplevel.cpp @@ -243,7 +243,7 @@ wxTopLevelWindowX11::~wxTopLevelWindowX11() // If this is the last top-level window, exit. if ( wxTheApp && (wxTopLevelWindows.GetCount() == 0) ) { - wxTheApp->SetTopWindow(NULL); + wxTheApp->SetTopWindow(nullptr); if (wxTheApp->GetExitOnFrameDelete()) { diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index eb1e2e6e4b..0a6eb74aeb 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -152,7 +152,7 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) // Configurable display in wxX11 -static Display *gs_currentDisplay = NULL; +static Display *gs_currentDisplay = nullptr; static wxString gs_displayName; WXDisplay *wxGetDisplay() @@ -171,7 +171,7 @@ void wxCloseDisplay() gs_displayName); } - gs_currentDisplay = NULL; + gs_currentDisplay = nullptr; gs_displayName.clear(); } } @@ -180,7 +180,7 @@ bool wxSetDisplay(const wxString& displayName) { Display *dpy = XOpenDisplay ( - displayName.empty() ? NULL + displayName.empty() ? nullptr : (const char *)displayName.mb_str() ); @@ -370,7 +370,7 @@ public: { wxFAIL_MSG("Monitoring FDs in the main loop is not implemented in wxX11"); - return NULL; + return nullptr; } }; diff --git a/src/x11/utilsx.cpp b/src/x11/utilsx.cpp index c43cd750cf..662a742d7a 100644 --- a/src/x11/utilsx.cpp +++ b/src/x11/utilsx.cpp @@ -143,8 +143,8 @@ static void wxCalcPrecAndShift( unsigned long mask, int *shift, int *prec ) wxXVisualInfo::wxXVisualInfo() { - m_visualColormap = NULL; - m_colorCube = NULL; + m_visualColormap = nullptr; + m_colorCube = nullptr; } wxXVisualInfo::~wxXVisualInfo() diff --git a/src/x11/window.cpp b/src/x11/window.cpp index e68696229c..86bf35834e 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -63,11 +63,11 @@ // global variables for this module // ---------------------------------------------------------------------------- -static wxWindowX11* g_captureWindow = NULL; +static wxWindowX11* g_captureWindow = nullptr; static GC g_eraseGC; // the window that is about to be focused after currently focused // one looses focus: -static wxWindow* gs_toBeFocusedWindow = NULL; +static wxWindow* gs_toBeFocusedWindow = nullptr; // ---------------------------------------------------------------------------- // macros @@ -122,8 +122,8 @@ inline void EnsureValidXWindowSize(wxSize& size) void wxWindowX11::Init() { // X11-specific - m_mainWindow = (WXWindow) 0; - m_clientWindow = (WXWindow) 0; + m_mainWindow = (WXWindow) nullptr; + m_clientWindow = (WXWindow) nullptr; m_insertIntoMain = false; m_updateNcArea = false; @@ -359,7 +359,7 @@ wxWindowX11::~wxWindowX11() SendDestroyEvent(); if (g_captureWindow == this) - g_captureWindow = NULL; + g_captureWindow = nullptr; if ( DoFindFocus() == this ) KillFocus(); @@ -372,7 +372,7 @@ wxWindowX11::~wxWindowX11() Window xwindow = (Window) m_clientWindow; wxDeleteClientWindowFromTable( xwindow ); XDestroyWindow( wxGlobalDisplay(), xwindow ); - m_clientWindow = NULL; + m_clientWindow = nullptr; } // Destroy the window @@ -381,7 +381,7 @@ wxWindowX11::~wxWindowX11() Window xwindow = (Window) m_mainWindow; wxDeleteWindowFromTable( xwindow ); XDestroyWindow( wxGlobalDisplay(), xwindow ); - m_mainWindow = NULL; + m_mainWindow = nullptr; } } @@ -410,13 +410,13 @@ void wxWindowX11::SetFocus() { gs_toBeFocusedWindow = (wxWindow*)this; focusedWindow->KillFocus(); - gs_toBeFocusedWindow = NULL; + gs_toBeFocusedWindow = nullptr; } #if 0 if (GetName() == "scrollBar") { - char *crash = NULL; + char *crash = nullptr; *crash = 0; } #endif @@ -481,7 +481,7 @@ wxWindow *wxWindowBase::DoFindFocus() return win; } - return NULL; + return nullptr; } // Enabling/disabling handled by event loop, and not sending events @@ -530,12 +530,12 @@ void wxWindowX11::Lower() void wxWindowX11::DoCaptureMouse() { - if ((g_captureWindow != NULL) && (g_captureWindow != this)) + if ((g_captureWindow != nullptr) && (g_captureWindow != this)) { wxFAIL_MSG(wxT("Trying to capture before mouse released.")); // Core dump now - int *tmp = NULL; + int *tmp = nullptr; (*tmp) = 1; return; } @@ -570,7 +570,7 @@ void wxWindowX11::DoCaptureMouse() wxLogDebug( wxT("This is not a viewable window - perhaps not shown yet?") ); } - g_captureWindow = NULL; + g_captureWindow = nullptr; return; } @@ -580,7 +580,7 @@ void wxWindowX11::DoCaptureMouse() void wxWindowX11::DoReleaseMouse() { - g_captureWindow = NULL; + g_captureWindow = nullptr; if ( !m_winCaptured ) return; @@ -675,7 +675,7 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect) Display *xdisplay = wxGlobalDisplay(); - GC xgc = XCreateGC( xdisplay, xwindow, 0, NULL ); + GC xgc = XCreateGC( xdisplay, xwindow, 0, nullptr ); XSetGraphicsExposures( xdisplay, xgc, True ); int s_x = 0; @@ -1152,7 +1152,7 @@ void wxWindowX11::DoGetTextExtent(const wxString& string, PangoRectangle rect; - pango_layout_line_get_extents(line, NULL, &rect); + pango_layout_line_get_extents(line, nullptr, &rect); if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE); if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE); @@ -1350,7 +1350,7 @@ void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event) } // See handler for InFocus case in app.cpp for details. -wxWindow* g_GettingFocus = NULL; +wxWindow* g_GettingFocus = nullptr; void wxWindowX11::OnInternalIdle() { @@ -1373,7 +1373,7 @@ void wxWindowX11::OnInternalIdle() // no point in trying again. m_needsInputFocus = false; } - g_GettingFocus = NULL; + g_GettingFocus = nullptr; } // ---------------------------------------------------------------------------- @@ -1398,7 +1398,7 @@ static bool DoAddWindowToTable(wxWindowHash *hash, Window w, wxWindow *win) static inline wxWindow *DoGetWindowFromTable(wxWindowHash *hash, Window w) { wxWindowHash::iterator i = hash->find(w); - return i == hash->end() ? NULL : i->second; + return i == hash->end() ? nullptr : i->second; } static inline void DoDeleteWindowFromTable(wxWindowHash *hash, Window w) @@ -1615,7 +1615,7 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win char buf[20]; KeySym keySym; - (void) XLookupString ((XKeyEvent *) xevent, buf, 20, &keySym, NULL); + (void) XLookupString ((XKeyEvent *) xevent, buf, 20, &keySym, nullptr); #if wxUSE_UNICODE int id = wxUnicodeCharXToWX(keySym); #else @@ -1810,7 +1810,7 @@ bool wxWinModule::OnInit() int xscreen = DefaultScreen( xdisplay ); Window xroot = RootWindow( xdisplay, xscreen ); - g_eraseGC = XCreateGC( xdisplay, xroot, 0, NULL ); + g_eraseGC = XCreateGC( xdisplay, xroot, 0, nullptr ); XSetFillStyle( xdisplay, g_eraseGC, FillSolid ); return true; diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp index 7f166efc8a..48e297e870 100644 --- a/src/xml/xml.cpp +++ b/src/xml/xml.cpp @@ -50,7 +50,7 @@ wxXmlNode::wxXmlNode(wxXmlNode *parent,wxXmlNodeType type, wxXmlAttribute *attrs, wxXmlNode *next, int lineNo) : m_type(type), m_name(name), m_content(content), m_attrs(attrs), m_parent(parent), - m_children(NULL), m_next(next), + m_children(nullptr), m_next(next), m_lineNo(lineNo), m_noConversion(false) { @@ -72,8 +72,8 @@ wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name, const wxString& content, int lineNo) : m_type(type), m_name(name), m_content(content), - m_attrs(NULL), m_parent(NULL), - m_children(NULL), m_next(NULL), + m_attrs(nullptr), m_parent(nullptr), + m_children(nullptr), m_next(nullptr), m_lineNo(lineNo), m_noConversion(false) { wxASSERT_MSG ( type != wxXML_ELEMENT_NODE || content.empty(), "element nodes can't have content" ); @@ -81,8 +81,8 @@ wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name, wxXmlNode::wxXmlNode(const wxXmlNode& node) { - m_next = NULL; - m_parent = NULL; + m_next = nullptr; + m_parent = nullptr; DoCopy(node); } @@ -126,7 +126,7 @@ void wxXmlNode::DoCopy(const wxXmlNode& node) m_content = node.m_content; m_lineNo = node.m_lineNo; m_noConversion = node.m_noConversion; - m_children = NULL; + m_children = nullptr; wxXmlNode *n = node.m_children; while (n) @@ -135,7 +135,7 @@ void wxXmlNode::DoCopy(const wxXmlNode& node) n = n->GetNext(); } - m_attrs = NULL; + m_attrs = nullptr; wxXmlAttribute *p = node.m_attrs; while (p) { @@ -159,7 +159,7 @@ bool wxXmlNode::HasAttribute(const wxString& attrName) const bool wxXmlNode::GetAttribute(const wxString& attrName, wxString *value) const { - wxCHECK_MSG( value, false, "value argument must not be NULL" ); + wxCHECK_MSG( value, false, "value argument must not be null" ); wxXmlAttribute *attr = GetAttributes(); @@ -187,7 +187,7 @@ wxString wxXmlNode::GetAttribute(const wxString& attrName, const wxString& defau void wxXmlNode::AddChild(wxXmlNode *child) { - if (m_children == NULL) + if (m_children == nullptr) m_children = child; else { @@ -195,23 +195,23 @@ void wxXmlNode::AddChild(wxXmlNode *child) while (ch->m_next) ch = ch->m_next; ch->m_next = child; } - child->m_next = NULL; + child->m_next = nullptr; child->m_parent = this; } // inserts a new node in front of 'followingNode' bool wxXmlNode::InsertChild(wxXmlNode *child, wxXmlNode *followingNode) { - wxCHECK_MSG( child, false, "cannot insert a NULL node!" ); - wxCHECK_MSG( child->m_parent == NULL, false, "node already has a parent" ); - wxCHECK_MSG( child->m_next == NULL, false, "node already has m_next" ); - wxCHECK_MSG( followingNode == NULL || followingNode->GetParent() == this, + wxCHECK_MSG( child, false, "cannot insert a null node!" ); + wxCHECK_MSG( child->m_parent == nullptr, false, "node already has a parent" ); + wxCHECK_MSG( child->m_next == nullptr, false, "node already has m_next" ); + wxCHECK_MSG( followingNode == nullptr || followingNode->GetParent() == this, false, "wxXmlNode::InsertChild - followingNode has incorrect parent" ); - // this is for backward compatibility, NULL was allowed here thanks to + // this is for backward compatibility, nullptr was allowed here thanks to // the confusion about followingNode's meaning - if ( followingNode == NULL ) + if ( followingNode == nullptr ) followingNode = m_children; if ( m_children == followingNode ) @@ -241,10 +241,10 @@ bool wxXmlNode::InsertChild(wxXmlNode *child, wxXmlNode *followingNode) // inserts a new node right after 'precedingNode' bool wxXmlNode::InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode) { - wxCHECK_MSG( child, false, "cannot insert a NULL node!" ); - wxCHECK_MSG( child->m_parent == NULL, false, "node already has a parent" ); - wxCHECK_MSG( child->m_next == NULL, false, "node already has m_next" ); - wxCHECK_MSG( precedingNode == NULL || precedingNode->m_parent == this, false, + wxCHECK_MSG( child, false, "cannot insert a null node!" ); + wxCHECK_MSG( child->m_parent == nullptr, false, "node already has a parent" ); + wxCHECK_MSG( child->m_next == nullptr, false, "node already has m_next" ); + wxCHECK_MSG( precedingNode == nullptr || precedingNode->m_parent == this, false, "precedingNode has wrong parent" ); if ( precedingNode ) @@ -252,10 +252,10 @@ bool wxXmlNode::InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode) child->m_next = precedingNode->m_next; precedingNode->m_next = child; } - else // precedingNode == NULL + else // precedingNode == nullptr { - wxCHECK_MSG( m_children == NULL, false, - "NULL precedingNode only makes sense when there are no children" ); + wxCHECK_MSG( m_children == nullptr, false, + "null precedingNode only makes sense when there are no children" ); child->m_next = m_children; m_children = child; @@ -267,13 +267,13 @@ bool wxXmlNode::InsertChildAfter(wxXmlNode *child, wxXmlNode *precedingNode) bool wxXmlNode::RemoveChild(wxXmlNode *child) { - if (m_children == NULL) + if (m_children == nullptr) return false; else if (m_children == child) { m_children = child->m_next; - child->m_parent = NULL; - child->m_next = NULL; + child->m_parent = nullptr; + child->m_next = nullptr; return true; } else @@ -284,8 +284,8 @@ bool wxXmlNode::RemoveChild(wxXmlNode *child) if (ch->m_next == child) { ch->m_next = child->m_next; - child->m_parent = NULL; - child->m_next = NULL; + child->m_parent = nullptr; + child->m_next = nullptr; return true; } ch = ch->m_next; @@ -296,12 +296,12 @@ bool wxXmlNode::RemoveChild(wxXmlNode *child) void wxXmlNode::AddAttribute(const wxString& name, const wxString& value) { - AddAttribute(new wxXmlAttribute(name, value, NULL)); + AddAttribute(new wxXmlAttribute(name, value, nullptr)); } void wxXmlNode::AddAttribute(wxXmlAttribute *attr) { - if (m_attrs == NULL) + if (m_attrs == nullptr) m_attrs = attr; else { @@ -315,14 +315,14 @@ bool wxXmlNode::DeleteAttribute(const wxString& name) { wxXmlAttribute *attr; - if (m_attrs == NULL) + if (m_attrs == nullptr) return false; else if (m_attrs->GetName() == name) { attr = m_attrs; m_attrs = attr->GetNext(); - attr->SetNext(NULL); + attr->SetNext(nullptr); delete attr; return true; } @@ -336,7 +336,7 @@ bool wxXmlNode::DeleteAttribute(const wxString& name) { attr = p->GetNext(); p->SetNext(attr->GetNext()); - attr->SetNext(NULL); + attr->SetNext(nullptr); delete attr; return true; } @@ -439,7 +439,7 @@ bool wxXmlDoctype::IsValid() const //----------------------------------------------------------------------------- wxXmlDocument::wxXmlDocument() - : m_version(wxS("1.0")), m_fileEncoding(wxS("UTF-8")), m_docNode(NULL) + : m_version(wxS("1.0")), m_fileEncoding(wxS("UTF-8")), m_docNode(nullptr) { #if !wxUSE_UNICODE m_encoding = wxS("UTF-8"); @@ -449,7 +449,7 @@ wxXmlDocument::wxXmlDocument() } wxXmlDocument::wxXmlDocument(const wxString& filename, const wxString& encoding) - :wxObject(), m_docNode(NULL) + :wxObject(), m_docNode(nullptr) { SetFileType(wxTextFileType_Unix); @@ -460,7 +460,7 @@ wxXmlDocument::wxXmlDocument(const wxString& filename, const wxString& encoding) } wxXmlDocument::wxXmlDocument(wxInputStream& stream, const wxString& encoding) - :wxObject(), m_docNode(NULL) + :wxObject(), m_docNode(nullptr) { SetFileType(wxTextFileType_Unix); @@ -497,7 +497,7 @@ void wxXmlDocument::DoCopy(const wxXmlDocument& doc) if (doc.m_docNode) m_docNode = new wxXmlNode(*doc.m_docNode); else - m_docNode = NULL; + m_docNode = nullptr; } bool wxXmlDocument::Load(const wxString& filename, const wxString& encoding, int flags) @@ -522,7 +522,7 @@ wxXmlNode *wxXmlDocument::GetRoot() const if (node) { node = m_docNode->GetChildren(); - while (node != NULL && node->GetType() != wxXML_ELEMENT_NODE) + while (node != nullptr && node->GetType() != wxXML_ELEMENT_NODE) node = node->GetNext(); } return node; @@ -534,8 +534,8 @@ wxXmlNode *wxXmlDocument::DetachRoot() if (node) { node = m_docNode->GetChildren(); - wxXmlNode *prev = NULL; - while (node != NULL && node->GetType() != wxXML_ELEMENT_NODE) + wxXmlNode *prev = nullptr; + while (node != nullptr && node->GetType() != wxXML_ELEMENT_NODE) { prev = node; node = node->GetNext(); @@ -548,8 +548,8 @@ wxXmlNode *wxXmlDocument::DetachRoot() if (prev) prev->SetNext(node->GetNext()); - node->SetParent(NULL); - node->SetNext(NULL); + node->SetParent(nullptr); + node->SetNext(nullptr); } } return node; @@ -567,8 +567,8 @@ void wxXmlDocument::SetRoot(wxXmlNode *root) if (node) { node = m_docNode->GetChildren(); - wxXmlNode *prev = NULL; - while (node != NULL && node->GetType() != wxXML_ELEMENT_NODE) + wxXmlNode *prev = nullptr; + while (node != nullptr && node->GetType() != wxXML_ELEMENT_NODE) { prev = node; node = node->GetNext(); @@ -613,7 +613,7 @@ void wxXmlDocument::AppendToProlog(wxXmlNode *node) //----------------------------------------------------------------------------- // converts Expat-produced string in UTF-8 into wxString using the specified -// conv or keep in UTF-8 if conv is NULL +// conv or keep in UTF-8 if conv is null static wxString CharToString(wxMBConv *conv, const char *s, size_t len = wxString::npos) { @@ -623,7 +623,7 @@ static wxString CharToString(wxMBConv *conv, // there can be no embedded NULs in this string so we don't need the // output length, it will be NUL-terminated const wxWCharBuffer wbuf( - wxConvUTF8.cMB2WC(s, len == wxString::npos ? wxNO_LEN : len, NULL)); + wxConvUTF8.cMB2WC(s, len == wxString::npos ? wxNO_LEN : len, nullptr)); return wxString(wbuf, *conv); } @@ -650,11 +650,11 @@ bool wxIsWhiteOnly(const wxString& buf) struct wxXmlParsingContext { wxXmlParsingContext() - : conv(NULL), - node(NULL), - lastChild(NULL), - lastAsText(NULL), - doctype(NULL), + : conv(nullptr), + node(nullptr), + lastChild(nullptr), + lastAsText(nullptr), + doctype(nullptr), removeWhiteOnlyNodes(false) {} @@ -671,9 +671,9 @@ struct wxXmlParsingContext // checks that ctx->lastChild is in consistent state #define ASSERT_LAST_CHILD_OK(ctx) \ - wxASSERT( ctx->lastChild == NULL || \ - ctx->lastChild->GetNext() == NULL ); \ - wxASSERT( ctx->lastChild == NULL || \ + wxASSERT( ctx->lastChild == nullptr || \ + ctx->lastChild->GetNext() == nullptr ); \ + wxASSERT( ctx->lastChild == nullptr || \ ctx->lastChild->GetParent() == ctx->node ) extern "C" { @@ -695,8 +695,8 @@ static void StartElementHnd(void *userData, const char *name, const char **atts) ASSERT_LAST_CHILD_OK(ctx); ctx->node->InsertChildAfter(node, ctx->lastChild); - ctx->lastAsText = NULL; - ctx->lastChild = NULL; // our new node "node" has no children yet + ctx->lastAsText = nullptr; + ctx->lastChild = nullptr; // our new node "node" has no children yet ctx->node = node; } @@ -711,7 +711,7 @@ static void EndElementHnd(void *userData, const char* WXUNUSED(name)) ctx->lastChild = ctx->node; ctx->node = ctx->node->GetParent(); - ctx->lastAsText = NULL; + ctx->lastAsText = nullptr; } static void TextHnd(void *userData, const char *s, int len) @@ -763,7 +763,7 @@ static void EndCdataHnd(void *userData) // their contents to this one but create new wxXML_TEXT_NODE objects (or // not create anything at all if only white space follows the CDATA section // and wxXMLDOC_KEEP_WHITESPACE_NODES is not used as is commonly the case) - ctx->lastAsText = NULL; + ctx->lastAsText = nullptr; } static void CommentHnd(void *userData, const char *data) @@ -778,7 +778,7 @@ static void CommentHnd(void *userData, const char *data) ASSERT_LAST_CHILD_OK(ctx); ctx->node->InsertChildAfter(commentnode, ctx->lastChild); ctx->lastChild = commentnode; - ctx->lastAsText = NULL; + ctx->lastAsText = nullptr; } static void PIHnd(void *userData, const char *target, const char *data) @@ -793,7 +793,7 @@ static void PIHnd(void *userData, const char *target, const char *data) ASSERT_LAST_CHILD_OK(ctx); ctx->node->InsertChildAfter(pinode, ctx->lastChild); ctx->lastChild = pinode; - ctx->lastAsText = NULL; + ctx->lastAsText = nullptr; } static void StartDoctypeHnd(void *userData, const char *doctypeName, @@ -853,9 +853,9 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData), info->map[i+1] = (int)wcBuf[0]; } - info->data = NULL; - info->convert = NULL; - info->release = NULL; + info->data = nullptr; + info->convert = nullptr; + info->release = nullptr; return 1; } @@ -874,11 +874,11 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding, int fl char buf[BUFSIZE]; wxXmlParsingContext ctx; bool done; - XML_Parser parser = XML_ParserCreate(NULL); + XML_Parser parser = XML_ParserCreate(nullptr); wxXmlNode *root = new wxXmlNode(wxXML_DOCUMENT_NODE, wxEmptyString); ctx.encoding = wxS("UTF-8"); // default in absence of encoding="" - ctx.conv = NULL; + ctx.conv = nullptr; #if !wxUSE_UNICODE if ( encoding.CmpNoCase(wxS("UTF-8")) != 0 ) ctx.conv = new wxCSConv(encoding); @@ -896,7 +896,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding, int fl XML_SetProcessingInstructionHandler(parser, PIHnd); XML_SetDoctypeDeclHandler(parser, StartDoctypeHnd, EndDoctypeHnd); XML_SetDefaultHandler(parser, DefaultHnd); - XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL); + XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, nullptr); bool ok = true; do @@ -1115,7 +1115,7 @@ bool OutputNode(wxOutputStream& stream, { rc = OutputString(stream, wxS(">"), convMem, convFile); - wxXmlNode *prev = NULL; + wxXmlNode *prev = nullptr; for ( wxXmlNode *n = node->GetChildren(); n && rc; n = n->GetNext() ) diff --git a/src/xrc/xh_animatctrl.cpp b/src/xrc/xh_animatctrl.cpp index 8f2f98c228..58481c8daa 100644 --- a/src/xrc/xh_animatctrl.cpp +++ b/src/xrc/xh_animatctrl.cpp @@ -29,7 +29,7 @@ wxAnimationCtrlXmlHandler::wxAnimationCtrlXmlHandler() : wxXmlResourceHandler() wxObject *wxAnimationCtrlXmlHandler::DoCreateResource() { - wxAnimationCtrlBase *ctrl = NULL; + wxAnimationCtrlBase *ctrl = nullptr; if ( m_instance ) ctrl = wxStaticCast(m_instance, wxAnimationCtrlBase); @@ -82,7 +82,7 @@ wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param, { wxString name = GetFilePath(GetParamNode(param)); if ( name.empty() ) - return NULL; + return nullptr; // load the animation from file wxScopedPtr ani(ctrl ? new wxAnimation(ctrl->CreateAnimation()) @@ -106,7 +106,7 @@ wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param, param, wxString::Format("cannot create animation from \"%s\"", name) ); - return NULL; + return nullptr; } return ani.release(); diff --git a/src/xrc/xh_aui.cpp b/src/xrc/xh_aui.cpp index 2eed3d5d16..a72b33a2ea 100644 --- a/src/xrc/xh_aui.cpp +++ b/src/xrc/xh_aui.cpp @@ -21,9 +21,9 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxAuiXmlHandler, wxXmlResourceHandler); wxAuiXmlHandler::wxAuiXmlHandler() : wxXmlResourceHandler(), - m_manager(NULL), - m_window(NULL), - m_notebook(NULL), + m_manager(nullptr), + m_window(nullptr), + m_notebook(nullptr), m_mgrInside(false), m_anbInside(false) { @@ -66,7 +66,7 @@ wxAuiManager *wxAuiXmlHandler::GetAuiManager( wxWindow *managed ) const return mgr; } - return NULL; + return nullptr; } void wxAuiXmlHandler::OnManagedWindowClose( wxWindowDestroyEvent &event ) @@ -92,7 +92,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource() { if (m_class == wxS("wxAuiManager")) { - wxAuiManager *manager = NULL; + wxAuiManager *manager = nullptr; if (m_parentAsWindow) { @@ -140,7 +140,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource() else if (m_class == "wxAuiPaneInfo") { wxXmlNode *node = GetParamNode(wxS("object")); - wxWindow *window = NULL; + wxWindow *window = nullptr; if (!node) node = GetParamNode(wxS("object_ref")); @@ -150,7 +150,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource() bool old_ins = m_mgrInside; m_mgrInside = false; - wxObject *object = CreateResFromNode(node, m_window, NULL); + wxObject *object = CreateResFromNode(node, m_window, nullptr); m_mgrInside = old_ins; window = wxDynamicCast( object, wxWindow ); @@ -233,7 +233,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource() { bool old_ins = m_anbInside; m_anbInside = false; - wxObject *item = CreateResFromNode(anb, m_notebook, NULL); + wxObject *item = CreateResFromNode(anb, m_notebook, nullptr); m_anbInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); @@ -262,7 +262,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource() else { ReportError("notebookpage must have a window child"); - return NULL; + return nullptr; } } else // if (m_class == wxS("wxAuiNotebook")) diff --git a/src/xrc/xh_auitoolb.cpp b/src/xrc/xh_auitoolb.cpp index f27a8e15f9..f04fe174d7 100644 --- a/src/xrc/xh_auitoolb.cpp +++ b/src/xrc/xh_auitoolb.cpp @@ -29,7 +29,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxAuiToolBarXmlHandler, wxXmlResourceHandler); wxAuiToolBarXmlHandler::wxAuiToolBarXmlHandler() : wxXmlResourceHandler() , m_isInside(false) - , m_toolbar(NULL) + , m_toolbar(nullptr) { XRC_ADD_STYLE(wxAUI_TB_DEFAULT_STYLE); XRC_ADD_STYLE(wxAUI_TB_TEXT); @@ -53,7 +53,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() if ( !m_toolbar ) { ReportError("tool only allowed inside a wxAuiToolBar"); - return NULL; + return nullptr; } wxItemKind kind = wxITEM_NORMAL; @@ -75,7 +75,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() } #if wxUSE_MENUS // check whether we have dropdown tag inside - wxMenu *menu = NULL; // menu for drop down items + wxMenu *menu = nullptr; // menu for drop down items wxXmlNode * const nodeDropdown = GetParamNode("dropdown"); if ( nodeDropdown ) { @@ -85,7 +85,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() wxXmlNode * const nodeMenu = GetNodeChildren(nodeDropdown); if ( nodeMenu ) { - wxObject *res = CreateResFromNode(nodeMenu, NULL); + wxObject *res = CreateResFromNode(nodeMenu, nullptr); menu = wxDynamicCast(res, wxMenu); if ( !menu ) { @@ -117,7 +117,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() kind, GetText(wxS("tooltip")), GetText(wxS("longhelp")), - NULL + nullptr ); if ( GetBool(wxS("disabled")) ) @@ -131,7 +131,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() } #endif - return m_toolbar; // must return non-NULL + return m_toolbar; // must return non-null } else if (m_class == wxS("separator") || m_class == wxS("space") || m_class == wxS("label")) @@ -139,7 +139,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() if ( !m_toolbar ) { ReportError("separators only allowed inside wxAuiToolBar"); - return NULL; + return nullptr; } if ( m_class == wxS("separator") ) @@ -153,7 +153,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() if (hasProportion && hasWidth) { ReportError("A space can't both stretch and have width"); - return NULL; + return nullptr; } if (hasWidth) @@ -182,7 +182,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() ); } - return m_toolbar; // must return non-NULL + return m_toolbar; // must return non-null } else /**/ @@ -220,7 +220,7 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() if (!children_node) children_node = GetParamNode(wxS("object_ref")); - if (children_node == NULL) return toolbar; + if (children_node == nullptr) return toolbar; m_isInside = true; m_toolbar = toolbar; @@ -231,20 +231,20 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource() { if (IsObjectNode(n)) { - wxObject *created = CreateResFromNode(n, toolbar, NULL); + wxObject *created = CreateResFromNode(n, toolbar, nullptr); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxS("tool")) && !IsOfClass(n, wxS("separator")) && !IsOfClass(n, wxS("label")) && !IsOfClass(n, wxS("space")) && - control != NULL) + control != nullptr) toolbar->AddControl(control); } n = GetNodeNext(n); } m_isInside = false; - m_toolbar = NULL; + m_toolbar = nullptr; toolbar->Realize(); @@ -266,13 +266,13 @@ void wxAuiToolBarXmlHandler::MenuHandler::OnDropDown(wxAuiToolBarEvent& event) if (event.IsDropDownClicked()) { wxAuiToolBar *toobar = wxDynamicCast(event.GetEventObject(), wxAuiToolBar); - if (toobar != NULL) + if (toobar != nullptr) { wxAuiToolBarItem *item = toobar->FindTool(event.GetId()); - if (item != NULL) + if (item != nullptr) { wxMenu * const menu = m_menus[item->GetUserData()]; - if (menu != NULL) + if (menu != nullptr) { wxRect rect = item->GetSizerItem()->GetRect(); toobar->PopupMenu(menu, rect.GetRight() - toobar->FromDIP(10), rect.GetBottom()); diff --git a/src/xrc/xh_bmpcbox.cpp b/src/xrc/xh_bmpcbox.cpp index 882cb67eb3..93c32f2e22 100644 --- a/src/xrc/xh_bmpcbox.cpp +++ b/src/xrc/xh_bmpcbox.cpp @@ -28,7 +28,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler, wxXmlResourceHandler); wxBitmapComboBoxXmlHandler::wxBitmapComboBoxXmlHandler() :wxXmlResourceHandler() - ,m_combobox(NULL) + ,m_combobox(nullptr) ,m_isInside(false) { XRC_ADD_STYLE(wxCB_SORT); @@ -43,7 +43,7 @@ wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource() if ( !m_combobox ) { ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox"); - return NULL; + return nullptr; } m_combobox->Append(GetText(wxT("text")), @@ -63,7 +63,7 @@ wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource() GetText(wxT("value")), GetPosition(), GetSize(), 0, - NULL, + nullptr, GetStyle(), wxDefaultValidator, GetName()); @@ -80,13 +80,13 @@ wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource() if ((n->GetType() == wxXML_ELEMENT_NODE) && (n->GetName() == wxT("object"))) { - CreateResFromNode(n, control, NULL); + CreateResFromNode(n, control, nullptr); } n = n->GetNext(); } m_isInside = false; - m_combobox = NULL; + m_combobox = nullptr; if (selection != -1) control->SetSelection(selection); diff --git a/src/xrc/xh_bookctrlbase.cpp b/src/xrc/xh_bookctrlbase.cpp index aff51084b7..ec8d0c7a2e 100644 --- a/src/xrc/xh_bookctrlbase.cpp +++ b/src/xrc/xh_bookctrlbase.cpp @@ -30,7 +30,7 @@ wxBookCtrlXmlHandlerBase::PageWithAttrs::PageWithAttrs() { - wnd = NULL; + wnd = nullptr; selected = false; imgId = bmpId = wxWithImages::NO_IMAGE; @@ -103,7 +103,7 @@ wxBookCtrlXmlHandlerBase::DoCreatePage(wxBookCtrlBase* book) { bool old_ins = m_isInside; m_isInside = false; - wxObject *item = CreateResFromNode(n, book, NULL); + wxObject *item = CreateResFromNode(n, book, nullptr); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); @@ -143,7 +143,7 @@ wxBookCtrlXmlHandlerBase::DoCreatePage(wxBookCtrlBase* book) else { ReportError(wxString::Format("%s must have a window child", m_class)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_chckl.cpp b/src/xrc/xh_chckl.cpp index fffdb8246f..38c49c586a 100644 --- a/src/xrc/xh_chckl.cpp +++ b/src/xrc/xh_chckl.cpp @@ -46,7 +46,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource() { // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxCheckListBox) @@ -92,7 +92,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_choic.cpp b/src/xrc/xh_choic.cpp index 3a87dea567..1d63d4d04c 100644 --- a/src/xrc/xh_choic.cpp +++ b/src/xrc/xh_choic.cpp @@ -40,7 +40,7 @@ wxObject *wxChoiceXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxChoice) @@ -69,7 +69,7 @@ wxObject *wxChoiceXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_choicbk.cpp b/src/xrc/xh_choicbk.cpp index 4f62d0acfc..a194422ad6 100644 --- a/src/xrc/xh_choicbk.cpp +++ b/src/xrc/xh_choicbk.cpp @@ -26,7 +26,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxChoicebookXmlHandler, wxXmlResourceHandler); wxChoicebookXmlHandler::wxChoicebookXmlHandler() - : m_choicebook(NULL) + : m_choicebook(nullptr) { XRC_ADD_STYLE(wxBK_DEFAULT); XRC_ADD_STYLE(wxBK_LEFT); diff --git a/src/xrc/xh_collpane.cpp b/src/xrc/xh_collpane.cpp index 21c44e15a6..46aa2b655e 100644 --- a/src/xrc/xh_collpane.cpp +++ b/src/xrc/xh_collpane.cpp @@ -43,7 +43,7 @@ wxObject *wxCollapsiblePaneXmlHandler::DoCreateResource() { bool old_ins = m_isInside; m_isInside = false; - wxObject *item = CreateResFromNode(n, m_collpane->GetPane(), NULL); + wxObject *item = CreateResFromNode(n, m_collpane->GetPane(), nullptr); m_isInside = old_ins; return item; @@ -51,7 +51,7 @@ wxObject *wxCollapsiblePaneXmlHandler::DoCreateResource() else { ReportError("no control within panewindow"); - return NULL; + return nullptr; } } else @@ -62,7 +62,7 @@ wxObject *wxCollapsiblePaneXmlHandler::DoCreateResource() if (label.empty()) { ReportParamError("label", "label cannot be empty"); - return NULL; + return nullptr; } ctrl->Create(m_parentAsWindow, diff --git a/src/xrc/xh_combo.cpp b/src/xrc/xh_combo.cpp index 8721b9fcf7..011a876c60 100644 --- a/src/xrc/xh_combo.cpp +++ b/src/xrc/xh_combo.cpp @@ -46,7 +46,7 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxComboBox) @@ -80,7 +80,7 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_comboctrl.cpp b/src/xrc/xh_comboctrl.cpp index e47b54b199..f9b5918d75 100644 --- a/src/xrc/xh_comboctrl.cpp +++ b/src/xrc/xh_comboctrl.cpp @@ -54,7 +54,7 @@ wxObject *wxComboCtrlXmlHandler::DoCreateResource() return control; } - return NULL; + return nullptr; } bool wxComboCtrlXmlHandler::CanHandle(wxXmlNode *node) diff --git a/src/xrc/xh_dataview.cpp b/src/xrc/xh_dataview.cpp index 9bdf014fc9..648d7594b6 100644 --- a/src/xrc/xh_dataview.cpp +++ b/src/xrc/xh_dataview.cpp @@ -46,7 +46,7 @@ wxObject *wxDataViewXmlHandler::DoCreateResource() { return HandleTreeCtrl(); } - return NULL; + return nullptr; } bool wxDataViewXmlHandler::CanHandle(wxXmlNode *node) diff --git a/src/xrc/xh_editlbox.cpp b/src/xrc/xh_editlbox.cpp index 62aae9b0ba..1a3c3c0f8b 100644 --- a/src/xrc/xh_editlbox.cpp +++ b/src/xrc/xh_editlbox.cpp @@ -85,7 +85,7 @@ wxObject *wxEditableListBoxXmlHandler::DoCreateResource() if ( contents ) { m_insideBox = true; - CreateChildrenPrivately(NULL, contents); + CreateChildrenPrivately(nullptr, contents); m_insideBox = false; control->SetStrings(m_items); @@ -98,12 +98,12 @@ wxObject *wxEditableListBoxXmlHandler::DoCreateResource() { m_items.push_back(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } else { ReportError("Unexpected node inside wxEditableListBox"); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_htmllbox.cpp b/src/xrc/xh_htmllbox.cpp index 10cc7aa7d1..06af726c2f 100644 --- a/src/xrc/xh_htmllbox.cpp +++ b/src/xrc/xh_htmllbox.cpp @@ -39,7 +39,7 @@ wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); m_insideBox = false; XRC_MAKE_INSTANCE(control, wxSimpleHtmlListBox) @@ -68,7 +68,7 @@ wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_infobar.cpp b/src/xrc/xh_infobar.cpp index 5c41aa2bf3..5029378166 100644 --- a/src/xrc/xh_infobar.cpp +++ b/src/xrc/xh_infobar.cpp @@ -69,11 +69,11 @@ wxObject *wxInfoBarXmlHandler::DoCreateResource() // handle buttons wxInfoBar * const infoBar = wxDynamicCast(m_parentAsWindow, wxInfoBar); - wxCHECK_MSG(infoBar, NULL, "must have wxInfoBar parent"); + wxCHECK_MSG(infoBar, nullptr, "must have wxInfoBar parent"); infoBar->AddButton(GetID(), GetText("label")); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_listb.cpp b/src/xrc/xh_listb.cpp index 62c4e8e084..06e5af83b4 100644 --- a/src/xrc/xh_listb.cpp +++ b/src/xrc/xh_listb.cpp @@ -47,7 +47,7 @@ wxObject *wxListBoxXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); m_insideBox = false; XRC_MAKE_INSTANCE(control, wxListBox) @@ -76,7 +76,7 @@ wxObject *wxListBoxXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_listbk.cpp b/src/xrc/xh_listbk.cpp index 1ee5b78f1e..6c7c412109 100644 --- a/src/xrc/xh_listbk.cpp +++ b/src/xrc/xh_listbk.cpp @@ -26,7 +26,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxListbookXmlHandler, wxXmlResourceHandler); wxListbookXmlHandler::wxListbookXmlHandler() - : m_listbook(NULL) + : m_listbook(nullptr) { XRC_ADD_STYLE(wxBK_DEFAULT); XRC_ADD_STYLE(wxBK_LEFT); diff --git a/src/xrc/xh_mdi.cpp b/src/xrc/xh_mdi.cpp index 026078d325..238934970f 100644 --- a/src/xrc/xh_mdi.cpp +++ b/src/xrc/xh_mdi.cpp @@ -74,7 +74,7 @@ wxWindow *wxMdiXmlHandler::CreateFrame() if ( !mdiParent ) { ReportError("parent of wxMDIChildFrame must be wxMDIParentFrame"); - return NULL; + return nullptr; } XRC_MAKE_INSTANCE(frame, wxMDIChildFrame) diff --git a/src/xrc/xh_menu.cpp b/src/xrc/xh_menu.cpp index 1c7e755645..33c0c02205 100644 --- a/src/xrc/xh_menu.cpp +++ b/src/xrc/xh_menu.cpp @@ -164,7 +164,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource() if (kind == wxITEM_CHECK) mitem->Check(GetBool(wxT("checked"))); } - return NULL; + return nullptr; } } @@ -191,7 +191,7 @@ wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler() wxObject *wxMenuBarXmlHandler::DoCreateResource() { - wxMenuBar *menubar = NULL; + wxMenuBar *menubar = nullptr; const int style = GetStyle(); wxASSERT_MSG(!style || !m_instance, diff --git a/src/xrc/xh_notbk.cpp b/src/xrc/xh_notbk.cpp index b9224b4faa..01e3ffdb78 100644 --- a/src/xrc/xh_notbk.cpp +++ b/src/xrc/xh_notbk.cpp @@ -26,7 +26,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler); wxNotebookXmlHandler::wxNotebookXmlHandler() - : m_notebook(NULL) + : m_notebook(nullptr) { XRC_ADD_STYLE(wxBK_DEFAULT); XRC_ADD_STYLE(wxBK_LEFT); diff --git a/src/xrc/xh_odcombo.cpp b/src/xrc/xh_odcombo.cpp index 108940f6f7..82072199b7 100644 --- a/src/xrc/xh_odcombo.cpp +++ b/src/xrc/xh_odcombo.cpp @@ -49,7 +49,7 @@ wxObject *wxOwnerDrawnComboBoxXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately(nullptr, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxOwnerDrawnComboBox) @@ -84,7 +84,7 @@ wxObject *wxOwnerDrawnComboBoxXmlHandler::DoCreateResource() // add to the list strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_propdlg.cpp b/src/xrc/xh_propdlg.cpp index dd71e88662..530ca3e837 100644 --- a/src/xrc/xh_propdlg.cpp +++ b/src/xrc/xh_propdlg.cpp @@ -28,7 +28,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialogXmlHandler, wxXmlResourceHandler); wxPropertySheetDialogXmlHandler::wxPropertySheetDialogXmlHandler() - : m_dialog(NULL) + : m_dialog(nullptr) { XRC_ADD_STYLE(wxSTAY_ON_TOP); XRC_ADD_STYLE(wxCAPTION); diff --git a/src/xrc/xh_radbx.cpp b/src/xrc/xh_radbx.cpp index c91de5127c..fc305d8e20 100644 --- a/src/xrc/xh_radbx.cpp +++ b/src/xrc/xh_radbx.cpp @@ -43,7 +43,7 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource() // need to build the list of strings from children m_insideBox = true; - CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); + CreateChildrenPrivately( nullptr, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxRadioBox) @@ -118,12 +118,12 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource() #if wxUSE_HELP const wxXmlNode* const nodeHelp = GetParamNode(wxT("helptext")); m_helptexts.push_back(GetNodeText(nodeHelp, wxXRC_TEXT_NO_ESCAPE)); - m_helptextSpecified.push_back(nodeHelp != NULL); + m_helptextSpecified.push_back(nodeHelp != nullptr); #endif // wxUSE_HELP m_isEnabled.push_back(GetBoolAttr("enabled", 1)); m_isShown.push_back(!GetBoolAttr("hidden", 0)); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_ribbon.cpp b/src/xrc/xh_ribbon.cpp index 77645b1c20..34f1aaa1e3 100644 --- a/src/xrc/xh_ribbon.cpp +++ b/src/xrc/xh_ribbon.cpp @@ -40,7 +40,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxRibbonXmlHandler, wxXmlResourceHandler); wxRibbonXmlHandler::wxRibbonXmlHandler() : wxXmlResourceHandler(), - m_isInside(NULL) + m_isInside(nullptr) { XRC_ADD_STYLE(wxRIBBON_BAR_SHOW_PAGE_LABELS); XRC_ADD_STYLE(wxRIBBON_BAR_SHOW_PAGE_ICONS); @@ -151,7 +151,7 @@ wxObject* wxRibbonXmlHandler::Handle_button() // FIXME: If re-enabling, don't forget to update the docs and RELAG NG schema! #if 0 // wxUSE_MENUS // check whether we have dropdown tag inside - wxMenu *menu = NULL; // menu for drop down items + wxMenu *menu = nullptr; // menu for drop down items wxXmlNode * const nodeDropdown = GetParamNode("dropdown"); if ( nodeDropdown ) { @@ -164,7 +164,7 @@ wxObject* wxRibbonXmlHandler::Handle_button() wxXmlNode * const nodeMenu = nodeDropdown->GetChildren(); if ( nodeMenu ) { - wxObject *res = CreateResFromNode(nodeMenu, NULL); + wxObject *res = CreateResFromNode(nodeMenu, nullptr); menu = wxDynamicCast(res, wxMenu); if ( !menu ) { @@ -202,7 +202,7 @@ wxObject* wxRibbonXmlHandler::Handle_button() if ( GetBool(wxT("disabled")) ) buttonBar->EnableButton(GetID(), false); - return NULL; // nothing to return + return nullptr; // nothing to return } wxObject* wxRibbonXmlHandler::Handle_control() @@ -269,11 +269,11 @@ wxObject* wxRibbonXmlHandler::Handle_gallery() wxObject* wxRibbonXmlHandler::Handle_galleryitem() { wxRibbonGallery *gallery = wxStaticCast(m_parent, wxRibbonGallery); - wxCHECK (gallery, NULL); + wxCHECK (gallery, nullptr); gallery->Append (GetBitmap(), GetID()); - return NULL; // nothing to return + return nullptr; // nothing to return } wxObject* wxRibbonXmlHandler::Handle_panel() diff --git a/src/xrc/xh_simplebook.cpp b/src/xrc/xh_simplebook.cpp index ad409a1798..46167b1633 100644 --- a/src/xrc/xh_simplebook.cpp +++ b/src/xrc/xh_simplebook.cpp @@ -25,7 +25,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxSimplebookXmlHandler, wxXmlResourceHandler); wxSimplebookXmlHandler::wxSimplebookXmlHandler() : wxXmlResourceHandler(), m_isInside(false), - m_simplebook(NULL) + m_simplebook(nullptr) { AddWindowStyles(); } @@ -43,7 +43,7 @@ wxObject *wxSimplebookXmlHandler::DoCreateResource() { bool old_ins = m_isInside; m_isInside = false; - wxObject *item = CreateResFromNode(n, m_simplebook, NULL); + wxObject *item = CreateResFromNode(n, m_simplebook, nullptr); m_isInside = old_ins; wxWindow *wnd = wxDynamicCast(item, wxWindow); @@ -61,7 +61,7 @@ wxObject *wxSimplebookXmlHandler::DoCreateResource() else { ReportError("simplebookpage must have a window child"); - return NULL; + return nullptr; } } diff --git a/src/xrc/xh_sizer.cpp b/src/xrc/xh_sizer.cpp index b0a644c882..c048f21f6b 100644 --- a/src/xrc/xh_sizer.cpp +++ b/src/xrc/xh_sizer.cpp @@ -43,7 +43,7 @@ wxSizerXmlHandler::wxSizerXmlHandler() :wxXmlResourceHandler(), m_isInside(false), m_isGBS(false), - m_parentSizer(NULL) + m_parentSizer(nullptr) { XRC_ADD_STYLE(wxHORIZONTAL); XRC_ADD_STYLE(wxVERTICAL); @@ -123,7 +123,7 @@ wxSizer* wxSizerXmlHandler::DoCreateSizer(const wxString& name) else if (name == wxT("wxGridSizer")) { if ( !ValidateGridSizerChildren() ) - return NULL; + return nullptr; return Handle_wxGridSizer(); } else if (name == wxT("wxFlexGridSizer")) @@ -140,7 +140,7 @@ wxSizer* wxSizerXmlHandler::DoCreateSizer(const wxString& name) } ReportError(wxString::Format("unknown sizer class \"%s\"", name)); - return NULL; + return nullptr; } @@ -174,8 +174,8 @@ wxObject* wxSizerXmlHandler::Handle_sizeritem() bool old_ins = m_isInside; wxSizer *old_par = m_parentSizer; m_isInside = false; - if (!IsSizerNode(n)) m_parentSizer = NULL; - wxObject *item = CreateResFromNode(n, m_parent, NULL); + if (!IsSizerNode(n)) m_parentSizer = nullptr; + wxObject *item = CreateResFromNode(n, m_parent, nullptr); m_isInside = old_ins; m_parentSizer = old_par; m_isGBS = old_gbs; @@ -197,10 +197,10 @@ wxObject* wxSizerXmlHandler::Handle_sizeritem() AddSizerItem(sitem); return item; } - else /*n == NULL*/ + else /*n == nullptr*/ { ReportError("no window/sizer/spacer within sizeritem object"); - return NULL; + return nullptr; } } @@ -210,14 +210,14 @@ wxObject* wxSizerXmlHandler::Handle_spacer() if ( !m_parentSizer ) { ReportError("spacer only allowed inside a sizer"); - return NULL; + return nullptr; } wxSizerItem* sitem = MakeSizerItem(); SetSizerItemAttributes(sitem); sitem->AssignSpacer(GetSize()); AddSizerItem(sitem); - return NULL; + return nullptr; } @@ -230,7 +230,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer() !m_parentAsWindow) ) { ReportError("sizer must have a window parent"); - return NULL; + return nullptr; } // Create the sizer of the appropriate class. @@ -238,7 +238,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer() // creation of sizer failed for some (already reported) reason, so exit: if ( !sizer ) - return NULL; + return nullptr; wxSize minsize = GetSize(wxT("minsize")); if (!(minsize == wxDefaultSize)) @@ -287,7 +287,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer() m_isInside = old_ins; m_parentSizer = old_par; - if (m_parentSizer == NULL) // setup window: + if (m_parentSizer == nullptr) // setup window: { m_parentAsWindow->SetSizer(sizer); @@ -295,7 +295,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer() m_node = parentNode; if (GetSize() == wxDefaultSize) { - if ( wxDynamicCast(m_parentAsWindow, wxScrolledWindow) != NULL ) + if ( wxDynamicCast(m_parentAsWindow, wxScrolledWindow) != nullptr ) { sizer->FitInside(m_parentAsWindow); } @@ -327,13 +327,13 @@ wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer() wxXmlNode* nodeWindowLabel = GetParamNode(wxS("windowlabel")); wxString const& labelText = GetText(wxS("label")); - wxStaticBox* box = NULL; + wxStaticBox* box = nullptr; if ( nodeWindowLabel ) { if ( !labelText.empty() ) { ReportError("Either label or windowlabel can be used, but not both"); - return NULL; + return nullptr; } #ifdef wxHAS_WINDOW_LABEL_IN_STATIC_BOX @@ -341,22 +341,22 @@ wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer() if ( !n ) { ReportError("windowlabel must have a window child"); - return NULL; + return nullptr; } if ( n->GetNext() ) { ReportError("windowlabel can only have a single child"); - return NULL; + return nullptr; } wxSizer* const old_par = m_parentSizer; const bool old_ins = m_isInside; - m_parentSizer = NULL; + m_parentSizer = nullptr; m_isInside = false; - wxObject* const item = CreateResFromNode(n, m_parent, NULL); + wxObject* const item = CreateResFromNode(n, m_parent, nullptr); wxWindow* const wndLabel = wxDynamicCast(item, wxWindow); m_parentSizer = old_par; @@ -365,7 +365,7 @@ wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer() if ( !wndLabel ) { ReportError(n, "windowlabel child must be a window"); - return NULL; + return nullptr; } box = new wxStaticBox(m_parentAsWindow, @@ -377,7 +377,7 @@ wxSizer* wxSizerXmlHandler::Handle_wxStaticBoxSizer() #else // !wxHAS_WINDOW_LABEL_IN_STATIC_BOX ReportError("Support for using windows as wxStaticBox labels is " "missing in this build of wxWidgets."); - return NULL; + return nullptr; #endif // wxHAS_WINDOW_LABEL_IN_STATIC_BOX/!wxHAS_WINDOW_LABEL_IN_STATIC_BOX } else // Using plain text label. @@ -404,7 +404,7 @@ wxSizer* wxSizerXmlHandler::Handle_wxGridSizer() wxFlexGridSizer* wxSizerXmlHandler::Handle_wxFlexGridSizer() { if ( !ValidateGridSizerChildren() ) - return NULL; + return nullptr; return new wxFlexGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")), GetDimension(wxT("vgap")), GetDimension(wxT("hgap"))); } @@ -413,7 +413,7 @@ wxFlexGridSizer* wxSizerXmlHandler::Handle_wxFlexGridSizer() wxGridBagSizer* wxSizerXmlHandler::Handle_wxGridBagSizer() { if ( !ValidateGridSizerChildren() ) - return NULL; + return nullptr; return new wxGridBagSizer(GetDimension(wxT("vgap")), GetDimension(wxT("hgap"))); } @@ -952,7 +952,7 @@ void wxSizerXmlHandler::AddSizerItem(wxSizerItem* sitem) wxIMPLEMENT_DYNAMIC_CLASS(wxStdDialogButtonSizerXmlHandler, wxXmlResourceHandler); wxStdDialogButtonSizerXmlHandler::wxStdDialogButtonSizerXmlHandler() - : m_isInside(false), m_parentSizer(NULL) + : m_isInside(false), m_parentSizer(nullptr) { } @@ -970,7 +970,7 @@ wxObject *wxStdDialogButtonSizerXmlHandler::DoCreateResource() m_parentSizer->Realize(); m_isInside = false; - m_parentSizer = NULL; + m_parentSizer = nullptr; return s; } @@ -986,7 +986,7 @@ wxObject *wxStdDialogButtonSizerXmlHandler::DoCreateResource() // did we find one? if (n) { - wxObject *item = CreateResFromNode(n, m_parent, NULL); + wxObject *item = CreateResFromNode(n, m_parent, nullptr); wxButton *button = wxDynamicCast(item, wxButton); if (button) @@ -996,10 +996,10 @@ wxObject *wxStdDialogButtonSizerXmlHandler::DoCreateResource() return item; } - else /*n == NULL*/ + else /*n == nullptr*/ { ReportError("no button within wxStdDialogButtonSizer"); - return NULL; + return nullptr; } } } diff --git a/src/xrc/xh_split.cpp b/src/xrc/xh_split.cpp index 4303142e92..5c877834af 100644 --- a/src/xrc/xh_split.cpp +++ b/src/xrc/xh_split.cpp @@ -58,7 +58,7 @@ wxObject *wxSplitterWindowXmlHandler::DoCreateResource() if (gravity != 0) splitter->SetSashGravity(double(gravity)); - wxWindow *win1 = NULL, *win2 = NULL; + wxWindow *win1 = nullptr, *win2 = nullptr; wxXmlNode *n = m_node->GetChildren(); while (n) { @@ -66,9 +66,9 @@ wxObject *wxSplitterWindowXmlHandler::DoCreateResource() (n->GetName() == wxT("object") || n->GetName() == wxT("object_ref"))) { - wxObject *created = CreateResFromNode(n, splitter, NULL); + wxObject *created = CreateResFromNode(n, splitter, nullptr); wxWindow *win = wxDynamicCast(created, wxWindow); - if (win1 == NULL) + if (win1 == nullptr) { win1 = win; } @@ -81,7 +81,7 @@ wxObject *wxSplitterWindowXmlHandler::DoCreateResource() n = n->GetNext(); } - if (win1 == NULL) + if (win1 == nullptr) ReportError("wxSplitterWindow node must contain at least one window"); bool horizontal = (GetParamValue(wxT("orientation")) != wxT("vertical")); diff --git a/src/xrc/xh_toolb.cpp b/src/xrc/xh_toolb.cpp index e1647be84f..cd5c523adc 100644 --- a/src/xrc/xh_toolb.cpp +++ b/src/xrc/xh_toolb.cpp @@ -27,7 +27,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler); wxToolBarXmlHandler::wxToolBarXmlHandler() -: wxXmlResourceHandler(), m_isInside(false), m_toolbar(NULL) +: wxXmlResourceHandler(), m_isInside(false), m_toolbar(nullptr) { XRC_ADD_STYLE(wxTB_FLAT); XRC_ADD_STYLE(wxTB_DOCKABLE); @@ -55,7 +55,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if ( !m_toolbar ) { ReportError("tool only allowed inside a wxToolBar"); - return NULL; + return nullptr; } wxItemKind kind = wxITEM_NORMAL; @@ -78,7 +78,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() #if wxUSE_MENUS // check whether we have dropdown tag inside - wxMenu *menu = NULL; // menu for drop down items + wxMenu *menu = nullptr; // menu for drop down items wxXmlNode * const nodeDropdown = GetParamNode("dropdown"); if ( nodeDropdown ) { @@ -99,7 +99,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() wxXmlNode * const nodeMenu = nodeDropdown->GetChildren(); if ( nodeMenu ) { - wxObject *res = CreateResFromNode(nodeMenu, NULL); + wxObject *res = CreateResFromNode(nodeMenu, nullptr); menu = wxDynamicCast(res, wxMenu); if ( !menu ) { @@ -157,7 +157,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() tool->SetDropdownMenu(menu); #endif - return m_toolbar; // must return non-NULL + return m_toolbar; // must return non-null } else if (m_class == wxT("separator") || m_class == wxT("space")) @@ -165,7 +165,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if ( !m_toolbar ) { ReportError("separators only allowed inside wxToolBar"); - return NULL; + return nullptr; } if ( m_class == wxT("separator") ) @@ -173,7 +173,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() else m_toolbar->AddStretchableSpace(); - return m_toolbar; // must return non-NULL + return m_toolbar; // must return non-null } else /**/ @@ -214,7 +214,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if (!children_node) children_node = GetParamNode(wxT("object_ref")); - if (children_node == NULL) return toolbar; + if (children_node == nullptr) return toolbar; m_isInside = true; m_toolbar = toolbar; @@ -226,19 +226,19 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if ((n->GetType() == wxXML_ELEMENT_NODE) && (n->GetName() == wxT("object") || n->GetName() == wxT("object_ref"))) { - wxObject *created = CreateResFromNode(n, toolbar, NULL); + wxObject *created = CreateResFromNode(n, toolbar, nullptr); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxT("tool")) && !IsOfClass(n, wxT("separator")) && !IsOfClass(n, wxT("space")) && - control != NULL) + control != nullptr) toolbar->AddControl(control); } n = n->GetNext(); } m_isInside = false; - m_toolbar = NULL; + m_toolbar = nullptr; if (m_parentAsWindow && !GetBool(wxT("dontattachtoframe"))) { diff --git a/src/xrc/xh_toolbk.cpp b/src/xrc/xh_toolbk.cpp index 381c102cac..f67c01a79a 100644 --- a/src/xrc/xh_toolbk.cpp +++ b/src/xrc/xh_toolbk.cpp @@ -28,7 +28,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxToolbookXmlHandler, wxXmlResourceHandler); wxToolbookXmlHandler::wxToolbookXmlHandler() - : m_toolbook(NULL) + : m_toolbook(nullptr) { XRC_ADD_STYLE(wxBK_DEFAULT); XRC_ADD_STYLE(wxBK_TOP); diff --git a/src/xrc/xh_treebk.cpp b/src/xrc/xh_treebk.cpp index a1a2959357..8752a6ee82 100644 --- a/src/xrc/xh_treebk.cpp +++ b/src/xrc/xh_treebk.cpp @@ -27,7 +27,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxTreebookXmlHandler, wxXmlResourceHandler); wxTreebookXmlHandler::wxTreebookXmlHandler() - : m_tbk(NULL) + : m_tbk(nullptr) { XRC_ADD_STYLE(wxBK_DEFAULT); XRC_ADD_STYLE(wxBK_TOP); @@ -125,14 +125,14 @@ wxObject *wxTreebookXmlHandler::DoCreateResource() if ( depth > m_treeContext.GetCount() ) { ReportParamError("depth", "invalid depth"); - return NULL; + return nullptr; } wxObject* const page = DoCreatePage(m_tbk); if ( !page ) { // Error was already reported by DoCreatePage(). - return NULL; + return nullptr; } // Determine the index of the parent page to use. diff --git a/src/xrc/xh_unkwn.cpp b/src/xrc/xh_unkwn.cpp index 4919ef38f3..2c7e9994d8 100644 --- a/src/xrc/xh_unkwn.cpp +++ b/src/xrc/xh_unkwn.cpp @@ -36,7 +36,7 @@ public: : wxPanel(parent, id, pos, size, style | wxTAB_TRAVERSAL | wxNO_BORDER, controlName + wxT("_container")), m_controlName(controlName), - m_control(NULL) + m_control(nullptr) { m_bg = UseBgCol() ? GetBackgroundColour() : wxColour(); } @@ -113,7 +113,7 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child) void wxUnknownControlContainer::RemoveChild(wxWindowBase *child) { wxPanel::RemoveChild(child); - m_control = NULL; + m_control = nullptr; InvalidateBestSize(); } @@ -129,7 +129,7 @@ wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler() wxObject *wxUnknownWidgetXmlHandler::DoCreateResource() { - wxASSERT_MSG( m_instance == NULL, + wxASSERT_MSG( m_instance == nullptr, wxT("'unknown' controls can't be subclassed, use wxXmlResource::AttachUnknownControl") ); wxPanel *panel = diff --git a/src/xrc/xh_wizrd.cpp b/src/xrc/xh_wizrd.cpp index a3044dad0f..86d9a64f77 100644 --- a/src/xrc/xh_wizrd.cpp +++ b/src/xrc/xh_wizrd.cpp @@ -25,8 +25,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWizardXmlHandler, wxXmlResourceHandler); wxWizardXmlHandler::wxWizardXmlHandler() : wxXmlResourceHandler() { - m_wizard = NULL; - m_lastSimplePage = NULL; + m_wizard = nullptr; + m_lastSimplePage = nullptr; XRC_ADD_STYLE(wxSTAY_ON_TOP); XRC_ADD_STYLE(wxCAPTION); @@ -97,7 +97,7 @@ wxObject *wxWizardXmlHandler::DoCreateResource() wxWizard *old = m_wizard; m_wizard = wiz; - m_lastSimplePage = NULL; + m_lastSimplePage = nullptr; CreateChildren(wiz, true /*this handler only*/); m_wizard = old; return wiz; @@ -109,7 +109,7 @@ wxObject *wxWizardXmlHandler::DoCreateResource() if (m_class == wxT("wxWizardPageSimple")) { XRC_MAKE_INSTANCE(p, wxWizardPageSimple) - p->Create(m_wizard, NULL, NULL, GetBitmapBundle()); + p->Create(m_wizard, nullptr, nullptr, GetBitmapBundle()); if (m_lastSimplePage) wxWizardPageSimple::Chain(m_lastSimplePage, p); page = p; @@ -120,7 +120,7 @@ wxObject *wxWizardXmlHandler::DoCreateResource() if ( !m_instance ) { ReportError("wxWizardPage is abstract class and must be subclassed"); - return NULL; + return nullptr; } page = wxStaticCast(m_instance, wxWizardPage); @@ -139,7 +139,7 @@ wxObject *wxWizardXmlHandler::DoCreateResource() bool wxWizardXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxWizard")) || - (m_wizard != NULL && + (m_wizard != nullptr && (IsOfClass(node, wxT("wxWizardPage")) || IsOfClass(node, wxT("wxWizardPageSimple"))) ); diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 71139a2ddf..f62357f500 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -168,7 +168,7 @@ public: static wxIdRangeManager *Get(); // Sets the global resources object and returns a pointer to the previous - // one (may be NULL). + // one (may be null). static wxIdRangeManager *Set(wxIdRangeManager *res); // Create a new IDrange from this node @@ -196,7 +196,7 @@ namespace // helper used by DoFindResource() and elsewhere: returns true if this is an // object or object_ref node // -// node must be non-NULL +// node must be non-null inline bool IsObjectNode(wxXmlNode *node) { return node->GetType() == wxXML_ELEMENT_NODE && @@ -249,7 +249,7 @@ GetFileNameFromNode(const wxXmlNode *node, const wxXmlResourceDataRecords& files } // anonymous namespace -wxXmlResource *wxXmlResource::ms_instance = NULL; +wxXmlResource *wxXmlResource::ms_instance = nullptr; /*static*/ wxXmlResource *wxXmlResource::Get() { @@ -493,14 +493,14 @@ void wxXmlResource::ClearHandlers() wxMenu *wxXmlResource::LoadMenu(const wxString& name) { - return (wxMenu*)CreateResFromNode(FindResource(name, wxT("wxMenu")), NULL, NULL); + return (wxMenu*)CreateResFromNode(FindResource(name, wxT("wxMenu")), nullptr, nullptr); } wxMenuBar *wxXmlResource::LoadMenuBar(wxWindow *parent, const wxString& name) { - return (wxMenuBar*)CreateResFromNode(FindResource(name, wxT("wxMenuBar")), parent, NULL); + return (wxMenuBar*)CreateResFromNode(FindResource(name, wxT("wxMenuBar")), parent, nullptr); } @@ -508,47 +508,47 @@ wxMenuBar *wxXmlResource::LoadMenuBar(wxWindow *parent, const wxString& name) #if wxUSE_TOOLBAR wxToolBar *wxXmlResource::LoadToolBar(wxWindow *parent, const wxString& name) { - return (wxToolBar*)CreateResFromNode(FindResource(name, wxT("wxToolBar")), parent, NULL); + return (wxToolBar*)CreateResFromNode(FindResource(name, wxT("wxToolBar")), parent, nullptr); } #endif wxDialog *wxXmlResource::LoadDialog(wxWindow *parent, const wxString& name) { - return (wxDialog*)CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, NULL); + return (wxDialog*)CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, nullptr); } bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name) { - return CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, dlg) != NULL; + return CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, dlg) != nullptr; } wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name) { - return (wxPanel*)CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, NULL); + return (wxPanel*)CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, nullptr); } bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name) { - return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL; + return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != nullptr; } wxFrame *wxXmlResource::LoadFrame(wxWindow* parent, const wxString& name) { - return (wxFrame*)CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, NULL); + return (wxFrame*)CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, nullptr); } bool wxXmlResource::LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name) { - return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != NULL; + return CreateResFromNode(FindResource(name, wxT("wxFrame")), parent, frame) != nullptr; } wxBitmap wxXmlResource::LoadBitmap(const wxString& name) { wxBitmap *bmp = (wxBitmap*)CreateResFromNode( - FindResource(name, wxT("wxBitmap")), NULL, NULL); + FindResource(name, wxT("wxBitmap")), nullptr, nullptr); wxBitmap rt; if (bmp) { rt = *bmp; delete bmp; } @@ -558,7 +558,7 @@ wxBitmap wxXmlResource::LoadBitmap(const wxString& name) wxIcon wxXmlResource::LoadIcon(const wxString& name) { wxIcon *icon = (wxIcon*)CreateResFromNode( - FindResource(name, wxT("wxIcon")), NULL, NULL); + FindResource(name, wxT("wxIcon")), nullptr, nullptr); wxIcon rt; if (icon) { rt = *icon; delete icon; } @@ -574,7 +574,7 @@ wxXmlResource::DoLoadObject(wxWindow *parent, { wxXmlNode * const node = FindResource(name, classname, recursive); - return node ? DoCreateResFromNode(*node, parent, NULL) : NULL; + return node ? DoCreateResFromNode(*node, parent, nullptr) : nullptr; } bool @@ -586,14 +586,14 @@ wxXmlResource::DoLoadObject(wxObject *instance, { wxXmlNode * const node = FindResource(name, classname, recursive); - return node && DoCreateResFromNode(*node, parent, instance) != NULL; + return node && DoCreateResFromNode(*node, parent, instance) != nullptr; } bool wxXmlResource::AttachUnknownControl(const wxString& name, wxWindow *control, wxWindow *parent) { - if (parent == NULL) + if (parent == nullptr) parent = control->GetParent(); wxWindow *container = parent->FindWindow(name + wxT("_container")); if (!container) @@ -735,7 +735,7 @@ wxXmlDocument *wxXmlResource::DoLoadFile(const wxString& filename) { wxLogTrace(wxT("xrc"), wxT("opening file '%s'"), filename); - wxInputStream *stream = NULL; + wxInputStream *stream = nullptr; #if wxUSE_FILESYSTEM wxFileSystem fsys; @@ -754,7 +754,7 @@ wxXmlDocument *wxXmlResource::DoLoadFile(const wxString& filename) if ( !stream || !stream->IsOk() ) { wxLogError(_("Cannot open resources file '%s'."), filename); - return NULL; + return nullptr; } wxString encoding(wxT("UTF-8")); @@ -772,11 +772,11 @@ wxXmlDocument *wxXmlResource::DoLoadFile(const wxString& filename) if (!doc->Load(*stream, encoding)) { wxLogError(_("Cannot load resources from file '%s'."), filename); - return NULL; + return nullptr; } if (!DoLoadDocument(*doc)) - return NULL; + return nullptr; return doc.release(); } @@ -892,7 +892,7 @@ wxXmlNode *wxXmlResource::DoFindResource(wxXmlNode *parent, } } - return NULL; + return nullptr; } wxXmlNode *wxXmlResource::FindResource(const wxString& name, @@ -907,7 +907,7 @@ wxXmlNode *wxXmlResource::FindResource(const wxString& name, { ReportError ( - NULL, + nullptr, wxString::Format ( "XRC resource \"%s\" (class \"%s\") not found", @@ -957,7 +957,7 @@ wxXmlResource::GetResourceNodeAndLocation(const wxString& name, } } - return NULL; + return nullptr; } static void MergeNodesOver(wxXmlNode& dest, wxXmlNode& overwriteWith, @@ -1045,11 +1045,11 @@ wxXmlResource::DoCreateResFromNode(wxXmlNode& node, refName ) ); - return NULL; + return nullptr; } - const bool hasOnlyRefAttr = node.GetAttributes() != NULL && - node.GetAttributes()->GetNext() == NULL; + const bool hasOnlyRefAttr = node.GetAttributes() != nullptr && + node.GetAttributes()->GetNext() == nullptr; if ( hasOnlyRefAttr && !node.GetChildren() ) { @@ -1106,7 +1106,7 @@ wxXmlResource::DoCreateResFromNode(wxXmlNode& node, node.GetAttribute("class", wxEmptyString) ) ); - return NULL; + return nullptr; } wxIdRange::wxIdRange(const wxXmlNode* node, @@ -1301,7 +1301,7 @@ void wxIdRange::Finalise(const wxXmlNode* node) m_finalised = true; } -wxIdRangeManager *wxIdRangeManager::ms_instance = NULL; +wxIdRangeManager *wxIdRangeManager::ms_instance = nullptr; /*static*/ wxIdRangeManager *wxIdRangeManager::Get() { @@ -1371,7 +1371,7 @@ wxIdRangeManager::FindRangeForItem(const wxXmlNode* node, wxString& value) const { wxString basename = item.BeforeFirst('['); - wxCHECK_MSG( !basename.empty(), NULL, + wxCHECK_MSG( !basename.empty(), nullptr, "an id-range item without a range name" ); int index = Find(basename); @@ -1379,7 +1379,7 @@ wxIdRangeManager::FindRangeForItem(const wxXmlNode* node, { // Don't assert just because we've found an unexpected foo[123] // Someone might just want such a name, nothing to do with ranges - return NULL; + return nullptr; } value = item.Mid(basename.Len()); @@ -1388,7 +1388,7 @@ wxIdRangeManager::FindRangeForItem(const wxXmlNode* node, return m_IdRanges.at(index); } wxXmlResource::Get()->ReportError(node, "a malformed id-range item"); - return NULL; + return nullptr; } void @@ -1433,7 +1433,7 @@ class wxXmlSubclassFactories : public wxVector // this is a class so that it can be forward-declared }; -wxXmlSubclassFactories *wxXmlResource::ms_subclassFactories = NULL; +wxXmlSubclassFactories *wxXmlResource::ms_subclassFactories = nullptr; /*static*/ void wxXmlResource::AddSubclassFactory(wxXmlSubclassFactory *factory) { @@ -1456,7 +1456,7 @@ public: if (classInfo) return classInfo->CreateObject(); else - return NULL; + return nullptr; } }; @@ -1537,7 +1537,7 @@ wxObject *wxXmlResourceHandlerImpl::CreateResource(wxXmlNode *node, wxObject *pa bool wxXmlResourceHandlerImpl::HasParam(const wxString& param) { - return (GetParamNode(param) != NULL); + return (GetParamNode(param) != nullptr); } @@ -1861,7 +1861,7 @@ wxBitmap LoadBitmapFromFS(wxXmlResourceHandlerImpl* impl, if (path.empty()) return wxNullBitmap; #if wxUSE_FILESYSTEM wxFSFile *fsfile = impl->GetCurFileSystem().OpenFile(path, wxFS_READ | wxFS_SEEKABLE); - if (fsfile == NULL) + if (fsfile == nullptr) { impl->ReportParamError ( @@ -1896,7 +1896,7 @@ ParseStringInPixels(wxXmlResourceHandlerImpl* impl, const wxString& param, const wxString& str, const T& defaultValue, - wxWindow *windowToUse = NULL); + wxWindow *windowToUse = nullptr); } // anonymous namespace @@ -1925,7 +1925,7 @@ wxBitmap wxXmlResourceHandlerImpl::GetBitmap(const wxXmlNode* node, const wxArtClient& defaultArtClient, wxSize size) { - wxCHECK_MSG( node, wxNullBitmap, "bitmap node can't be NULL" ); + wxCHECK_MSG( node, wxNullBitmap, "bitmap node can't be null" ); /* If the bitmap is specified as stock item, query wxArtProvider for it: */ wxString art_id, art_client; @@ -2009,7 +2009,7 @@ wxXmlResourceHandlerImpl::GetBitmapBundle(const wxXmlNode* node, wxDefaultSize); #if wxUSE_FILESYSTEM wxFSFile* fsfile = GetCurFileSystem().OpenFile(paramValue, wxFS_READ | wxFS_SEEKABLE); - if (fsfile == NULL) + if (fsfile == nullptr) { ReportParamError ( @@ -2120,7 +2120,7 @@ wxIconBundle wxXmlResourceHandlerImpl::GetIconBundle(const wxString& param, #if wxUSE_FILESYSTEM wxFSFile *fsfile = GetCurFileSystem().OpenFile(name, wxFS_READ | wxFS_SEEKABLE); - if ( fsfile == NULL ) + if ( fsfile == nullptr ) { ReportParamError ( @@ -2154,7 +2154,7 @@ wxImageList *wxXmlResourceHandlerImpl::GetImageList(const wxString& param) { wxXmlNode * const imagelist_node = GetParamNode(param); if ( !imagelist_node ) - return NULL; + return nullptr; wxXmlNode * const oldnode = m_handler->m_node; m_handler->m_node = imagelist_node; @@ -2165,7 +2165,7 @@ wxImageList *wxXmlResourceHandlerImpl::GetImageList(const wxString& param) // Start adding images, we'll create the image list when adding the first // one. - wxImageList * imagelist = NULL; + wxImageList * imagelist = nullptr; wxString parambitmap = wxT("bitmap"); if ( HasParam(parambitmap) ) { @@ -2210,7 +2210,7 @@ wxString wxXmlResourceHandlerImpl::GetFilePath(const wxXmlNode* node) wxXmlNode *wxXmlResourceHandlerImpl::GetParamNode(const wxString& param) { - wxCHECK_MSG(m_handler->m_node, NULL, wxT("You can't access handler data before it was initialized!")); + wxCHECK_MSG(m_handler->m_node, nullptr, wxT("You can't access handler data before it was initialized!")); wxXmlNode *n = m_handler->m_node->GetChildren(); @@ -2228,7 +2228,7 @@ wxXmlNode *wxXmlResourceHandlerImpl::GetParamNode(const wxString& param) } n = n->GetNext(); } - return NULL; + return nullptr; } bool wxXmlResourceHandlerImpl::IsOfClass(wxXmlNode *node, const wxString& classname) const @@ -2248,7 +2248,7 @@ bool wxXmlResourceHandlerImpl::IsObjectNode(const wxXmlNode *node) const wxString wxXmlResourceHandlerImpl::GetNodeContent(const wxXmlNode *node) { const wxXmlNode *n = node; - if (n == NULL) return wxEmptyString; + if (n == nullptr) return wxEmptyString; n = n->GetChildren(); while (n) @@ -2263,17 +2263,17 @@ wxString wxXmlResourceHandlerImpl::GetNodeContent(const wxXmlNode *node) wxXmlNode *wxXmlResourceHandlerImpl::GetNodeParent(const wxXmlNode *node) const { - return node ? node->GetParent() : NULL; + return node ? node->GetParent() : nullptr; } wxXmlNode *wxXmlResourceHandlerImpl::GetNodeNext(const wxXmlNode *node) const { - return node ? node->GetNext() : NULL; + return node ? node->GetNext() : nullptr; } wxXmlNode *wxXmlResourceHandlerImpl::GetNodeChildren(const wxXmlNode *node) const { - return node ? node->GetChildren() : NULL; + return node ? node->GetChildren() : nullptr; } @@ -2390,7 +2390,7 @@ T ParseValueInPixels(wxXmlResourceHandlerImpl* impl, const wxString& param, const T& defaultValue, - wxWindow *windowToUse = NULL) + wxWindow *windowToUse = nullptr) { return ParseStringInPixels(impl, param, impl->GetParamValue(param), defaultValue, windowToUse); } @@ -2499,7 +2499,7 @@ static wxFont GetSystemFont(const wxString& name) wxFont wxXmlResourceHandlerImpl::GetFont(const wxString& param, wxWindow* parent) { wxXmlNode *font_node = GetParamNode(param); - if (font_node == NULL) + if (font_node == nullptr) { ReportError( wxString::Format("cannot find font node \"%s\"", param)); @@ -2809,8 +2809,8 @@ void wxXmlResourceHandlerImpl::CreateChildren(wxObject *parent, bool this_hnd_on { if ( IsObjectNode(n) ) { - m_handler->m_resource->DoCreateResFromNode(*n, parent, NULL, - this_hnd_only ? this->GetHandler() : NULL); + m_handler->m_resource->DoCreateResFromNode(*n, parent, nullptr, + this_hnd_only ? this->GetHandler() : nullptr); } } } @@ -2819,14 +2819,14 @@ void wxXmlResourceHandlerImpl::CreateChildren(wxObject *parent, bool this_hnd_on void wxXmlResourceHandlerImpl::CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode) { wxXmlNode *root; - if (rootnode == NULL) root = m_handler->m_node; else root = rootnode; + if (rootnode == nullptr) root = m_handler->m_node; else root = rootnode; wxXmlNode *n = root->GetChildren(); while (n) { if (n->GetType() == wxXML_ELEMENT_NODE && GetHandler()->CanHandle(n)) { - CreateResource(n, parent, NULL); + CreateResource(n, parent, nullptr); } n = n->GetNext(); } @@ -2858,7 +2858,7 @@ void wxXmlResource::ReportError(const wxXmlNode *context, const wxString& messag { if ( !context ) { - DoReportError(wxString(), NULL, message); + DoReportError(wxString(), nullptr, message); return; } @@ -2904,7 +2904,7 @@ struct XRCID_record XRCID_record *next; }; -static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL}; +static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {nullptr}; // Extremely simplistic hash function which probably ought to be replaced with // wxStringHash::stringHash(). @@ -2924,7 +2924,7 @@ static void XRCID_Assign(const wxString& str_id, int value) const unsigned index = XRCIdHash(buf_id); - XRCID_record *oldrec = NULL; + XRCID_record *oldrec = nullptr; for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next) { if (wxStrcmp(rec->key, buf_id) == 0) @@ -2935,12 +2935,12 @@ static void XRCID_Assign(const wxString& str_id, int value) oldrec = rec; } - XRCID_record **rec_var = (oldrec == NULL) ? + XRCID_record **rec_var = (oldrec == nullptr) ? &XRCID_Records[index] : &oldrec->next; *rec_var = new XRCID_record; (*rec_var)->key = wxStrdup(str_id); (*rec_var)->id = value; - (*rec_var)->next = NULL; + (*rec_var)->next = nullptr; } static int XRCID_Lookup(const char *str_id, int value_if_not_found = wxID_NONE) @@ -2948,7 +2948,7 @@ static int XRCID_Lookup(const char *str_id, int value_if_not_found = wxID_NONE) const unsigned index = XRCIdHash(str_id); - XRCID_record *oldrec = NULL; + XRCID_record *oldrec = nullptr; for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next) { if (wxStrcmp(rec->key, str_id) == 0) @@ -2958,11 +2958,11 @@ static int XRCID_Lookup(const char *str_id, int value_if_not_found = wxID_NONE) oldrec = rec; } - XRCID_record **rec_var = (oldrec == NULL) ? + XRCID_record **rec_var = (oldrec == nullptr) ? &XRCID_Records[index] : &oldrec->next; *rec_var = new XRCID_record; (*rec_var)->key = wxStrdup(str_id); - (*rec_var)->next = NULL; + (*rec_var)->next = nullptr; char *end; if (value_if_not_found != wxID_NONE) @@ -3184,7 +3184,7 @@ static void CleanXRCID_Records() for (int i = 0; i < XRCID_TABLE_SIZE; i++) { CleanXRCID_Record(XRCID_Records[i]); - XRCID_Records[i] = NULL; + XRCID_Records[i] = nullptr; } gs_stdIDsAdded = false; @@ -3218,8 +3218,8 @@ public: } void OnExit() override { - delete wxXmlResource::Set(NULL); - delete wxIdRangeManager::Set(NULL); + delete wxXmlResource::Set(nullptr); + delete wxIdRangeManager::Set(nullptr); if(wxXmlResource::ms_subclassFactories) { for ( wxXmlSubclassFactories::iterator i = wxXmlResource::ms_subclassFactories->begin(); diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index 7169e7e468..3a8a318b0b 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -56,7 +56,7 @@ TestOutputStream::TestOutputStream(int options) void TestOutputStream::Init() { - m_data = NULL; + m_data = nullptr; m_size = 0; m_capacity = 0; m_pos = 0; @@ -174,7 +174,7 @@ void TestInputStream::Rewind() if (m_wbacksize) { free(m_wback); - m_wback = NULL; + m_wback = nullptr; m_wbacksize = 0; m_wbackcur = 0; } @@ -248,7 +248,7 @@ size_t TestInputStream::OnSysRead(void *buffer, size_t size) template class Ptr { public: - explicit Ptr(T* p = NULL) : m_p(p), m_count(new int) { *m_count = 1; } + explicit Ptr(T* p = nullptr) : m_p(p), m_count(new int) { *m_count = 1; } Ptr(const Ptr& sp) : m_p(sp.m_p), m_count(sp.m_count) { ++*m_count; } ~Ptr() { Free(); } @@ -367,7 +367,7 @@ void TempDir::RemoveDir(wxString& path) # define WXARC_pclose _pclose #else # define WXARC_NO_POPEN -# define WXARC_popen(cmd, type) NULL +# define WXARC_popen(cmd, type) nullptr # define WXARC_pclose(fp) #endif @@ -417,7 +417,7 @@ ArchiveTestCase::ArchiveTestCase( m_archiver(archiver), m_unarchiver(unarchiver) { - wxASSERT(m_factory.get() != NULL); + wxASSERT(m_factory.get() != nullptr); } template @@ -515,7 +515,7 @@ TestEntry& ArchiveTestCase::Add(const char *name, if (len == -1) len = strlen(data); TestEntry*& entry = m_testEntries[wxString(name, *wxConvCurrent)]; - wxASSERT(entry == NULL); + wxASSERT(entry == nullptr); entry = new TestEntry(m_timeStamp, len, data); m_timeStamp += wxTimeSpan(0, 1, 30); return *entry; @@ -641,7 +641,7 @@ void ArchiveTestCase::CreateArchive(wxOutputStream& out, entry.SetDateTime(wxDateTime()); else #endif - fn.SetTimes(NULL, &dt, NULL); + fn.SetTimes(nullptr, &dt, nullptr); } if ((m_options & PipeOut) == 0) { @@ -693,7 +693,7 @@ void ArchiveTestCase::ModifyArchive(wxInputStream& in, arcOut->CopyArchiveMetaData(*arcIn); - while ((pEntry = arcIn->GetNextEntry()) != NULL) { + while ((pEntry = arcIn->GetNextEntry()) != nullptr) { wxScopedPtr entry(pEntry); OnSetNotifier(*entry); wxString name = entry->GetName(wxPATH_UNIX); @@ -770,7 +770,7 @@ void ArchiveTestCase::ExtractArchive(wxInputStream& in) if ((m_options & PipeIn) == 0) OnArchiveExtracted(*arc, expectedTotal); - while (entry = EntryPtr(arc->GetNextEntry()), entry.get() != NULL) { + while (entry = EntryPtr(arc->GetNextEntry()), entry.get() != nullptr) { wxString name = entry->GetName(wxPATH_UNIX); // provide some context for the error message so that we know which @@ -1199,7 +1199,7 @@ void CorruptionTestCase::ExtractArchive(wxInputStream& in) wxScopedPtr arc(m_factory->NewStream(in)); wxScopedPtr entry(arc->GetNextEntry()); - while (entry.get() != NULL) { + while (entry.get() != nullptr) { char buf[1024]; while (arc->IsOk()) @@ -1311,7 +1311,7 @@ CppUnit::Test *ArchiveTestSuite::makeTest( const wxString& WXUNUSED(archiver), const wxString& WXUNUSED(unarchiver)) { - return NULL; + return nullptr; } // make a display string for the option bits diff --git a/tests/archive/archivetest.h b/tests/archive/archivetest.h index 3f2a0dd001..a97169e830 100644 --- a/tests/archive/archivetest.h +++ b/tests/archive/archivetest.h @@ -74,7 +74,7 @@ public: // ctor takes the data from the output stream, which is then empty TestInputStream(TestOutputStream& out, int eoftype) - : m_data(NULL), m_eoftype(eoftype) { SetData(out); } + : m_data(nullptr), m_eoftype(eoftype) { SetData(out); } // this ctor 'dups' TestInputStream(const TestInputStream& in); ~TestInputStream() { delete [] m_data; } @@ -212,11 +212,11 @@ protected: virtual void OnCreateEntry( OutputStreamT& WXUNUSED(arc), TestEntry& WXUNUSED(testEntry), - EntryT *entry = NULL) { (void)entry; } + EntryT *entry = nullptr) { (void)entry; } virtual void OnEntryExtracted( EntryT& WXUNUSED(entry), const TestEntry& WXUNUSED(testEntry), - InputStreamT *arc = NULL) { (void)arc; } + InputStreamT *arc = nullptr) { (void)arc; } typedef std::map TestEntries; TestEntries m_testEntries; // test data diff --git a/tests/archive/tartest.cpp b/tests/archive/tartest.cpp index 5aa00489b8..3eb7971222 100644 --- a/tests/archive/tartest.cpp +++ b/tests/archive/tartest.cpp @@ -52,7 +52,7 @@ CppUnit::Test *tartest::makeTest( const wxString& unarchiver) { if ((options & Stub) && (options & PipeIn) == 0) - return NULL; + return nullptr; if (genericInterface) { diff --git a/tests/archive/ziptest.cpp b/tests/archive/ziptest.cpp index 6d33c924a1..d544f4f201 100644 --- a/tests/archive/ziptest.cpp +++ b/tests/archive/ziptest.cpp @@ -184,7 +184,7 @@ void ZipPipeTestCase::runTest() wxZipInputStream zip(in); wxScopedPtr entry(zip.GetNextEntry()); - CPPUNIT_ASSERT(entry.get() != NULL); + CPPUNIT_ASSERT(entry.get() != nullptr); if ((m_options & PipeIn) == 0) CPPUNIT_ASSERT(entry->GetSize() != wxInvalidOffset); @@ -233,7 +233,7 @@ CppUnit::Test *ziptest::makeTest( { // unzip doesn't support piping in the zip if ((options & PipeIn) && !unarchiver.empty()) - return NULL; + return nullptr; if (genericInterface) { diff --git a/tests/base64/base64.cpp b/tests/base64/base64.cpp index 835698ce21..43abfd7206 100644 --- a/tests/base64/base64.cpp +++ b/tests/base64/base64.cpp @@ -273,29 +273,29 @@ void Base64TestCase::EncodeDecodeRandom() void Base64TestCase::DecodeInvalid() { size_t rc, posErr; - rc = wxBase64Decode(NULL, 0, "one two!", wxNO_LEN, + rc = wxBase64Decode(nullptr, 0, "one two!", wxNO_LEN, wxBase64DecodeMode_Strict, &posErr); CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc); CPPUNIT_ASSERT_EQUAL( 3, posErr ); - rc = wxBase64Decode(NULL, 0, "one two!", wxNO_LEN, + rc = wxBase64Decode(nullptr, 0, "one two!", wxNO_LEN, wxBase64DecodeMode_SkipWS, &posErr); CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc); CPPUNIT_ASSERT_EQUAL( 7, posErr ); - rc = wxBase64Decode(NULL, 0, "? QQ==", wxNO_LEN, + rc = wxBase64Decode(nullptr, 0, "? QQ==", wxNO_LEN, wxBase64DecodeMode_SkipWS, &posErr); CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc); CPPUNIT_ASSERT_EQUAL( 0, posErr ); const size_t POS_INVALID = (size_t)-1; posErr = POS_INVALID; - rc = wxBase64Decode(NULL, 0, " QQ==", wxNO_LEN, + rc = wxBase64Decode(nullptr, 0, " QQ==", wxNO_LEN, wxBase64DecodeMode_SkipWS, &posErr); CPPUNIT_ASSERT_EQUAL( 1, rc ); CPPUNIT_ASSERT_EQUAL( POS_INVALID, posErr ); - rc = wxBase64Decode(NULL, 0, "? QQ==", wxNO_LEN, + rc = wxBase64Decode(nullptr, 0, "? QQ==", wxNO_LEN, wxBase64DecodeMode_Relaxed, &posErr); CPPUNIT_ASSERT_EQUAL( 1, rc ); CPPUNIT_ASSERT_EQUAL( POS_INVALID, posErr ); diff --git a/tests/benchmarks/bench.cpp b/tests/benchmarks/bench.cpp index b7af05701b..70807914de 100644 --- a/tests/benchmarks/bench.cpp +++ b/tests/benchmarks/bench.cpp @@ -87,7 +87,7 @@ wxIMPLEMENT_APP_CONSOLE(BenchApp); // Bench namespace symbols implementation // ============================================================================ -Bench::Function *Bench::Function::ms_head = NULL; +Bench::Function *Bench::Function::ms_head = nullptr; long Bench::GetNumericParameter(long defVal) { @@ -122,7 +122,7 @@ bool BenchApp::OnInit() #if wxUSE_GUI // create a hidden parent window to be used as parent for the GUI controls - new wxFrame(NULL, wxID_ANY, "Hidden wx benchmark frame"); + new wxFrame(nullptr, wxID_ANY, "Hidden wx benchmark frame"); #endif // wxUSE_GUI return true; diff --git a/tests/benchmarks/bench.h b/tests/benchmarks/bench.h index 9eef60bcec..86828d75e8 100644 --- a/tests/benchmarks/bench.h +++ b/tests/benchmarks/bench.h @@ -32,8 +32,8 @@ public: /// Ctor is used implicitly by BENCHMARK_FUNC(). Function(const char *name, FuncType func, - InitType init = NULL, - DoneType done = NULL) + InitType init = nullptr, + DoneType done = nullptr) : m_name(name), m_func(func), m_init(init), @@ -58,7 +58,7 @@ public: /// Get the head of the linked list of benchmark objects static Function *GetFirst() { return ms_head; } - /// Get the next object in the linked list or NULL + /// Get the next object in the linked list or nullptr Function *GetNext() const { return m_next; } private: @@ -71,7 +71,7 @@ private: const InitType m_init; const DoneType m_done; - // pointer to the next object in the linked list or NULL + // pointer to the next object in the linked list or nullptr Function * const m_next; wxDECLARE_NO_COPY_CLASS(Function); diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index cbe2be7f30..09d3543505 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -121,17 +121,17 @@ class GraphicsBenchmarkFrame : public wxFrame { public: GraphicsBenchmarkFrame() - : wxFrame(NULL, wxID_ANY, "wxWidgets Graphics Benchmark") + : wxFrame(nullptr, wxID_ANY, "wxWidgets Graphics Benchmark") { SetClientSize(opts.width, opts.height); #if wxUSE_GLCANVAS - m_glCanvas = NULL; - m_glContext = NULL; + m_glCanvas = nullptr; + m_glContext = nullptr; if ( opts.useGL ) { - m_glCanvas = new wxGLCanvas(this, wxID_ANY, NULL, + m_glCanvas = new wxGLCanvas(this, wxID_ANY, nullptr, wxPoint(0, 0), wxSize(opts.width, opts.height)); m_glContext = new wxGLContext(m_glCanvas); @@ -149,7 +149,7 @@ public: m_glCanvas->Connect( wxEVT_PAINT, wxPaintEventHandler(GraphicsBenchmarkFrame::OnGLRender), - NULL, + nullptr, this ); } @@ -183,7 +183,7 @@ public: m_bitmapRGBwithMask.Create(64, 64, 24); m_bitmapRGBwithMask.SetMask(new wxMask(bmpMask)); - m_renderer = NULL; + m_renderer = nullptr; if ( opts.useGC ) { #ifdef __WXMSW__ @@ -202,7 +202,7 @@ public: if ( !gc ) { wxPrintf("Couldn't initialize '%s' graphics renderer.\n", m_renderer->GetName().c_str()); - m_renderer = NULL; + m_renderer = nullptr; } delete gc; } diff --git a/tests/benchmarks/htmlparser/htmlpars.cpp b/tests/benchmarks/htmlparser/htmlpars.cpp index 30fd8938be..6121d8d5fe 100644 --- a/tests/benchmarks/htmlparser/htmlpars.cpp +++ b/tests/benchmarks/htmlparser/htmlpars.cpp @@ -64,14 +64,14 @@ wxIMPLEMENT_ABSTRACT_CLASS(wx28HtmlParser, wxObject); wx28HtmlParser::wx28HtmlParser() : wxObject(), m_HandlersHash(wxKEY_STRING), - m_FS(NULL), m_HandlersStack(NULL) + m_FS(nullptr), m_HandlersStack(nullptr) { m_entitiesParser = new wx28HtmlEntitiesParser; - m_Tags = NULL; - m_CurTag = NULL; - m_TextPieces = NULL; + m_Tags = nullptr; + m_CurTag = nullptr; + m_TextPieces = nullptr; m_CurTextPiece = 0; - m_SavedStates = NULL; + m_SavedStates = nullptr; } wx28HtmlParser::~wx28HtmlParser() @@ -118,7 +118,7 @@ void wx28HtmlParser::SetSource(const wxString& src) DestroyDOMTree(); m_Source = src; CreateDOMTree(); - m_CurTag = NULL; + m_CurTag = nullptr; m_CurTextPiece = 0; } @@ -126,7 +126,7 @@ void wx28HtmlParser::CreateDOMTree() { wx28HtmlTagsCache cache(m_Source); m_TextPieces = new wx28HtmlTextPieces; - CreateDOMSubTree(NULL, 0, m_Source.length(), &cache); + CreateDOMSubTree(nullptr, 0, m_Source.length(), &cache); m_CurTextPiece = 0; } @@ -146,7 +146,7 @@ void wx28HtmlParser::CreateDOMSubTree(wx28HtmlTag *cur, // and ending tag verbosely. Setting i=end_pos will skip to the very // end of this function where text piece is added, bypassing any child // tags parsing (CDATA element can't have child elements by definition): - if (cur != NULL && wxIsCDATAElement(cur->GetName().c_str())) + if (cur != nullptr && wxIsCDATAElement(cur->GetName().c_str())) { i = end_pos; } @@ -197,7 +197,7 @@ void wx28HtmlParser::CreateDOMSubTree(wx28HtmlTag *cur, i, end_pos, cache, m_entitiesParser); else { - chd = new wx28HtmlTag(NULL, m_Source, + chd = new wx28HtmlTag(nullptr, m_Source, i, end_pos, cache, m_entitiesParser); if (!m_Tags) { @@ -253,10 +253,10 @@ void wx28HtmlParser::DestroyDOMTree() delete t1; t1 = t2; } - m_Tags = m_CurTag = NULL; + m_Tags = m_CurTag = nullptr; delete m_TextPieces; - m_TextPieces = NULL; + m_TextPieces = nullptr; } void wx28HtmlParser::DoParsing() @@ -347,7 +347,7 @@ void wx28HtmlParser::PushTagHandler(wx28HtmlTagHandler *handler, const wxString& wxStringTokenizer tokenizer(tags, wxT(", ")); wxString key; - if (m_HandlersStack == NULL) + if (m_HandlersStack == nullptr) { m_HandlersStack = new wxList; } @@ -370,7 +370,7 @@ void wx28HtmlParser::PopTagHandler() #if wxUSE_STL !(first = m_HandlersStack->GetFirst()) #else // !wxUSE_STL - ((first = m_HandlersStack->GetFirst()) == NULL) + ((first = m_HandlersStack->GetFirst()) == nullptr) #endif // wxUSE_STL/!wxUSE_STL ) { @@ -395,9 +395,9 @@ void wx28HtmlParser::SetSourceAndSaveState(const wxString& src) s->m_nextState = m_SavedStates; m_SavedStates = s; - m_CurTag = NULL; - m_Tags = NULL; - m_TextPieces = NULL; + m_CurTag = nullptr; + m_Tags = nullptr; + m_TextPieces = nullptr; m_CurTextPiece = 0; m_Source = wxEmptyString; @@ -453,7 +453,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wx28HtmlEntitiesParser,wxObject); wx28HtmlEntitiesParser::wx28HtmlEntitiesParser() #if !wxUSE_UNICODE - : m_conv(NULL), m_encoding(wxFONTENCODING_SYSTEM) + : m_conv(nullptr), m_encoding(wxFONTENCODING_SYSTEM) #endif { } @@ -475,7 +475,7 @@ void wx28HtmlEntitiesParser::SetEncoding(wxFontEncoding encoding) m_encoding = encoding; if (m_encoding == wxFONTENCODING_SYSTEM) - m_conv = NULL; + m_conv = nullptr; else m_conv = new wxCSConv(wxFontMapper::GetEncodingName(m_encoding)); #else @@ -832,14 +832,14 @@ wxChar wx28HtmlEntitiesParser::GetEntityChar(const wxString& entity) { wxT("zeta"),950 }, { wxT("zwj"),8205 }, { wxT("zwnj"),8204 }, - {NULL, 0}}; + {nullptr, 0}}; static size_t substitutions_cnt = 0; if (substitutions_cnt == 0) while (substitutions[substitutions_cnt].code != 0) substitutions_cnt++; - wx28HtmlEntityInfo *info = NULL; + wx28HtmlEntityInfo *info = nullptr; info = (wx28HtmlEntityInfo*) bsearch(entity.c_str(), substitutions, substitutions_cnt, sizeof(wx28HtmlEntityInfo), @@ -857,7 +857,7 @@ wxChar wx28HtmlEntitiesParser::GetEntityChar(const wxString& entity) wxFSFile *wx28HtmlParser::OpenURL(wx28HtmlURLType WXUNUSED(type), const wxString& url) const { - return m_FS ? m_FS->OpenFile(url) : NULL; + return m_FS ? m_FS->OpenFile(url) : nullptr; } @@ -871,7 +871,7 @@ class wxMetaTagParser : public wx28HtmlParser public: wxMetaTagParser() { } - wxObject* GetProduct() { return NULL; } + wxObject* GetProduct() { return nullptr; } protected: virtual void AddText(const wxChar* WXUNUSED(txt)) {} diff --git a/tests/benchmarks/htmlparser/htmlpars.h b/tests/benchmarks/htmlparser/htmlpars.h index 0913deaaa7..63d619bc35 100644 --- a/tests/benchmarks/htmlparser/htmlpars.h +++ b/tests/benchmarks/htmlparser/htmlpars.h @@ -199,7 +199,7 @@ class wx28HtmlTagHandler : public wxObject wxDECLARE_ABSTRACT_CLASS(wx28HtmlTagHandler); public: - wx28HtmlTagHandler() : wxObject () { m_Parser = NULL; } + wx28HtmlTagHandler() : wxObject () { m_Parser = nullptr; } // Sets the parser. // NOTE : each _instance_ of handler is guaranteed to be called diff --git a/tests/benchmarks/htmlparser/htmltag.cpp b/tests/benchmarks/htmlparser/htmltag.cpp index 4975fcde5d..362942e9e8 100644 --- a/tests/benchmarks/htmlparser/htmltag.cpp +++ b/tests/benchmarks/htmlparser/htmltag.cpp @@ -53,7 +53,7 @@ wx28HtmlTagsCache::wx28HtmlTagsCache(const wxString& source) int lng = source.length(); wxChar tagBuffer[256]; - m_Cache = NULL; + m_Cache = nullptr; m_CacheSize = 0; m_CachePos = 0; @@ -166,13 +166,13 @@ wx28HtmlTagsCache::wx28HtmlTagsCache(const wxString& source) for (int i = 0; i < m_CacheSize; i++) { delete[] m_Cache[i].Name; - m_Cache[i].Name = NULL; + m_Cache[i].Name = nullptr; } } void wx28HtmlTagsCache::QueryTag(int at, int* end1, int* end2) { - if (m_Cache == NULL) return; + if (m_Cache == nullptr) return; if (m_Cache[m_CachePos].Key != at) { int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1; @@ -212,20 +212,20 @@ wx28HtmlTag::wx28HtmlTag(wx28HtmlTag *parent, { /* Setup DOM relations */ - m_Next = NULL; - m_FirstChild = m_LastChild = NULL; + m_Next = nullptr; + m_FirstChild = m_LastChild = nullptr; m_Parent = parent; if (parent) { m_Prev = m_Parent->m_LastChild; - if (m_Prev == NULL) + if (m_Prev == nullptr) m_Parent->m_FirstChild = this; else m_Prev->m_Next = this; m_Parent->m_LastChild = this; } else - m_Prev = NULL; + m_Prev = nullptr; /* Find parameters and their values: */ @@ -460,7 +460,7 @@ wx28HtmlTag *wx28HtmlTag::GetNextTag() const if (m_FirstChild) return m_FirstChild; if (m_Next) return m_Next; wx28HtmlTag *cur = m_Parent; - if (!cur) return NULL; + if (!cur) return nullptr; while (cur->m_Parent && !cur->m_Next) cur = cur->m_Parent; return cur->m_Next; diff --git a/tests/benchmarks/htmlparser/htmltag.h b/tests/benchmarks/htmlparser/htmltag.h index 9ede52fe24..fc3478a723 100644 --- a/tests/benchmarks/htmlparser/htmltag.h +++ b/tests/benchmarks/htmlparser/htmltag.h @@ -33,7 +33,7 @@ private: int m_CachePos; public: - wx28HtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = NULL;} + wx28HtmlTagsCache() : wxObject() {m_CacheSize = 0; m_Cache = nullptr;} wx28HtmlTagsCache(const wxString& source); virtual ~wx28HtmlTagsCache() {free(m_Cache);} diff --git a/tests/benchmarks/ipcclient.cpp b/tests/benchmarks/ipcclient.cpp index 1fb9853468..3b3833dab5 100644 --- a/tests/benchmarks/ipcclient.cpp +++ b/tests/benchmarks/ipcclient.cpp @@ -69,7 +69,7 @@ class PokeAdviseClient : public wxClient public: // provide a convenient helper taking care of connecting to the right // server/service/topic and returning the connection of the derived type - // (or NULL if we failed to connect) + // (or nullptr if we failed to connect) PokeAdviseConn *Connect() { wxString host = Bench::GetStringParameter(); @@ -126,7 +126,7 @@ private: wxDECLARE_NO_COPY_CLASS(PokeAdvisePersistentConnection); }; -PokeAdvisePersistentConnection *theConnection = NULL; +PokeAdvisePersistentConnection *theConnection = nullptr; bool ConnInit() { @@ -134,7 +134,7 @@ bool ConnInit() if ( !theConnection->Get() ) { delete theConnection; - theConnection = NULL; + theConnection = nullptr; return false; } diff --git a/tests/benchmarks/mbconv.cpp b/tests/benchmarks/mbconv.cpp index ea4bb6d8ae..4579a4fc1f 100644 --- a/tests/benchmarks/mbconv.cpp +++ b/tests/benchmarks/mbconv.cpp @@ -30,7 +30,7 @@ bool ComputeMBLength(const wxMBConv& conv) { // we suppose a fixed length encoding here (which happens to cover UTF-8 // too as long as the test string is ASCII) - return conv.FromWChar(NULL, 0, TEST_STRING) + return conv.FromWChar(nullptr, 0, TEST_STRING) == (wcslen(TEST_STRING) + 1)*conv.GetMBNulLen(); } diff --git a/tests/benchmarks/strings.cpp b/tests/benchmarks/strings.cpp index bbdc532214..3aef700263 100644 --- a/tests/benchmarks/strings.cpp +++ b/tests/benchmarks/strings.cpp @@ -424,7 +424,7 @@ BENCHMARK_FUNC(CharBuffer) class DummyParser : public wx28HtmlParser { public: - virtual wxObject* GetProduct() { return NULL; } + virtual wxObject* GetProduct() { return nullptr; } virtual void AddText(const wxChar*) {} }; diff --git a/tests/benchmarks/tls.cpp b/tests/benchmarks/tls.cpp index 185e64ccce..75568a9f32 100644 --- a/tests/benchmarks/tls.cpp +++ b/tests/benchmarks/tls.cpp @@ -79,7 +79,7 @@ class PthreadKey public: PthreadKey() { - pthread_key_create(&m_key, NULL); + pthread_key_create(&m_key, nullptr); } ~PthreadKey() diff --git a/tests/cmdline/cmdlinetest.cpp b/tests/cmdline/cmdlinetest.cpp index 3b976845dc..3272b25e75 100644 --- a/tests/cmdline/cmdlinetest.cpp +++ b/tests/cmdline/cmdlinetest.cpp @@ -302,19 +302,19 @@ void CmdLineTestCase::Usage() // details, its format can change in the future) static const wxCmdLineEntryDesc desc[] = { - { wxCMD_LINE_USAGE_TEXT, NULL, NULL, "Verbosity options" }, + { wxCMD_LINE_USAGE_TEXT, nullptr, nullptr, "Verbosity options" }, { wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" }, { wxCMD_LINE_SWITCH, "q", "quiet", "be quiet" }, - { wxCMD_LINE_USAGE_TEXT, NULL, NULL, "Output options" }, + { wxCMD_LINE_USAGE_TEXT, nullptr, nullptr, "Output options" }, { wxCMD_LINE_OPTION, "o", "output", "output file" }, { wxCMD_LINE_OPTION, "s", "size", "output block size", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "d", "date", "output file date", wxCMD_LINE_VAL_DATE }, { wxCMD_LINE_OPTION, "f", "double", "output double", wxCMD_LINE_VAL_DOUBLE }, - { wxCMD_LINE_PARAM, NULL, NULL, "input file", }, + { wxCMD_LINE_PARAM, nullptr, nullptr, "input file", }, - { wxCMD_LINE_USAGE_TEXT, NULL, NULL, "\nEven more usage text" }, + { wxCMD_LINE_USAGE_TEXT, nullptr, nullptr, "\nEven more usage text" }, { wxCMD_LINE_NONE } }; @@ -358,7 +358,7 @@ void CmdLineTestCase::Found() { wxCMD_LINE_OPTION, "s", "size", "output block size", wxCMD_LINE_VAL_NUMBER }, { wxCMD_LINE_OPTION, "d", "date", "output file date", wxCMD_LINE_VAL_DATE }, { wxCMD_LINE_OPTION, "f", "double", "output double", wxCMD_LINE_VAL_DOUBLE }, - { wxCMD_LINE_PARAM, NULL, NULL, "input file", }, + { wxCMD_LINE_PARAM, nullptr, nullptr, "input file", }, { wxCMD_LINE_NONE } }; diff --git a/tests/controls/auitest.cpp b/tests/controls/auitest.cpp index 7813f7d3aa..81649a39f4 100644 --- a/tests/controls/auitest.cpp +++ b/tests/controls/auitest.cpp @@ -159,7 +159,7 @@ TEST_CASE_METHOD(AuiNotebookTestCase, "wxAuiNotebook::FindPage", "[aui]") REQUIRE( nb->AddPage(p1, "Page 1") ); REQUIRE( nb->AddPage(p2, "Page 2") ); - CHECK( nb->FindPage(NULL) == wxNOT_FOUND ); + CHECK( nb->FindPage(nullptr) == wxNOT_FOUND ); CHECK( nb->FindPage(p1) == 0 ); CHECK( nb->FindPage(p2) == 1 ); CHECK( nb->FindPage(p3) == wxNOT_FOUND ); diff --git a/tests/controls/choicetest.cpp b/tests/controls/choicetest.cpp index a213610085..d738650b30 100644 --- a/tests/controls/choicetest.cpp +++ b/tests/controls/choicetest.cpp @@ -62,7 +62,7 @@ void ChoiceTestCase::Sort() #if !defined(__WXOSX__) wxDELETE(m_choice); m_choice = new wxChoice(wxTheApp->GetTopWindow(), wxID_ANY, - wxDefaultPosition, wxDefaultSize, 0, 0, + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_SORT); wxArrayString testitems; diff --git a/tests/controls/comboboxtest.cpp b/tests/controls/comboboxtest.cpp index 78612ccc68..0f5b31cb95 100644 --- a/tests/controls/comboboxtest.cpp +++ b/tests/controls/comboboxtest.cpp @@ -100,7 +100,7 @@ void ComboBoxTestCase::setUp() void ComboBoxTestCase::tearDown() { delete m_combo; - m_combo = NULL; + m_combo = nullptr; } // ---------------------------------------------------------------------------- @@ -158,7 +158,7 @@ void ComboBoxTestCase::Sort() #if !defined(__WXOSX__) delete m_combo; m_combo = new wxComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", - wxDefaultPosition, wxDefaultSize, 0, NULL, + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_SORT); m_combo->Append("aaa"); diff --git a/tests/controls/dataviewctrltest.cpp b/tests/controls/dataviewctrltest.cpp index 731f4e5c8f..b460195a43 100644 --- a/tests/controls/dataviewctrltest.cpp +++ b/tests/controls/dataviewctrltest.cpp @@ -328,7 +328,7 @@ public: private: wxTestItem GetItemID(const wxDataViewItem &dataViewItem) const { - if ( dataViewItem.GetID() == NULL ) + if ( dataViewItem.GetID() == nullptr ) return wxTEST_ITEM_NULL; return *static_cast(dataViewItem.GetID()); } diff --git a/tests/controls/datepickerctrltest.cpp b/tests/controls/datepickerctrltest.cpp index 1de8c6021b..c738d9e767 100644 --- a/tests/controls/datepickerctrltest.cpp +++ b/tests/controls/datepickerctrltest.cpp @@ -56,7 +56,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DatePickerCtrlTestCase, "DatePickerCtrlTe void DatePickerCtrlTestCase::setUp() { m_datepicker = new wxDatePickerCtrl(wxTheApp->GetTopWindow(), wxID_ANY); - m_button = NULL; + m_button = nullptr; } void DatePickerCtrlTestCase::tearDown() diff --git a/tests/controls/dialogtest.cpp b/tests/controls/dialogtest.cpp index f5c4db6b01..d23722a905 100644 --- a/tests/controls/dialogtest.cpp +++ b/tests/controls/dialogtest.cpp @@ -74,7 +74,7 @@ void ModalDialogsTestCase::MessageDialog() #if wxUSE_FILEDLG void ModalDialogsTestCase::FileDialog() { - wxFileDialog dlg(NULL); + wxFileDialog dlg(nullptr); int rc; wxTEST_DIALOG @@ -128,7 +128,7 @@ protected: void ModalDialogsTestCase::CustomDialog() { - MyDialog dlg(NULL); + MyDialog dlg(nullptr); wxTEST_DIALOG ( @@ -143,7 +143,7 @@ void ModalDialogsTestCase::CustomDialog() class MyModalDialog : public wxDialog { public: - MyModalDialog() : wxDialog (NULL, wxID_ANY, "Modal Dialog") + MyModalDialog() : wxDialog (nullptr, wxID_ANY, "Modal Dialog") { m_wasModal = false; Bind( wxEVT_INIT_DIALOG, &MyModalDialog::OnInit, this ); diff --git a/tests/controls/frametest.cpp b/tests/controls/frametest.cpp index 144fae355d..9f6d6da2c0 100644 --- a/tests/controls/frametest.cpp +++ b/tests/controls/frametest.cpp @@ -46,7 +46,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase, "FrameTestCase" ); void FrameTestCase::setUp() { - m_frame = new wxFrame(NULL, wxID_ANY, "test frame"); + m_frame = new wxFrame(nullptr, wxID_ANY, "test frame"); m_frame->Show(); } diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 7579d9a53b..50e7f2f730 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -117,7 +117,7 @@ public: if ( attr ) attr->DecRef(); - return attr != NULL; + return attr != nullptr; } size_t GetCellAttrCount() const @@ -349,7 +349,7 @@ protected: wxDECLARE_NO_COPY_CLASS(GridTestCase); }; -GridTestCase::GridTestCase() : m_tempGrid(NULL) +GridTestCase::GridTestCase() : m_tempGrid(nullptr) { m_grid = new TestableGrid(wxTheApp->GetTopWindow()); m_grid->CreateGrid(10, 2); @@ -1708,7 +1708,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellAttribute", "[attr][cell][grid]") { CHECK_ATTR_COUNT( 0 ); - m_grid->SetAttr(0, 0, NULL); + m_grid->SetAttr(0, 0, nullptr); CHECK_ATTR_COUNT( 0 ); SetCellAttr(0, 0); @@ -1718,15 +1718,15 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellAttribute", "[attr][cell][grid]") SetCellAttr(0, 0); CHECK_ATTR_COUNT( 1 ); - m_grid->SetAttr(0, 0, NULL); + m_grid->SetAttr(0, 0, nullptr); CHECK_ATTR_COUNT( 0 ); SetCellAttr(0, 0); m_grid->SetCellBackgroundColour(0, 1, *wxGREEN); CHECK_ATTR_COUNT( 2 ); - m_grid->SetAttr(0, 1, NULL); - m_grid->SetAttr(0, 0, NULL); + m_grid->SetAttr(0, 1, nullptr); + m_grid->SetAttr(0, 0, nullptr); CHECK_ATTR_COUNT( 0 ); } diff --git a/tests/controls/headerctrltest.cpp b/tests/controls/headerctrltest.cpp index b51b8f60c6..fc6bd3393e 100644 --- a/tests/controls/headerctrltest.cpp +++ b/tests/controls/headerctrltest.cpp @@ -65,7 +65,7 @@ void HeaderCtrlTestCase::setUp() void HeaderCtrlTestCase::tearDown() { delete m_header; - m_header = NULL; + m_header = nullptr; } // ---------------------------------------------------------------------------- diff --git a/tests/controls/itemcontainertest.cpp b/tests/controls/itemcontainertest.cpp index 12b99f2fe8..44c06a367a 100644 --- a/tests/controls/itemcontainertest.cpp +++ b/tests/controls/itemcontainertest.cpp @@ -201,8 +201,8 @@ void ItemContainerTestCase::VoidData() CPPUNIT_ASSERT_EQUAL(item2, container->GetClientData(2)); - WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData((unsigned)-1, NULL) ); - WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData(12345, NULL) ); + WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData((unsigned)-1, nullptr) ); + WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData(12345, nullptr) ); // wxMSW used to hace problems retrieving the client data of -1 from a few // standard controls, especially if the last error was set before doing it, diff --git a/tests/controls/listboxtest.cpp b/tests/controls/listboxtest.cpp index 2e759dab47..6073d6bba0 100644 --- a/tests/controls/listboxtest.cpp +++ b/tests/controls/listboxtest.cpp @@ -76,7 +76,7 @@ void ListBoxTestCase::setUp() if( ms_ownerdrawn ) { m_list = new wxListBox(wxTheApp->GetTopWindow(), wxID_ANY, - wxDefaultPosition, wxSize(300, 200), 0, NULL, + wxDefaultPosition, wxSize(300, 200), 0, nullptr, wxLB_OWNERDRAW); } else @@ -96,7 +96,7 @@ void ListBoxTestCase::Sort() #ifndef __WXOSX__ wxDELETE(m_list); m_list = new wxListBox(wxTheApp->GetTopWindow(), wxID_ANY, - wxDefaultPosition, wxDefaultSize, 0, 0, + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT); wxArrayString testitems; @@ -127,7 +127,7 @@ void ListBoxTestCase::MultipleSelect() { wxDELETE(m_list); m_list = new wxListBox(wxTheApp->GetTopWindow(), wxID_ANY, - wxDefaultPosition, wxDefaultSize, 0, 0, + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_MULTIPLE); wxArrayString testitems; diff --git a/tests/controls/listctrltest.cpp b/tests/controls/listctrltest.cpp index c6b6b7700a..38aebb205f 100644 --- a/tests/controls/listctrltest.cpp +++ b/tests/controls/listctrltest.cpp @@ -86,7 +86,7 @@ void ListCtrlTestCase::setUp() void ListCtrlTestCase::tearDown() { DeleteTestWindow(m_list); - m_list = NULL; + m_list = nullptr; } void ListCtrlTestCase::EditLabel() diff --git a/tests/controls/listviewtest.cpp b/tests/controls/listviewtest.cpp index 60f43c3395..f10154b4d4 100644 --- a/tests/controls/listviewtest.cpp +++ b/tests/controls/listviewtest.cpp @@ -60,7 +60,7 @@ void ListViewTestCase::setUp() void ListViewTestCase::tearDown() { DeleteTestWindow(m_list); - m_list = NULL; + m_list = nullptr; } void ListViewTestCase::Selection() diff --git a/tests/controls/notebooktest.cpp b/tests/controls/notebooktest.cpp index 2ae4e585ff..f293116b36 100644 --- a/tests/controls/notebooktest.cpp +++ b/tests/controls/notebooktest.cpp @@ -25,7 +25,7 @@ class NotebookTestCase : public BookCtrlBaseTestCase, public CppUnit::TestCase { public: - NotebookTestCase() { m_notebook = NULL; m_numPageChanges = 0; } + NotebookTestCase() { m_notebook = nullptr; m_numPageChanges = 0; } virtual void setUp() override; virtual void tearDown() override; @@ -114,7 +114,7 @@ void NotebookTestCase::NoEventsOnDestruction() // selected. m_notebook->ChangeSelection(1); m_notebook->Destroy(); - m_notebook = NULL; + m_notebook = nullptr; CHECK( m_numPageChanges == 1 ); } diff --git a/tests/controls/ownerdrawncomboboxtest.cpp b/tests/controls/ownerdrawncomboboxtest.cpp index c42664eefd..db49a85210 100644 --- a/tests/controls/ownerdrawncomboboxtest.cpp +++ b/tests/controls/ownerdrawncomboboxtest.cpp @@ -87,7 +87,7 @@ void OwnerDrawnComboBoxTestCase::setUp() void OwnerDrawnComboBoxTestCase::tearDown() { delete m_combo; - m_combo = NULL; + m_combo = nullptr; } // ---------------------------------------------------------------------------- @@ -137,7 +137,7 @@ void OwnerDrawnComboBoxTestCase::Sort() m_combo = new wxOwnerDrawnComboBox(wxTheApp->GetTopWindow(), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, wxCB_SORT); m_combo->Append("aaa"); diff --git a/tests/controls/pickerbasetest.cpp b/tests/controls/pickerbasetest.cpp index 1b378b99fb..b10fca1c58 100644 --- a/tests/controls/pickerbasetest.cpp +++ b/tests/controls/pickerbasetest.cpp @@ -65,8 +65,8 @@ void PickerBaseTestCase::Controls() wxPickerBase* const base = GetBase(); CPPUNIT_ASSERT(base->HasTextCtrl()); - CPPUNIT_ASSERT(base->GetTextCtrl() != NULL); - CPPUNIT_ASSERT(base->GetPickerCtrl() != NULL); + CPPUNIT_ASSERT(base->GetTextCtrl() != nullptr); + CPPUNIT_ASSERT(base->GetPickerCtrl() != nullptr); } #endif diff --git a/tests/controls/radioboxtest.cpp b/tests/controls/radioboxtest.cpp index 507ab2e3b1..37f41084f5 100644 --- a/tests/controls/radioboxtest.cpp +++ b/tests/controls/radioboxtest.cpp @@ -198,7 +198,7 @@ TEST_CASE("RadioBox::NoItems", "[radiobox]") wxScopedPtr radio(new wxRadioBox(wxTheApp->GetTopWindow(), wxID_ANY, "Empty", wxDefaultPosition, wxDefaultSize, - 0, NULL, + 0, nullptr, 1, wxRA_SPECIFY_COLS)); CHECK( radio->GetCount() == 0 ); diff --git a/tests/controls/radiobuttontest.cpp b/tests/controls/radiobuttontest.cpp index 96e1b0e5e7..7ec277dbc4 100644 --- a/tests/controls/radiobuttontest.cpp +++ b/tests/controls/radiobuttontest.cpp @@ -156,17 +156,17 @@ TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Group", "[radiobutton]") // GetNextInGroup() CHECK_SAME_WINDOW(g1radio0->GetNextInGroup(), g1radio1); - CHECK_SAME_WINDOW(g1radio1->GetNextInGroup(), NULL); + CHECK_SAME_WINDOW(g1radio1->GetNextInGroup(), nullptr); CHECK_SAME_WINDOW(g2radio0->GetNextInGroup(), g2radio1); CHECK_SAME_WINDOW(g2radio1->GetNextInGroup(), g2radio2); - CHECK_SAME_WINDOW(g2radio2->GetNextInGroup(), NULL); + CHECK_SAME_WINDOW(g2radio2->GetNextInGroup(), nullptr); // GetPreviousInGroup() - CHECK_SAME_WINDOW(g1radio0->GetPreviousInGroup(), NULL); + CHECK_SAME_WINDOW(g1radio0->GetPreviousInGroup(), nullptr); CHECK_SAME_WINDOW(g1radio1->GetPreviousInGroup(), g1radio0); - CHECK_SAME_WINDOW(g2radio0->GetPreviousInGroup(), NULL); + CHECK_SAME_WINDOW(g2radio0->GetPreviousInGroup(), nullptr); CHECK_SAME_WINDOW(g2radio1->GetPreviousInGroup(), g2radio0); CHECK_SAME_WINDOW(g2radio2->GetPreviousInGroup(), g2radio1); } @@ -205,8 +205,8 @@ TEST_CASE_METHOD(RadioButtonTestCase, "RadioButton::Single", "[radiobutton]") // Also check that navigation works as expected with "single" buttons. CHECK_SAME_WINDOW(sradio->GetFirstInGroup(), sradio); CHECK_SAME_WINDOW(sradio->GetLastInGroup(), sradio); - CHECK_SAME_WINDOW(sradio->GetPreviousInGroup(), NULL); - CHECK_SAME_WINDOW(sradio->GetNextInGroup(), NULL); + CHECK_SAME_WINDOW(sradio->GetPreviousInGroup(), nullptr); + CHECK_SAME_WINDOW(sradio->GetNextInGroup(), nullptr); } TEST_CASE("RadioButton::Focus", "[radiobutton][focus]") diff --git a/tests/controls/richtextctrltest.cpp b/tests/controls/richtextctrltest.cpp index a4fbc1529c..56f6eda4b0 100644 --- a/tests/controls/richtextctrltest.cpp +++ b/tests/controls/richtextctrltest.cpp @@ -875,7 +875,7 @@ void RichTextCtrlTestCase::Table() CPPUNIT_ASSERT_EQUAL(0, table->GetRowCount()); m_rich->Clear(); - m_rich->SetFocusObject(NULL); + m_rich->SetFocusObject(nullptr); } #endif //wxUSE_RICHTEXT diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 7a15730f90..c851628e50 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -825,7 +825,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style) CPPUNIT_ASSERT_EQUAL( coords_0[i].x, x ); CPPUNIT_ASSERT_EQUAL( coords_0[i].y, y ); } - ok = m_text->PositionToXY(WXSIZEOF(coords_0), NULL, NULL); + ok = m_text->PositionToXY(WXSIZEOF(coords_0), nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // one line @@ -845,7 +845,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style) CPPUNIT_ASSERT_EQUAL( coords_1[i].x, x ); CPPUNIT_ASSERT_EQUAL( coords_1[i].y, y ); } - ok = m_text->PositionToXY(WXSIZEOF(coords_1), NULL, NULL); + ok = m_text->PositionToXY(WXSIZEOF(coords_1), nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // few lines @@ -893,7 +893,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style) CPPUNIT_ASSERT_EQUAL( ref_coords_2[i].x, x ); CPPUNIT_ASSERT_EQUAL( ref_coords_2[i].y, y ); } - ok = m_text->PositionToXY(ref_numChars_2 + 1, NULL, NULL); + ok = m_text->PositionToXY(ref_numChars_2 + 1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // only empty lines @@ -943,7 +943,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style) CPPUNIT_ASSERT_EQUAL( ref_coords_3[i].x, x ); CPPUNIT_ASSERT_EQUAL( ref_coords_3[i].y, y ); } - ok = m_text->PositionToXY(ref_numChars_3 + 1, NULL, NULL); + ok = m_text->PositionToXY(ref_numChars_3 + 1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // mixed empty/non-empty lines @@ -997,7 +997,7 @@ void TextCtrlTestCase::DoPositionToXYMultiLine(long style) CPPUNIT_ASSERT_EQUAL( ref_coords_4[i].x, x ); CPPUNIT_ASSERT_EQUAL( ref_coords_4[i].y, y ); } - ok = m_text->PositionToXY(ref_numChars_4 + 1, NULL, NULL); + ok = m_text->PositionToXY(ref_numChars_4 + 1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); } @@ -1194,7 +1194,7 @@ void TextCtrlTestCase::PositionToXYSingleLine() CPPUNIT_ASSERT_EQUAL( i, x0 ); CPPUNIT_ASSERT_EQUAL( 0, y0 ); } - ok = m_text->PositionToXY(numChars_0+1, NULL, NULL); + ok = m_text->PositionToXY(numChars_0+1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // pure one line @@ -1210,7 +1210,7 @@ void TextCtrlTestCase::PositionToXYSingleLine() CPPUNIT_ASSERT_EQUAL( i, x1 ); CPPUNIT_ASSERT_EQUAL( 0, y1 ); } - ok = m_text->PositionToXY(numChars_1+1, NULL, NULL); + ok = m_text->PositionToXY(numChars_1+1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); // with new line characters @@ -1226,7 +1226,7 @@ void TextCtrlTestCase::PositionToXYSingleLine() CPPUNIT_ASSERT_EQUAL( i, x2 ); CPPUNIT_ASSERT_EQUAL( 0, y2 ); } - ok = m_text->PositionToXY(numChars_2+1, NULL, NULL); + ok = m_text->PositionToXY(numChars_2+1, nullptr, nullptr); CPPUNIT_ASSERT_EQUAL( false, ok ); } diff --git a/tests/controls/textentrytest.h b/tests/controls/textentrytest.h index c5b2c31592..58447ca063 100644 --- a/tests/controls/textentrytest.h +++ b/tests/controls/textentrytest.h @@ -88,7 +88,7 @@ public: // Return another creator similar to this one, but creating multiline // version of the control. If the returned pointer is non-null, it must be // deleted by the caller. - virtual TextLikeControlCreator* CloneAsMultiLine() const { return NULL; } + virtual TextLikeControlCreator* CloneAsMultiLine() const { return nullptr; } // Give it a virtual dtor to avoid warnings even though this class is not // supposed to be used polymorphically. diff --git a/tests/controls/treebooktest.cpp b/tests/controls/treebooktest.cpp index 833de0b898..d36a0d4f0e 100644 --- a/tests/controls/treebooktest.cpp +++ b/tests/controls/treebooktest.cpp @@ -98,7 +98,7 @@ void TreebookTestCase::ContainerPage() CHECK( m_treebook->GetPageCount() == 0 ); // Adding a page without the associated window should be allowed. - REQUIRE_NOTHROW( m_treebook->AddPage(NULL, "Container page") ); + REQUIRE_NOTHROW( m_treebook->AddPage(nullptr, "Container page") ); CHECK( m_treebook->GetPageParent(0) == -1 ); m_treebook->AddSubPage(new wxPanel(m_treebook), "Child page"); diff --git a/tests/controls/treectrltest.cpp b/tests/controls/treectrltest.cpp index 413e4c1c15..26c22ffe7b 100644 --- a/tests/controls/treectrltest.cpp +++ b/tests/controls/treectrltest.cpp @@ -150,7 +150,7 @@ void TreeCtrlTestCase::setUp() void TreeCtrlTestCase::tearDown() { delete m_tree; - m_tree = NULL; + m_tree = nullptr; m_root = m_child1 = diff --git a/tests/controls/treelistctrltest.cpp b/tests/controls/treelistctrltest.cpp index 467db044fc..f430f13409 100644 --- a/tests/controls/treelistctrltest.cpp +++ b/tests/controls/treelistctrltest.cpp @@ -139,7 +139,7 @@ void TreeListCtrlTestCase::setUp() void TreeListCtrlTestCase::tearDown() { delete m_treelist; - m_treelist = NULL; + m_treelist = nullptr; } // ---------------------------------------------------------------------------- diff --git a/tests/controls/virtlistctrltest.cpp b/tests/controls/virtlistctrltest.cpp index ab3b82e4ed..3922d90371 100644 --- a/tests/controls/virtlistctrltest.cpp +++ b/tests/controls/virtlistctrltest.cpp @@ -86,7 +86,7 @@ void VirtListCtrlTestCase::setUp() void VirtListCtrlTestCase::tearDown() { delete m_list; - m_list = NULL; + m_list = nullptr; } void VirtListCtrlTestCase::UpdateSelection() diff --git a/tests/controls/windowtest.cpp b/tests/controls/windowtest.cpp index 563af79db4..eeac946552 100644 --- a/tests/controls/windowtest.cpp +++ b/tests/controls/windowtest.cpp @@ -150,7 +150,7 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Mouse", "[window]") #if wxUSE_CARET CHECK(!m_window->GetCaret()); - wxCaret* caret = NULL; + wxCaret* caret = nullptr; // Try creating the caret in two different, but normally equivalent, ways. SECTION("Caret 1-step") @@ -235,21 +235,21 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Help", "[window]") TEST_CASE_METHOD(WindowTestCase, "Window::Parent", "[window]") { - CHECK( m_window->GetGrandParent() == static_cast(NULL) ); + CHECK( m_window->GetGrandParent() == static_cast(nullptr) ); CHECK( m_window->GetParent() == wxTheApp->GetTopWindow() ); } TEST_CASE_METHOD(WindowTestCase, "Window::Siblings", "[window]") { - CHECK( m_window->GetNextSibling() == static_cast(NULL) ); - CHECK( m_window->GetPrevSibling() == static_cast(NULL) ); + CHECK( m_window->GetNextSibling() == static_cast(nullptr) ); + CHECK( m_window->GetPrevSibling() == static_cast(nullptr) ); wxWindow* newwin = new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY); CHECK( m_window->GetNextSibling() == newwin ); - CHECK( m_window->GetPrevSibling() == static_cast(NULL) ); + CHECK( m_window->GetPrevSibling() == static_cast(nullptr) ); - CHECK( newwin->GetNextSibling() == static_cast(NULL) ); + CHECK( newwin->GetNextSibling() == static_cast(nullptr) ); CHECK( newwin->GetPrevSibling() == m_window ); wxDELETE(newwin); @@ -434,9 +434,9 @@ TEST_CASE_METHOD(WindowTestCase, "Window::FindWindowBy", "[window]") CHECK( wxWindow::FindWindowByName("name") == m_window ); CHECK( wxWindow::FindWindowByLabel("label") == m_window ); - CHECK( wxWindow::FindWindowById(wxID_HIGHEST + 3) == NULL ); - CHECK( wxWindow::FindWindowByName("noname") == NULL ); - CHECK( wxWindow::FindWindowByLabel("nolabel") == NULL ); + CHECK( wxWindow::FindWindowById(wxID_HIGHEST + 3) == nullptr ); + CHECK( wxWindow::FindWindowByName("noname") == nullptr ); + CHECK( wxWindow::FindWindowByLabel("nolabel") == nullptr ); } TEST_CASE_METHOD(WindowTestCase, "Window::SizerErrors", "[window][sizer][error]") diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 064575bfb7..31bd6f89db 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -737,7 +737,7 @@ void DateTimeTestCase::TestTimeFormat() // for those locales it's impossible to pass the test with %p... wxString am, pm; wxDateTime::GetAmPmStrings(&am, &pm); - if (am.empty() && pm.empty() && wxStrstr(fmt, "%p") != NULL) + if (am.empty() && pm.empty() && wxStrstr(fmt, "%p") != nullptr) continue; // what can we recover? diff --git a/tests/drawing/drawing.cpp b/tests/drawing/drawing.cpp index a92353caae..db23150255 100644 --- a/tests/drawing/drawing.cpp +++ b/tests/drawing/drawing.cpp @@ -125,7 +125,7 @@ void GraphicsContextDrawingTestCase::RunIndividualDrawingCase ( gcFactory.GetExtensionForFileName()); { - wxGraphicsContext *gc = NULL; + wxGraphicsContext *gc = nullptr; wxON_BLOCK_EXIT_OBJ1(gcFactory, DrawingTestGCFactory::CleanUp, gc); @@ -251,7 +251,7 @@ GraphicsContextDrawingTestCase::SvgGraphicsContextLifeCycle:: double WXUNUSED(pointsPerInch), const wxFileName &WXUNUSED(targetFileName)) { - m_svgFileDc = NULL; + m_svgFileDc = nullptr; //m_svg_file_dc = new wxSVGFileDC (target_file_name.GetFullPath(), // expected_size.GetWidth(), expected_size.GetHeight(), points_per_inch); diff --git a/tests/drawing/plugindriver.cpp b/tests/drawing/plugindriver.cpp index dfbec6e5f3..02638c2434 100644 --- a/tests/drawing/plugindriver.cpp +++ b/tests/drawing/plugindriver.cpp @@ -82,7 +82,7 @@ void GraphicsContextDrawingTestCase::RunPluginsDrawingCase ( // GraphicsContextDrawingTestCase::PluginInfo ///////////////////////////////// GraphicsContextDrawingTestCase::PluginInfo::PluginInfo() - : library(NULL), gcFactory(NULL), destroy(NULL) { + : library(nullptr), gcFactory(nullptr), destroy(nullptr) { } GraphicsContextDrawingTestCase::PluginInfo::~PluginInfo() diff --git a/tests/events/evthandler.cpp b/tests/events/evthandler.cpp index dcf0485ab3..f7c5adc256 100644 --- a/tests/events/evthandler.cpp +++ b/tests/events/evthandler.cpp @@ -162,8 +162,8 @@ TEST_CASE("Event::BuiltinConnect", "[event][connect]") handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle)); handler.Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle)); - handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &handler); - handler.Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &handler); + handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &handler); + handler.Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &handler); // using casts like this is even uglier than using wxIdleEventHandler but // it should still continue to work for compatibility @@ -197,13 +197,13 @@ TEST_CASE("Event::LegacyConnect", "[event][connect]") handler.Disconnect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent ); - handler.Connect( LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); - handler.Connect( 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); - handler.Connect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); + handler.Connect( LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); + handler.Connect( 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); + handler.Connect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); - handler.Disconnect( LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); - handler.Disconnect( 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); - handler.Disconnect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, NULL, &handler ); + handler.Disconnect( LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); + handler.Disconnect( 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); + handler.Disconnect( 0, 0, LegacyEventType, (wxObjectEventFunction)&MyHandler::OnEvent, nullptr, &handler ); } TEST_CASE("Event::ConnectOverloaded", "[event][connect]") @@ -221,7 +221,7 @@ TEST_CASE("Event::DisconnectWildcard", "[event][connect][disconnect]") // should be able to disconnect a different handler using "wildcard search" MyHandler sink; wxEvtHandler source; - source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink); + source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &sink); CHECK(source.Disconnect(wxID_ANY, wxEVT_IDLE)); // destruction of source and sink here should properly clean up the // wxEventConnectionRef without crashing @@ -232,9 +232,9 @@ TEST_CASE("Event::AutoDisconnect", "[event][connect][disconnect]") wxEvtHandler source; { MyHandler sink; - source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink); + source.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &sink); // mismatched event type, so nothing should be disconnected - CHECK(!source.Disconnect(wxEVT_THREAD, wxIdleEventHandler(MyHandler::OnIdle), NULL, &sink)); + CHECK(!source.Disconnect(wxEVT_THREAD, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &sink)); } // destruction of sink should have automatically disconnected it, so // there should be nothing to disconnect anymore diff --git a/tests/events/propagation.cpp b/tests/events/propagation.cpp index 440cd2c2b9..aa7b304f8f 100644 --- a/tests/events/propagation.cpp +++ b/tests/events/propagation.cpp @@ -289,8 +289,8 @@ void EventPropagationTestCase::setUp() void EventPropagationTestCase::tearDown() { - SetFilterEventFunc(NULL); - SetProcessEventFunc(NULL); + SetFilterEventFunc(nullptr); + SetProcessEventFunc(nullptr); } void EventPropagationTestCase::OneHandler() @@ -465,7 +465,7 @@ void EventPropagationTestCase::MenuEvent() #if wxUSE_MENUBAR wxMenuBar* const mb = menu->GetMenuBar(); wxScopedPtr ensureMenuBarDestruction(mb); - wxON_BLOCK_EXIT_OBJ1( *frame, wxFrame::SetMenuBar, (wxMenuBar*)NULL ); + wxON_BLOCK_EXIT_OBJ1( *frame, wxFrame::SetMenuBar, (wxMenuBar*)nullptr ); #endif // Check that wxApp gets the event exactly once. ASSERT_MENU_EVENT_RESULT( menu, "aA" ); @@ -475,7 +475,7 @@ void EventPropagationTestCase::MenuEvent() TestMenuEvtHandler hm('m'); // 'm' for "menu" menu->SetNextHandler(&hm); wxON_BLOCK_EXIT_OBJ1( *menu, - wxEvtHandler::SetNextHandler, (wxEvtHandler*)NULL ); + wxEvtHandler::SetNextHandler, (wxEvtHandler*)nullptr ); ASSERT_MENU_EVENT_RESULT( menu, "aomA" ); @@ -487,7 +487,7 @@ void EventPropagationTestCase::MenuEvent() TestMenuEvtHandler hs('s'); // 's' for "submenu" submenu->SetNextHandler(&hs); wxON_BLOCK_EXIT_OBJ1( *submenu, - wxEvtHandler::SetNextHandler, (wxEvtHandler*)NULL ); + wxEvtHandler::SetNextHandler, (wxEvtHandler*)nullptr ); ASSERT_MENU_EVENT_RESULT_FOR( wxID_ABOUT, submenu, "aosomA" ); #if wxUSE_MENUBAR @@ -538,7 +538,7 @@ void EventPropagationTestCase::DocView() wxDocManager docManager; wxScopedPtr - parent(new wxDocMDIParentFrame(&docManager, NULL, wxID_ANY, "Parent")); + parent(new wxDocMDIParentFrame(&docManager, nullptr, wxID_ANY, "Parent")); wxMenu* const menu = CreateTestMenu(parent.get()); @@ -546,11 +546,11 @@ void EventPropagationTestCase::DocView() // Set up the event handlers. TestEvtSink sinkDM('m'); docManager.Connect(wxEVT_MENU, - wxEventHandler(TestEvtSink::Handle), NULL, &sinkDM); + wxEventHandler(TestEvtSink::Handle), nullptr, &sinkDM); TestEvtSink sinkParent('p'); parent->Connect(wxEVT_MENU, - wxEventHandler(TestEvtSink::Handle), NULL, &sinkParent); + wxEventHandler(TestEvtSink::Handle), nullptr, &sinkParent); // Check that wxDocManager and wxFrame get the event in order. @@ -590,15 +590,15 @@ void EventPropagationTestCase::DocView() TestEvtSink sinkDoc('d'); doc->Connect(wxEVT_MENU, - wxEventHandler(TestEvtSink::Handle), NULL, &sinkDoc); + wxEventHandler(TestEvtSink::Handle), nullptr, &sinkDoc); TestEvtSink sinkView('v'); view->Connect(wxEVT_MENU, - wxEventHandler(TestEvtSink::Handle), NULL, &sinkView); + wxEventHandler(TestEvtSink::Handle), nullptr, &sinkView); TestEvtSink sinkChild('c'); child->Connect(wxEVT_MENU, - wxEventHandler(TestEvtSink::Handle), NULL, &sinkChild); + wxEventHandler(TestEvtSink::Handle), nullptr, &sinkChild); // Check that wxDocument, wxView, wxDocManager, child frame and the parent // get the event in order. diff --git a/tests/exec/exec.cpp b/tests/exec/exec.cpp index 069e4b428f..ec0a22586e 100644 --- a/tests/exec/exec.cpp +++ b/tests/exec/exec.cpp @@ -113,7 +113,7 @@ private: long DoExecute(AsyncExecLoopExitEnum forceExitLoop_, const wxString& command_, int flags_ = wxEXEC_ASYNC, - wxProcess* callback_ = NULL) + wxProcess* callback_ = nullptr) { forceExitLoop = forceExitLoop_; @@ -363,7 +363,7 @@ ExecTestCase::DoTestAsyncRedirect(const wxString& command, // to trigger the exit of the event loop. command, wxEXEC_ASYNC, &proc) != 0 ); - wxInputStream *streamToCheck = NULL; + wxInputStream *streamToCheck = nullptr; switch ( check ) { case Check_Stdout: diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 84356b39f7..bee7bb10b9 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -794,7 +794,7 @@ TEST_CASE("wxFileName::SameAs", "[filename]") // We need to create a temporary directory and a temporary link. // Unfortunately we can't use wxFileName::CreateTempFileName() for either // as it creates plain files, so use tempnam() explicitly instead. - char* tn = tempnam(NULL, "wxfn1"); + char* tn = tempnam(nullptr, "wxfn1"); const wxString tempdir1 = wxString::From8BitData(tn); free(tn); @@ -803,7 +803,7 @@ TEST_CASE("wxFileName::SameAs", "[filename]") wxON_BLOCK_EXIT2( static_cast(wxFileName::Rmdir), tempdir1, static_cast(wxPATH_RMDIR_RECURSIVE) ); - tn = tempnam(NULL, "wxfn2"); + tn = tempnam(nullptr, "wxfn2"); const wxString tempdir2 = wxString::From8BitData(tn); free(tn); CHECK( symlink(tempdir1.c_str(), tempdir2.c_str()) == 0 ); @@ -993,7 +993,7 @@ void CreateShortcut(const wxString& pathFile, const wxString& pathLink) HRESULT hr; wxCOMPtr sl; - hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&sl); REQUIRE( SUCCEEDED(hr) ); diff --git a/tests/filesys/filesystest.cpp b/tests/filesys/filesystest.cpp index 8e32c7c171..18fecd7310 100644 --- a/tests/filesys/filesystest.cpp +++ b/tests/filesys/filesystest.cpp @@ -41,7 +41,7 @@ public: bool CanOpen(const wxString& WXUNUSED(url)) override { return false; } wxFSFile *OpenFile(wxFileSystem& WXUNUSED(fs), - const wxString& WXUNUSED(url)) override { return NULL; } + const wxString& WXUNUSED(url)) override { return nullptr; } }; diff --git a/tests/formatconverter/formatconvertertest.cpp b/tests/formatconverter/formatconvertertest.cpp index 6f057f790a..d244090e3b 100644 --- a/tests/formatconverter/formatconvertertest.cpp +++ b/tests/formatconverter/formatconvertertest.cpp @@ -250,11 +250,11 @@ void FormatConverterTestCase::doTest(const char *input, const char *expectedWcharWindows) { static const wxChar *flag_width[] = - { wxT(""), wxT("*"), wxT("10"), wxT("-*"), wxT("-10"), NULL }; + { wxT(""), wxT("*"), wxT("10"), wxT("-*"), wxT("-10"), nullptr }; static const wxChar *precision[] = - { wxT(""), wxT(".*"), wxT(".10"), NULL }; + { wxT(""), wxT(".*"), wxT(".10"), nullptr }; static const wxChar *empty[] = - { wxT(""), NULL }; + { wxT(""), nullptr }; // no precision for %c or %C const wxChar **precs = wxTolower(input[wxStrlen(input)-1]) == wxT('c') ? diff --git a/tests/fswatcher/fswatchertest.cpp b/tests/fswatcher/fswatchertest.cpp index c5b09dc19a..a6ab80bd13 100644 --- a/tests/fswatcher/fswatchertest.cpp +++ b/tests/fswatcher/fswatchertest.cpp @@ -200,7 +200,7 @@ private: static wxFileName ms_watchDir; }; -EventGenerator* EventGenerator::ms_instance = 0; +EventGenerator* EventGenerator::ms_instance = nullptr; wxFileName EventGenerator::ms_watchDir; @@ -439,7 +439,7 @@ TEST_CASE_METHOD(FileSystemWatcherTestCase, wxFileSystemWatcherEvent event(wxFSW_EVENT_DELETE); event.SetPath(eg.m_old); - // CHECK maybe new path here could be NULL or sth? + // CHECK maybe new path here could be null or sth? event.SetNewPath(eg.m_old); return event; } diff --git a/tests/graphics/affinematrix.cpp b/tests/graphics/affinematrix.cpp index f50cb81302..a1fc4d6007 100644 --- a/tests/graphics/affinematrix.cpp +++ b/tests/graphics/affinematrix.cpp @@ -108,7 +108,7 @@ class TransformMatrixTestCaseDCBase : public CppUnit::TestCase public: TransformMatrixTestCaseDCBase() { - m_dc = NULL; + m_dc = nullptr; wxImage::AddHandler(new wxJPEGHandler); m_imgOrig.LoadFile(wxS("horse.jpg")); CPPUNIT_ASSERT( m_imgOrig.IsOk() ); @@ -315,7 +315,7 @@ public: // and therefore we have to destroy the renderer // to do so. TransformMatrixTestCaseGCDC::FlushDC(); - m_gcdc->SetGraphicsContext(NULL); + m_gcdc->SetGraphicsContext(nullptr); } private: diff --git a/tests/graphics/bitmap.cpp b/tests/graphics/bitmap.cpp index ff9df3f0d2..1437cfefc1 100644 --- a/tests/graphics/bitmap.cpp +++ b/tests/graphics/bitmap.cpp @@ -126,7 +126,7 @@ TEST_CASE("BitmapTestCase::Mask", "[bitmap][mask]") REQUIRE(bmp.GetMask() == mask); // copying masks should work - wxMask *mask2 = NULL; + wxMask *mask2 = nullptr; REQUIRE_NOTHROW(mask2 = new wxMask(*mask)); bmp.SetMask(mask2); REQUIRE(bmp.GetMask() == mask2); @@ -145,7 +145,7 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]") dc.DrawRectangle(0, 0, bmp.GetWidth(), bmp.GetHeight()); } REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); wxImage image = bmp.ConvertToImage(); REQUIRE_FALSE(image.HasAlpha()); @@ -198,7 +198,7 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]") } bmp.SetMask(new wxMask(bmask)); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); const int numUnmaskedPixels = 8 * 8; wxImage image = bmp.ConvertToImage(); @@ -288,7 +288,7 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]") } } REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); wxImage image = bmp.ConvertToImage(); REQUIRE(image.HasAlpha() == true); @@ -383,7 +383,7 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]") } bmp.SetMask(new wxMask(bmask)); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); const int numUnmaskedPixels = 8 * 8; wxImage image = bmp.ConvertToImage(); @@ -452,7 +452,7 @@ TEST_CASE("BitmapTestCase::FromImage", "[bitmap][image][convertfrom]") wxBitmap bmp(img); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); REQUIRE(bmp.GetWidth() == img.GetWidth()); REQUIRE(bmp.GetHeight() == img.GetHeight()); @@ -485,7 +485,7 @@ TEST_CASE("BitmapTestCase::FromImage", "[bitmap][image][convertfrom]") wxBitmap bmp(img); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); REQUIRE(bmp.GetWidth() == img.GetWidth()); REQUIRE(bmp.GetHeight() == img.GetHeight()); @@ -531,7 +531,7 @@ TEST_CASE("BitmapTestCase::FromImage", "[bitmap][image][convertfrom]") wxBitmap bmp(img); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); REQUIRE(bmp.GetWidth() == img.GetWidth()); REQUIRE(bmp.GetHeight() == img.GetHeight()); @@ -576,7 +576,7 @@ TEST_CASE("BitmapTestCase::FromImage", "[bitmap][image][convertfrom]") wxBitmap bmp(img); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); REQUIRE(bmp.GetWidth() == img.GetWidth()); REQUIRE(bmp.GetHeight() == img.GetHeight()); @@ -634,7 +634,7 @@ TEST_CASE("BitmapTestCase::OverlappingBlit", "[bitmap][blit]") dc.DrawLine(0, 0, 10, 10); dc.DrawLine(10, 0, 0, 10); } - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Clear to white. { @@ -737,10 +737,10 @@ TEST_CASE("BitmapTestCase::DrawNonAlphaWithMask", "[bitmap][draw][nonalpha][with dc.DrawRectangle(w / 2, 0, w / 2, h); } REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); bmp.SetMask(new wxMask(bmask)); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Drawing the bitmap using mask { @@ -851,7 +851,7 @@ TEST_CASE("BitmapTestCase::DrawAlpha", "[bitmap][draw][alpha]") } } REQUIRE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Drawing the bitmap on 24 bpp RGB target wxBitmap bmpOut24(w, h, 24); @@ -966,10 +966,10 @@ TEST_CASE("BitmapTestCase::DrawAlphaWithMask", "[bitmap][draw][alpha][withmask]" } } REQUIRE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); bmp.SetMask(new wxMask(bmask)); REQUIRE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Drawing the bitmap on 24 bpp RGB target using mask { @@ -1164,7 +1164,7 @@ TEST_CASE("BitmapTestCase::SubBitmapNonAlpha", "[bitmap][subbitmap][nonalpha]") dc.DrawRectangle(w / 2, h / 2, w / 2, h / 2); } REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Get sub bitmap wxBitmap subBmp = bmp.GetSubBitmap(wxRect(w/4, h/4, w/2, h/2)); @@ -1173,7 +1173,7 @@ TEST_CASE("BitmapTestCase::SubBitmapNonAlpha", "[bitmap][subbitmap][nonalpha]") REQUIRE(subBmp.GetHeight() == h/2); REQUIRE(subBmp.GetDepth() == bmp.GetDepth()); REQUIRE(subBmp.HasAlpha() == bmp.HasAlpha()); - REQUIRE((subBmp.GetMask() == NULL) == (bmp.GetMask() == NULL)); + REQUIRE((subBmp.GetMask() == nullptr) == (bmp.GetMask() == nullptr)); const int w2 = w / 2; const int h2 = h / 2; @@ -1226,10 +1226,10 @@ TEST_CASE("BitmapTestCase::SubBitmapNonAlphaWithMask", "[bitmap][subbitmap][nona dc.DrawRectangle(w / 2, h / 2, w / 2, h / 2); } REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); bmp.SetMask(new wxMask(bmpMask)); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Get sub bitmap wxBitmap subBmp = bmp.GetSubBitmap(wxRect(w/4, h/4, w/2, h/2)); @@ -1240,7 +1240,7 @@ TEST_CASE("BitmapTestCase::SubBitmapNonAlphaWithMask", "[bitmap][subbitmap][nona REQUIRE(subBmp.GetHeight() == h2); REQUIRE(subBmp.GetDepth() == bmp.GetDepth()); REQUIRE(subBmp.HasAlpha() == bmp.HasAlpha()); - REQUIRE((subBmp.GetMask() == NULL) == (bmp.GetMask() == NULL)); + REQUIRE((subBmp.GetMask() == nullptr) == (bmp.GetMask() == nullptr)); // Check sub bitmap pixels { @@ -1442,7 +1442,7 @@ TEST_CASE("BitmapTestCase::SubBitmapAlphaWithMask", "[bitmap][subbitmap][alpha][ REQUIRE(subBmp.GetHeight() == h2); REQUIRE(subBmp.GetDepth() == bmp.GetDepth()); REQUIRE(subBmp.HasAlpha() == bmp.HasAlpha()); - REQUIRE((subBmp.GetMask() == NULL) == (bmp.GetMask() == NULL)); + REQUIRE((subBmp.GetMask() == nullptr) == (bmp.GetMask() == nullptr)); // Check sub bitmap pixels { diff --git a/tests/graphics/clippingbox.cpp b/tests/graphics/clippingbox.cpp index d20203a281..de341d9695 100644 --- a/tests/graphics/clippingbox.cpp +++ b/tests/graphics/clippingbox.cpp @@ -286,7 +286,7 @@ static void FlushDC(wxDC& dc) // to do so. wxGraphicsRenderer* rend = gc->GetRenderer(); if ( rend == wxGraphicsRenderer::GetDirect2DRenderer() ) - dc.SetGraphicsContext(NULL); + dc.SetGraphicsContext(nullptr); #endif // __WXMSW__ && wxUSE_GRAPHICS_DIRECT2D } #else diff --git a/tests/graphics/coords.cpp b/tests/graphics/coords.cpp index 4edb87a76b..bec0c53101 100644 --- a/tests/graphics/coords.cpp +++ b/tests/graphics/coords.cpp @@ -36,7 +36,7 @@ public: CoordinatesDCTestCaseBase() { m_bmp.Create(s_dcSize); - m_dc = NULL; + m_dc = nullptr; } virtual ~CoordinatesDCTestCaseBase() @@ -1055,7 +1055,7 @@ public: { wxGraphicsRenderer* rend = wxGraphicsRenderer::GetGDIPlusRenderer(); wxGraphicsContext* ctx = rend->CreateContext(m_mdc); - REQUIRE(ctx != NULL); + REQUIRE(ctx != nullptr); m_gcdc->SetGraphicsContext(ctx); } @@ -1185,7 +1185,7 @@ public: { wxGraphicsRenderer* rend = wxGraphicsRenderer::GetDirect2DRenderer(); wxGraphicsContext* ctx = rend->CreateContext(m_mdc); - REQUIRE(ctx != NULL); + REQUIRE(ctx != nullptr); m_gcdc->SetGraphicsContext(ctx); } @@ -1316,7 +1316,7 @@ public: { wxGraphicsRenderer* rend = wxGraphicsRenderer::GetCairoRenderer(); wxGraphicsContext* ctx = rend->CreateContext(m_mdc); - REQUIRE(ctx != NULL); + REQUIRE(ctx != nullptr); m_gcdc->SetGraphicsContext(ctx); } diff --git a/tests/graphics/graphbitmap.cpp b/tests/graphics/graphbitmap.cpp index f1574491ab..929f1fecdf 100644 --- a/tests/graphics/graphbitmap.cpp +++ b/tests/graphics/graphbitmap.cpp @@ -51,7 +51,7 @@ wxBitmap DoCreateBitmapRGB(int w, int h, int bpp, bool withMask) dc.DrawRectangle(2, 2, bmp.GetWidth() - 2, bmp.GetHeight() - 2); } REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); if ( withMask ) { // Mask @@ -71,7 +71,7 @@ wxBitmap DoCreateBitmapRGB(int w, int h, int bpp, bool withMask) } bmp.SetMask(new wxMask(bmask)); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); } return bmp; @@ -136,7 +136,7 @@ wxBitmap CreateBitmapRGBA(int w, int h, bool withMask) } } REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); if ( withMask ) { // Mask @@ -156,7 +156,7 @@ wxBitmap CreateBitmapRGBA(int w, int h, bool withMask) } bmp.SetMask(new wxMask(bmask)); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); } return bmp; @@ -256,7 +256,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") // RGB bitmap wxBitmap bmp = CreateBitmapRGB(8, 8, false); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -268,7 +268,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -277,7 +277,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -286,7 +286,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -296,7 +296,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -307,7 +307,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") // RGB bitmap wxBitmap bmp = CreateBitmapRGB(8, 8, true); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -321,7 +321,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -330,7 +330,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -342,7 +342,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -352,7 +352,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -365,7 +365,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") wxBitmap bmp = CreateBitmapXRGB(8, 8, false); REQUIRE(bmp.GetDepth() == 32); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -377,7 +377,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -386,7 +386,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -395,7 +395,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -405,7 +405,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -417,7 +417,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") wxBitmap bmp = CreateBitmapXRGB(8, 8, true); REQUIRE(bmp.GetDepth() == 32); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -431,7 +431,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -440,7 +440,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -452,7 +452,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -462,7 +462,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -474,7 +474,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") // RGBA Bitmap wxBitmap bmp = CreateBitmapRGBA(8, 8, false); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -486,7 +486,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -495,7 +495,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -504,7 +504,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -514,7 +514,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -525,7 +525,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") // RGBA Bitmap wxBitmap bmp = CreateBitmapRGBA(8, 8, true); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image wxImage image = bmp.ConvertToImage(); @@ -539,7 +539,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } @@ -548,7 +548,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -560,7 +560,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -570,7 +570,7 @@ TEST_CASE("GraphicsBitmapTestCase::Create", "[graphbitmap][create]") SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmap(gr, bmp, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -584,7 +584,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] // RGB bitmap wxBitmap bmp = CreateBitmapRGB(8, 8, false); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image const int subX = 1; @@ -600,7 +600,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -609,7 +609,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -618,7 +618,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -628,7 +628,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -639,7 +639,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] // RGB bitmap wxBitmap bmp = CreateBitmapRGB(8, 8, true); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image const int subX = 2; @@ -657,7 +657,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -666,7 +666,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -678,7 +678,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -688,7 +688,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -701,7 +701,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] wxBitmap bmp = CreateBitmapXRGB(8, 8, false); REQUIRE(bmp.GetDepth() == 32); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image const int subX = 1; @@ -717,7 +717,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -726,7 +726,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -735,7 +735,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -745,7 +745,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -757,7 +757,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] wxBitmap bmp = CreateBitmapXRGB(8, 8, true); REQUIRE(bmp.GetDepth() == 32); REQUIRE_FALSE(bmp.HasAlpha()); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image const int subX = 2; @@ -791,7 +791,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -800,7 +800,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -812,7 +812,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -822,7 +822,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -834,7 +834,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] // RGBA Bitmap wxBitmap bmp = CreateBitmapRGBA(8, 8, false); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() == NULL); + REQUIRE(bmp.GetMask() == nullptr); // Reference image const int subX = 2; @@ -850,7 +850,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -859,7 +859,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -868,7 +868,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -878,7 +878,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -889,7 +889,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] // RGBA Bitmap wxBitmap bmp = CreateBitmapRGBA(8, 8, true); REQUIRE(bmp.HasAlpha() == true); - REQUIRE(bmp.GetMask() != NULL); + REQUIRE(bmp.GetMask() != nullptr); // Reference image const int subX = 2; @@ -907,7 +907,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } @@ -916,7 +916,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -928,7 +928,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] return; wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -938,7 +938,7 @@ TEST_CASE("GraphicsBitmapTestCase::SubBitmap", "[graphbitmap][subbitmap][create] SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphSubBitmap(gr, bmp, subX, subY, subW, subH, image); } #endif // wxUSE_GRAPHICS_CAIRO @@ -967,7 +967,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } @@ -976,7 +976,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -985,7 +985,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -995,7 +995,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_CAIRO @@ -1019,7 +1019,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } @@ -1028,7 +1028,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -1037,7 +1037,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -1047,7 +1047,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_CAIRO @@ -1076,7 +1076,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } @@ -1085,7 +1085,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -1094,7 +1094,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -1104,7 +1104,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_CAIRO @@ -1134,7 +1134,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Default GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDefaultRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } @@ -1143,7 +1143,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("GDI+ GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetGDIPlusRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_GDIPLUS @@ -1152,7 +1152,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Direct2D GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetDirect2DRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_DIRECT2D @@ -1162,7 +1162,7 @@ TEST_CASE("GraphicsBitmapTestCase::CreateFromImage", "[graphbitmap][create][from SECTION("Cairo GC") { wxGraphicsRenderer* gr = wxGraphicsRenderer::GetCairoRenderer(); - REQUIRE(gr != NULL); + REQUIRE(gr != nullptr); CheckCreateGraphBitmapFromImage(gr, img); } #endif // wxUSE_GRAPHICS_CAIRO diff --git a/tests/graphics/graphmatrix.cpp b/tests/graphics/graphmatrix.cpp index 4161baf470..fcd2b0a184 100644 --- a/tests/graphics/graphmatrix.cpp +++ b/tests/graphics/graphmatrix.cpp @@ -29,8 +29,8 @@ public: { m_bmp.Create(100, 100); m_dc.SelectObject(m_bmp); - m_rend = NULL; - m_ctx = NULL; + m_rend = nullptr; + m_ctx = nullptr; } ~GraphicsMatrixTestCaseBase() @@ -48,7 +48,7 @@ public: virtual void tearDown() override { delete m_ctx; - m_ctx = NULL; + m_ctx = nullptr; } protected: diff --git a/tests/graphics/imagelist.cpp b/tests/graphics/imagelist.cpp index e543a1131f..bbe0b564d5 100644 --- a/tests/graphics/imagelist.cpp +++ b/tests/graphics/imagelist.cpp @@ -116,16 +116,16 @@ ImageListTestCase::ImageListTestCase() REQUIRE(ico.IsOk()); REQUIRE(bmpRGB.HasAlpha() == false); - REQUIRE(bmpRGB.GetMask() == NULL); + REQUIRE(bmpRGB.GetMask() == nullptr); REQUIRE(bmpRGBWithMask.HasAlpha() == false); - REQUIRE(bmpRGBWithMask.GetMask() != NULL); + REQUIRE(bmpRGBWithMask.GetMask() != nullptr); REQUIRE(bmpRGBA.HasAlpha() == true); - REQUIRE(bmpRGBA.GetMask() == NULL); + REQUIRE(bmpRGBA.GetMask() == nullptr); REQUIRE(bmpRGBAWithMask.HasAlpha() == true); - REQUIRE(bmpRGBAWithMask.GetMask() != NULL); + REQUIRE(bmpRGBAWithMask.GetMask() != nullptr); } // ---------------------------------------------------------------------------- @@ -480,7 +480,7 @@ TEST_CASE_METHOD(ImageListTestCase, CHECK(il.GetImageCount() == 1); wxBitmap bmp1 = il.GetBitmap(idx); CHECK(bmp1.HasAlpha() == false); - CHECK(bmp1.GetMask() == NULL); + CHECK(bmp1.GetMask() == nullptr); CHECK(bmp1.GetSize() == BITMAP_SIZE); idx = il.Add(bmpRGBWithMask); @@ -503,7 +503,7 @@ TEST_CASE_METHOD(ImageListTestCase, CHECK(il.GetImageCount() == 1); wxBitmap bmp1 = il.GetBitmap(idx); CHECK(bmp1.HasAlpha() == true); - CHECK(bmp1.GetMask() == NULL); + CHECK(bmp1.GetMask() == nullptr); CHECK(bmp1.GetSize() == BITMAP_SIZE); idx = il.Add(bmpRGBAWithMask); @@ -541,7 +541,7 @@ TEST_CASE_METHOD(ImageListTestCase, wxBitmap bmp1 = il.GetBitmap(idx1); CHECK(bmp1.HasAlpha() == false); - CHECK(bmp1.GetMask() == NULL); + CHECK(bmp1.GetMask() == nullptr); CHECK(bmp1.GetSize() == BITMAP_SIZE); wxBitmap bmp2 = il.GetBitmap(idx2); @@ -562,7 +562,7 @@ TEST_CASE_METHOD(ImageListTestCase, wxBitmap bmp1 = il.GetBitmap(idx1); CHECK(bmp1.HasAlpha() == true); - CHECK(bmp1.GetMask() == NULL); + CHECK(bmp1.GetMask() == nullptr); CHECK(bmp1.GetSize() == BITMAP_SIZE); wxBitmap bmp2 = il.GetBitmap(idx2); @@ -733,14 +733,14 @@ TEST_CASE("ImageList:HiDPI", "[imagelist][hidpi]") CHECK(bmp1x.GetSize() == wxSize(8, 4)); CHECK(bmp1x.GetLogicalSize() == wxSize(8, 4)); CHECK_FALSE(bmp1x.HasAlpha()); - CHECK(bmp1x.GetMask() == NULL); + CHECK(bmp1x.GetMask() == nullptr); wxBitmap bmp2x(img2, -1, 2.0); REQUIRE(bmp2x.IsOk()); CHECK(bmp2x.GetSize() == wxSize(16, 8)); CHECK(bmp2x.GetLogicalSize() == wxSize(8, 4)); CHECK_FALSE(bmp2x.HasAlpha()); - CHECK(bmp2x.GetMask() == NULL); + CHECK(bmp2x.GetMask() == nullptr); // Logical image size wxImageList il(8, 4, false); @@ -759,7 +759,7 @@ TEST_CASE("ImageList:HiDPI", "[imagelist][hidpi]") CHECK(bmp.GetSize() == wxSize(16, 8)); CHECK(bmp.GetLogicalSize() == wxSize(8, 4)); CHECK_FALSE(bmp.HasAlpha()); - CHECK(bmp.GetMask() == NULL); + CHECK(bmp.GetMask() == nullptr); bmp = il.GetBitmap(1); REQUIRE(bmp.IsOk() == true); @@ -767,6 +767,6 @@ TEST_CASE("ImageList:HiDPI", "[imagelist][hidpi]") CHECK(bmp.GetSize() == wxSize(8, 4)); CHECK(bmp.GetLogicalSize() == wxSize(8, 4)); CHECK_FALSE(bmp.HasAlpha()); - CHECK(bmp.GetMask() == NULL); + CHECK(bmp.GetMask() == nullptr); } #endif // wxHAS_DPI_INDEPENDENT_PIXELS diff --git a/tests/graphics/measuring.cpp b/tests/graphics/measuring.cpp index 4ee2fef9f0..0e1836fb1a 100644 --- a/tests/graphics/measuring.cpp +++ b/tests/graphics/measuring.cpp @@ -46,7 +46,7 @@ void GetTextExtentTester(const T& obj) { // Test that getting the height only doesn't crash. int y; - obj.GetTextExtent("H", NULL, &y); + obj.GetTextExtent("H", nullptr, &y); CHECK( y > 1 ); @@ -71,7 +71,7 @@ TEST_CASE("wxDC::GetTextExtent", "[dc][text-extent]") GetTextExtentTester(dc); int w; - dc.GetMultiLineTextExtent("Good\nbye", &w, NULL); + dc.GetMultiLineTextExtent("Good\nbye", &w, nullptr); const wxSize sz = dc.GetTextExtent("Good"); CHECK( w == sz.x ); @@ -126,19 +126,19 @@ TEST_CASE("wxDC::LeadingAndDescent", "[dc][text-extent]") // Retrieving just the descent should work. int descent = -17; - dc.GetTextExtent("foo", NULL, NULL, &descent); + dc.GetTextExtent("foo", nullptr, nullptr, &descent); CHECK( descent != -17 ); // Same for external leading. int leading = -289; - dc.GetTextExtent("foo", NULL, NULL, NULL, &leading); + dc.GetTextExtent("foo", nullptr, nullptr, nullptr, &leading); CHECK( leading != -289 ); // And both should also work for the empty string as they retrieve the // values valid for the entire font and not just this string. int descent2, leading2; - dc.GetTextExtent("", NULL, NULL, &descent2, &leading2); + dc.GetTextExtent("", nullptr, nullptr, &descent2, &leading2); CHECK( descent2 == descent ); CHECK( leading2 == leading ); diff --git a/tests/hashes/hashes.cpp b/tests/hashes/hashes.cpp index bfefba7590..82e9de6afc 100644 --- a/tests/hashes/hashes.cpp +++ b/tests/hashes/hashes.cpp @@ -155,13 +155,13 @@ void HashesTestCase::wxHashTableTest() CPPUNIT_ASSERT( hash.Delete(i) == o + i + 20); for ( i = 0; i < COUNT/2; ++i ) - CPPUNIT_ASSERT( hash.Get(i) == NULL); + CPPUNIT_ASSERT( hash.Get(i) == nullptr); hash2.Put(wxT("foo"), o + 1); hash2.Put(wxT("bar"), o + 2); hash2.Put(wxT("baz"), o + 3); - CPPUNIT_ASSERT(hash2.Get(wxT("moo")) == NULL); + CPPUNIT_ASSERT(hash2.Get(wxT("moo")) == nullptr); CPPUNIT_ASSERT(hash2.Get(wxT("bar")) == o + 2); hash2.Put(wxT("bar"), o + 0); @@ -177,31 +177,31 @@ void HashesTestCase::wxHashTableTest() hash.Put(3, &dummy); hash.Delete(3); - CPPUNIT_ASSERT(hash.Get(3) == NULL); + CPPUNIT_ASSERT(hash.Get(3) == nullptr); hash.Put(3, &dummy); hash.Put(13, &dummy); hash.Delete(3); - CPPUNIT_ASSERT(hash.Get(3) == NULL); + CPPUNIT_ASSERT(hash.Get(3) == nullptr); hash.Delete(13); - CPPUNIT_ASSERT(hash.Get(13) == NULL); + CPPUNIT_ASSERT(hash.Get(13) == nullptr); hash.Put(3, &dummy); hash.Put(13, &dummy); hash.Delete(13); - CPPUNIT_ASSERT(hash.Get(13) == NULL); + CPPUNIT_ASSERT(hash.Get(13) == nullptr); hash.Delete(3); - CPPUNIT_ASSERT(hash.Get(3) == NULL); + CPPUNIT_ASSERT(hash.Get(3) == nullptr); } // test for key + value access (specifically that supplying either - // wrong key or wrong value returns NULL) + // wrong key or wrong value returns nullptr) { wxHashTable hash(wxKEY_INTEGER, 10); wxObject dummy[8]; @@ -209,15 +209,15 @@ void HashesTestCase::wxHashTableTest() hash.Put(3, 7, dummy + 7); hash.Put(4, 8, dummy + 8); - CPPUNIT_ASSERT(hash.Get(7) == NULL); + CPPUNIT_ASSERT(hash.Get(7) == nullptr); CPPUNIT_ASSERT(hash.Get(3, 7) == dummy + 7); - CPPUNIT_ASSERT(hash.Get(4) == NULL); - CPPUNIT_ASSERT(hash.Get(3) == NULL); - CPPUNIT_ASSERT(hash.Get(8) == NULL); - CPPUNIT_ASSERT(hash.Get(8, 4) == NULL); + CPPUNIT_ASSERT(hash.Get(4) == nullptr); + CPPUNIT_ASSERT(hash.Get(3) == nullptr); + CPPUNIT_ASSERT(hash.Get(8) == nullptr); + CPPUNIT_ASSERT(hash.Get(8, 4) == nullptr); - CPPUNIT_ASSERT(hash.Delete(7) == NULL); - CPPUNIT_ASSERT(hash.Delete(3) == NULL); + CPPUNIT_ASSERT(hash.Delete(7) == nullptr); + CPPUNIT_ASSERT(hash.Delete(3) == nullptr); CPPUNIT_ASSERT(hash.Delete(3, 7) == dummy + 7); } @@ -289,13 +289,13 @@ void HashesTestCase::wxTypedHashTableTest() { Foo *foo = hash.Get(hashTestData[n], n); - CPPUNIT_ASSERT( foo != NULL ); + CPPUNIT_ASSERT( foo != nullptr ); CPPUNIT_ASSERT( foo->n == (int)n ); } // element not in hash - CPPUNIT_ASSERT( hash.Get(1234) == NULL ); - CPPUNIT_ASSERT( hash.Get(1, 0) == NULL ); + CPPUNIT_ASSERT( hash.Get(1234) == nullptr ); + CPPUNIT_ASSERT( hash.Get(1, 0) == nullptr ); // delete from hash without deleting object Foo* foo = hash.Delete(0); diff --git a/tests/html/htmlparser.cpp b/tests/html/htmlparser.cpp index 641e658ece..f79c0e39a7 100644 --- a/tests/html/htmlparser.cpp +++ b/tests/html/htmlparser.cpp @@ -45,8 +45,8 @@ TEST_CASE("wxHtmlCell::Detach", "[html][cell]") { wxMemoryDC dc; - wxScopedPtr const top(new wxHtmlContainerCell(NULL)); - wxHtmlContainerCell* const cont = new wxHtmlContainerCell(NULL); + wxScopedPtr const top(new wxHtmlContainerCell(nullptr)); + wxHtmlContainerCell* const cont = new wxHtmlContainerCell(nullptr); wxHtmlCell* const cell1 = new wxHtmlWordCell("Hello", dc); wxHtmlCell* const cell2 = new wxHtmlColourCell(*wxRED); wxHtmlCell* const cell3 = new wxHtmlWordCell("world", dc); @@ -59,7 +59,7 @@ TEST_CASE("wxHtmlCell::Detach", "[html][cell]") SECTION("container") { top->Detach(cont); - CHECK( top->GetFirstChild() == NULL ); + CHECK( top->GetFirstChild() == nullptr ); delete cont; } @@ -86,7 +86,7 @@ TEST_CASE("wxHtmlCell::Detach", "[html][cell]") cont->Detach(cell3); CHECK( cont->GetFirstChild() == cell1 ); CHECK( cell1->GetNext() == cell2 ); - CHECK( cell2->GetNext() == NULL ); + CHECK( cell2->GetNext() == nullptr ); delete cell3; } diff --git a/tests/html/htmlwindow.cpp b/tests/html/htmlwindow.cpp index f8ab1d0431..b543b875bd 100644 --- a/tests/html/htmlwindow.cpp +++ b/tests/html/htmlwindow.cpp @@ -76,7 +76,7 @@ void HtmlWindowTestCase::setUp() void HtmlWindowTestCase::tearDown() { DeleteTestWindow(m_win); - m_win = NULL; + m_win = nullptr; } // ---------------------------------------------------------------------------- diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 80db358f7c..77ee78d0ee 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -908,7 +908,7 @@ enum static void CompareImage(const wxImageHandler& handler, const wxImage& image, - int properties = 0, const wxImage *compareTo = NULL) + int properties = 0, const wxImage *compareTo = nullptr) { wxBitmapType type = handler.GetType(); @@ -1107,7 +1107,7 @@ void ImageTestCase::SavePNG() #if wxUSE_LIBTIFF static void TestTIFFImage(const wxString& option, int value, - const wxImage *compareImage = NULL) + const wxImage *compareImage = nullptr) { wxImage image; if (compareImage) diff --git a/tests/interactive/output.cpp b/tests/interactive/output.cpp index 30645d2146..4fcbf7ea54 100644 --- a/tests/interactive/output.cpp +++ b/tests/interactive/output.cpp @@ -105,7 +105,7 @@ void InteractiveOutputTestCase::TestDllListLoaded() const wxDynamicLibraryDetails& details = dlls[n]; wxPrintf("%-45s", details.GetPath()); - void *addr wxDUMMY_INITIALIZE(NULL); + void *addr wxDUMMY_INITIALIZE(nullptr); size_t len wxDUMMY_INITIALIZE(0); if ( details.GetAddress(&addr, &len) ) { @@ -154,7 +154,7 @@ void InteractiveOutputTestCase::TestMimeEnum() filetype->GetDescription(&desc); filetype->GetExtensions(exts); - filetype->GetIcon(NULL); + filetype->GetIcon(nullptr); wxString extsAll; for ( size_t e = 0; e < exts.GetCount(); e++ ) diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index 94539d062f..097e2e56aa 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -31,7 +31,7 @@ class IntlTestCase : public CppUnit::TestCase { public: - IntlTestCase() { m_locale=NULL; } + IntlTestCase() { m_locale=nullptr; } virtual void setUp() override; virtual void tearDown() override; @@ -70,7 +70,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( IntlTestCase, "IntlTestCase" ); void IntlTestCase::setUp() { // Check that French locale is supported, this test doesn't work without it - // and all the other function need to check whether m_locale is non-NULL + // and all the other function need to check whether m_locale is non-null // before continuing if ( !wxLocale::IsAvailable(wxLANGUAGE_FRENCH) ) return; @@ -92,7 +92,7 @@ void IntlTestCase::tearDown() if (m_locale) { delete m_locale; - m_locale = NULL; + m_locale = nullptr; } } @@ -225,12 +225,12 @@ void IntlTestCase::DateTimeFmtFrench() void IntlTestCase::IsAvailable() { - const wxString origLocale(setlocale(LC_ALL, NULL)); + const wxString origLocale(setlocale(LC_ALL, nullptr)); // Calling IsAvailable() shouldn't change the locale. wxLocale::IsAvailable(wxLANGUAGE_ENGLISH); - CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, NULL) ); + CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, nullptr) ); } // The test may fail in ANSI builds because of unsupported encoding, but we @@ -408,7 +408,7 @@ static void CheckFindLanguage(const wxString& tag, const char* expected) TEST_CASE("wxUILocale::FindLanguageInfo", "[uilocale]") { - CheckFindLanguage("", NULL); + CheckFindLanguage("", nullptr); CheckFindLanguage("en", "en"); CheckFindLanguage("en_US", "en_US"); CheckFindLanguage("en_US.utf8", "en_US"); diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index 02fad418c5..40bb606ed5 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -365,7 +365,7 @@ void macroCompilabilityTest() TEST_CASE("wxLog::Trace", "[log][.]") { // Running this test without setting WXTRACE is useless. - REQUIRE( wxGetEnv("WXTRACE", NULL) ); + REQUIRE( wxGetEnv("WXTRACE", nullptr) ); wxLogTrace("logtest", "Starting test"); wxMilliSleep(250); diff --git a/tests/longlong/longlongtest.cpp b/tests/longlong/longlongtest.cpp index 00b18891c4..5d1678859f 100644 --- a/tests/longlong/longlongtest.cpp +++ b/tests/longlong/longlongtest.cpp @@ -89,7 +89,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( LongLongTestCase, "LongLongTestCase" ); LongLongTestCase::LongLongTestCase() { - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); } void LongLongTestCase::Conversion() diff --git a/tests/mbconv/convautotest.cpp b/tests/mbconv/convautotest.cpp index 81e6288572..9e006480f2 100644 --- a/tests/mbconv/convautotest.cpp +++ b/tests/mbconv/convautotest.cpp @@ -131,7 +131,7 @@ void ConvAutoTestCase::TestFirstChar(const char *src, wchar_t wch, size_t len, ConvState st, wxFontEncoding fe) { wxConvAuto conv(fe); - wxWCharBuffer wbuf = conv.cMB2WC(src, len, NULL); + wxWCharBuffer wbuf = conv.cMB2WC(src, len, nullptr); CPPUNIT_ASSERT( wbuf ); CPPUNIT_ASSERT_EQUAL( wch, *wbuf ); st.Check(conv); diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index 53309c4b60..3bf203a0ac 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -182,21 +182,21 @@ private: // of each length void UTF8_41() { UTF8("\x41", u41); } void UTF8_7f() { UTF8("\x7f", u7f); } - void UTF8_80() { UTF8("\x80", NULL); } + void UTF8_80() { UTF8("\x80", nullptr); } - void UTF8_c2_7f() { UTF8("\xc2\x7f", NULL); } + void UTF8_c2_7f() { UTF8("\xc2\x7f", nullptr); } void UTF8_c2_80() { UTF8("\xc2\x80", u80); } void UTF8_ce_91() { UTF8("\xce\x91", u391); } void UTF8_df_bf() { UTF8("\xdf\xbf", u7ff); } - void UTF8_df_c0() { UTF8("\xdf\xc0", NULL); } + void UTF8_df_c0() { UTF8("\xdf\xc0", nullptr); } - void UTF8_e0_a0_7f() { UTF8("\xe0\xa0\x7f", NULL); } + void UTF8_e0_a0_7f() { UTF8("\xe0\xa0\x7f", nullptr); } void UTF8_e0_a0_80() { UTF8("\xe0\xa0\x80", u800); } void UTF8_e2_98_a0() { UTF8("\xe2\x98\xa0", u2620); } void UTF8_ef_bf_bd() { UTF8("\xef\xbf\xbd", ufffd); } - void UTF8_ef_bf_c0() { UTF8("\xef\xbf\xc0", NULL); } + void UTF8_ef_bf_c0() { UTF8("\xef\xbf\xc0", nullptr); } - void UTF8_f0_90_80_7f() { UTF8("\xf0\x90\x80\x7f", NULL); } + void UTF8_f0_90_80_7f() { UTF8("\xf0\x90\x80\x7f", nullptr); } void UTF8_f0_90_80_80() { UTF8("\xf0\x90\x80\x80", u10000); } void UTF8_f4_8f_bf_bd() { UTF8("\xf4\x8f\xbf\xbd", u10fffd); } @@ -235,7 +235,7 @@ void MBConvTestCase::WC2CP1250() } data[] = { { L"hello", "hello" }, // test that it works in simplest case - { L"\xBD of \xBD is \xBC", NULL }, // this should fail as cp1250 doesn't have 1/2 + { L"\xBD of \xBD is \xBC", nullptr }, // this should fail as cp1250 doesn't have 1/2 }; wxCSConv cs1250(wxFONTENCODING_CP1250); @@ -248,7 +248,7 @@ void MBConvTestCase::WC2CP1250() } else { - CPPUNIT_ASSERT( (const char*)cs1250.cWC2MB(d.wc) == NULL ); + CPPUNIT_ASSERT( (const char*)cs1250.cWC2MB(d.wc) == nullptr ); } } } @@ -471,13 +471,13 @@ void MBConvTestCase::UTF8Tests() #if SIZEOF_WCHAR_T == 2 // Can't use \ud800 as it's an invalid Unicode character. const wchar_t wc = 0xd800; - CPPUNIT_ASSERT_EQUAL(wxCONV_FAILED, wxConvUTF8.FromWChar(NULL, 0, &wc, 1)); + CPPUNIT_ASSERT_EQUAL(wxCONV_FAILED, wxConvUTF8.FromWChar(nullptr, 0, &wc, 1)); #endif // SIZEOF_WCHAR_T == 2 SECTION("UTF-8-FFFF") { const wchar_t wcFFFF = 0xFFFF; - REQUIRE(wxConvUTF8.FromWChar(NULL, 0, &wcFFFF, 1) == 3); + REQUIRE(wxConvUTF8.FromWChar(nullptr, 0, &wcFFFF, 1) == 3); char buf[4]; buf[3] = '\0'; @@ -846,7 +846,7 @@ void MBConvTestCase::BufSize() const char *cp1251text = "\313\301\326\305\324\323\321 \325\304\301\336\316\331\315"; - const size_t lenW = conv1251.MB2WC(NULL, cp1251text, 0); + const size_t lenW = conv1251.MB2WC(nullptr, cp1251text, 0); CPPUNIT_ASSERT_EQUAL( strlen(cp1251text), lenW ); wxWCharBuffer wbuf(lenW + 1); // allocates lenW + 2 characters wbuf.data()[lenW + 1] = L'!'; @@ -872,7 +872,7 @@ void MBConvTestCase::BufSize() CPPUNIT_ASSERT( convUTF16.IsOk() ); const wchar_t *utf16text = L"Hello"; - const size_t lenMB = convUTF16.WC2MB(NULL, utf16text, 0); + const size_t lenMB = convUTF16.WC2MB(nullptr, utf16text, 0); CPPUNIT_ASSERT_EQUAL( wcslen(utf16text)*2, lenMB ); wxCharBuffer buf(lenMB + 2); // it only adds 1 for NUL on its own, we need 2 // for NUL and an extra one for the guard byte @@ -1142,7 +1142,7 @@ void MBConvTestCase::TestDecoder( // calculate the output size size_t outputWritten = converter.MB2WC ( - 0, + nullptr, (const char*)inputCopy.data(), 0 ); @@ -1209,7 +1209,7 @@ void MBConvTestCase::TestEncoder( // instead of computing it precisely size_t outputWritten = converter.WC2MB ( - 0, + nullptr, (const wchar_t*)inputCopy.data(), 0 ); @@ -1322,7 +1322,7 @@ void MBConvTestCase::TestStreamEncoder( #ifdef HAVE_WCHAR_H // Check that 'charSequence' translates to 'wideSequence' and back. -// Invalid sequences can be tested by giving NULL for 'wideSequence'. Even +// Invalid sequences can be tested by giving nullptr for 'wideSequence'. Even // invalid sequences should roundtrip when an option is given and this is // checked. // @@ -1341,7 +1341,7 @@ void MBConvTestCase::UTF8PUA(const char *charSequence, const wchar_t *wideSequence) { UTF8(charSequence, wideSequence, wxMBConvUTF8::MAP_INVALID_UTF8_NOT); - UTF8(charSequence, NULL, wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA); + UTF8(charSequence, nullptr, wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA); UTF8(charSequence, wideSequence, wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL); } @@ -1353,7 +1353,7 @@ void MBConvTestCase::UTF8Octal(const char *charSequence, { UTF8(charSequence, wideSequence, wxMBConvUTF8::MAP_INVALID_UTF8_NOT); UTF8(charSequence, wideSequence, wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA); - UTF8(charSequence, NULL, wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL); + UTF8(charSequence, nullptr, wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL); } // in case wcscpy is missing @@ -1429,7 +1429,7 @@ void MBConvTestCase::UTF8(const char *charSequence, // translate it into wide characters wxMBConvUTF8 utf8(option); wchar_t widechars[BUFSIZE]; - size_t lenResult = utf8.MB2WC(NULL, bytes, 0); + size_t lenResult = utf8.MB2WC(nullptr, bytes, 0); size_t result = utf8.MB2WC(widechars, bytes, BUFSIZE); UTF8ASSERT(result == lenResult); @@ -1449,7 +1449,7 @@ void MBConvTestCase::UTF8(const char *charSequence, UTF8ASSERT(wx_wcslen(widechars) == result); } else { - // If 'wideSequence' is NULL, then the result is expected to be + // If 'wideSequence' is null, then the result is expected to be // invalid. Normally that is as far as we can go, but if there is an // option then the conversion should succeed anyway, and it should be // possible to translate back to the original @@ -1464,7 +1464,7 @@ void MBConvTestCase::UTF8(const char *charSequence, // translate it back and check we get the original char bytesAgain[BUFSIZE]; - size_t lenResultAgain = utf8.WC2MB(NULL, widechars, 0); + size_t lenResultAgain = utf8.WC2MB(nullptr, widechars, 0); size_t resultAgain = utf8.WC2MB(bytesAgain, widechars, BUFSIZE); UTF8ASSERT(resultAgain == lenResultAgain); UTF8ASSERT(resultAgain != (size_t)-1); diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index f129434d80..d97e15f209 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -249,8 +249,8 @@ void MenuTestCase::FindInMenubar() } // Find by id: - wxMenu* menu = NULL; - wxMenuItem* item = NULL; + wxMenu* menu = nullptr; + wxMenuItem* item = nullptr; item = bar->FindItem(MenuTestCase_Foo, &menu); CPPUNIT_ASSERT( item ); CPPUNIT_ASSERT( menu ); @@ -562,7 +562,7 @@ public: { m_win->Bind(wxEVT_MENU, &MenuEventHandler::OnMenu, this); - m_event = NULL; + m_event = nullptr; } virtual ~MenuEventHandler() @@ -573,13 +573,13 @@ public: } // Check that we received an event with the given ID and return the event - // object if we did (otherwise fail the test and return NULL). + // object if we did (otherwise fail the test and return nullptr). const wxObject* CheckGot(int expectedId) { if ( !m_event ) { FAIL("Event not generated"); - return NULL; + return nullptr; } CHECK( m_event->GetId() == expectedId ); @@ -587,14 +587,14 @@ public: const wxObject* const src = m_event->GetEventObject(); delete m_event; - m_event = NULL; + m_event = nullptr; return src; } bool GotEvent() const { - return m_event != NULL; + return m_event != nullptr; } private: diff --git a/tests/misc/guifuncs.cpp b/tests/misc/guifuncs.cpp index 857cbdaab1..029ab66cdb 100644 --- a/tests/misc/guifuncs.cpp +++ b/tests/misc/guifuncs.cpp @@ -43,10 +43,10 @@ TEST_CASE("GUI::DisplaySize", "[guifuncs]") CHECK( sz.x == w ); CHECK( sz.y == h ); - // test that passing NULL works as expected, e.g. doesn't crash - wxDisplaySize(NULL, NULL); - wxDisplaySize(&w, NULL); - wxDisplaySize(NULL, &h); + // test that passing nullptr works as expected, e.g. doesn't crash + wxDisplaySize(nullptr, nullptr); + wxDisplaySize(&w, nullptr); + wxDisplaySize(nullptr, &h); CHECK( sz.x == w ); CHECK( sz.y == h ); @@ -211,7 +211,7 @@ TEST_CASE("GUI::FindWindowAtPoint", "[guifuncs]") TEST_CASE("wxWindow::Dump", "[window]") { - CHECK_NOTHROW( wxDumpWindow(NULL) ); + CHECK_NOTHROW( wxDumpWindow(nullptr) ); wxScopedPtr button(new wxButton(wxTheApp->GetTopWindow(), wxID_ANY, "bloordyblop")); diff --git a/tests/misc/misctests.cpp b/tests/misc/misctests.cpp index 3571514aa0..a95527f2c0 100644 --- a/tests/misc/misctests.cpp +++ b/tests/misc/misctests.cpp @@ -76,7 +76,7 @@ void MiscTestCase::Assert() WX_ASSERT_FAILS_WITH_ASSERT(AssertIfOdd(1)); // doesn't fail any more - wxAssertHandler_t oldHandler = wxSetAssertHandler(NULL); + wxAssertHandler_t oldHandler = wxSetAssertHandler(nullptr); AssertIfOdd(17); wxSetAssertHandler(oldHandler); } @@ -97,23 +97,23 @@ void MiscTestCase::Delete() { // Allocate some arbitrary memory to get a valid pointer: long *pointer = new long; - CPPUNIT_ASSERT( pointer != NULL ); + CPPUNIT_ASSERT( pointer != nullptr ); - // Check that wxDELETE sets the pointer to NULL: + // Check that wxDELETE sets the pointer to nullptr: wxDELETE( pointer ); - CPPUNIT_ASSERT( pointer == NULL ); + CPPUNIT_ASSERT( pointer == nullptr ); // Allocate some arbitrary array to get a valid pointer: long *array = new long[ 3 ]; - CPPUNIT_ASSERT( array != NULL ); + CPPUNIT_ASSERT( array != nullptr ); - // Check that wxDELETEA sets the pointer to NULL: + // Check that wxDELETEA sets the pointer to nullptr: wxDELETEA( array ); - CPPUNIT_ASSERT( array == NULL ); + CPPUNIT_ASSERT( array == nullptr ); // this results in compilation error, as it should #if 0 - struct SomeUnknownStruct *p = NULL; + struct SomeUnknownStruct *p = nullptr; wxDELETE(p); #endif } @@ -127,7 +127,7 @@ namespace // used in WX_ASSERT_FAILS_WITH_ASSERT() in StaticCast() below bool IsNull(void *p) { - return p == NULL; + return p == nullptr; } #endif // __WXDEBUG__ diff --git a/tests/net/ipc.cpp b/tests/net/ipc.cpp index 8c5e304706..c5494a2ad4 100644 --- a/tests/net/ipc.cpp +++ b/tests/net/ipc.cpp @@ -77,7 +77,7 @@ protected: { wxTheApp->MainLoop(); - return NULL; + return nullptr; } wxDECLARE_NO_COPY_CLASS(EventThread); @@ -92,7 +92,7 @@ class IPCTestServer : public wxServer public: IPCTestServer() { - m_conn = NULL; + m_conn = nullptr; #if wxUSE_SOCKETS_FOR_IPC // we must call this from the main thread @@ -122,7 +122,7 @@ public: virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) { if ( topic != IPC_TEST_TOPIC ) - return NULL; + return nullptr; m_conn = new IPCTestConnection; return m_conn; @@ -135,7 +135,7 @@ private: wxDECLARE_NO_COPY_CLASS(IPCTestServer); }; -static IPCTestServer *gs_server = NULL; +static IPCTestServer *gs_server = nullptr; // ---------------------------------------------------------------------------- // test client class @@ -146,7 +146,7 @@ class IPCTestClient : public wxClient public: IPCTestClient() { - m_conn = NULL; + m_conn = nullptr; } virtual ~IPCTestClient() @@ -159,7 +159,7 @@ public: { m_conn = MakeConnection(host, service, topic); - return m_conn != NULL; + return m_conn != nullptr; } void Disconnect() @@ -167,7 +167,7 @@ public: if ( m_conn ) { delete m_conn; - m_conn = NULL; + m_conn = nullptr; } } @@ -184,7 +184,7 @@ private: wxDECLARE_NO_COPY_CLASS(IPCTestClient); }; -static IPCTestClient *gs_client = NULL; +static IPCTestClient *gs_client = nullptr; // ---------------------------------------------------------------------------- // the test code itself @@ -246,13 +246,13 @@ void IPCTestCase::Disconnect() { gs_client->Disconnect(); delete gs_client; - gs_client = NULL; + gs_client = nullptr; } if ( gs_server ) { delete gs_server; - gs_server = NULL; + gs_server = nullptr; } } diff --git a/tests/net/socket.cpp b/tests/net/socket.cpp index 8857af73e9..feccfd4883 100644 --- a/tests/net/socket.cpp +++ b/tests/net/socket.cpp @@ -37,11 +37,11 @@ class SocketTestCase : public CppUnit::TestCase public: SocketTestCase() { } - // get the address to connect to, if NULL is returned it means that the + // get the address to connect to, if nullptr is returned it means that the // test is disabled and shouldn't run at all static wxSockAddress* GetServer(); - // get the socket to read HTTP reply from, returns NULL if the test is + // get the socket to read HTTP reply from, returns nullptr if the test is // disabled static wxSocketClient* GetHTTPSocket(int flags = wxSOCKET_NONE); @@ -117,7 +117,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SocketTestCase, "SocketTestCase" ); wxSockAddress* SocketTestCase::GetServer() { if ( gs_serverHost.empty() ) - return NULL; + return nullptr; wxIPV4address *addr = new wxIPV4address; addr->Hostname(gs_serverHost); @@ -130,7 +130,7 @@ wxSocketClient* SocketTestCase::GetHTTPSocket(int flags) { wxSockAddress *addr = GetServer(); if ( !addr ) - return NULL; + return nullptr; wxSocketClient *sock = new wxSocketClient(flags); sock->SetTimeout(1); @@ -261,7 +261,7 @@ void SocketTestCase::ReadAnotherThread() { wxSocketClientPtr sock(SocketTestCase::GetHTTPSocket(wxSOCKET_BLOCK)); if ( !sock ) - return NULL; + return nullptr; char bufSmall[128]; sock->Read(bufSmall, WXSIZEOF(bufSmall)); @@ -272,7 +272,7 @@ void SocketTestCase::ReadAnotherThread() REQUIRE_NOTHROW( sock.reset() ); - return NULL; + return nullptr; } }; @@ -282,7 +282,7 @@ void SocketTestCase::ReadAnotherThread() thr.Run(); - CHECK( thr.Wait() == NULL ); + CHECK( thr.Wait() == nullptr ); } void SocketTestCase::UrlTest() diff --git a/tests/regex/wxregextest.cpp b/tests/regex/wxregextest.cpp index 291ed7afb1..5adcca9cd2 100644 --- a/tests/regex/wxregextest.cpp +++ b/tests/regex/wxregextest.cpp @@ -70,7 +70,7 @@ TEST_CASE("wxRegEx::Compile", "[regex][compile]") static void CheckMatch(const char* pattern, const char* text, - const char* expected = NULL, + const char* expected = nullptr, int compileFlags = wxRE_DEFAULT, int matchFlags = 0) { @@ -112,7 +112,7 @@ TEST_CASE("wxRegEx::Match", "[regex][match]") { // Match tests // pattern, text, expected results (match, followed by submatches - // tab separated, or NULL for no match expected) + // tab separated, or nullptr for no match expected) CheckMatch("foo", "bar"); CheckMatch("foo", "foobar", "foo"); @@ -125,7 +125,7 @@ TEST_CASE("wxRegEx::Match", "[regex][match]") CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "AA", wxRE_NEWLINE); CheckMatch("^[a-z].*$", "AA\nbb\nCC", "bb", wxRE_NEWLINE); CheckMatch("^[A-Z].*$", "AA\nbb\nCC", "CC", wxRE_NEWLINE, wxRE_NOTBOL); - CheckMatch("^[A-Z].*$", "AA\nbb\nCC", NULL, wxRE_NEWLINE, wxRE_NOTBOL | wxRE_NOTEOL); + CheckMatch("^[A-Z].*$", "AA\nbb\nCC", nullptr, wxRE_NEWLINE, wxRE_NOTBOL | wxRE_NOTEOL); CheckMatch("([[:alpha:]]+) ([[:alpha:]]+) ([[:digit:]]+).* ([[:digit:]]+)$", "Fri Jul 13 18:37:52 CEST 2001", "Fri Jul 13 18:37:52 CEST 2001\tFri\tJul\t13\t2001"); diff --git a/tests/sizers/gridsizer.cpp b/tests/sizers/gridsizer.cpp index 492bf9aab8..cfa6ee7cdd 100644 --- a/tests/sizers/gridsizer.cpp +++ b/tests/sizers/gridsizer.cpp @@ -57,9 +57,9 @@ GridSizerTestCase::GridSizerTestCase() GridSizerTestCase::~GridSizerTestCase() { delete m_win; - m_win = NULL; + m_win = nullptr; - m_sizer = NULL; + m_sizer = nullptr; } // ---------------------------------------------------------------------------- diff --git a/tests/streams/bstream.h b/tests/streams/bstream.h index deb9ae295c..c7381844e9 100644 --- a/tests/streams/bstream.h +++ b/tests/streams/bstream.h @@ -50,8 +50,8 @@ public: m_bSimpleTellOTest(false), m_bSeekInvalidBeyondEnd(true), m_bEofAtLastRead(true), - m_pCurrentIn(NULL), - m_pCurrentOut(NULL) + m_pCurrentIn(nullptr), + m_pCurrentOut(nullptr) { /* Nothing extra */ } virtual ~BaseStreamTestCase() { @@ -411,7 +411,7 @@ protected: } m_pCurrentIn = DoCreateInStream(); - wxASSERT(m_pCurrentIn != NULL); + wxASSERT(m_pCurrentIn != nullptr); return *m_pCurrentIn; } TStreamOut &CreateOutStream() @@ -422,28 +422,28 @@ protected: } m_pCurrentOut = DoCreateOutStream(); - wxASSERT(m_pCurrentOut != NULL); + wxASSERT(m_pCurrentOut != nullptr); return *m_pCurrentOut; } void DeleteInStream() { - if (m_pCurrentIn == NULL) + if (m_pCurrentIn == nullptr) return; delete m_pCurrentIn; - m_pCurrentIn = NULL; + m_pCurrentIn = nullptr; // In case something extra needs to be done. DoDeleteInStream(); } void DeleteOutStream() { - if (m_pCurrentOut == NULL) + if (m_pCurrentOut == nullptr) return; CPPUNIT_ASSERT(m_pCurrentOut->Close()); delete m_pCurrentOut; - m_pCurrentOut = NULL; + m_pCurrentOut = nullptr; // In case something extra needs to be done. DoDeleteOutStream(); } diff --git a/tests/streams/largefile.cpp b/tests/streams/largefile.cpp index 31ad203489..16552b139e 100644 --- a/tests/streams/largefile.cpp +++ b/tests/streams/largefile.cpp @@ -339,11 +339,11 @@ void GetVolumeInfo(const wxString& path) } } - // NULL means the current volume - const wxChar *pVol = vol.empty() ? (const wxChar *)NULL + // nullptr means the current volume + const wxChar *pVol = vol.empty() ? (const wxChar *)nullptr : vol.c_str(); - if (!::GetVolumeInformation(pVol, NULL, 0, NULL, NULL, + if (!::GetVolumeInformation(pVol, nullptr, 0, nullptr, nullptr, &volumeFlags, volumeType, WXSIZEOF(volumeType))) @@ -371,11 +371,11 @@ void MakeSparse(const wxString& path, int fd) if ((volumeFlags & FILE_SUPPORTS_SPARSE_FILES) != 0) if (!::DeviceIoControl((HANDLE)_get_osfhandle(fd), FSCTL_SET_SPARSE, - NULL, 0, NULL, 0, &cb, NULL)) + nullptr, 0, nullptr, 0, &cb, nullptr)) volumeFlags &= ~FILE_SUPPORTS_SPARSE_FILES; } -// return the suite if sparse files are supported, otherwise return NULL +// return the suite if sparse files are supported, otherwise return nullptr // CppUnit::Test* GetlargeFileSuite() { @@ -392,7 +392,7 @@ CppUnit::Test* GetlargeFileSuite() if ((volumeFlags & FILE_SUPPORTS_SPARSE_FILES) != 0) return largeFile::suite(); else - return NULL; + return nullptr; } #else // __WINDOWS__ @@ -400,7 +400,7 @@ CppUnit::Test* GetlargeFileSuite() bool IsFAT(const wxString& WXUNUSED(path)) { return false; } void MakeSparse(const wxString& WXUNUSED(path), int WXUNUSED(fd)) { } -// return the suite if sparse files are supported, otherwise return NULL +// return the suite if sparse files are supported, otherwise return nullptr // CppUnit::Test* GetlargeFileSuite() { @@ -428,7 +428,7 @@ CppUnit::Test* GetlargeFileSuite() if (st1.st_blocks != st2.st_blocks) return largeFile::suite(); else - return NULL; + return nullptr; } #endif // __WINDOWS__ diff --git a/tests/streams/socketstream.cpp b/tests/streams/socketstream.cpp index cf25ec7ed4..b646c9a2ef 100644 --- a/tests/streams/socketstream.cpp +++ b/tests/streams/socketstream.cpp @@ -83,7 +83,7 @@ protected: delete socket; } - return NULL; + return nullptr; } int m_port; @@ -167,10 +167,10 @@ wxSocketFlags socketStream::ms_flags = wxSOCKET_NONE; socketStream::socketStream() { m_readSocket = - m_writeSocket = NULL; + m_writeSocket = nullptr; m_writeThread = - m_readThread = NULL; + m_readThread = nullptr; wxSocketBase::Initialize(); } @@ -233,7 +233,7 @@ void socketStream::DoCheckInputStream(wxSocketInputStream& stream_in) { // This check sometimes fails in the AppVeyor CI environment for unknown // reason, so just log it there but don't fail the entire test suite run. - if ( wxGetEnv("APPVEYOR", NULL) ) + if ( wxGetEnv("APPVEYOR", nullptr) ) { if ( !stream_in.IsOk() ) { diff --git a/tests/streams/sstream.cpp b/tests/streams/sstream.cpp index fb12475f47..b22c0b51c5 100644 --- a/tests/streams/sstream.cpp +++ b/tests/streams/sstream.cpp @@ -133,7 +133,7 @@ TEST_CASE("wxStringOutputStream::Tell", "[stream]") #if wxUSE_UNICODE wxMBConvUTF16 convUTF16; - wxStringOutputStream ss16(NULL, convUTF16); + wxStringOutputStream ss16(nullptr, convUTF16); CHECK( ss16.TellO() == 0 ); const wxCharBuffer s16 = convUTF16.cWC2MB(wxWCharBuffer(str.wc_str())); diff --git a/tests/streams/stdstream.cpp b/tests/streams/stdstream.cpp index 4b663f7d73..5a783d5e46 100644 --- a/tests/streams/stdstream.cpp +++ b/tests/streams/stdstream.cpp @@ -123,7 +123,7 @@ void StdStreamTestCase::InputBuffer_pubsetbuf() wxStdInputStreamBuffer buffer(stream); char testBuffer[TEST_SIZE]; - CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL); + CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == nullptr); } void StdStreamTestCase::InputBuffer_pubseekoff() @@ -328,7 +328,7 @@ void StdStreamTestCase::OutputBuffer_pubsetbuf() wxStdOutputStreamBuffer buffer(stream); char testBuffer[TEST_SIZE]; - CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == NULL); + CPPUNIT_ASSERT(buffer.pubsetbuf(testBuffer, TEST_SIZE) == nullptr); } void StdStreamTestCase::OutputBuffer_pubseekoff() diff --git a/tests/streams/zlibstream.cpp b/tests/streams/zlibstream.cpp index c39871ab5c..d10f52e89b 100644 --- a/tests/streams/zlibstream.cpp +++ b/tests/streams/zlibstream.cpp @@ -111,7 +111,7 @@ protected: private: const char *GetDataBuffer(); const unsigned char *GetCompressedData(); - void doTestStreamData(int input_flag, int output_flag, int compress_level, const wxMemoryBuffer *buf = NULL); + void doTestStreamData(int input_flag, int output_flag, int compress_level, const wxMemoryBuffer *buf = nullptr); void doDecompress_ExternalData(const unsigned char *data, const char *value, size_t data_size, size_t value_size, int flag = wxZLIB_AUTO); private: @@ -138,9 +138,9 @@ private: zlibStream::zlibStream() :m_SizeCompressedData(0), - m_pCompressedData(NULL), - m_pTmpMemInStream(NULL), - m_pTmpMemOutStream(NULL) + m_pCompressedData(nullptr), + m_pTmpMemInStream(nullptr), + m_pTmpMemOutStream(nullptr) { // Init the data buffer. for (size_t i = 0; i < DATABUFFER_SIZE; i++) @@ -311,7 +311,7 @@ const unsigned char *zlibStream::GetCompressedData() memstream_out.CopyTo(m_pCompressedData, m_SizeCompressedData); } - CPPUNIT_ASSERT(m_pCompressedData != NULL); + CPPUNIT_ASSERT(m_pCompressedData != nullptr); return m_pCompressedData; } @@ -381,8 +381,8 @@ void zlibStream::doTestStreamData(int input_flag, int output_flag, int compress_ void zlibStream::doDecompress_ExternalData(const unsigned char *data, const char *value, size_t data_size, size_t value_size, int flag) { // See that the input is ok. - wxASSERT(data != NULL); - wxASSERT(value != NULL); + wxASSERT(data != nullptr); + wxASSERT(value != nullptr); wxASSERT(data_size > 0); wxASSERT(value_size > 0); @@ -494,12 +494,12 @@ wxZlibOutputStream *zlibStream::DoCreateOutStream() void zlibStream::DoDeleteInStream() { delete m_pTmpMemInStream; - m_pTmpMemInStream = NULL; + m_pTmpMemInStream = nullptr; } void zlibStream::DoDeleteOutStream() { delete m_pTmpMemOutStream; - m_pTmpMemOutStream = NULL; + m_pTmpMemOutStream = nullptr; } diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 8256db034d..6fefd3e3fc 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -48,7 +48,7 @@ TEST_CASE("CRT::SetGetEnv", "[crt][getenv][setenv]") CHECK( wxString(wxGetenv(TESTVAR_NAME)) == "something else" ); CHECK( wxUnsetEnv(TESTVAR_NAME) ); - CHECK( !wxGetEnv(TESTVAR_NAME, NULL) ); + CHECK( !wxGetEnv(TESTVAR_NAME, nullptr) ); CHECK( !wxGetenv(TESTVAR_NAME) ); #undef TESTVAR_NAME @@ -226,7 +226,7 @@ TEST_CASE("CRT::Strnlen", "[crt][strnlen]") CHECK( wxStrnlen(L"123456789", 8) == 8 ); CHECK( wxStrnlen(L"123456789", 12) == 9 ); - // wxStrlen() is only for NULL-terminated strings: + // wxStrlen() is only for null-terminated strings: CHECK( wxStrnlen("1234" "\0" "78", 12) == 4 ); CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 ); } @@ -239,7 +239,7 @@ TEST_CASE("CRT::Strtox", "[crt][strtod][strtol]") SECTION("char") { - char* end = NULL; + char* end = nullptr; CHECK( wxStrtod(s, &end) == d ); REQUIRE( end ); CHECK( *end == '@' ); @@ -251,7 +251,7 @@ TEST_CASE("CRT::Strtox", "[crt][strtod][strtol]") SECTION("wchar_t") { - wchar_t* end = NULL; + wchar_t* end = nullptr; CHECK( wxStrtod(s, &end) == d ); REQUIRE( end ); CHECK( *end == L'@' ); diff --git a/tests/strings/numformatter.cpp b/tests/strings/numformatter.cpp index ba0e86ac69..a1b80ca805 100644 --- a/tests/strings/numformatter.cpp +++ b/tests/strings/numformatter.cpp @@ -163,7 +163,7 @@ TEST_CASE_METHOD(NumFormatterTestCase, "NumFormatter::LongFromString", "[numform WX_ASSERT_FAILS_WITH_ASSERT ( - wxNumberFormatter::FromString("123", static_cast(0)) + wxNumberFormatter::FromString("123", static_cast(nullptr)) ); long l; @@ -208,7 +208,7 @@ TEST_CASE_METHOD(NumFormatterTestCase, "NumFormatter::LongLongFromString", "[num WX_ASSERT_FAILS_WITH_ASSERT ( - wxNumberFormatter::FromString("123", static_cast(0)) + wxNumberFormatter::FromString("123", static_cast(nullptr)) ); wxLongLong_t l; @@ -307,7 +307,7 @@ TEST_CASE_METHOD(NumFormatterTestCase, "NumFormatter::DoubleFromString", "[numfo WX_ASSERT_FAILS_WITH_ASSERT ( - wxNumberFormatter::FromString("123", static_cast(0)) + wxNumberFormatter::FromString("123", static_cast(nullptr)) ); double d; diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index a5acd38bba..7bf682272e 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -248,8 +248,8 @@ void StringTestCase::Constructors() const char *end = wxStrchr(s, '!'); CPPUNIT_ASSERT_EQUAL( "really", wxString(start, end) ); - // test if creating string from NULL C pointer works: - CPPUNIT_ASSERT_EQUAL( "", wxString((const char *)NULL) ); + // test if creating string from null C pointer works: + CPPUNIT_ASSERT_EQUAL( "", wxString((const char *)nullptr) ); } void StringTestCase::StaticConstructors() diff --git a/tests/strings/tokenizer.cpp b/tests/strings/tokenizer.cpp index 5400de53af..c921e8ec8b 100644 --- a/tests/strings/tokenizer.cpp +++ b/tests/strings/tokenizer.cpp @@ -264,7 +264,7 @@ void TokenizerTestCase::StrtokCompat() while ( tkz.HasMoreTokens() ) { CPPUNIT_ASSERT_EQUAL( wxString(s), tkz.GetNextToken() ); - s = wxStrtok(NULL, ttd.delims, &last); + s = wxStrtok(nullptr, ttd.delims, &last); } } } diff --git a/tests/strings/unicode.cpp b/tests/strings/unicode.cpp index 68dd2e827a..ac19eed9d6 100644 --- a/tests/strings/unicode.cpp +++ b/tests/strings/unicode.cpp @@ -25,7 +25,7 @@ struct StringConversionData { - // either str or wcs (but not both) may be NULL, this means that the conversion + // either str or wcs (but not both) may be null, this means that the conversion // to it should fail StringConversionData(const char *str_, const wchar_t *wcs_, int flags_ = 0) : str(str_), wcs(wcs_), flags(flags_) @@ -253,10 +253,10 @@ void UnicodeTestCase::ConversionFixed() #if wxUSE_UNICODE // check that when we convert a fixed number of characters we obtain the // expected return value - CPPUNIT_ASSERT_EQUAL( 0, wxConvLibc.ToWChar(NULL, 0, "", 0) ); - CPPUNIT_ASSERT_EQUAL( 1, wxConvLibc.ToWChar(NULL, 0, "x", 1) ); - CPPUNIT_ASSERT_EQUAL( 2, wxConvLibc.ToWChar(NULL, 0, "x", 2) ); - CPPUNIT_ASSERT_EQUAL( 2, wxConvLibc.ToWChar(NULL, 0, "xy", 2) ); + CPPUNIT_ASSERT_EQUAL( 0, wxConvLibc.ToWChar(nullptr, 0, "", 0) ); + CPPUNIT_ASSERT_EQUAL( 1, wxConvLibc.ToWChar(nullptr, 0, "x", 1) ); + CPPUNIT_ASSERT_EQUAL( 2, wxConvLibc.ToWChar(nullptr, 0, "x", 2) ); + CPPUNIT_ASSERT_EQUAL( 2, wxConvLibc.ToWChar(nullptr, 0, "xy", 2) ); #endif // wxUSE_UNICODE } @@ -311,10 +311,10 @@ void UnicodeTestCase::ConversionUTF7() StringConversionData("+--", L"+-"), // the following are invalid UTF-7 sequences - StringConversionData("\xa3", NULL), - StringConversionData("+", NULL), - StringConversionData("+~", NULL), - StringConversionData("a+", NULL), + StringConversionData("\xa3", nullptr), + StringConversionData("+", nullptr), + StringConversionData("+~", nullptr), + StringConversionData("a+", nullptr), }; for ( size_t n = 0; n < WXSIZEOF(utf7data); n++ ) @@ -344,7 +344,7 @@ void UnicodeTestCase::ConversionUTF8() #ifdef wxHAVE_U_ESCAPE StringConversionData("\xc2\xa3", L"\u00a3"), #endif - StringConversionData("\xc2", NULL), + StringConversionData("\xc2", nullptr), }; wxCSConv conv(wxT("utf-8")); @@ -357,10 +357,10 @@ void UnicodeTestCase::ConversionUTF8() static const char* const u25a6 = "\xe2\x96\xa6"; wxMBConvUTF8 c(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL); - CPPUNIT_ASSERT_EQUAL( 2, c.ToWChar(NULL, 0, u25a6, wxNO_LEN) ); - CPPUNIT_ASSERT_EQUAL( 0, c.ToWChar(NULL, 0, u25a6, 0) ); - CPPUNIT_ASSERT_EQUAL( 1, c.ToWChar(NULL, 0, u25a6, 3) ); - CPPUNIT_ASSERT_EQUAL( 2, c.ToWChar(NULL, 0, u25a6, 4) ); + CPPUNIT_ASSERT_EQUAL( 2, c.ToWChar(nullptr, 0, u25a6, wxNO_LEN) ); + CPPUNIT_ASSERT_EQUAL( 0, c.ToWChar(nullptr, 0, u25a6, 0) ); + CPPUNIT_ASSERT_EQUAL( 1, c.ToWChar(nullptr, 0, u25a6, 3) ); + CPPUNIT_ASSERT_EQUAL( 2, c.ToWChar(nullptr, 0, u25a6, 4) ); // Verify that converting a string with embedded NULs works. CPPUNIT_ASSERT_EQUAL( 5, wxString::FromUTF8("abc\0\x32", 5).length() ); @@ -419,7 +419,7 @@ void UnicodeTestCase::ConversionUTF16() wchar_t ws[2]; ws[0] = 0xd83d; ws[1] = 0xdc31; - CPPUNIT_ASSERT_EQUAL( 4, wxMBConvUTF32BE().FromWChar(NULL, 0, ws, 2) ); + CPPUNIT_ASSERT_EQUAL( 4, wxMBConvUTF32BE().FromWChar(nullptr, 0, ws, 2) ); #endif // UTF-16 internal representation } diff --git a/tests/strings/vsnprintf.cpp b/tests/strings/vsnprintf.cpp index f1fa10f99f..f907a2d974 100644 --- a/tests/strings/vsnprintf.cpp +++ b/tests/strings/vsnprintf.cpp @@ -109,7 +109,7 @@ TEST_CASE_METHOD(VsnprintfTestCase, "Vsnprintf::C", "[vsnprintf]") CMP("hi!", "%c%c%c", wxT('h'), wxT('i'), wxT('!')); // NOTE: - // the NULL characters _can_ be passed to %c to e.g. create strings + // the NUL characters _can_ be passed to %c to e.g. create strings // with embedded NULs (because strings are not always supposed to be // NUL-terminated). @@ -151,24 +151,24 @@ TEST_CASE_METHOD(VsnprintfTestCase, "Vsnprintf::P", "[vsnprintf]") (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO)) #if SIZEOF_VOID_P == 4 CMP("00ABCDEF", "%p", (void*)0xABCDEF); - CMP("00000000", "%p", (void*)NULL); + CMP("00000000", "%p", (void*)nullptr); #elif SIZEOF_VOID_P == 8 CMP("0000ABCDEFABCDEF", "%p", (void*)0xABCDEFABCDEF); - CMP("0000000000000000", "%p", (void*)NULL); + CMP("0000000000000000", "%p", (void*)nullptr); #endif #elif defined(__MINGW32__) #if SIZEOF_VOID_P == 4 CMP("00abcdef", "%p", (void*)0xABCDEF); - CMP("00000000", "%p", (void*)NULL); + CMP("00000000", "%p", (void*)nullptr); #elif SIZEOF_VOID_P == 8 CMP("0000abcdefabcdef", "%p", (void*)0xABCDEFABCDEF); - CMP("0000000000000000", "%p", (void*)NULL); + CMP("0000000000000000", "%p", (void*)nullptr); #endif #elif defined(__GNUG__) - // glibc prints pointers as %#x except for NULL pointers which are printed + // glibc prints pointers as %#x except for null pointers which are printed // as '(nil)'. CMP("0xabcdef", "%p", (void*)0xABCDEF); - CMP("(nil)", "%p", (void*)NULL); + CMP("(nil)", "%p", (void*)nullptr); #endif } @@ -282,7 +282,7 @@ TEST_CASE_METHOD(VsnprintfTestCase, "Vsnprintf::S", "[vsnprintf]") CMP_UTF8(ABCDE, "%.5s", ABCDEFGHI); #endif // wxUSE_UNICODE - // test a string which has a NULL character after "ab"; + // test a string which has a NUL character after "ab"; // obviously it should be handled exactly like just as "ab" CMP(" ab", "%5s", wxT("ab\0cdefghi")); } diff --git a/tests/test.cpp b/tests/test.cpp index fbc6a19119..c2b054656a 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -470,8 +470,8 @@ extern bool IsAutomaticTest() static int s_isAutomatic = -1; if ( s_isAutomatic == -1 ) { - s_isAutomatic = wxGetEnv(wxASCII_STR("GITHUB_ACTIONS"), NULL) || - wxGetEnv(wxASCII_STR("APPVEYOR"), NULL); + s_isAutomatic = wxGetEnv(wxASCII_STR("GITHUB_ACTIONS"), nullptr) || + wxGetEnv(wxASCII_STR("APPVEYOR"), nullptr); } return s_isAutomatic == 1; @@ -599,8 +599,8 @@ TestApp::TestApp() { m_runTests = true; - m_filterEventFunc = NULL; - m_processEventFunc = NULL; + m_filterEventFunc = nullptr; + m_processEventFunc = nullptr; #if wxUSE_GUI m_exitcode = EXIT_SUCCESS; @@ -647,7 +647,7 @@ bool TestApp::OnInit() Connect(wxEVT_IDLE, wxIdleEventHandler(TestApp::OnIdle)); #ifdef __WXGTK__ - g_log_set_default_handler(wxTestGLogHandler, NULL); + g_log_set_default_handler(wxTestGLogHandler, nullptr); #endif // __WXGTK__ #ifdef GDK_WINDOWING_X11 diff --git a/tests/testableframe.cpp b/tests/testableframe.cpp index 8882885208..7d3b51412a 100644 --- a/tests/testableframe.cpp +++ b/tests/testableframe.cpp @@ -13,7 +13,7 @@ #include "wx/app.h" #include "testableframe.h" -wxTestableFrame::wxTestableFrame() : wxFrame(NULL, wxID_ANY, wxASCII_STR("Test Frame")) +wxTestableFrame::wxTestableFrame() : wxFrame(nullptr, wxID_ANY, wxASCII_STR("Test Frame")) { // Use fixed position to facilitate debugging. Move(200, 200); @@ -46,19 +46,19 @@ EventCounter::EventCounter(wxWindow* win, wxEventType type) : m_type(type), m_frame = wxStaticCast(wxTheApp->GetTopWindow(), wxTestableFrame); m_win->Connect(m_type, wxEventHandler(wxTestableFrame::OnEvent), - NULL, m_frame); + nullptr, m_frame); } EventCounter::~EventCounter() { m_win->Disconnect(m_type, wxEventHandler(wxTestableFrame::OnEvent), - NULL, m_frame); + nullptr, m_frame); //This stops spurious counts from previous tests Clear(); - m_frame = NULL; - m_win = NULL; + m_frame = nullptr; + m_win = nullptr; } bool EventCounter::WaitEvent(int timeInMs) diff --git a/tests/testimage.h b/tests/testimage.h index d98e0886eb..d5d90b5c5e 100644 --- a/tests/testimage.h +++ b/tests/testimage.h @@ -73,8 +73,8 @@ public: { for ( int x = 0; x < m_image.GetWidth(); ++x ) { - wxString a1txt = dispAlphaVal ? (a1 != NULL ? wxString::Format("%02x", *a1) : dispAlphaValNull) : wxString(); - wxString a2txt = dispAlphaVal ? (a2 != NULL ? wxString::Format("%02x", *a2) : dispAlphaValNull) : wxString(); + wxString a1txt = dispAlphaVal ? (a1 != nullptr ? wxString::Format("%02x", *a1) : dispAlphaValNull) : wxString(); + wxString a2txt = dispAlphaVal ? (a2 != nullptr ? wxString::Format("%02x", *a2) : dispAlphaValNull) : wxString(); for ( int i = 0; i < 3; i++ ) { diff --git a/tests/textfile/textfiletest.cpp b/tests/textfile/textfiletest.cpp index e469949b7d..408580184b 100644 --- a/tests/textfile/textfiletest.cpp +++ b/tests/textfile/textfiletest.cpp @@ -34,7 +34,7 @@ class TextFileTestCase : public CppUnit::TestCase public: TextFileTestCase() { - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); } virtual void tearDown() override { unlink(GetTestFileName()); } diff --git a/tests/thread/atomic.cpp b/tests/thread/atomic.cpp index 7278a8d14e..978a7aa82e 100644 --- a/tests/thread/atomic.cpp +++ b/tests/thread/atomic.cpp @@ -135,7 +135,7 @@ TEST_CASE("Atomic::WithThreads", "[atomic]") for ( i = 0; i < count; ++i ) { // each thread should return 0, else it detected some problem - CHECK (threads[i]->Wait() == (wxThread::ExitCode)0); + CHECK (threads[i]->Wait() == (wxThread::ExitCode)nullptr); delete threads[i]; } diff --git a/tests/thread/misc.cpp b/tests/thread/misc.cpp index b445341415..335fa18d75 100644 --- a/tests/thread/misc.cpp +++ b/tests/thread/misc.cpp @@ -104,7 +104,7 @@ wxThread::ExitCode MyDetachedThread::Entry() wxMilliSleep(100); } - return 0; + return nullptr; } void MyDetachedThread::OnExit() @@ -140,7 +140,7 @@ public: //wxPrintf(wxT("Thread %lu finished to wait, exiting.\n"), GetId()); - return 0; + return nullptr; } private: @@ -181,7 +181,7 @@ public: m_sem->Post(); - return 0; + return nullptr; } private: diff --git a/tests/thread/queue.cpp b/tests/thread/queue.cpp index 3f74e5b51e..bd94cfbb1f 100644 --- a/tests/thread/queue.cpp +++ b/tests/thread/queue.cpp @@ -101,7 +101,7 @@ void QueueTestCase::TestReceive() int i; for ( i = 0; i < threadCount; ++i ) { - MyThread *previousThread = i == 0 ? NULL : threads[i-1]; + MyThread *previousThread = i == 0 ? nullptr : threads[i-1]; MyThread *thread = new MyThread(WaitInfinitlyLong, previousThread, msgCount); @@ -139,8 +139,8 @@ void QueueTestCase::TestReceive() // should return wxMSGQUEUUE_TIMEOUT. void QueueTestCase::TestReceiveTimeout() { - MyThread* thread1 = new MyThread(WaitWithTimeout, NULL, 2); - MyThread* thread2 = new MyThread(WaitWithTimeout, NULL, 2); + MyThread* thread1 = new MyThread(WaitWithTimeout, nullptr, 2); + MyThread* thread2 = new MyThread(WaitWithTimeout, nullptr, 2); CPPUNIT_ASSERT_EQUAL ( thread1->Create(), wxTHREAD_NO_ERROR ); CPPUNIT_ASSERT_EQUAL ( thread2->Create(), wxTHREAD_NO_ERROR ); @@ -185,7 +185,7 @@ void *QueueTestCase::MyThread::Entry() if ( result == wxMSGQUEUE_NO_ERROR ) { - if ( m_nextThread != NULL ) + if ( m_nextThread != nullptr ) { wxMessageQueueError res = m_nextThread->GetQueue().Post(msg); diff --git a/tests/thread/tls.cpp b/tests/thread/tls.cpp index 03c0822ee8..0b66049dbb 100644 --- a/tests/thread/tls.cpp +++ b/tests/thread/tls.cpp @@ -65,7 +65,7 @@ public: wxASSERT( gs_threadData.name == std::string("worker") ); wxASSERT( gs_threadData.number == 2 ); - return NULL; + return nullptr; } }; @@ -112,7 +112,7 @@ void TLSTestCase::TestInt() void TLSTestCase::TestStruct() { - CPPUNIT_ASSERT_EQUAL( NULL, gs_threadData.name ); + CPPUNIT_ASSERT_EQUAL( nullptr, gs_threadData.name ); CPPUNIT_ASSERT_EQUAL( 0, gs_threadData.number ); gs_threadData.name = "main"; diff --git a/tests/toplevel/toplevel.cpp b/tests/toplevel/toplevel.cpp index 8361f8d021..a69015d6f9 100644 --- a/tests/toplevel/toplevel.cpp +++ b/tests/toplevel/toplevel.cpp @@ -87,7 +87,7 @@ TEST_CASE("wxTopLevel::Show", "[tlw][show]") { SECTION("Dialog") { - wxDialog* dialog = new wxDialog(NULL, -1, "Dialog Test"); + wxDialog* dialog = new wxDialog(nullptr, -1, "Dialog Test"); DestroyOnScopeExit destroy(dialog); TopLevelWindowShowTest(dialog); @@ -95,7 +95,7 @@ TEST_CASE("wxTopLevel::Show", "[tlw][show]") SECTION("Frame") { - wxFrame* frame = new wxFrame(NULL, -1, "Frame test"); + wxFrame* frame = new wxFrame(nullptr, -1, "Frame test"); DestroyOnScopeExit destroy(frame); TopLevelWindowShowTest(frame); @@ -105,7 +105,7 @@ TEST_CASE("wxTopLevel::Show", "[tlw][show]") // Check that we receive the expected event when showing the TLW. TEST_CASE("wxTopLevel::ShowEvent", "[tlw][show][event]") { - wxFrame* const frame = new wxFrame(NULL, wxID_ANY, "Maximized frame"); + wxFrame* const frame = new wxFrame(nullptr, wxID_ANY, "Maximized frame"); DestroyOnScopeExit destroy(frame); EventCounter countShow(frame, wxEVT_SHOW); diff --git a/tests/uris/ftp.cpp b/tests/uris/ftp.cpp index 08da356901..9bdb9af7d9 100644 --- a/tests/uris/ftp.cpp +++ b/tests/uris/ftp.cpp @@ -82,11 +82,11 @@ TEST_CASE("FTP", "[net][.]") // test RETR wxInputStream *in1 = ftp.GetInputStream("bloordyblop"); - CPPUNIT_ASSERT( in1 == NULL ); + CPPUNIT_ASSERT( in1 == nullptr ); delete in1; wxInputStream *in2 = ftp.GetInputStream(valid_filename); - CPPUNIT_ASSERT( in2 != NULL ); + CPPUNIT_ASSERT( in2 != nullptr ); size_t size = in2->GetSize(); wxChar *data = new wxChar[size]; @@ -131,7 +131,7 @@ TEST_CASE("FTP", "[net][.]") // upload a file static const wxChar *file1 = wxT("test1"); wxOutputStream *out = ftp.GetOutputStream(file1); - CPPUNIT_ASSERT( out != NULL ); + CPPUNIT_ASSERT( out != nullptr ); CPPUNIT_ASSERT( out->Write("First hello", 11).GetLastError() == wxSTREAM_NO_ERROR ); delete out; diff --git a/tests/uris/uris.cpp b/tests/uris/uris.cpp index 57a2406b19..136b68e4db 100644 --- a/tests/uris/uris.cpp +++ b/tests/uris/uris.cpp @@ -421,7 +421,7 @@ void URITestCase::URLCompat() CPPUNIT_ASSERT(urlProblem.GetError() == wxURL_NOERR); wxInputStream* is = urlProblem.GetInputStream(); - CPPUNIT_ASSERT(is != NULL); + CPPUNIT_ASSERT(is != nullptr); wxFile fOut(wxT("test.html"), wxFile::write); wxASSERT(fOut.IsOpened()); @@ -453,7 +453,7 @@ void URITestCase::URLProxy() wxURL::SetDefaultProxy(wxT("fol.singnet.com.sg:8080")); wxURL url2(wxT("http://server-name/path/to/file?query_data=value")); wxInputStream *data = url2.GetInputStream(); - CPPUNIT_ASSERT(data != NULL); + CPPUNIT_ASSERT(data != nullptr); } #endif // wxUSE_PROTOCOL_HTTP diff --git a/tests/validators/valnum.cpp b/tests/validators/valnum.cpp index a937a99797..2407c20561 100644 --- a/tests/validators/valnum.cpp +++ b/tests/validators/valnum.cpp @@ -266,7 +266,7 @@ TEST_CASE_METHOD(NumValidatorTestCase, "ValNum::Interactive", "[valnum]") wxLocale loc(wxLANGUAGE_ENGLISH_UK, wxLOCALE_DONT_LOAD_DEFAULT); m_text->SetValidator( - wxIntegerValidator(NULL, wxNUM_VAL_THOUSANDS_SEPARATOR)); + wxIntegerValidator(nullptr, wxNUM_VAL_THOUSANDS_SEPARATOR)); // Create a sibling text control to be able to switch focus and thus // trigger the control validation/normalization. diff --git a/tests/weakref/evtconnection.cpp b/tests/weakref/evtconnection.cpp index 4eb60e3385..3542c881c4 100644 --- a/tests/weakref/evtconnection.cpp +++ b/tests/weakref/evtconnection.cpp @@ -94,16 +94,16 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EvtConnectionTestCase, "EvtConnectionTest // Helpers void DoConnect( wxEvtHandler& eh1, wxEvtHandler& eh2, wxTestSink& ts ){ eh1.Connect(wxEVT_TEST, (wxObjectEventFunction)&wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); eh2.Connect(wxEVT_TEST, (wxObjectEventFunction) &wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); } void DoDisconnect( wxEvtHandler& eh1, wxEvtHandler& eh2, wxTestSink& ts ){ eh1.Disconnect(wxEVT_TEST, (wxObjectEventFunction) &wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); eh2.Disconnect(wxEVT_TEST, (wxObjectEventFunction) &wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); } @@ -196,7 +196,7 @@ void EvtConnectionTestCase::MultiConnectionTest() // One source wxEvtHandler eh1; evt.SetEventObject(&eh1); - gs_psrc1 = NULL; + gs_psrc1 = nullptr; gs_psrc2 = &eh1; { @@ -204,11 +204,11 @@ void EvtConnectionTestCase::MultiConnectionTest() wxTestSink ts; eh1.Connect(wxEVT_TEST, (wxObjectEventFunction)&wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); eh1.Connect(wxEVT_TEST1, (wxObjectEventFunction)&wxTestSink::OnTestEvent1, - NULL, &ts); + nullptr, &ts); eh1.Connect(wxEVT_TEST2, (wxObjectEventFunction)&wxTestSink::OnTestEvent2, - NULL, &ts); + nullptr, &ts); // Generate events gs_value = 0; @@ -224,7 +224,7 @@ void EvtConnectionTestCase::MultiConnectionTest() // And now destroyed eh1.Disconnect(wxEVT_TEST, (wxObjectEventFunction)&wxTestSink::OnTestEvent, - NULL, &ts); + nullptr, &ts); eh1.ProcessEvent(evt); eh1.ProcessEvent(evt1); eh1.ProcessEvent(evt2); diff --git a/tests/weakref/weakref.cpp b/tests/weakref/weakref.cpp index f4165e60b2..9f5fa14f81 100644 --- a/tests/weakref/weakref.cpp +++ b/tests/weakref/weakref.cpp @@ -86,9 +86,9 @@ struct IncompleteClass; void WeakRefTestCase::DeclareTest() { { - // Not initializing or initializing with NULL should work too + // Not initializing or initializing with nullptr should work too wxWeakRef wroDef; - wxWeakRef wro0(NULL); + wxWeakRef wro0(nullptr); wxObject o; // Should not work wxEvtHandler eh; @@ -170,8 +170,8 @@ void WeakRefTestCase::AssignTest() wro1 = &eh; wro2 = &ot; - wro1 = NULL; - wro2 = NULL; + wro1 = nullptr; + wro2 = nullptr; CPPUNIT_ASSERT( !wro1 ); CPPUNIT_ASSERT( !wro2 ); diff --git a/tests/xlocale/xlocale.cpp b/tests/xlocale/xlocale.cpp index c2b7b5e0ca..fe41c85ccb 100644 --- a/tests/xlocale/xlocale.cpp +++ b/tests/xlocale/xlocale.cpp @@ -81,11 +81,11 @@ void XLocaleTestCase::TestCtor() void XLocaleTestCase::PreserveLocale() { // Test that using locale functions doesn't change the global C locale. - const wxString origLocale(setlocale(LC_ALL, NULL)); + const wxString origLocale(setlocale(LC_ALL, nullptr)); - wxStrtod_l(wxT("1.234"), NULL, wxCLocale); + wxStrtod_l(wxT("1.234"), nullptr, wxCLocale); - CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, NULL) ); + CPPUNIT_ASSERT_EQUAL( origLocale, setlocale(LC_ALL, nullptr) ); } // test the ctype functions with the given locale @@ -198,23 +198,23 @@ void XLocaleTestCase::TestStdlibFunctionsWith(const wxXLocale& loc) #endif // strtod (don't use decimal separator as it's locale-specific) - CPPUNIT_ASSERT_EQUAL( 0.0, wxStrtod_l(wxT("0"), NULL, loc) ); - CPPUNIT_ASSERT_EQUAL( 1234.0, wxStrtod_l(wxT("1234"), NULL, loc) ); + CPPUNIT_ASSERT_EQUAL( 0.0, wxStrtod_l(wxT("0"), nullptr, loc) ); + CPPUNIT_ASSERT_EQUAL( 1234.0, wxStrtod_l(wxT("1234"), nullptr, loc) ); // strtol - endptr = NULL; - CPPUNIT_ASSERT_EQUAL( 100, wxStrtol_l(wxT("100"), NULL, 0, loc) ); - CPPUNIT_ASSERT_EQUAL( 0xFF, wxStrtol_l(wxT("0xFF"), NULL, 0, loc) ); + endptr = nullptr; + CPPUNIT_ASSERT_EQUAL( 100, wxStrtol_l(wxT("100"), nullptr, 0, loc) ); + CPPUNIT_ASSERT_EQUAL( 0xFF, wxStrtol_l(wxT("0xFF"), nullptr, 0, loc) ); CPPUNIT_ASSERT_EQUAL( 2001, wxStrtol_l(wxT("2001 60c0c0 -1101110100110100100000 0x6fffff"), &endptr, 10, loc) ); CPPUNIT_ASSERT_EQUAL( 0x60c0c0, wxStrtol_l(endptr, &endptr, 16, loc) ); CPPUNIT_ASSERT_EQUAL( -0x374D20, wxStrtol_l(endptr, &endptr, 2, loc) ); - CPPUNIT_ASSERT_EQUAL( 0x6fffff, wxStrtol_l(endptr, NULL, 0, loc) ); + CPPUNIT_ASSERT_EQUAL( 0x6fffff, wxStrtol_l(endptr, nullptr, 0, loc) ); // strtoul // NOTE: 3147483647 and 0xEE6B2800 are greater than LONG_MAX (on 32bit machines) but // smaller than ULONG_MAX - CPPUNIT_ASSERT_EQUAL( 3147483647ul, wxStrtoul_l(wxT("3147483647"), NULL, 0, loc) ); - CPPUNIT_ASSERT_EQUAL( 0xEE6B2800ul, wxStrtoul_l(wxT("0xEE6B2800"), NULL, 0, loc) ); + CPPUNIT_ASSERT_EQUAL( 3147483647ul, wxStrtoul_l(wxT("3147483647"), nullptr, 0, loc) ); + CPPUNIT_ASSERT_EQUAL( 0xEE6B2800ul, wxStrtoul_l(wxT("0xEE6B2800"), nullptr, 0, loc) ); // TODO: test for "failure" behaviour of the functions above } @@ -274,12 +274,12 @@ void XLocaleTestCase::TestStdlibFunctions() #endif // strtod checks specific for C locale - endptr = NULL; - CPPUNIT_ASSERT_EQUAL( 0.0, wxStrtod_l(wxT("0.000"), NULL, wxCLocale) ); - CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1.234"), NULL, wxCLocale) ); - CPPUNIT_ASSERT_EQUAL( -1.234E-5, wxStrtod_l(wxT("-1.234E-5"), NULL, wxCLocale) ); + endptr = nullptr; + CPPUNIT_ASSERT_EQUAL( 0.0, wxStrtod_l(wxT("0.000"), nullptr, wxCLocale) ); + CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1.234"), nullptr, wxCLocale) ); + CPPUNIT_ASSERT_EQUAL( -1.234E-5, wxStrtod_l(wxT("-1.234E-5"), nullptr, wxCLocale) ); CPPUNIT_ASSERT_EQUAL( 365.24, wxStrtod_l(wxT("365.24 29.53"), &endptr, wxCLocale) ); - CPPUNIT_ASSERT_EQUAL( 29.53, wxStrtod_l(endptr, NULL, wxCLocale) ); + CPPUNIT_ASSERT_EQUAL( 29.53, wxStrtod_l(endptr, nullptr, wxCLocale) ); } #ifdef wxHAS_XLOCALE_SUPPORT @@ -292,10 +292,10 @@ void XLocaleTestCase::TestStdlibFunctions() TestCtypeFunctionsWith(locFR); // comma as decimal point: - CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1,234"), NULL, locFR) ); + CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1,234"), nullptr, locFR) ); // space as thousands separator is not recognized by wxStrtod_l(): - CPPUNIT_ASSERT( 1234.5 != wxStrtod_l(wxT("1 234,5"), NULL, locFR) ); + CPPUNIT_ASSERT( 1234.5 != wxStrtod_l(wxT("1 234,5"), nullptr, locFR) ); } @@ -308,10 +308,10 @@ void XLocaleTestCase::TestStdlibFunctions() TestStdlibFunctionsWith(locIT); // comma as decimal point: - CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1,234"), NULL, locIT) ); + CPPUNIT_ASSERT_EQUAL( 1.234, wxStrtod_l(wxT("1,234"), nullptr, locIT) ); // dot as thousands separator is not recognized by wxStrtod_l(): - CPPUNIT_ASSERT( 1234.5 != wxStrtod_l(wxT("1.234,5"), NULL, locIT) ); + CPPUNIT_ASSERT( 1234.5 != wxStrtod_l(wxT("1.234,5"), nullptr, locIT) ); } #endif // wxHAS_XLOCALE_SUPPORT } diff --git a/tests/xml/xmltest.cpp b/tests/xml/xmltest.cpp index f75bd7f61f..ea532d98cf 100644 --- a/tests/xml/xmltest.cpp +++ b/tests/xml/xmltest.cpp @@ -40,12 +40,12 @@ void CheckXml(const wxXmlNode *n, ...) for (;;) { const char *childName = va_arg(args, char*); - if ( childName == NULL ) + if ( childName == nullptr ) break; CPPUNIT_ASSERT( child ); CPPUNIT_ASSERT_EQUAL( childName, child->GetName() ); - CPPUNIT_ASSERT( child->GetChildren() == NULL ); + CPPUNIT_ASSERT( child->GetChildren() == nullptr ); CPPUNIT_ASSERT( child->GetParent() == n ); child = child->GetNext(); @@ -53,7 +53,7 @@ void CheckXml(const wxXmlNode *n, ...) va_end(args); - CPPUNIT_ASSERT( child == NULL ); // no more children + CPPUNIT_ASSERT( child == nullptr ); // no more children } } // anon namespace @@ -112,41 +112,41 @@ void XmlTestCase::InsertChild() wxXmlNode *two = new wxXmlNode(wxXML_ELEMENT_NODE, "2"); root->AddChild(two); root->AddChild(new wxXmlNode(wxXML_ELEMENT_NODE, "3")); - CheckXml(root.get(), "1", "2", "3", NULL); + CheckXml(root.get(), "1", "2", "3", nullptr); // check inserting in front: - root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), NULL); - CheckXml(root.get(), "A", "1", "2", "3", NULL); + root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), nullptr); + CheckXml(root.get(), "A", "1", "2", "3", nullptr); root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "B"), root->GetChildren()); - CheckXml(root.get(), "B", "A", "1", "2", "3", NULL); + CheckXml(root.get(), "B", "A", "1", "2", "3", nullptr); // and in the middle: root->InsertChild(new wxXmlNode(wxXML_ELEMENT_NODE, "C"), two); - CheckXml(root.get(), "B", "A", "1", "C", "2", "3", NULL); + CheckXml(root.get(), "B", "A", "1", "C", "2", "3", nullptr); } void XmlTestCase::InsertChildAfter() { wxScopedPtr root(new wxXmlNode(wxXML_ELEMENT_NODE, "root")); - root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), NULL); - CheckXml(root.get(), "1", NULL); + root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "1"), nullptr); + CheckXml(root.get(), "1", nullptr); wxXmlNode *two = new wxXmlNode(wxXML_ELEMENT_NODE, "2"); root->AddChild(two); wxXmlNode *three = new wxXmlNode(wxXML_ELEMENT_NODE, "3"); root->AddChild(three); - CheckXml(root.get(), "1", "2", "3", NULL); + CheckXml(root.get(), "1", "2", "3", nullptr); // check inserting in the middle: root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "A"), root->GetChildren()); - CheckXml(root.get(), "1", "A", "2", "3", NULL); + CheckXml(root.get(), "1", "A", "2", "3", nullptr); root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "B"), two); - CheckXml(root.get(), "1", "A", "2", "B", "3", NULL); + CheckXml(root.get(), "1", "A", "2", "B", "3", nullptr); // and at the end: root->InsertChildAfter(new wxXmlNode(wxXML_ELEMENT_NODE, "C"), three); - CheckXml(root.get(), "1", "A", "2", "B", "3", "C", NULL); + CheckXml(root.get(), "1", "A", "2", "B", "3", "C", nullptr); } void XmlTestCase::LoadSave() @@ -445,7 +445,7 @@ void XmlTestCase::SetRoot() // Other tests. CPPUNIT_ASSERT( docNode == root->GetParent() ); - doc.SetRoot(NULL); // Removes from doc but dosn't free mem, doc node left. + doc.SetRoot(nullptr); // Removes from doc but dosn't free mem, doc node left. CPPUNIT_ASSERT( !doc.IsOk() ); wxXmlNode *comment = new wxXmlNode(wxXML_COMMENT_NODE, "comment", "Prolog Comment"); @@ -468,7 +468,7 @@ void XmlTestCase::SetRoot() CPPUNIT_ASSERT( node->GetParent() == docNode ); node = node->GetNext(); CPPUNIT_ASSERT( !node ); - doc.SetRoot(NULL); + doc.SetRoot(nullptr); CPPUNIT_ASSERT( !doc.IsOk() ); doc.SetRoot(root); CPPUNIT_ASSERT( doc.IsOk() ); diff --git a/tests/xml/xrctest.cpp b/tests/xml/xrctest.cpp index 94d38c983f..19416d4dd2 100644 --- a/tests/xml/xrctest.cpp +++ b/tests/xml/xrctest.cpp @@ -161,7 +161,7 @@ TEST_CASE_METHOD(XrcTestCase, "XRC::ObjectReferences", "[xrc]") // In xrc there's now a dialog containing two panels, one an object // reference of the other wxDialog dlg; - REQUIRE( wxXmlResource::Get()->LoadDialog(&dlg, NULL, "dialog") ); + REQUIRE( wxXmlResource::Get()->LoadDialog(&dlg, nullptr, "dialog") ); // Might as well test XRCCTRL too wxPanel* panel1 = XRCCTRL(dlg,"panel1",wxPanel); wxPanel* panel2 = XRCCTRL(dlg,"ref_of_panel1",wxPanel); @@ -286,7 +286,7 @@ TEST_CASE("XRC::EnvVarInPath", "[xrc]") wxUnsetEnv("WX_TEST_ENV_IN_PATH"); wxXmlResource::Get()->SetFlags(wxXRC_USE_LOCALE); } - virtual wxObject* DoCreateResource() override { return NULL; } + virtual wxObject* DoCreateResource() override { return nullptr; } virtual bool CanHandle(wxXmlNode*) override { return false; } bool varIsSet; } handler(xmlDoc.GetRoot()); diff --git a/utils/emulator/src/emulator.cpp b/utils/emulator/src/emulator.cpp index cdb3421ac0..706a2f742e 100644 --- a/utils/emulator/src/emulator.cpp +++ b/utils/emulator/src/emulator.cpp @@ -75,7 +75,7 @@ static const wxCmdLineEntryDesc sg_cmdLineDesc[] = { wxCMD_LINE_SWITCH, "h", "help", "displays help on the command line parameters" }, { wxCMD_LINE_SWITCH, "v", "version", "print version" }, - { wxCMD_LINE_PARAM, NULL, NULL, "config file 1", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_PARAM, nullptr, nullptr, "config file 1", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, wxCMD_LINE_DESC_END }; @@ -91,8 +91,8 @@ static const wxCmdLineEntryDesc sg_cmdLineDesc[] = wxEmulatorApp::wxEmulatorApp() { - m_xnestWindow = NULL; - m_containerWindow = NULL; + m_xnestWindow = nullptr; + m_containerWindow = nullptr; m_displayNumber = wxT("100"); m_xnestPID = 0; @@ -259,7 +259,7 @@ bool wxEmulatorApp::LoadEmulator(const wxString& appDir) // frame constructor wxEmulatorFrame::wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size) - : wxFrame(NULL, wxID_ANY, title, pos, size) + : wxFrame(nullptr, wxID_ANY, title, pos, size) { // set the frame icon SetIcon(wxICON(emulator)); @@ -311,7 +311,7 @@ void wxEmulatorFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) #ifdef __WXX11__ if (wxGetApp().m_xnestWindow) { - wxGetApp().m_xnestWindow->SetHandle((WXWindow) NULL); + wxGetApp().m_xnestWindow->SetHandle((WXWindow) nullptr); } #endif this->Destroy(); @@ -382,7 +382,7 @@ void wxEmulatorContainer::OnPaint(wxPaintEvent& WXUNUSED(event)) void wxEmulatorContainer::OnEraseBackground(wxEraseEvent& event) { - wxDC* dc wxDUMMY_INITIALIZE(NULL); + wxDC* dc wxDUMMY_INITIALIZE(nullptr); if (event.GetDC()) { diff --git a/utils/helpview/src/client.cpp b/utils/helpview/src/client.cpp index 7638d331e4..a55c3dbd55 100644 --- a/utils/helpview/src/client.cpp +++ b/utils/helpview/src/client.cpp @@ -76,7 +76,7 @@ wxEND_EVENT_TABLE() // globals // ---------------------------------------------------------------------------- -wxListBox *the_list = NULL; +wxListBox *the_list = nullptr; // ============================================================================ // implementation @@ -92,7 +92,7 @@ bool MyApp::OnInit() { wxString a_appname, a_service, a_windowname, a_book; - m_help = NULL; + m_help = nullptr; // for MSW (DDE classes), a_service is 'service name', apparently an arbitrary string // for Unix, should be a valid file name (for a nonexistent file) @@ -128,7 +128,7 @@ bool MyApp::OnInit() m_help->SetTitleFormat( a_windowname ); // Create the main frame window - MyFrame* frame = new MyFrame(NULL, "Help Client"); + MyFrame* frame = new MyFrame(nullptr, "Help Client"); frame->Show(true); return true; @@ -137,7 +137,7 @@ bool MyApp::OnInit() int MyApp::OnExit() { delete m_help; - delete wxConfig::Set(NULL); + delete wxConfig::Set(nullptr); return 0; } @@ -145,7 +145,7 @@ int MyApp::OnExit() MyFrame::MyFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize( 200, 100 ) ) { - m_panel = NULL; + m_panel = nullptr; // Give it an icon SetIcon(wxICON(mondrian)); diff --git a/utils/helpview/src/helpview.cpp b/utils/helpview/src/helpview.cpp index 516c644a60..75877fd4ec 100644 --- a/utils/helpview/src/helpview.cpp +++ b/utils/helpview/src/helpview.cpp @@ -40,7 +40,7 @@ wxIMPLEMENT_APP(hvApp); hvApp::hvApp() { #if wxUSE_IPC - m_server = NULL; + m_server = nullptr; #endif } @@ -59,7 +59,7 @@ bool hvApp::OnInit() bool createServer = false; #if wxUSE_IPC - m_server = NULL; + m_server = nullptr; #endif // Help books are recognized by extension ".hhp" ".htb" or ".zip". @@ -139,7 +139,7 @@ bool hvApp::OnInit() wxEmptyString, wxT("Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, - NULL); + nullptr); if (!s.empty()) { @@ -228,12 +228,12 @@ int hvApp::OnExit() if (m_server) { delete m_server; - m_server = NULL; + m_server = nullptr; } #endif delete m_helpController; - delete wxConfig::Set(NULL); + delete wxConfig::Set(nullptr); return 0; } @@ -248,7 +248,7 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller) "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\ HTML Help Project (*.hhp)|*.hhp"), wxFD_OPEN | wxFD_FILE_MUST_EXIST, - NULL); + nullptr); if ( !s.empty() ) { @@ -377,7 +377,7 @@ wxConnectionBase *hvServer::OnAcceptConnection(const wxString& topic) if (topic == wxT("HELP")) return new hvConnection(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------------- diff --git a/utils/helpview/src/remhelp.cpp b/utils/helpview/src/remhelp.cpp index bcdb85ed50..42512550d6 100644 --- a/utils/helpview/src/remhelp.cpp +++ b/utils/helpview/src/remhelp.cpp @@ -86,11 +86,11 @@ wxIMPLEMENT_CLASS(wxRemoteHtmlHelpController, wxHelpControllerBase); wxRemoteHtmlHelpController::wxRemoteHtmlHelpController(int style ) { m_style = style; - m_connection = NULL; - m_client = NULL; + m_connection = nullptr; + m_client = nullptr; m_pid = 0; isconn_1 = false; - m_process = NULL; + m_process = nullptr; // defaults // @@ -148,7 +148,7 @@ wxRemoteHtmlHelpController::~wxRemoteHtmlHelpController() delete m_connection; delete m_process; - m_process = NULL; + m_process = nullptr; } if( m_client ) delete m_client; //should be automatic? @@ -186,7 +186,7 @@ bool wxRemoteHtmlHelpController::DoConnection() cmd = m_appname + blank + m_service + blank + m_windowname + blank + m_book + blank + stylestr; - m_process = new wxProcess(NULL); + m_process = new wxProcess(nullptr); m_pid = wxExecute( cmd, false, m_process ); // leaks - wxExecute itself (if not deleted) and in wxExecute at // wxExecuteData *data = new wxExecuteData; diff --git a/utils/ifacecheck/src/ifacecheck.cpp b/utils/ifacecheck/src/ifacecheck.cpp index 1e14abf280..dd29fefb69 100644 --- a/utils/ifacecheck/src/ifacecheck.cpp +++ b/utils/ifacecheck/src/ifacecheck.cpp @@ -59,9 +59,9 @@ static const wxCmdLineEntryDesc g_cmdLineDesc[] = "show help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, VERBOSE_SWITCH, "verbose", "be verbose" }, - { wxCMD_LINE_PARAM, NULL, NULL, + { wxCMD_LINE_PARAM, nullptr, nullptr, "gccXML", wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY }, - { wxCMD_LINE_PARAM, NULL, NULL, + { wxCMD_LINE_PARAM, nullptr, nullptr, "doxygenXML", wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY }, wxCMD_LINE_DESC_END }; @@ -670,7 +670,7 @@ void IfaceCheckApp::PrintStatistics(long secs) int undoc = 0; const wxClassArray& arr = m_gccInterface.GetClasses(); for (unsigned int i=0; iRecursiveUpwardFindMethod(m, allclasses); @@ -577,7 +577,7 @@ const wxMethod* wxClass::RecursiveUpwardFindMethod(const wxMethod& m, } // could not find anything even in parent classes... - return NULL; + return nullptr; } wxMethodPtrArray wxClass::FindMethodsNamed(const wxString& name) const @@ -1373,7 +1373,7 @@ static bool HasTextNodeContaining(const wxXmlNode *parent, const wxString& name) static const wxXmlNode* FindNodeNamed(const wxXmlNode* parent, const wxString& name) { if (!parent) - return NULL; + return nullptr; const wxXmlNode *p = parent->GetChildren(); while (p) @@ -1389,7 +1389,7 @@ static const wxXmlNode* FindNodeNamed(const wxXmlNode* parent, const wxString& n p = p->GetNext(); } - return NULL; + return nullptr; } int GetAvailabilityFor(const wxXmlNode *node) diff --git a/utils/ifacecheck/src/xmlparser.h b/utils/ifacecheck/src/xmlparser.h index a92ddc6767..7cfa6a31eb 100644 --- a/utils/ifacecheck/src/xmlparser.h +++ b/utils/ifacecheck/src/xmlparser.h @@ -406,7 +406,7 @@ public: for (unsigned int i=0; iDetach(m_grid); delete m_grid; - m_grid = NULL; + m_grid = nullptr; sizer->Add(ctrl); } diff --git a/utils/screenshotgen/src/guiframe.cpp b/utils/screenshotgen/src/guiframe.cpp index 8716447203..76e03f94f7 100644 --- a/utils/screenshotgen/src/guiframe.cpp +++ b/utils/screenshotgen/src/guiframe.cpp @@ -209,7 +209,7 @@ void GUIFrame::AddPanel_2() m_checkList1->Check(0); fgSizer2->Add(m_checkList1, m_commonExpandFlags); - m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, 0 ); m_listBox1->Append( _("wxListBox") ); m_listBox1->Append( _("Item1") ); m_listBox1->Append( _("Item2") ); @@ -394,7 +394,7 @@ void GUIFrame::AddPanel_5() m_choice1->SetSelection( 0 ); fgSizer4->Add( m_choice1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); - m_comboBox1 = new wxComboBox( m_panel5, wxID_ANY, _("wxComboBox"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_comboBox1 = new wxComboBox( m_panel5, wxID_ANY, _("wxComboBox"), wxDefaultPosition, wxDefaultSize, 0, nullptr, 0 ); m_comboBox1->Append( _("wxComboBox") ); m_comboBox1->Append( _("Item1") ); m_comboBox1->Append( _("Item2") ); @@ -417,7 +417,7 @@ void GUIFrame::AddPanel_5() for a screenshot. */ m_bmpComboBox1 = new wxBitmapComboBox(m_panel5, wxID_ANY,_("Item1"), - wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); + wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY); m_bmpComboBox1->Append(_("Item1"), wxBitmap(wxT("bitmaps/bell.png"),wxBITMAP_TYPE_PNG)); m_bmpComboBox1->Append(_("Item2"), wxBitmap(wxT("bitmaps/sound.png"),wxBITMAP_TYPE_PNG)); m_bmpComboBox1->Append(_("Item3"), wxBitmap(wxT("bitmaps/bell.png"),wxBITMAP_TYPE_PNG)); diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index 80e14281e0..5e0cff4473 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -271,7 +271,7 @@ int XmlResApp::OnRun() #if 0 // not yet implemented { wxCMD_LINE_OPTION, "l", "list-of-handlers", "output list of necessary handlers to this file" }, #endif - { wxCMD_LINE_PARAM, NULL, NULL, "input file(s)", + { wxCMD_LINE_PARAM, nullptr, nullptr, "input file(s)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_OPTION_MANDATORY }, @@ -472,7 +472,7 @@ static bool NodeContainsFilename(wxXmlNode *node) // wxBitmapButton: wxXmlNode *parent = node->GetParent(); - if (parent != NULL && + if (parent != nullptr && parent->GetAttribute(wxT("class"), wxT("")) == wxT("wxBitmapButton") && (name == wxT("focus") || name == wxT("disabled") || @@ -496,7 +496,7 @@ static bool NodeContainsFilename(wxXmlNode *node) // URLs in wxHtmlWindow: if ( name == wxT("url") && - parent != NULL && + parent != nullptr && parent->GetAttribute(wxT("class"), wxT("")) == wxT("wxHtmlWindow") ) { // FIXME: this is wrong for e.g. http:// URLs @@ -510,7 +510,7 @@ static bool NodeContainsFilename(wxXmlNode *node) void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath) { // Is 'node' XML node element? - if (node == NULL) return; + if (node == nullptr) return; if (node->GetType() != wxXML_ELEMENT_NODE) return; bool containsFilename = NodeContainsFilename(node); @@ -991,7 +991,7 @@ XmlResApp::FindStrings(const wxString& filename, wxXmlNode *node) ExtractedStrings arr; wxXmlNode *n = node; - if (n == NULL) return arr; + if (n == nullptr) return arr; n = n->GetChildren(); while (n)