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:
Vadim Zeitlin
2007-03-31 02:57:55 +00:00
parent 531030e2d2
commit 9005f2edfd
16 changed files with 91 additions and 69 deletions

View File

@@ -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;
};
// ----------------------------------------------------------------------------