From 89930c9e5e1c23d130f111f947623b4f9cc2bb54 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 20 Jun 2023 21:13:45 +0100 Subject: [PATCH] Deprecate old wxMSW-specific clipboard functions Formally deprecate these functions that shouldn't be used since a couple of decades already. --- include/wx/msw/clipbrd.h | 21 +++++++++++---------- src/msw/clipbrd.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/wx/msw/clipbrd.h b/include/wx/msw/clipbrd.h index 5f74817af2..f1aa88f029 100644 --- a/include/wx/msw/clipbrd.h +++ b/include/wx/msw/clipbrd.h @@ -13,19 +13,20 @@ #if wxUSE_CLIPBOARD -// These functions superseded by wxClipboard, but retained in order to -// implement wxClipboard, and for compatibility. +// Deprecated wxMSW-only function superseded by wxClipboard, don't use them and +// use that class instead. +#ifdef WXWIN_COMPATIBILITY_3_2 -// open/close the clipboard -WXDLLIMPEXP_CORE bool wxOpenClipboard(); -WXDLLIMPEXP_CORE bool wxIsClipboardOpened(); -#define wxClipboardOpen wxIsClipboardOpened -WXDLLIMPEXP_CORE bool wxCloseClipboard(); +wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxOpenClipboard(); +wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxIsClipboardOpened(); +wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxClipboardOpen(); +wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxCloseClipboard(); +wxDEPRECATED_MSG("Use wxClipboard") WXDLLIMPEXP_CORE bool wxEmptyClipboard(); -// get/set data -WXDLLIMPEXP_CORE bool wxEmptyClipboard(); +#endif // WXWIN_COMPATIBILITY_3_2 -// clipboard formats +// Non-deprecated but still wxMSW-specific functions working with clipboard +// formats -- don't use them neither. WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); WXDLLIMPEXP_CORE int wxRegisterClipboardFormat(wxChar *formatName); diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 89a3c5151d..2012f246d2 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -60,10 +60,13 @@ // old-style clipboard functions using Windows API // --------------------------------------------------------------------------- -static bool gs_wxClipboardIsOpen = false; static int gs_htmlcfid = 0; static int gs_pngcfid = 0; +#ifdef WXWIN_COMPATIBILITY_3_2 + +static bool gs_wxClipboardIsOpen = false; + bool wxOpenClipboard() { wxCHECK_MSG( !gs_wxClipboardIsOpen, true, wxT("clipboard already opened.") ); @@ -121,6 +124,13 @@ bool wxIsClipboardOpened() return gs_wxClipboardIsOpen; } +bool wxClipboardOpen() +{ + return gs_wxClipboardIsOpen; +} + +#endif // WXWIN_COMPATIBILITY_3_2 + bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { wxDataFormat::NativeFormat cf = dataFormat.GetFormatId();