don't forget to open the clipboard
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4106
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
top_builddir = ../..
program_dir = samples/dnd
top_builddir = ../..
program_dir = samples/dnd
+DATAFILES=julian.png dnd.wxr
// `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit()
{
// `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit()
{
+ // load our ressources
+ wxPathList pathList;
+ pathList.Add(".");
+#ifdef __WXMSW__
+ pathList.Add("./Debug");
+ pathList.Add("./Release");
+#endif // wxMSW
+
+ wxString path = pathList.FindValidPath("dnd.wxr");
+ if ( !path )
+ {
+ wxLogError("Can't find the resource file dnd.wxr in the current "
+ "directory, aborting.");
+
+ return FALSE;
+ }
+
+ wxDefaultResourceTable->ParseResourceFile(path);
+
#if wxUSE_LIBPNG
wxImage::AddHandler( new wxPNGHandler );
#endif
#if wxUSE_LIBPNG
wxImage::AddHandler( new wxPNGHandler );
#endif
- wxDefaultResourceTable->ParseResourceFile("dnd.wxr");
-
void DnDShapeFrame::OnCopyShape(wxCommandEvent& event)
{
if ( m_shape )
void DnDShapeFrame::OnCopyShape(wxCommandEvent& event)
{
if ( m_shape )
+ {
+ wxClipboardLocker clipLocker;
+ if ( !clipLocker )
+ {
+ wxLogError("Can't open the clipboard");
+
+ return;
+ }
+
wxTheClipboard->AddData(new DnDShapeDataObject(m_shape));
wxTheClipboard->AddData(new DnDShapeDataObject(m_shape));
}
void DnDShapeFrame::OnPasteShape(wxCommandEvent& event)
{
}
void DnDShapeFrame::OnPasteShape(wxCommandEvent& event)
{
+ wxClipboardLocker clipLocker;
+ if ( !clipLocker )
+ {
+ wxLogError("Can't open the clipboard");
+
+ return;
+ }
+
DnDShapeDataObject shapeDataObject(NULL);
if ( wxTheClipboard->GetData(shapeDataObject) )
{
DnDShapeDataObject shapeDataObject(NULL);
if ( wxTheClipboard->GetData(shapeDataObject) )
{