]>
git.saurik.com Git - wxWidgets.git/blob - src/common/clipcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/clipcmn.cpp
3 // Purpose: common (to all ports) wxClipboard functions
4 // Author: Robert Roebling
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
28 #include "wx/clipbrd.h"
31 #include "wx/dataobj.h"
32 #include "wx/module.h"
35 // ---------------------------------------------------------
37 // ---------------------------------------------------------
39 IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent
,wxEvent
)
41 wxDEFINE_EVENT( wxEVT_CLIPBOARD_CHANGED
, wxClipboardEvent
);
43 bool wxClipboardEvent::SupportsFormat( const wxDataFormat
&format
) const
46 for (wxVector
<wxDataFormat
>::size_type n
= 0; n
< m_formats
.size(); n
++)
48 if (m_formats
[n
] == format
)
54 // All other ports just query the clipboard directly
56 wxClipboard
* clipboard
= (wxClipboard
*) GetEventObject();
57 return clipboard
->IsSupported( format
);
61 void wxClipboardEvent::AddFormat(const wxDataFormat
& format
)
63 m_formats
.push_back( format
);
66 // ---------------------------------------------------------
68 // ---------------------------------------------------------
70 static wxClipboard
*gs_clipboard
= NULL
;
72 /*static*/ wxClipboard
*wxClipboardBase::Get()
76 gs_clipboard
= new wxClipboard
;
81 bool wxClipboardBase::IsSupportedAsync( wxEvtHandler
*sink
)
83 // We just imitate an asynchronous API on most platforms.
84 // This method is overridden uner GTK.
85 wxClipboardEvent
*event
= new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED
);
86 event
->SetEventObject( this );
88 sink
->QueueEvent( event
);
94 // ----------------------------------------------------------------------------
95 // wxClipboardModule: module responsible for destroying the global clipboard
97 // ----------------------------------------------------------------------------
99 class wxClipboardModule
: public wxModule
102 bool OnInit() { return true; }
103 void OnExit() { wxDELETE(gs_clipboard
); }
106 DECLARE_DYNAMIC_CLASS(wxClipboardModule
)
109 IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule
, wxModule
)
111 #endif // wxUSE_CLIPBOARD