updated the makefile to copy dnd.wxr so that the program can find it,
don't forget to open the clipboard git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f536e0f24b
commit
ae125753e4
@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@
|
||||
top_builddir = ../..
|
||||
program_dir = samples/dnd
|
||||
|
||||
DATAFILES=julian.png
|
||||
DATAFILES=julian.png dnd.wxr
|
||||
|
||||
PROGRAM=dnd
|
||||
|
||||
|
@ -619,6 +619,25 @@ END_EVENT_TABLE()
|
||||
// `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
|
||||
@ -633,8 +652,6 @@ bool DnDApp::OnInit()
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
wxDefaultResourceTable->ParseResourceFile("dnd.wxr");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1299,11 +1316,29 @@ void DnDShapeFrame::OnClearShape(wxCommandEvent& event)
|
||||
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) )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user