]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/clipbrd.cpp
48cd4598f40e6f877aeb787086aa747dfb2e7fc3
[wxWidgets.git] / src / gtk1 / clipbrd.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clipbrd.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "clipbrd.h"
12 #endif
13
14 #include "wx/clipbrd.h"
15
16 //-----------------------------------------------------------------------------
17 // data
18 //-----------------------------------------------------------------------------
19
20 wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
21
22 //-----------------------------------------------------------------------------
23 // functions
24 //-----------------------------------------------------------------------------
25
26 void wxInitClipboard()
27 {
28 if (wxTheClipboard) delete wxTheClipboard;
29 wxTheClipboard = new wxClipboard();
30 }
31
32 void wxDoneClipboard()
33 {
34 if (wxTheClipboard) delete wxTheClipboard;
35 wxTheClipboard = (wxClipboard*) NULL;
36 }
37
38 //-----------------------------------------------------------------------------
39 // "selection_received"
40 //-----------------------------------------------------------------------------
41
42 /*
43 static void selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
44 {
45 }
46 */
47
48 //-----------------------------------------------------------------------------
49 // wxClipboard
50 //-----------------------------------------------------------------------------
51
52 IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
53
54 wxClipboard::wxClipboard()
55 {
56 m_data = (wxDataObject*)NULL;
57 m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
58 gtk_widget_realize( m_clipboardWidget );
59 }
60
61 wxClipboard::~wxClipboard()
62 {
63 if (m_data) delete m_data;
64 if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
65 }
66
67 void wxClipboard::SetData( wxDataObject *data )
68 {
69 if (m_data) delete m_data;
70 m_data = data;
71 }
72
73 void *wxClipboard::GetData( wxDataFormat format, size_t *length )
74 {
75 if (!IsAvailable(format))
76 {
77 if (length) *length = 0;
78 return NULL;
79 }
80 return NULL;
81 }
82
83 bool wxClipboard::IsAvailable( wxDataFormat WXUNUSED(format) )
84 {
85 return FALSE;
86 }