// `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
SetTopWindow(frame);
- wxDefaultResourceTable->ParseResourceFile("dnd.wxr");
-
return TRUE;
}
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));
+ }
}
void DnDShapeFrame::OnPasteShape(wxCommandEvent& event)
{
+ wxClipboardLocker clipLocker;
+ if ( !clipLocker )
+ {
+ wxLogError("Can't open the clipboard");
+
+ return;
+ }
+
DnDShapeDataObject shapeDataObject(NULL);
if ( wxTheClipboard->GetData(shapeDataObject) )
{