]>
Commit | Line | Data |
---|---|---|
b068c4e8 | 1 | ///////////////////////////////////////////////////////////////////////////// |
02761f6c | 2 | // Name: src/common/clipcmn.cpp |
b068c4e8 RR |
3 | // Purpose: common (to all ports) wxClipboard functions |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 28.06.99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Robert Roebling | |
65571936 | 9 | // Licence: wxWindows licence |
b068c4e8 RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
b068c4e8 RR |
20 | // For compilers that support precompilation, includes "wx.h". |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
02761f6c WS |
27 | #if wxUSE_CLIPBOARD |
28 | ||
b068c4e8 RR |
29 | #include "wx/clipbrd.h" |
30 | ||
02761f6c | 31 | #ifndef WX_PRECOMP |
01fc4932 | 32 | #include "wx/dataobj.h" |
02761f6c WS |
33 | #include "wx/module.h" |
34 | #endif | |
41b1047d | 35 | |
c220de0b RR |
36 | // --------------------------------------------------------- |
37 | // wxClipboardEvent | |
38 | // --------------------------------------------------------- | |
39 | ||
40 | IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent) | |
41 | ||
42 | DEFINE_EVENT_TYPE(wxEVT_CLIPBOARD_CHANGED) | |
43 | ||
44 | bool wxClipboardEvent::SupportsFormat( const wxDataFormat &format ) const | |
45 | { | |
46 | wxVector<wxDataFormat>::size_type n; | |
47 | for (n = 0; n < m_formats.size(); n++) | |
48 | { if (m_formats[n] == format) return true; } | |
49 | return false; | |
50 | } | |
51 | ||
52 | void wxClipboardEvent::AddFormat( const wxDataFormat &format ) | |
53 | { | |
54 | m_formats.push_back( format ); | |
55 | } | |
56 | ||
57 | // --------------------------------------------------------- | |
58 | // wxClipboardBase | |
59 | // --------------------------------------------------------- | |
60 | ||
5dc43d1f VS |
61 | static wxClipboard *gs_clipboard = NULL; |
62 | ||
63 | /*static*/ wxClipboard *wxClipboardBase::Get() | |
64 | { | |
65 | if ( !gs_clipboard ) | |
66 | { | |
67 | gs_clipboard = new wxClipboard; | |
68 | } | |
69 | return gs_clipboard; | |
70 | } | |
71 | ||
b068c4e8 | 72 | // ---------------------------------------------------------------------------- |
5dc43d1f | 73 | // wxClipboardModule: module responsible for destroying the global clipboard |
b068c4e8 | 74 | // object |
b068c4e8 RR |
75 | // ---------------------------------------------------------------------------- |
76 | ||
77 | class wxClipboardModule : public wxModule | |
78 | { | |
79 | public: | |
5dc43d1f VS |
80 | bool OnInit() { return true; } |
81 | void OnExit() { wxDELETE(gs_clipboard); } | |
b068c4e8 RR |
82 | |
83 | private: | |
84 | DECLARE_DYNAMIC_CLASS(wxClipboardModule) | |
85 | }; | |
86 | ||
d54598dd | 87 | IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule) |
8ee9d618 | 88 | |
41b1047d | 89 | #endif // wxUSE_CLIPBOARD |