]> git.saurik.com Git - wxWidgets.git/blob - src/common/clipcmn.cpp
fix typo in r57455 which totally broke modal dialogs display (close #10291)
[wxWidgets.git] / src / common / clipcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/clipcmn.cpp
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_CLIPBOARD
28
29 #include "wx/clipbrd.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/module.h"
33 #endif
34
35 // ---------------------------------------------------------
36 // wxClipboardEvent
37 // ---------------------------------------------------------
38
39 IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent)
40
41 DEFINE_EVENT_TYPE(wxEVT_CLIPBOARD_CHANGED)
42
43 bool wxClipboardEvent::SupportsFormat( const wxDataFormat &format ) const
44 {
45 wxVector<wxDataFormat>::size_type n;
46 for (n = 0; n < m_formats.size(); n++)
47 { if (m_formats[n] == format) return true; }
48 return false;
49 }
50
51 void wxClipboardEvent::AddFormat( const wxDataFormat &format )
52 {
53 m_formats.push_back( format );
54 }
55
56 // ---------------------------------------------------------
57 // wxClipboardBase
58 // ---------------------------------------------------------
59
60 static wxClipboard *gs_clipboard = NULL;
61
62 /*static*/ wxClipboard *wxClipboardBase::Get()
63 {
64 if ( !gs_clipboard )
65 {
66 gs_clipboard = new wxClipboard;
67 }
68 return gs_clipboard;
69 }
70
71 // ----------------------------------------------------------------------------
72 // wxClipboardModule: module responsible for destroying the global clipboard
73 // object
74 // ----------------------------------------------------------------------------
75
76 class wxClipboardModule : public wxModule
77 {
78 public:
79 bool OnInit() { return true; }
80 void OnExit() { wxDELETE(gs_clipboard); }
81
82 private:
83 DECLARE_DYNAMIC_CLASS(wxClipboardModule)
84 };
85
86 IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule)
87
88 #endif // wxUSE_CLIPBOARD