1. Moved m_usePrimary to wxClipboardBase as it's now also used by wxMSW/wxMac
2. Added IsUsingPrimarySelection() 3. Fail all clipboard operations when IsUsingPrimarySelection() is true on non-X11 platforms git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45183 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,7 +35,7 @@ class WXDLLEXPORT wxClipboard;
|
||||
class WXDLLEXPORT wxClipboardBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxClipboardBase() {}
|
||||
wxClipboardBase() { m_usePrimary = false; }
|
||||
|
||||
// open the clipboard before Add/SetData() and GetData()
|
||||
virtual bool Open() = 0;
|
||||
@@ -70,11 +70,28 @@ public:
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush() { return false; }
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
virtual void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
|
||||
// this allows to choose whether we work with CLIPBOARD (default) or
|
||||
// PRIMARY selection on X11-based systems
|
||||
//
|
||||
// on the other ones, working with primary selection does nothing: this
|
||||
// allows to write code which sets the primary selection when something is
|
||||
// selected without any ill effects (i.e. without overwriting the
|
||||
// clipboard which would be wrong on the platforms without X11 PRIMARY)
|
||||
virtual void UsePrimarySelection(bool usePrimary = false)
|
||||
{
|
||||
m_usePrimary = usePrimary;
|
||||
}
|
||||
|
||||
// return true if we're using primary selection
|
||||
bool IsUsingPrimarySelection() const { return m_usePrimary; }
|
||||
|
||||
// Returns global instance (wxTheClipboard) of the object:
|
||||
static wxClipboard *Get();
|
||||
|
||||
|
||||
// don't use this directly, it is public for compatibility with some ports
|
||||
// (wxX11, wxMotif, ...) only
|
||||
bool m_usePrimary;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -52,11 +52,7 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
// If primary == TRUE, use primary selection in all further ops,
|
||||
// primary == FALSE resets it.
|
||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
@@ -111,7 +107,6 @@ private:
|
||||
GtkWidget *m_targetsWidget; // for getting list of supported formats
|
||||
|
||||
bool m_open;
|
||||
bool m_usePrimary;
|
||||
bool m_formatSupported;
|
||||
|
||||
|
||||
|
||||
@@ -53,11 +53,6 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
// If primary == TRUE, use primary selection in all further ops,
|
||||
// primary == FALSE resets it.
|
||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
// implementation from now on
|
||||
bool m_open;
|
||||
bool m_ownsClipboard;
|
||||
@@ -70,7 +65,6 @@ public:
|
||||
|
||||
bool m_formatSupported;
|
||||
GdkAtom m_targetRequested;
|
||||
bool m_usePrimary;
|
||||
wxDataObject *m_receivedData;
|
||||
|
||||
private:
|
||||
|
||||
@@ -63,9 +63,6 @@ public:
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush();
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
|
||||
|
||||
private:
|
||||
wxDataObject *m_data;
|
||||
bool m_open;
|
||||
@@ -73,5 +70,4 @@ private:
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_
|
||||
#endif // _WX_CLIPBRD_H_
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: clipboard.h
|
||||
// Name: wx/mgl/clipboard.h
|
||||
// Purpose:
|
||||
// Author: Vaclav Slavik
|
||||
// Id: $Id$
|
||||
@@ -52,11 +52,6 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear() {}
|
||||
|
||||
// If primary == TRUE, use primary selection in all further ops,
|
||||
// primary == FALSE resets it.
|
||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
// implementation from now on
|
||||
bool m_open;
|
||||
bool m_ownsClipboard;
|
||||
@@ -69,7 +64,6 @@ public:
|
||||
|
||||
bool m_formatSupported;
|
||||
GdkAtom m_targetRequested;
|
||||
bool m_usePrimary;
|
||||
wxDataObject *m_receivedData;
|
||||
|
||||
private:
|
||||
|
||||
@@ -67,13 +67,9 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
virtual void UsePrimarySelection(bool primary = true)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
// implementation from now on
|
||||
bool m_open;
|
||||
wxDataObjectList m_data;
|
||||
bool m_usePrimary;
|
||||
wxDataIdToDataObjectList m_idToObject;
|
||||
|
||||
private:
|
||||
@@ -82,5 +78,4 @@ private:
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_
|
||||
#endif // _WX_CLIPBRD_H_
|
||||
|
||||
@@ -85,14 +85,11 @@ public:
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush();
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
void UsePrimarySelection( bool WXUNUSED(primary) = false ) { }
|
||||
|
||||
private:
|
||||
IDataObject *m_lastDataObject;
|
||||
bool m_isOpened;
|
||||
};
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_
|
||||
|
||||
#endif // _WX_CLIPBRD_H_
|
||||
|
||||
@@ -88,13 +88,9 @@ public:
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush();
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
|
||||
|
||||
private:
|
||||
bool m_clearOnExit;
|
||||
};
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_
|
||||
#endif // _WX_CLIPBRD_H_
|
||||
|
||||
@@ -85,9 +85,6 @@ public:
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush();
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
|
||||
|
||||
private:
|
||||
bool m_clearOnExit;
|
||||
bool m_isOpened;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: clipbrd.h
|
||||
// Name: wx/x11/clipbrd.h
|
||||
// Purpose: Clipboard functionality.
|
||||
// Author: Robert Roebling
|
||||
// Created: 17/09/98
|
||||
@@ -8,8 +8,8 @@
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __X11CLIPBOARDH__
|
||||
#define __X11CLIPBOARDH__
|
||||
#ifndef _WX_X11_CLIPBRD_H_
|
||||
#define _WX_X11_CLIPBRD_H_
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
||||
@@ -53,11 +53,6 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
// If primary == TRUE, use primary selection in all further ops,
|
||||
// primary == FALSE resets it.
|
||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
// implementation from now on
|
||||
bool m_open;
|
||||
bool m_ownsClipboard;
|
||||
@@ -70,15 +65,12 @@ public:
|
||||
|
||||
bool m_formatSupported;
|
||||
Atom m_targetRequested;
|
||||
bool m_usePrimary;
|
||||
wxDataObject *m_receivedData;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_CLIPBOARD
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
#endif
|
||||
// __X11CLIPBOARDH__
|
||||
#endif // _WX_X11_CLIPBRD_H_
|
||||
|
||||
Reference in New Issue
Block a user