Replace wxScopedPtr with std::unique_ptr in wxOSX

Stop using wxScopedPtr in wxOSX and use the standard class instead:
there were just a few occurrences of the former in this port, so it was
easy to get rid of it.
This commit is contained in:
Vadim Zeitlin 2023-03-06 22:54:37 +01:00
parent d09245429a
commit 0f158ac6d2
5 changed files with 14 additions and 8 deletions

View file

@ -32,6 +32,8 @@
#include "wx/osx/private.h"
#include "wx/osx/private/datatransfer.h"
#include <memory>
static CFStringRef kUTTypeTraditionalMacText = CFSTR("com.apple.traditional-mac-plain-text");
static wxString privateUTIPrefix = "org.wxwidgets.private.";
@ -423,7 +425,7 @@ bool wxDataObject::ReadFromSource(wxOSXDataSource * source)
for ( size_t itemIndex = 0; itemIndex < itemCount && !transferred; ++itemIndex)
{
wxScopedPtr<const wxOSXDataSourceItem> sitem(source->GetItem(itemIndex));
std::unique_ptr<const wxOSXDataSourceItem> sitem(source->GetItem(itemIndex));
wxDataFormat::NativeFormat nativeFormat = sitem->AvailableType(typesarray);
CFDataRef flavorData = sitem->DoGetData(nativeFormat);

View file

@ -19,11 +19,12 @@
#include "wx/dcclient.h"
#endif
#include "wx/scopedptr.h"
#include "wx/taskbar.h"
#include "wx/osx/private.h"
#include <memory>
class wxTaskBarIconWindow;
//-----------------------------------------------------------------------------
@ -105,7 +106,7 @@ protected:
private:
wxTaskBarIconDockImpl();
wxMenu *m_pMenu;
wxScopedPtr<wxMenu> m_menuDeleter;
std::unique_ptr<wxMenu> m_menuDeleter;
};
class wxTaskBarIconCustomStatusItemImpl;

View file

@ -31,6 +31,8 @@
#if wxUSE_EVENTLOOP_SOURCE
#include <memory>
namespace
{
@ -76,7 +78,7 @@ public:
{
wxCHECK_MSG( fd != -1, nullptr, "can't monitor invalid fd" );
wxScopedPtr<wxCFEventLoopSource>
std::unique_ptr<wxCFEventLoopSource>
source(new wxCFEventLoopSource(handler, flags));
CFSocketContext context = { 0, source.get(), nullptr, nullptr, nullptr };

View file

@ -31,13 +31,14 @@
#endif
#include "wx/osx/private.h"
#include "wx/scopedptr.h"
#include "wx/private/menuradio.h" // for wxMenuRadioItemsData
// other standard headers
// ----------------------
#include <string.h>
#include <memory>
wxIMPLEMENT_ABSTRACT_CLASS(wxMenuImpl, wxObject);
wxMenuImpl::~wxMenuImpl()
@ -47,7 +48,7 @@ wxMenuImpl::~wxMenuImpl()
// the (popup) menu title has this special menuid
static const int idMenuTitle = -3;
wxScopedPtr<wxMenu> gs_emptyMenuBar;
std::unique_ptr<wxMenu> gs_emptyMenuBar;
// ============================================================================
// implementation

View file

@ -533,7 +533,7 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region)
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/scopedptr.h"
#include <memory>
bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path)
{
@ -547,7 +547,7 @@ bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path)
dc.SetBackground(*wxBLACK_BRUSH);
dc.Clear();
wxScopedPtr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
std::unique_ptr<wxGraphicsContext> context(wxGraphicsContext::Create(dc));
context->SetBrush(*wxWHITE_BRUSH);
context->SetAntialiasMode(wxANTIALIAS_NONE);
context->FillPath(path);