1999-10-21 10:23:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-08-31 19:31:43 +00:00
|
|
|
// Name: src/common/clipcmn.cpp
|
1999-10-21 10:23:30 +00:00
|
|
|
// Purpose: common (to all ports) wxClipboard functions
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// Modified by:
|
|
|
|
// Created: 28.06.99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Robert Roebling
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-10-21 10:23:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// declarations
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2006-08-31 19:31:43 +00:00
|
|
|
#if wxUSE_CLIPBOARD
|
|
|
|
|
1999-10-21 10:23:30 +00:00
|
|
|
#include "wx/clipbrd.h"
|
|
|
|
|
2006-08-31 19:31:43 +00:00
|
|
|
#ifndef WX_PRECOMP
|
2008-12-22 17:11:15 +00:00
|
|
|
#include "wx/dataobj.h"
|
2006-08-31 19:31:43 +00:00
|
|
|
#include "wx/module.h"
|
|
|
|
#endif
|
1999-12-13 16:16:52 +00:00
|
|
|
|
2008-12-21 22:15:50 +00:00
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxClipboardEvent
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent)
|
|
|
|
|
|
|
|
DEFINE_EVENT_TYPE(wxEVT_CLIPBOARD_CHANGED)
|
|
|
|
|
|
|
|
bool wxClipboardEvent::SupportsFormat( const wxDataFormat &format ) const
|
|
|
|
{
|
|
|
|
wxVector<wxDataFormat>::size_type n;
|
|
|
|
for (n = 0; n < m_formats.size(); n++)
|
|
|
|
{ if (m_formats[n] == format) return true; }
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void wxClipboardEvent::AddFormat( const wxDataFormat &format )
|
|
|
|
{
|
|
|
|
m_formats.push_back( format );
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
// wxClipboardBase
|
|
|
|
// ---------------------------------------------------------
|
|
|
|
|
2004-06-20 17:19:26 +00:00
|
|
|
static wxClipboard *gs_clipboard = NULL;
|
|
|
|
|
|
|
|
/*static*/ wxClipboard *wxClipboardBase::Get()
|
|
|
|
{
|
|
|
|
if ( !gs_clipboard )
|
|
|
|
{
|
|
|
|
gs_clipboard = new wxClipboard;
|
|
|
|
}
|
|
|
|
return gs_clipboard;
|
|
|
|
}
|
|
|
|
|
1999-10-21 10:23:30 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
2004-06-20 17:19:26 +00:00
|
|
|
// wxClipboardModule: module responsible for destroying the global clipboard
|
1999-10-21 10:23:30 +00:00
|
|
|
// object
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxClipboardModule : public wxModule
|
|
|
|
{
|
|
|
|
public:
|
2004-06-20 17:19:26 +00:00
|
|
|
bool OnInit() { return true; }
|
|
|
|
void OnExit() { wxDELETE(gs_clipboard); }
|
1999-10-21 10:23:30 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
|
|
|
};
|
|
|
|
|
1999-10-21 13:40:07 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule)
|
1999-10-23 23:40:55 +00:00
|
|
|
|
1999-12-13 16:16:52 +00:00
|
|
|
#endif // wxUSE_CLIPBOARD
|