#include "wx/dnd.h"
-#ifdef __WXGTK__
+#ifdef __WXMOTIF__
+#error Sorry, drag and drop is not yet implemented on wxMotif.
+#endif
+
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm"
#endif
public:
DnDText(wxListBox *pOwner) { m_pOwner = pOwner; }
- virtual bool OnDropText(long x, long y, const char *psz );
+ virtual bool OnDropText(int x, int y, const char *psz );
private:
wxListBox *m_pOwner;
public:
DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; }
- virtual bool OnDropFiles(long x, long y,
+ virtual bool OnDropFiles(int x, int y,
size_t nFiles, const char * const aszFiles[] );
private:
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
- bool OnClose();
-
DECLARE_EVENT_TABLE()
private:
wxPaintDC dc(this);
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL, FALSE, "charter" ) );
- dc.DrawText( "Drag text from here!", 20, h-22 );
+ dc.DrawText( "Drag text from here!", 20, h-35 );
}
void DnDFrame::OnDrag(wxCommandEvent& /* event */)
m_ctrlLog->Clear();
}
-bool DnDFrame::OnClose()
-{
- return TRUE;
-}
-
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
if ( !m_strText.IsEmpty() )
{
// start drag operation
-
- wxDropSource dragSource( new wxTextDataObject (m_strText), this );
+#ifdef __WXMSW__
+ wxTextDataObject textData(m_strText);
+ wxDropSource dragSource( textData, this );
+#else
+ wxDropSource dragSource( new wxTextDataObject (m_strText), this, wxIcon(mondrian_xpm) );
+#endif
const char *pc;
switch ( dragSource.DoDragDrop(TRUE) )
// ----------------------------------------------------------------------------
// Notifications called by the base class
// ----------------------------------------------------------------------------
-bool DnDText::OnDropText(long, long, const char *psz)
+bool DnDText::OnDropText(int, int, const char *psz)
{
m_pOwner->Append(psz);
return TRUE;
}
-bool DnDFile::OnDropFiles(long, long, size_t nFiles,
+bool DnDFile::OnDropFiles(int, int, size_t nFiles,
const char * const aszFiles[])
{
wxString str;