Add wx headers and ext
This commit is contained in:
parent
6390dcef6a
commit
66d3c7b811
1531 changed files with 295895 additions and 0 deletions
117
wxheaders/wx/osx/private/addremovectrl.h
Normal file
117
wxheaders/wx/osx/private/addremovectrl.h
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/private/addremovectrl.h
|
||||
// Purpose: OS X specific wxAddRemoveImpl implementation
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2015-02-05
|
||||
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_PRIVATE_ADDREMOVECTRL_H_
|
||||
#define _WX_OSX_PRIVATE_ADDREMOVECTRL_H_
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/bmpbuttn.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAddRemoveImpl itself
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxAddRemoveImpl : public wxAddRemoveImplWithButtons
|
||||
{
|
||||
public:
|
||||
wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor,
|
||||
wxAddRemoveCtrl* parent,
|
||||
wxWindow* ctrlItems)
|
||||
: wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems),
|
||||
m_ctrlItems(ctrlItems)
|
||||
{
|
||||
// This size is hard coded for now as this is what the system dialogs
|
||||
// themselves (e.g. the buttons under the lists in the "Users" or
|
||||
// "Network" panes of the "System Preferences") use under OS X 10.8.
|
||||
const wxSize sizeBtn(25, 23);
|
||||
|
||||
m_btnAdd = new wxBitmapButton(parent, wxID_ADD,
|
||||
wxArtProvider::GetBitmap("NSAddTemplate"),
|
||||
wxDefaultPosition,
|
||||
sizeBtn,
|
||||
wxBORDER_SIMPLE);
|
||||
|
||||
m_btnRemove = new wxBitmapButton(parent, wxID_REMOVE,
|
||||
wxArtProvider::GetBitmap("NSRemoveTemplate"),
|
||||
wxDefaultPosition,
|
||||
sizeBtn,
|
||||
wxBORDER_SIMPLE);
|
||||
|
||||
// Under OS X the space to the right of the buttons is actually
|
||||
// occupied by an inactive gradient button, so create one.
|
||||
m_btnPlaceholder = new wxButton(parent, wxID_ANY, "",
|
||||
wxDefaultPosition,
|
||||
sizeBtn,
|
||||
wxBORDER_SIMPLE);
|
||||
m_btnPlaceholder->Disable();
|
||||
|
||||
|
||||
// We need to lay out our windows manually under OS X as it is the only
|
||||
// way to achieve the required, for the correct look, overlap between
|
||||
// their borders -- sizers would never allow this.
|
||||
parent->Bind(wxEVT_SIZE, &wxAddRemoveImpl::OnSize, this);
|
||||
|
||||
// We also have to ensure that the window with the items doesn't have
|
||||
// any border as it wouldn't look correctly if it did.
|
||||
long style = ctrlItems->GetWindowStyle();
|
||||
style &= ~wxBORDER_MASK;
|
||||
style |= wxBORDER_SIMPLE;
|
||||
ctrlItems->SetWindowStyle(style);
|
||||
|
||||
|
||||
SetUpEvents();
|
||||
}
|
||||
|
||||
// As we don't use sizers, we also need to compute our best size ourselves.
|
||||
virtual wxSize GetBestClientSize() const wxOVERRIDE
|
||||
{
|
||||
wxSize size = m_ctrlItems->GetBestSize();
|
||||
|
||||
const wxSize sizeBtn = m_btnAdd->GetSize();
|
||||
|
||||
size.y += sizeBtn.y;
|
||||
size.IncTo(wxSize(3*sizeBtn.x, -1));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
private:
|
||||
void OnSize(wxSizeEvent& event)
|
||||
{
|
||||
const wxSize size = event.GetSize();
|
||||
|
||||
const wxSize sizeBtn = m_btnAdd->GetSize();
|
||||
|
||||
const int yBtn = size.y - sizeBtn.y;
|
||||
|
||||
// There is a vertical overlap which hides the items control bottom
|
||||
// border.
|
||||
m_ctrlItems->SetSize(0, 0, size.x, yBtn + 2);
|
||||
|
||||
// And there is also a horizontal 1px overlap between the buttons
|
||||
// themselves, so subtract 1 from the next button position.
|
||||
int x = 0;
|
||||
m_btnAdd->Move(x, yBtn);
|
||||
x += sizeBtn.x - 1;
|
||||
|
||||
m_btnRemove->Move(x, yBtn);
|
||||
x += sizeBtn.x - 1;
|
||||
|
||||
// The last one needs to be resized to take up all the remaining space.
|
||||
m_btnPlaceholder->SetSize(x, yBtn, size.x - x, sizeBtn.y);
|
||||
}
|
||||
|
||||
wxWindow* m_ctrlItems;
|
||||
wxButton* /* const */ m_btnPlaceholder;
|
||||
};
|
||||
|
||||
#endif // _WX_OSX_PRIVATE_ADDREMOVECTRL_H_
|
||||
51
wxheaders/wx/osx/private/available.h
Normal file
51
wxheaders/wx/osx/private/available.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/private/available.h
|
||||
// Purpose: Helper for checking API availability under macOS.
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2019-04-17
|
||||
// Copyright: (c) 2019 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_PRIVATE_AVAILABLE_H_
|
||||
#define _WX_OSX_PRIVATE_AVAILABLE_H_
|
||||
|
||||
// Xcode 9 adds new @available keyword and the corresponding __builtin_available
|
||||
// builtin which should be used instead of manual checks for API availability
|
||||
// as using this builtin suppresses the compiler -Wunguarded-availability
|
||||
// warnings, so use it if possible for the implementation of our own macro.
|
||||
#if defined(__clang__) && __has_builtin(__builtin_available)
|
||||
#define WX_IS_MACOS_AVAILABLE(major, minor) \
|
||||
__builtin_available(macOS major ## . ## minor, *)
|
||||
|
||||
#define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \
|
||||
__builtin_available(macOS macmajor ## . ## macminor, iOS imajor ##. ## iminor, *)
|
||||
|
||||
#define WX_IS_MACOS_AVAILABLE_FULL(major, minor, micro) \
|
||||
__builtin_available(macOS major ## . ## minor ## . ## micro, *)
|
||||
|
||||
// Note that we can't easily forward to API_AVAILABLE macro here, so go
|
||||
// directly to its expansion instead.
|
||||
#define WX_API_AVAILABLE_MACOS(major, minor) \
|
||||
__attribute__((availability(macos,introduced=major ## . ## minor)))
|
||||
#else // Not clang or old clang version without __builtin_available
|
||||
#include "wx/platinfo.h"
|
||||
|
||||
#define WX_IS_MACOS_AVAILABLE(major, minor) \
|
||||
wxPlatformInfo::Get().CheckOSVersion(major, minor)
|
||||
|
||||
#ifdef wxOSX_USE_IPHONE
|
||||
#define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \
|
||||
wxPlatformInfo::Get().CheckOSVersion(imajor, iminor)
|
||||
#else
|
||||
#define WX_IS_MACOS_OR_IOS_AVAILABLE(macmajor, macminor, imajor, iminor) \
|
||||
wxPlatformInfo::Get().CheckOSVersion(macmajor, macminor)
|
||||
#endif
|
||||
|
||||
#define WX_IS_MACOS_AVAILABLE_FULL(major, minor, micro) \
|
||||
wxPlatformInfo::Get().CheckOSVersion(major, minor, micro)
|
||||
|
||||
#define WX_API_AVAILABLE_MACOS(major, minor)
|
||||
#endif
|
||||
|
||||
#endif // _WX_OSX_PRIVATE_AVAILABLE_H_
|
||||
113
wxheaders/wx/osx/private/datatransfer.h
Normal file
113
wxheaders/wx/osx/private/datatransfer.h
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/private/datatransfer.h
|
||||
// Purpose: OS X specific data transfer implementation
|
||||
// Author: Stefan Csomor
|
||||
// Created: 2019-03-29
|
||||
// Copyright: (c) 2019 Stefan Csomor <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_PRIVATE_DATATRANSFER_H_
|
||||
#define _WX_OSX_PRIVATE_DATATRANSFER_H_
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/dataform.h"
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDataObject;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXDataSourceItem
|
||||
{
|
||||
public:
|
||||
virtual ~wxOSXDataSourceItem();
|
||||
|
||||
virtual wxDataFormat::NativeFormat AvailableType(CFArrayRef types) const = 0;
|
||||
|
||||
virtual bool GetData( const wxDataFormat& dataFormat, wxMemoryBuffer& target) = 0;
|
||||
|
||||
virtual bool GetData( wxDataFormat::NativeFormat type, wxMemoryBuffer& target) = 0;
|
||||
|
||||
virtual CFDataRef DoGetData(wxDataFormat::NativeFormat type) const = 0;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXDataSource
|
||||
{
|
||||
public:
|
||||
// the number of source items
|
||||
virtual size_t GetItemCount() const = 0;
|
||||
|
||||
// get source item by index, needs to be deleted after use
|
||||
virtual const wxOSXDataSourceItem* GetItem(size_t pos) const = 0;
|
||||
|
||||
// returns true if there is any data in this source conforming to dataFormat
|
||||
virtual bool IsSupported(const wxDataFormat &dataFormat);
|
||||
|
||||
// returns true if there is any data in this source supported by dataobj
|
||||
virtual bool IsSupported(const wxDataObject &dataobj);
|
||||
|
||||
// returns true if there is any data in this source of types
|
||||
virtual bool HasData(CFArrayRef types) const = 0;
|
||||
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXDataSinkItem
|
||||
{
|
||||
public:
|
||||
virtual ~wxOSXDataSinkItem();
|
||||
|
||||
virtual void SetFilename(const wxString& filename);
|
||||
|
||||
// translating from wx into native representation
|
||||
virtual void SetData(const wxDataFormat& format, const void *buf, size_t size) = 0;
|
||||
|
||||
// translating from wx into native representation
|
||||
virtual void SetData(wxDataFormat::NativeFormat format, const void *buf, size_t size) = 0;
|
||||
|
||||
// native implementation for setting data
|
||||
virtual void DoSetData(wxDataFormat::NativeFormat format, CFDataRef data) = 0;
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXDataSink
|
||||
{
|
||||
public:
|
||||
// delete all created sink items
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// create a new sink item
|
||||
virtual wxOSXDataSinkItem* CreateItem() = 0;
|
||||
|
||||
// flush the created sink items into the system sink representation
|
||||
virtual void Flush() = 0 ;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxOSXPasteboard : public wxOSXDataSink, public wxOSXDataSource
|
||||
{
|
||||
public:
|
||||
wxOSXPasteboard(OSXPasteboard native);
|
||||
~wxOSXPasteboard();
|
||||
|
||||
// sink methods
|
||||
|
||||
virtual wxOSXDataSinkItem* CreateItem() wxOVERRIDE;
|
||||
|
||||
void Clear() wxOVERRIDE;
|
||||
|
||||
void Flush() wxOVERRIDE;
|
||||
|
||||
// source methods
|
||||
|
||||
virtual size_t GetItemCount() const wxOVERRIDE;
|
||||
|
||||
virtual const wxOSXDataSourceItem* GetItem(size_t pos) const wxOVERRIDE;
|
||||
|
||||
virtual bool HasData(CFArrayRef types) const wxOVERRIDE;
|
||||
|
||||
static wxOSXPasteboard* GetGeneralClipboard();
|
||||
private:
|
||||
void DeleteSinkItems();
|
||||
|
||||
OSXPasteboard m_pasteboard;
|
||||
wxVector<wxOSXDataSinkItem*> m_sinkItems;
|
||||
};
|
||||
|
||||
#endif
|
||||
1
wxheaders/wx/osx/private/print.h
Normal file
1
wxheaders/wx/osx/private/print.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include "wx/osx/carbon/private/print.h"
|
||||
3
wxheaders/wx/osx/private/timer.h
Normal file
3
wxheaders/wx/osx/private/timer.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#if 1 // revert to wxOSX_USE_COCOA_OR_IPHONE in case of problems
|
||||
#include "wx/osx/core/private/timer.h"
|
||||
#endif
|
||||
172
wxheaders/wx/osx/private/webrequest_urlsession.h
Normal file
172
wxheaders/wx/osx/private/webrequest_urlsession.h
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/osx/webrequest_urlsession.h
|
||||
// Purpose: wxWebRequest implementation using URLSession
|
||||
// Author: Tobias Taschner
|
||||
// Created: 2018-10-25
|
||||
// Copyright: (c) 2018 wxWidgets development team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OSX_WEBREQUEST_URLSESSION_H
|
||||
#define _WX_OSX_WEBREQUEST_URLSESSION_H
|
||||
|
||||
#if wxUSE_WEBREQUEST_URLSESSION
|
||||
|
||||
#include "wx/private/webrequest.h"
|
||||
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLCredential);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSession);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(NSURLSessionTask);
|
||||
DECLARE_WXCOCOA_OBJC_CLASS(wxWebSessionDelegate);
|
||||
|
||||
class wxWebSessionURLSession;
|
||||
class wxWebRequestURLSession;
|
||||
class wxWebResponseURLSession;
|
||||
|
||||
class wxWebAuthChallengeURLSession : public wxWebAuthChallengeImpl
|
||||
{
|
||||
public:
|
||||
wxWebAuthChallengeURLSession(wxWebAuthChallenge::Source source,
|
||||
wxWebRequestURLSession& request)
|
||||
: wxWebAuthChallengeImpl(source),
|
||||
m_request(request)
|
||||
{
|
||||
}
|
||||
|
||||
~wxWebAuthChallengeURLSession();
|
||||
|
||||
void SetCredentials(const wxWebCredentials& cred) wxOVERRIDE;
|
||||
|
||||
WX_NSURLCredential GetURLCredential() const { return m_cred; }
|
||||
|
||||
private:
|
||||
wxWebRequestURLSession& m_request;
|
||||
WX_NSURLCredential m_cred = NULL;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebAuthChallengeURLSession);
|
||||
};
|
||||
|
||||
class wxWebResponseURLSession : public wxWebResponseImpl
|
||||
{
|
||||
public:
|
||||
wxWebResponseURLSession(wxWebRequestURLSession& request, WX_NSURLSessionTask task);
|
||||
|
||||
~wxWebResponseURLSession();
|
||||
|
||||
wxFileOffset GetContentLength() const wxOVERRIDE;
|
||||
|
||||
wxString GetURL() const wxOVERRIDE;
|
||||
|
||||
wxString GetHeader(const wxString& name) const wxOVERRIDE;
|
||||
|
||||
int GetStatus() const wxOVERRIDE;
|
||||
|
||||
wxString GetStatusText() const wxOVERRIDE;
|
||||
|
||||
wxString GetSuggestedFileName() const wxOVERRIDE;
|
||||
|
||||
void HandleData(WX_NSData data);
|
||||
|
||||
private:
|
||||
WX_NSURLSessionTask m_task;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebResponseURLSession);
|
||||
};
|
||||
|
||||
class wxWebRequestURLSession : public wxWebRequestImpl
|
||||
{
|
||||
public:
|
||||
wxWebRequestURLSession(wxWebSession& session,
|
||||
wxWebSessionURLSession& sessionImpl,
|
||||
wxEvtHandler* handler,
|
||||
const wxString& url,
|
||||
int winid);
|
||||
|
||||
~wxWebRequestURLSession();
|
||||
|
||||
void Start() wxOVERRIDE;
|
||||
|
||||
wxWebResponseImplPtr GetResponse() const wxOVERRIDE
|
||||
{ return m_response; }
|
||||
|
||||
wxWebAuthChallengeImplPtr GetAuthChallenge() const wxOVERRIDE
|
||||
{ return m_authChallenge; }
|
||||
|
||||
wxFileOffset GetBytesSent() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesExpectedToSend() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesReceived() const wxOVERRIDE;
|
||||
|
||||
wxFileOffset GetBytesExpectedToReceive() const wxOVERRIDE;
|
||||
|
||||
wxWebRequestHandle GetNativeHandle() const wxOVERRIDE
|
||||
{
|
||||
return (wxWebRequestHandle)m_task;
|
||||
}
|
||||
|
||||
void HandleCompletion();
|
||||
|
||||
void HandleChallenge(wxWebAuthChallengeURLSession* challenge);
|
||||
|
||||
void OnSetCredentials(const wxWebCredentials& cred);
|
||||
|
||||
wxWebResponseURLSession* GetResponseImplPtr() const
|
||||
{ return m_response.get(); }
|
||||
|
||||
wxWebAuthChallengeURLSession* GetAuthChallengeImplPtr() const
|
||||
{ return m_authChallenge.get(); }
|
||||
|
||||
private:
|
||||
void DoCancel() wxOVERRIDE;
|
||||
|
||||
wxWebSessionURLSession& m_sessionImpl;
|
||||
wxString m_url;
|
||||
WX_NSURLSessionTask m_task;
|
||||
wxObjectDataPtr<wxWebResponseURLSession> m_response;
|
||||
wxObjectDataPtr<wxWebAuthChallengeURLSession> m_authChallenge;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebRequestURLSession);
|
||||
};
|
||||
|
||||
class wxWebSessionURLSession : public wxWebSessionImpl
|
||||
{
|
||||
public:
|
||||
wxWebSessionURLSession();
|
||||
|
||||
~wxWebSessionURLSession();
|
||||
|
||||
wxWebRequestImplPtr
|
||||
CreateRequest(wxWebSession& session,
|
||||
wxEvtHandler* handler,
|
||||
const wxString& url,
|
||||
int winid = wxID_ANY) wxOVERRIDE;
|
||||
|
||||
wxVersionInfo GetLibraryVersionInfo() wxOVERRIDE;
|
||||
|
||||
wxWebSessionHandle GetNativeHandle() const wxOVERRIDE
|
||||
{
|
||||
return (wxWebSessionHandle)m_session;
|
||||
}
|
||||
|
||||
WX_NSURLSession GetSession() { return m_session; }
|
||||
|
||||
WX_wxWebSessionDelegate GetDelegate() { return m_delegate; }
|
||||
|
||||
private:
|
||||
WX_NSURLSession m_session;
|
||||
WX_wxWebSessionDelegate m_delegate;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxWebSessionURLSession);
|
||||
};
|
||||
|
||||
class wxWebSessionFactoryURLSession : public wxWebSessionFactory
|
||||
{
|
||||
public:
|
||||
wxWebSessionImpl* Create() wxOVERRIDE
|
||||
{ return new wxWebSessionURLSession(); }
|
||||
};
|
||||
|
||||
#endif // wxUSE_WEBREQUEST_URLSESSION
|
||||
|
||||
#endif // _WX_OSX_WEBREQUEST_URLSESSION_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue