1 \section{\class{wxClipboard
}}\label{wxclipboard
}
3 A class for manipulating the clipboard. Note that this is not compatible with the
4 clipboard class from wxWindows
1.xx, which has the same name but a different implementation.
6 To use the clipboard, you call member functions of the global
{\bf wxTheClipboard
} object.
8 Call
\helpref{wxClipboard::Open
}{wxclipboardopen
} to get ownership of the clipboard. If this operation returns TRUE, you
9 now own the clipboard. Call
\helpref{wxClipboard::AddData
}{wxclipboardadddata
} to put data
10 on the clipboard (one or more times), or
\helpref{wxClipboard::GetData
}{wxclipboardgetdata
} to
11 retrieve data from the clipboard. Call
\helpref{wxClipboard::Close
}{wxclipboardclose
} to close
12 the clipboard and relinquish ownership. You should keep the clipboard open only momentarily.
17 // Write some text to the clipboard
18 if (wxTheClipboard->Open())
20 // This data objects are held by the clipboard,
21 // so do not delete them in the app.
22 wxTheClipboard->AddData( new wxTextDataObject("Some text") );
23 wxTheClipboard->Close();
27 if (wxTheClipboard->Open())
29 if (wxTheClipboard->IsSupported( "STRING" ))
31 wxTextDataObject data;
32 wxTheClipboard->GetData( &data );
33 wxMessageBox( data.GetText() );
35 wxTheClipboard->Close();
39 \wxheading{Derived from
}
41 \helpref{wxObject
}{wxobject
}
43 \wxheading{Include files
}
49 \helpref{Drag and drop overview
}{wxdndoverview
},
\helpref{wxDataObject
}{wxdataobject
}
51 \latexignore{\rtfignore{\wxheading{Members
}}}
53 \membersection{wxClipboard::wxClipboard
}
55 \func{}{wxClipboard
}{\void}
59 \membersection{wxClipboard::
\destruct{wxClipboard
}}
61 \func{}{\destruct{wxClipboard
}}{\void}
65 \membersection{wxClipboard::AddData
}\label{wxclipboardadddata
}
67 \func{bool
}{AddData
}{\param{wxDataObject*
}{ data
}}
69 Call this function to add a data object to the clipboard. This function can be called several times
70 to put different formats on the clipboard.
72 \membersection{wxClipboard::Clear
}\label{wxclipboardclear
}
74 \func{void
}{Clear
}{\void}
76 Clears the global clipboard object and the system's clipboard if possible.
78 \membersection{wxClipboard::Close
}\label{wxclipboardclose
}
80 \func{bool
}{Close
}{\void}
82 Call this function to close the clipboard, having opened it with
\helpref{wxClipboard::Open
}{wxclipboardopen
}.
84 \membersection{wxClipboard::GetData
}\label{wxclipboardgetdata
}
86 \func{bool
}{GetData
}{\param{wxDataObject*
}{ data
}}
88 Call this function to fill
{\it data
} with data on the clipboard, if available in the required
89 format. Returns TRUE on success.
91 \membersection{wxClipboard::IsSupported
}\label{wxclipboardissupported
}
93 \func{bool
}{IsSupported
}{\param{wxDataFormat
}{ format
}}
95 Returns TRUE if the format of the given data object is available on the clipboard.
97 \membersection{wxClipboard::Open
}\label{wxclipboardopen
}
99 \func{bool
}{Open
}{\void}
101 Call this function to open the clipboard before calling
\helpref{wxClipboard::SetData
}{wxclipboardsetdata
}
102 and
\helpref{wxClipboard::GetData
}{wxclipboardgetdata
}.
104 Call
\helpref{wxClipboard::Close
}{wxclipboardclose
} when you have finished with the clipboard. You
105 should keep the clipboard open for only a very short time.
107 Returns TRUE on success. This should be tested (as in the sample shown above).
109 \membersection{wxClipboard::SetData
}\label{wxclipboardsetdata
}
111 \func{bool
}{SetData
}{\param{wxDataObject*
}{ data
}}
113 Call this function to set the data object to the clipboard. This function will
114 clear all previous contents in the clipboard, so calling it several times
115 does not make any sense.
117 \membersection{wxClipboard::UsePrimarySelection
}\label{wxclipboarduseprimary
}
119 \func{void
}{UsePrimarySelection
}{\param{bool
}{ primary = TRUE
}}
121 On platforms supporting it (currently only GTK), selects the so called
122 PRIMARY SELECTION as the clipboard as opposed to the normal clipboard,
123 if
{\it primary
} is TRUE.