DnD with Unicode fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -111,7 +111,7 @@ public:
|
|||||||
virtual bool OnData( int x, int y );
|
virtual bool OnData( int x, int y );
|
||||||
|
|
||||||
/* you have to override OnDropData to get at the text */
|
/* you have to override OnDropData to get at the text */
|
||||||
virtual bool OnDropText( int x, int y, const char *text ) = 0;
|
virtual bool OnDropText( int x, int y, const wxChar *text ) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ public:
|
|||||||
virtual bool OnData( int x, int y );
|
virtual bool OnData( int x, int y );
|
||||||
|
|
||||||
/* you have to override OnDropData to get at the text */
|
/* you have to override OnDropData to get at the text */
|
||||||
virtual bool OnDropText( int x, int y, const char *text ) = 0;
|
virtual bool OnDropText( int x, int y, const wxChar *text ) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ class DnDText : public wxTextDropTarget
|
|||||||
public:
|
public:
|
||||||
DnDText(wxListBox *pOwner) { m_pOwner = pOwner; }
|
DnDText(wxListBox *pOwner) { m_pOwner = pOwner; }
|
||||||
|
|
||||||
virtual bool OnDropText(long x, long y, const char *psz );
|
virtual bool OnDropText(int x, int y, const wxChar* psz );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxListBox *m_pOwner;
|
wxListBox *m_pOwner;
|
||||||
@@ -53,8 +53,8 @@ class DnDFile : public wxFileDropTarget
|
|||||||
public:
|
public:
|
||||||
DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; }
|
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[] );
|
size_t nFiles, const wxChar* const aszFiles[] );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxListBox *m_pOwner;
|
wxListBox *m_pOwner;
|
||||||
@@ -349,18 +349,18 @@ DnDFrame::~DnDFrame()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Notifications called by the base class
|
// Notifications called by the base class
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
bool DnDText::OnDropText(long, long, const char *psz)
|
bool DnDText::OnDropText( int, int, const wxChar *psz )
|
||||||
{
|
{
|
||||||
m_pOwner->Append(psz);
|
m_pOwner->Append(psz);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DnDFile::OnDropFiles(long, long, size_t nFiles,
|
bool DnDFile::OnDropFiles( int, int, size_t nFiles,
|
||||||
const char * const aszFiles[])
|
const wxChar* const aszFiles[])
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf("%d files dropped", nFiles);
|
str.Printf( _T("%d files dropped"), nFiles);
|
||||||
m_pOwner->Append(str);
|
m_pOwner->Append(str);
|
||||||
for ( size_t n = 0; n < nFiles; n++ ) {
|
for ( size_t n = 0; n < nFiles; n++ ) {
|
||||||
m_pOwner->Append(aszFiles[n]);
|
m_pOwner->Append(aszFiles[n]);
|
||||||
|
@@ -341,7 +341,7 @@ size_t wxTextDataObject::GetSize() const
|
|||||||
|
|
||||||
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
||||||
{
|
{
|
||||||
memcpy( dest, m_data.c_str(), GetSize() );
|
memcpy( dest, m_data.mbc_str(), GetSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -368,7 +368,7 @@ wxString wxFileDataObject::GetFiles() const
|
|||||||
|
|
||||||
void wxFileDataObject::WriteData( void *dest ) const
|
void wxFileDataObject::WriteData( void *dest ) const
|
||||||
{
|
{
|
||||||
memcpy( dest, m_files.c_str(), GetSize() );
|
memcpy( dest, m_files.mbc_str(), GetSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileDataObject::GetSize() const
|
size_t wxFileDataObject::GetSize() const
|
||||||
|
@@ -470,7 +470,7 @@ bool wxTextDropTarget::OnData( int x, int y )
|
|||||||
wxTextDataObject data;
|
wxTextDataObject data;
|
||||||
if (!GetData( &data )) return FALSE;
|
if (!GetData( &data )) return FALSE;
|
||||||
|
|
||||||
OnDropText( x, y, data.GetText().mbc_str() );
|
OnDropText( x, y, data.GetText() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -591,6 +591,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
||||||
{
|
{
|
||||||
size_t data_size = data_object->GetSize();
|
size_t data_size = data_object->GetSize();
|
||||||
|
|
||||||
if (data_size > 0)
|
if (data_size > 0)
|
||||||
{
|
{
|
||||||
guchar *buffer = new guchar[data_size];
|
guchar *buffer = new guchar[data_size];
|
||||||
|
@@ -341,7 +341,7 @@ size_t wxTextDataObject::GetSize() const
|
|||||||
|
|
||||||
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
||||||
{
|
{
|
||||||
memcpy( dest, m_data.c_str(), GetSize() );
|
memcpy( dest, m_data.mbc_str(), GetSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -368,7 +368,7 @@ wxString wxFileDataObject::GetFiles() const
|
|||||||
|
|
||||||
void wxFileDataObject::WriteData( void *dest ) const
|
void wxFileDataObject::WriteData( void *dest ) const
|
||||||
{
|
{
|
||||||
memcpy( dest, m_files.c_str(), GetSize() );
|
memcpy( dest, m_files.mbc_str(), GetSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileDataObject::GetSize() const
|
size_t wxFileDataObject::GetSize() const
|
||||||
|
@@ -470,7 +470,7 @@ bool wxTextDropTarget::OnData( int x, int y )
|
|||||||
wxTextDataObject data;
|
wxTextDataObject data;
|
||||||
if (!GetData( &data )) return FALSE;
|
if (!GetData( &data )) return FALSE;
|
||||||
|
|
||||||
OnDropText( x, y, data.GetText().mbc_str() );
|
OnDropText( x, y, data.GetText() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -591,6 +591,7 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
||||||
{
|
{
|
||||||
size_t data_size = data_object->GetSize();
|
size_t data_size = data_object->GetSize();
|
||||||
|
|
||||||
if (data_size > 0)
|
if (data_size > 0)
|
||||||
{
|
{
|
||||||
guchar *buffer = new guchar[data_size];
|
guchar *buffer = new guchar[data_size];
|
||||||
|
Reference in New Issue
Block a user