Replace all remaining occurrences of wxScopedPtr

Use std::unique_ptr<> in the library code instead of the legacy wx
class.
This commit is contained in:
Vadim Zeitlin
2023-03-06 23:53:13 +01:00
parent abb9859b89
commit a4e8e7066d
38 changed files with 129 additions and 98 deletions
+4 -3
View File
@@ -16,7 +16,8 @@
#include "wx/string.h"
#include "wx/filename.h"
#include "wx/dc.h"
#include "wx/scopedptr.h"
#include <memory>
#define wxSVGVersion wxT("v0101")
@@ -271,8 +272,8 @@ private:
bool m_graphics_changed; // set by Set{Brush,Pen}()
int m_width, m_height;
double m_dpi;
wxScopedPtr<wxFileOutputStream> m_outfile;
wxScopedPtr<wxSVGBitmapHandler> m_bmp_handler; // class to handle bitmaps
std::unique_ptr<wxFileOutputStream> m_outfile;
std::unique_ptr<wxSVGBitmapHandler> m_bmp_handler; // class to handle bitmaps
wxSVGShapeRenderingMode m_renderingMode;
// The clipping nesting level is incremented by every call to
+4 -2
View File
@@ -15,7 +15,9 @@
#if wxUSE_GRID
#include "wx/scopedptr.h"
#if wxUSE_VALIDATORS
#include <memory>
#endif
class wxGridCellEditorEvtHandler : public wxEvtHandler
{
@@ -102,7 +104,7 @@ protected:
private:
size_t m_maxChars; // max number of chars allowed
#if wxUSE_VALIDATORS
wxScopedPtr<wxValidator> m_validator;
std::unique_ptr<wxValidator> m_validator;
#endif
wxString m_value;
};
+5 -4
View File
@@ -12,10 +12,11 @@
#include "wx/ffile.h"
#include "wx/hashmap.h"
#include "wx/scopedptr.h"
#include "wx/private/refcountermt.h"
#include <memory>
WX_DECLARE_STRING_HASH_MAP(wxString, wxWebRequestHeaderMap);
// Default buffer size when a fixed-size buffer must be used.
@@ -63,7 +64,7 @@ public:
void SetData(const wxString& text, const wxString& contentType, const wxMBConv& conv = wxConvUTF8);
bool SetData(wxScopedPtr<wxInputStream>& dataStream, const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset);
bool SetData(std::unique_ptr<wxInputStream>& dataStream, const wxString& contentType, wxFileOffset dataSize = wxInvalidOffset);
void SetStorage(wxWebRequest::Storage storage) { m_storage = storage; }
@@ -111,7 +112,7 @@ protected:
wxWebRequest::Storage m_storage;
wxWebRequestHeaderMap m_headers;
wxFileOffset m_dataSize;
wxScopedPtr<wxInputStream> m_dataStream;
std::unique_ptr<wxInputStream> m_dataStream;
bool m_peerVerifyDisabled;
wxWebRequestImpl(wxWebSession& session,
@@ -204,7 +205,7 @@ private:
wxMemoryBuffer m_readBuffer;
mutable wxFFile m_file;
mutable wxScopedPtr<wxInputStream> m_stream;
mutable std::unique_ptr<wxInputStream> m_stream;
wxDECLARE_NO_COPY_CLASS(wxWebResponseImpl);
};
+3 -1
View File
@@ -11,6 +11,8 @@
#include <wx/scopedarray.h>
#include <memory>
class QApplication;
class WXDLLIMPEXP_CORE wxApp : public wxAppBase
{
@@ -21,7 +23,7 @@ public:
virtual bool Initialize(int& argc, wxChar **argv) override;
private:
wxScopedPtr<QApplication> m_qtApplication;
std::unique_ptr<QApplication> m_qtApplication;
int m_qtArgc;
wxScopedArray<char*> m_qtArgv;
+2 -2
View File
@@ -10,7 +10,7 @@
#include "wx/qt/dc.h"
#include "wx/scopedptr.h"
#include <memory>
class QPicture;
@@ -39,7 +39,7 @@ public:
~wxClientDCImpl();
private:
wxScopedPtr<QPicture> m_pict;
std::unique_ptr<QPicture> m_pict;
wxDECLARE_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
+4 -2
View File
@@ -9,6 +9,8 @@
#ifndef _WX_QT_WINDOW_H_
#define _WX_QT_WINDOW_H_
#include <memory>
class QShortcut;
template < class T > class QList;
@@ -243,13 +245,13 @@ private:
bool QtSetBackgroundStyle();
QPicture *m_qtPicture; // not owned
wxScopedPtr<QPainter> m_qtPainter; // always allocated
std::unique_ptr<QPainter> m_qtPainter; // always allocated
bool m_mouseInside;
#if wxUSE_ACCEL
wxVector<QShortcut*> m_qtShortcuts; // owned by whatever GetHandle() returns
wxScopedPtr<wxQtShortcutHandler> m_qtShortcutHandler; // always allocated
std::unique_ptr<wxQtShortcutHandler> m_qtShortcutHandler; // always allocated
bool m_processingShortcut;
#endif // wxUSE_ACCEL
+4 -3
View File
@@ -25,7 +25,8 @@
#include "wx/module.h"
#include "wx/hashmap.h"
#include "wx/hashset.h"
#include "wx/scopedptr.h"
#include <memory>
using namespace wxPrivate;
@@ -118,9 +119,9 @@ private:
wxVector<wxAnyToVariantRegistration*> m_anyToVariantRegs;
};
static wxScopedPtr<wxAnyValueTypeGlobals>& GetAnyValueTypeGlobals()
static std::unique_ptr<wxAnyValueTypeGlobals>& GetAnyValueTypeGlobals()
{
static wxScopedPtr<wxAnyValueTypeGlobals> s_wxAnyValueTypeGlobals;
static std::unique_ptr<wxAnyValueTypeGlobals> s_wxAnyValueTypeGlobals;
if ( !s_wxAnyValueTypeGlobals )
{
// Notice that it is _not_ sufficient to just initialize the static
+3 -1
View File
@@ -74,6 +74,8 @@
#include "wx/recguard.h"
#endif // wxDEBUG_LEVEL
#include <memory>
// wxABI_VERSION can be defined when compiling applications but it should be
// left undefined when compiling the library itself, it is then set to its
// default value in version.h
@@ -397,7 +399,7 @@ bool wxAppConsoleBase::Yield(bool onlyIfNeeded)
if ( loop )
return loop->Yield(onlyIfNeeded);
wxScopedPtr<wxEventLoopBase> tmpLoop(CreateMainLoop());
std::unique_ptr<wxEventLoopBase> tmpLoop(CreateMainLoop());
return tmpLoop->Yield(onlyIfNeeded);
}
+4 -3
View File
@@ -55,7 +55,6 @@
#include "wx/stdpaths.h"
#include "wx/vector.h"
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
#include "wx/scopeguard.h"
#include "wx/except.h"
@@ -68,6 +67,8 @@
#include "wx/wfstream.h"
#endif
#include <memory>
// ----------------------------------------------------------------------------
// wxWidgets macros
// ----------------------------------------------------------------------------
@@ -880,7 +881,7 @@ wxDocTemplate::~wxDocTemplate()
wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags)
{
// InitDocument() is supposed to delete the document object if its
// initialization fails so don't use wxScopedPtr<> here: this is fragile
// initialization fails so don't use unique_ptr<> here: this is fragile
// but unavoidable because the default implementation uses CreateView()
// which may -- or not -- create a wxView and if it does create it and its
// initialization fails then the view destructor will delete the document
@@ -924,7 +925,7 @@ wxDocTemplate::InitDocument(wxDocument* doc, const wxString& path, long flags)
wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags)
{
wxScopedPtr<wxView> view(DoCreateView());
std::unique_ptr<wxView> view(DoCreateView());
if ( !view )
return nullptr;
+3 -2
View File
@@ -34,7 +34,6 @@
#include "wx/filename.h"
#include "wx/dir.h"
#include "wx/scopedptr.h"
#include "wx/tokenzr.h"
// there are just too many of those...
@@ -48,6 +47,8 @@
#include <string.h>
#include <errno.h>
#include <memory>
#if defined(__WXMAC__)
#include "wx/osx/private.h" // includes mac headers
#endif
@@ -669,7 +670,7 @@ bool wxDirExists(const wxString& pathName)
// Get first file name matching given wild card.
static wxScopedPtr<wxDir> gs_dir;
static std::unique_ptr<wxDir> gs_dir;
static wxString gs_dirPath;
wxString wxFindFirstFile(const wxString& spec, int flags)
+4 -3
View File
@@ -30,13 +30,14 @@
#include "wx/wfstream.h"
#include "wx/quantize.h"
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
#include "wx/anidecod.h"
#include "wx/private/icondir.h"
// For memcpy
#include <string.h>
#include <memory>
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
@@ -269,10 +270,10 @@ bool wxBMPHandler::SaveDib(wxImage *image,
}
#if wxUSE_PALETTE
wxScopedPtr<wxPalette> palette; // entries for quantized images
std::unique_ptr<wxPalette> palette; // entries for quantized images
#endif // wxUSE_PALETTE
wxScopedArray<wxUint8> rgbquad; // for the RGBQUAD bytes for the colormap
wxScopedPtr<wxImage> q_image; // destination for quantized image
std::unique_ptr<wxImage> q_image; // destination for quantized image
// if <24bpp use quantization to reduce colors for *some* of the formats
if ( (format == wxBMP_1BPP) || (format == wxBMP_4BPP) ||
+1 -3
View File
@@ -28,8 +28,6 @@
#include "wx/apptrait.h"
#include "wx/renderer.h"
#include "wx/scopedptr.h"
#if wxUSE_DYNLIB_CLASS
#include "wx/dynlib.h"
#endif // wxUSE_DYNLIB_CLASS
@@ -38,7 +36,7 @@
// wxRendererPtr: auto pointer holding the global renderer
// ----------------------------------------------------------------------------
typedef wxScopedPtr<wxRendererNative> wxRendererPtrBase;
using wxRendererPtrBase = std::unique_ptr<wxRendererNative>;
class wxRendererPtr : public wxRendererPtrBase
{
+3 -3
View File
@@ -32,8 +32,8 @@
#include "wx/vector.h"
#include "wx/listimpl.cpp"
#include "wx/private/window.h"
#include "wx/scopedptr.h"
#include <memory>
//---------------------------------------------------------------------------
@@ -832,7 +832,7 @@ wxSizerItem* wxSizer::DoInsert( size_t index, wxSizerItem *item )
}
private:
wxScopedPtr<wxSizerItem> m_item;
std::unique_ptr<wxSizerItem> m_item;
};
ContainingSizerGuard guard( item );
@@ -1527,7 +1527,7 @@ wxGridSizer::wxGridSizer( int rows, int cols, const wxSize& gap )
wxSizerItem *wxGridSizer::DoInsert(size_t index, wxSizerItem *item)
{
// Ensure that the item will be deleted in case of exception.
wxScopedPtr<wxSizerItem> scopedItem( item );
std::unique_ptr<wxSizerItem> scopedItem( item );
// if only the number of columns or the number of rows is specified for a
// sizer, arbitrarily many items can be added to it but if both of them are
+2 -2
View File
@@ -22,7 +22,7 @@
#include "wx/menu.h"
#endif
#include "wx/scopedptr.h"
#include <memory>
extern WXDLLIMPEXP_DATA_BASE(wxList) wxPendingDelete;
@@ -46,7 +46,7 @@ wxEND_EVENT_TABLE()
void wxTaskBarIconBase::OnRightButtonDown(wxTaskBarIconEvent& WXUNUSED(event))
{
wxScopedPtr<wxMenu> menuDeleter;
std::unique_ptr<wxMenu> menuDeleter;
wxMenu *menu = GetPopupMenu();
if ( !menu )
{
+5 -4
View File
@@ -43,7 +43,6 @@
#include "wx/filename.h"
#include "wx/tokenzr.h"
#include "wx/fontmap.h"
#include "wx/scopedptr.h"
#include "wx/stdpaths.h"
#include "wx/version.h"
#include "wx/private/threadinfo.h"
@@ -56,6 +55,8 @@
#include "wx/msw/missing.h"
#endif
#include <memory>
// ----------------------------------------------------------------------------
// simple types
// ----------------------------------------------------------------------------
@@ -1084,7 +1085,7 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash,
// conversion to use to convert catalog strings to the GUI encoding
wxMBConv *inputConv = nullptr;
wxScopedPtr<wxMBConv> inputConvPtr; // just to delete inputConv if needed
std::unique_ptr<wxMBConv> inputConvPtr; // just to delete inputConv if needed
if ( !m_charset.empty() )
{
@@ -1157,7 +1158,7 @@ wxMsgCatalog::~wxMsgCatalog() = default;
wxMsgCatalog *wxMsgCatalog::CreateFromFile(const wxString& filename,
const wxString& domain)
{
wxScopedPtr<wxMsgCatalog> cat(new wxMsgCatalog(domain));
std::unique_ptr<wxMsgCatalog> cat(new wxMsgCatalog(domain));
wxMsgCatalogFile file;
@@ -1174,7 +1175,7 @@ wxMsgCatalog *wxMsgCatalog::CreateFromFile(const wxString& filename,
wxMsgCatalog *wxMsgCatalog::CreateFromData(const wxScopedCharBuffer& data,
const wxString& domain)
{
wxScopedPtr<wxMsgCatalog> cat(new wxMsgCatalog(domain));
std::unique_ptr<wxMsgCatalog> cat(new wxMsgCatalog(domain));
wxMsgCatalogFile file;
+3 -3
View File
@@ -113,13 +113,13 @@ void wxWebRequestImpl::SetData(const wxString& text, const wxString& contentType
{
m_dataText = text.mb_str(conv);
wxScopedPtr<wxInputStream>
std::unique_ptr<wxInputStream>
stream(new wxMemoryInputStream(m_dataText, m_dataText.length()));
SetData(stream, contentType);
}
bool
wxWebRequestImpl::SetData(wxScopedPtr<wxInputStream>& dataStream,
wxWebRequestImpl::SetData(std::unique_ptr<wxInputStream>& dataStream,
const wxString& contentType,
wxFileOffset dataSize)
{
@@ -431,7 +431,7 @@ wxWebRequest::SetData(wxInputStream* dataStream,
wxFileOffset dataSize)
{
// Ensure that the stream is destroyed even we return below.
wxScopedPtr<wxInputStream> streamPtr(dataStream);
std::unique_ptr<wxInputStream> streamPtr(dataStream);
wxCHECK_IMPL( false );
+3 -2
View File
@@ -30,7 +30,8 @@
#endif // WX_PRECOMP
#include "wx/graphics.h"
#include "wx/scopedptr.h"
#include <memory>
// ----------------------------------------------------------------------------
// constants
@@ -121,7 +122,7 @@ private:
{
wxPaintDC pdc(m_win);
wxScopedPtr<wxGraphicsContext> const
std::unique_ptr<wxGraphicsContext> const
gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(pdc));
const wxSize size = m_win->GetClientSize();
+2 -2
View File
@@ -25,7 +25,7 @@
#include "wx/filename.h"
#include "wx/filepicker.h"
#include "wx/scopedptr.h"
#include <memory>
// ============================================================================
@@ -89,7 +89,7 @@ bool wxGenericFileDirButton::Create(wxWindow *parent,
void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev))
{
wxScopedPtr<wxDialog> p(CreateDialog());
std::unique_ptr<wxDialog> p(CreateDialog());
if (p->ShowModal() == wxID_OK)
{
// save updated path in m_path
+3 -2
View File
@@ -35,7 +35,8 @@
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/graphics.h"
#include "wx/scopedptr.h"
#include <memory>
#endif
namespace
@@ -292,7 +293,7 @@ public:
private:
#if wxUSE_GRAPHICS_CONTEXT
wxScopedPtr<wxGraphicsContext> m_gc;
std::unique_ptr<wxGraphicsContext> m_gc;
#endif
wxWindow* const m_win;
int const m_rendererFlags;
+3 -2
View File
@@ -30,10 +30,11 @@
#include "wx/notebook.h"
#include "wx/sizer.h"
#include "wx/sharedptr.h"
#include "wx/scopedptr.h"
#include "wx/scopeguard.h"
#include "wx/vector.h"
#include <memory>
namespace
{
@@ -205,7 +206,7 @@ public:
virtual void Show(wxWindow* parent) override
{
wxScopedPtr<wxGenericPrefsDialog> dlg(CreateDialog(parent));
std::unique_ptr<wxGenericPrefsDialog> dlg(CreateDialog(parent));
// Store it for Dismiss() but ensure that the pointer is reset to nullptr
// when the dialog is destroyed on leaving this function.
+3 -2
View File
@@ -19,7 +19,8 @@
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/graphics.h"
#include "wx/scopedptr.h"
#include <memory>
#else
#include "wx/image.h"
#include "wx/math.h"
@@ -92,7 +93,7 @@ void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
wxDouble x = (drawSize.x - w) / 2;
wxDouble y = (drawSize.y - h) / 2;
#if wxUSE_GRAPHICS_CONTEXT
wxScopedPtr<wxGraphicsContext> const
std::unique_ptr<wxGraphicsContext> const
gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc));
gc->DrawBitmap(bitmap, x, y, w, h);
#else
+3 -2
View File
@@ -30,7 +30,8 @@
#include "wx/dataview.h"
#include "wx/renderer.h"
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
#include <memory>
// ----------------------------------------------------------------------------
// Constants
@@ -486,7 +487,7 @@ wxTreeListModel::InsertItem(Node* parent,
dvc->SetIndent(dvc->GetIndent());
}
wxScopedPtr<Node>
std::unique_ptr<Node>
newItem(new Node(parent, text, imageClosed, imageOpened, data));
// If we have no children at all, then inserting as last child is the same
+3 -2
View File
@@ -24,7 +24,8 @@
#if wxUSE_ACCEL
#include "wx/accel.h"
#include "wx/scopedptr.h"
#include <memory>
#endif // wxUSE_ACCEL
#include "wx/stockitem.h"
@@ -1433,7 +1434,7 @@ void GtkAccel::Init(const wxAcceleratorEntry* entry)
GtkAccel::GtkAccel(const wxMenuItem* item)
{
wxScopedPtr<wxAcceleratorEntry> accel(item->GetAccel());
std::unique_ptr<wxAcceleratorEntry> accel(item->GetAccel());
Init(accel.get());
#ifndef __WXGTK4__
+4 -3
View File
@@ -24,13 +24,14 @@
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/region.h"
#include "wx/scopedptr.h"
#endif // WX_PRECOMP
#include "wx/graphics.h"
#include "wx/gtk/private/wrapgtk.h"
#include <memory>
// ----------------------------------------------------------------------------
// wxNonOwnedWindowShapeImpl: base class for region and path-based classes.
// ----------------------------------------------------------------------------
@@ -162,7 +163,7 @@ private:
#ifdef __WXGTK3__
wxGraphicsContext* context = dc.GetGraphicsContext();
#else
wxScopedPtr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
#endif
context->SetBrush(*wxWHITE);
context->FillPath(path);
@@ -195,7 +196,7 @@ private:
#ifdef __WXGTK3__
wxGraphicsContext* context = dc.GetGraphicsContext();
#else
wxScopedPtr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
#endif
context->SetPen(wxPen(*wxLIGHT_GREY, 2));
context->StrokePath(m_path);
+3 -2
View File
@@ -36,7 +36,6 @@
#endif
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
#include "wx/msw/private.h"
#include "wx/msw/dc.h"
@@ -48,6 +47,8 @@
#include "wx/rawbmp.h"
#endif
#include <memory>
// missing from mingw32 header
#ifndef CLR_INVALID
#define CLR_INVALID ((COLORREF)-1)
@@ -634,7 +635,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon, wxBitmapTransparency transp)
bool wxBitmap::CopyFromDIB(const wxDIB& dib)
{
wxScopedPtr<wxBitmapRefData> newData(new wxBitmapRefData);
std::unique_ptr<wxBitmapRefData> newData(new wxBitmapRefData);
newData->CopyFromDIB(dib);
if ( !newData->IsOk() )
return false;
+3 -2
View File
@@ -39,13 +39,14 @@
#include "wx/file.h"
#include "wx/quantize.h"
#include "wx/scopedarray.h"
#include "wx/scopedptr.h"
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <memory>
#include "wx/msw/dib.h"
// ----------------------------------------------------------------------------
@@ -676,7 +677,7 @@ bool wxDIB::Create(const wxImage& image, PixelFormat pf, int dstDepth)
{
return false;
}
wxScopedPtr<wxPalette> palette(tempPalette);
std::unique_ptr<wxPalette> palette(tempPalette);
eightBitData.reset(tempEightBitData);
// use palette's colors in result bitmap
+4 -3
View File
@@ -41,7 +41,6 @@
#include "wx/dynlib.h"
#include "wx/filename.h"
#include "wx/scopedptr.h"
#include "wx/scopeguard.h"
#include "wx/tokenzr.h"
#include "wx/modalhook.h"
@@ -67,6 +66,8 @@
#include "wx/msw/private/cotaskmemptr.h"
#endif // wxUSE_IFILEOPENDIALOG
#include <memory>
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -579,7 +580,7 @@ public:
// We pass the ID of the first control that will be added to the
// combobox as the ctor argument.
wxScopedPtr<wxFileDialogChoiceImplFDC>
std::unique_ptr<wxFileDialogChoiceImplFDC>
impl(new wxFileDialogChoiceImplFDC(m_fdc, m_lastId, m_lastAuxId - 1));
for ( size_t i = 0; i < n; ++i )
@@ -1162,7 +1163,7 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err)
{
// Extra controls do not handle per-monitor DPI, fall back to system DPI
// so entire file-dialog is resized.
wxScopedPtr<wxMSWImpl::AutoSystemDpiAware> dpiAwareness;
std::unique_ptr<wxMSWImpl::AutoSystemDpiAware> dpiAwareness;
if ( of->Flags & OFN_ENABLEHOOK )
dpiAwareness.reset(new wxMSWImpl::AutoSystemDpiAware());
+4 -3
View File
@@ -35,9 +35,10 @@
#endif // wxUSE_GRAPHICS_CONTEXT
#include "wx/dynlib.h"
#include "wx/scopedptr.h"
#include "wx/msw/missing.h"
#include <memory>
// ============================================================================
// wxNonOwnedWindow implementation
// ============================================================================
@@ -91,7 +92,7 @@ public:
{
// Create the region corresponding to this path and set it as windows
// shape.
wxScopedPtr<wxGraphicsContext> context(wxGraphicsContext::Create(win));
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(win));
Region gr(static_cast<GraphicsPath*>(m_path.GetNativePath()));
win->SetShape(
wxRegion(
@@ -117,7 +118,7 @@ private:
event.Skip();
wxPaintDC dc(m_win);
wxScopedPtr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
context->SetPen(wxPen(*wxLIGHT_GREY, 2));
context->StrokePath(m_path);
}
+5 -4
View File
@@ -25,13 +25,14 @@
#include "wx/msw/private.h"
#include "wx/msw/taskbarbutton.h"
#include "wx/dynlib.h"
#include "wx/scopedptr.h"
#include "wx/msw/private/comptr.h"
#include "wx/msw/private/cotaskmemptr.h"
#include <shlwapi.h>
#include <initguid.h>
#include <memory>
// ----------------------------------------------------------------------------
// Redefine the interfaces: ITaskbarList3, IObjectCollection,
// ICustomDestinationList, IShellLink, IShellItem, IApplicationDocumentLists
@@ -566,9 +567,9 @@ private:
wxCOMPtr<ICustomDestinationList> m_destinationList;
wxCOMPtr<IObjectArray> m_objectArray;
wxScopedPtr<wxTaskBarJumpListCategory> m_tasks;
wxScopedPtr<wxTaskBarJumpListCategory> m_frequent;
wxScopedPtr<wxTaskBarJumpListCategory> m_recent;
std::unique_ptr<wxTaskBarJumpListCategory> m_tasks;
std::unique_ptr<wxTaskBarJumpListCategory> m_frequent;
std::unique_ptr<wxTaskBarJumpListCategory> m_recent;
wxTaskBarJumpListCategories m_customCategories;
bool m_recent_visible;
bool m_frequent_visible;
+3 -2
View File
@@ -29,11 +29,12 @@
#endif
#include "wx/graphics.h"
#include "wx/scopedptr.h"
#include "wx/tokenzr.h"
#include "wx/private/graphics.h"
#include <memory>
namespace
{
@@ -1064,7 +1065,7 @@ protected:
private:
// This pointer may be empty if we don't own m_qtPainter.
wxScopedPtr<QPainter> m_ownedPainter;
std::unique_ptr<QPainter> m_ownedPainter;
wxDECLARE_NO_COPY_CLASS(wxQtGraphicsContext);
};
+3 -2
View File
@@ -17,7 +17,6 @@
#include "wx/ribbon/art.h"
#include "wx/ribbon/bar.h"
#include "wx/dcbuffer.h"
#include "wx/scopedptr.h"
#ifndef WX_PRECOMP
#endif
@@ -26,6 +25,8 @@
#include "wx/msw/private.h"
#endif
#include <memory>
class wxRibbonToolBarToolBase
{
public:
@@ -242,7 +243,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::InsertTool(
wxASSERT(bitmap.IsOk());
// Create the wxRibbonToolBarToolBase with parameters
wxScopedPtr<wxRibbonToolBarToolBase> tool(new wxRibbonToolBarToolBase);
std::unique_ptr<wxRibbonToolBarToolBase> tool(new wxRibbonToolBarToolBase);
tool->id = tool_id;
tool->bitmap = bitmap;
if(bitmap_disabled.IsOk())
+3 -2
View File
@@ -16,7 +16,6 @@
#endif
#include "wx/evtloop.h"
#include "wx/scopedptr.h"
#include "wx/unix/private/wakeuppipe.h"
#include "wx/private/fdiodispatcher.h"
#include "wx/private/fdioeventloopsourcehandler.h"
@@ -24,6 +23,8 @@
#include <signal.h>
#include <unistd.h>
#include <memory>
#ifndef SA_RESTART
// don't use for systems which don't define it (at least VMS and QNX)
#define SA_RESTART 0
@@ -134,7 +135,7 @@ wxFDIOHandler* wxAppConsole::RegisterSignalWakeUpPipe(wxFDIODispatcher& dispatch
// we need a bridge to wxFDIODispatcher
//
// TODO: refactor the code so that only wxEventLoopSourceHandler is used
wxScopedPtr<wxFDIOHandler>
std::unique_ptr<wxFDIOHandler>
fdioHandler(new wxFDIOEventLoopSourceHandler(m_signalWakeUpPipe));
if ( !dispatcher.RegisterFD
+4 -3
View File
@@ -30,7 +30,6 @@
#endif
#include "wx/apptrait.h"
#include "wx/scopedptr.h"
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/unix/private/timer.h"
@@ -45,6 +44,8 @@
#include "wx/evtloopsrc.h"
#endif // wxUSE_EVENTLOOP_SOURCE
#include <memory>
// ===========================================================================
// wxEventLoop implementation
// ===========================================================================
@@ -61,7 +62,7 @@ wxConsoleEventLoop::wxConsoleEventLoop()
m_wakeupSource = nullptr;
// Create the pipe.
wxScopedPtr<wxWakeUpPipeMT> wakeupPipe(new wxWakeUpPipeMT);
std::unique_ptr<wxWakeUpPipeMT> wakeupPipe(new wxWakeUpPipeMT);
const int pipeFD = wakeupPipe->GetReadFd();
if ( pipeFD == wxPipe::INVALID_FD )
return;
@@ -119,7 +120,7 @@ public:
// we need a bridge to wxFDIODispatcher
//
// TODO: refactor the code so that only wxEventLoopSourceHandler is used
wxScopedPtr<wxFDIOHandler>
std::unique_ptr<wxFDIOHandler>
fdioHandler(new wxFDIOEventLoopSourceHandler(handler));
if ( !wxFDIODispatcher::Get()->RegisterFD(fd, fdioHandler.get(), flags) )
+3 -3
View File
@@ -26,8 +26,6 @@
#include "wx/log.h"
#endif //WX_PRECOMP
#include "wx/scopedptr.h"
#include "wx/gtk/private/wrapgtk.h"
#include "wx/gtk/private/backend.h"
#ifdef GDK_WINDOWING_WAYLAND
@@ -41,6 +39,8 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <memory>
// ----------------------------------------------------------------------------
// wxGLContextAttrs: OpenGL rendering context attributes
// ----------------------------------------------------------------------------
@@ -583,7 +583,7 @@ EGLConfig *wxGLCanvasEGL::InitConfig(const wxGLAttributes& dispAttrs)
/* static */
bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs)
{
wxScopedPtr<EGLConfig> config(wxGLCanvasEGL::InitConfig(dispAttrs));
std::unique_ptr<EGLConfig> config(wxGLCanvasEGL::InitConfig(dispAttrs));
return config != nullptr;
}
+6 -5
View File
@@ -45,7 +45,6 @@
#include "wx/apptrait.h"
#include "wx/process.h"
#include "wx/scopedptr.h"
#include "wx/thread.h"
#include "wx/cmdline.h"
@@ -63,6 +62,8 @@
#include "wx/mstream.h"
#include "wx/private/fdioeventloopsourcehandler.h"
#include <memory>
#include <pwd.h>
#include <sys/wait.h> // waitpid()
@@ -546,12 +547,12 @@ int BlockUntilChildExit(wxExecuteData& execData)
// Do register all the FDs we want to monitor here: first, the one used to
// handle the signals asynchronously.
wxScopedPtr<wxFDIOHandler>
std::unique_ptr<wxFDIOHandler>
signalHandler(wxTheApp->RegisterSignalWakeUpPipe(dispatcher));
#if wxUSE_STREAMS
// And then the two for the child output and error streams if necessary.
wxScopedPtr<wxFDIOHandler>
std::unique_ptr<wxFDIOHandler>
stdoutHandler,
stderrHandler;
if ( execData.IsRedirected() )
@@ -622,7 +623,7 @@ long wxExecute(const char* const* argv, int flags, wxProcess* process,
#endif // __DARWIN__
// this struct contains all information which we use for housekeeping
wxScopedPtr<wxExecuteData> execDataPtr(new wxExecuteData);
std::unique_ptr<wxExecuteData> execDataPtr(new wxExecuteData);
wxExecuteData& execData = *execDataPtr;
execData.m_flags = flags;
@@ -1570,7 +1571,7 @@ wxAppTraits::RunLoopUntilChildExit(wxExecuteData& execData,
#if wxUSE_STREAMS
// Monitor the child streams if necessary.
wxScopedPtr<wxEventLoopSourceHandler>
std::unique_ptr<wxEventLoopSourceHandler>
stdoutHandler,
stderrHandler;
if ( execData.IsRedirected() )
+3 -2
View File
@@ -25,9 +25,10 @@
#include "wx/datstrm.h"
#include "wx/zstream.h"
#include "wx/strconv.h"
#include "wx/scopedptr.h"
#include "wx/versioninfo.h"
#include <memory>
#include "expat.h" // from Expat
// DLL options compatibility check:
@@ -1139,7 +1140,7 @@ bool wxXmlDocument::Save(wxOutputStream& stream, int indentstep) const
if ( !IsOk() )
return false;
wxScopedPtr<wxMBConv> convMem, convFile;
std::unique_ptr<wxMBConv> convMem, convFile;
convFile.reset(new wxCSConv(GetFileEncoding()));
+4 -3
View File
@@ -16,7 +16,8 @@
#include "wx/xrc/xh_animatctrl.h"
#include "wx/animate.h"
#include "wx/generic/animate.h"
#include "wx/scopedptr.h"
#include <memory>
wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrlXmlHandler, wxXmlResourceHandler);
@@ -57,7 +58,7 @@ wxObject *wxAnimationCtrlXmlHandler::DoCreateResource()
if ( GetBool("hidden", 0) == 1 )
ctrl->Hide();
wxScopedPtr<wxAnimation> animation(GetAnimation("animation", ctrl));
std::unique_ptr<wxAnimation> animation(GetAnimation("animation", ctrl));
if ( animation )
ctrl->SetAnimation(*animation);
@@ -85,7 +86,7 @@ wxAnimation* wxXmlResourceHandlerImpl::GetAnimation(const wxString& param,
return nullptr;
// load the animation from file
wxScopedPtr<wxAnimation> ani(ctrl ? new wxAnimation(ctrl->CreateAnimation())
std::unique_ptr<wxAnimation> ani(ctrl ? new wxAnimation(ctrl->CreateAnimation())
: new wxAnimation);
#if wxUSE_FILESYSTEM
wxFSFile * const
+3 -4
View File
@@ -39,7 +39,6 @@
#include "wx/imaglist.h"
#include "wx/dir.h"
#include "wx/xml/xml.h"
#include "wx/scopedptr.h"
#include "wx/config.h"
#include "wx/platinfo.h"
@@ -61,7 +60,7 @@ wxDateTime GetXRCFileModTime(const wxString& filename)
{
#if wxUSE_FILESYSTEM
wxFileSystem fsys;
wxScopedPtr<wxFSFile> file(fsys.OpenFile(filename));
std::unique_ptr<wxFSFile> file(fsys.OpenFile(filename));
return file ? file->GetModificationTime() : wxDateTime();
#else // wxUSE_FILESYSTEM
@@ -777,7 +776,7 @@ wxXmlDocument *wxXmlResource::DoLoadFile(const wxString& filename)
#if wxUSE_FILESYSTEM
wxFileSystem fsys;
wxScopedPtr<wxFSFile> file(fsys.OpenFile(filename));
std::unique_ptr<wxFSFile> file(fsys.OpenFile(filename));
if (file)
{
// Notice that we don't have ownership of the stream in this case, it
@@ -797,7 +796,7 @@ wxXmlDocument *wxXmlResource::DoLoadFile(const wxString& filename)
wxString encoding(wxT("UTF-8"));
wxScopedPtr<wxXmlDocument> doc(new wxXmlDocument);
std::unique_ptr<wxXmlDocument> doc(new wxXmlDocument);
if (!doc->Load(*stream, encoding))
{
wxLogError(_("Cannot load resources from file '%s'."), filename);