1998-12-14 16:13:49 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dataobj.h
|
|
|
|
// Purpose: declaration of the wxDataObject class
|
|
|
|
// Author: Robert Roebling
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
|
|
|
|
// Licence: wxWindows license
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKDATAOBJECTH__
|
|
|
|
#define __GTKDATAOBJECTH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxDataObject;
|
|
|
|
class wxTextDataObject;
|
|
|
|
class wxBitmapDataObject;
|
|
|
|
class wxPrivateDataObject;
|
|
|
|
class wxFileDataObject;
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// wxDataObject
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxDataObject: public wxObject
|
|
|
|
{
|
|
|
|
DECLARE_ABSTRACT_CLASS( wxDataObject )
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxDataObject() {}
|
|
|
|
~wxDataObject() {}
|
|
|
|
|
|
|
|
virtual wxDataFormat GetFormat() const = 0;
|
|
|
|
|
|
|
|
// implementation
|
|
|
|
|
|
|
|
GdkAtom m_formatAtom;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTextDataObject is a specialization of wxDataObject for text data
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxTextDataObject : public wxDataObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( wxTextDataObject )
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxTextDataObject() {}
|
|
|
|
wxTextDataObject( const wxString& strText )
|
|
|
|
: m_strText(strText) { }
|
|
|
|
|
|
|
|
virtual wxDataFormat GetFormat() const
|
|
|
|
{ return wxDF_TEXT; }
|
|
|
|
|
|
|
|
void SetText( const wxString& strText)
|
|
|
|
{ m_strText = strText; }
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
wxString GetText() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_strText; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_strText;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxFileDataObject is a specialization of wxDataObject for file names
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxFileDataObject : public wxDataObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( wxFileDataObject )
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxFileDataObject(void) {}
|
|
|
|
|
|
|
|
virtual wxDataFormat GetFormat() const
|
|
|
|
{ return wxDF_FILENAME; }
|
|
|
|
|
|
|
|
void AddFile( const wxString &file )
|
|
|
|
{ m_files += file; m_files += (char)0; }
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
wxString GetFiles() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_files; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxString m_files;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxBitmapDataObject : public wxDataObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( wxBitmapDataObject )
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxBitmapDataObject(void) {}
|
|
|
|
|
|
|
|
virtual wxDataFormat GetFormat() const
|
|
|
|
{ return wxDF_BITMAP; }
|
|
|
|
|
|
|
|
void SetBitmap( const wxBitmap &bitmap )
|
|
|
|
{ m_bitmap = bitmap; }
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
wxBitmap GetBitmap() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_bitmap; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxBitmap m_bitmap;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxPrivateDataObject is a specialization of wxDataObject for app specific data
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxPrivateDataObject : public wxDataObject
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
1999-01-14 00:24:03 +00:00
|
|
|
wxPrivateDataObject();
|
1998-12-14 16:13:49 +00:00
|
|
|
|
1999-01-14 00:24:03 +00:00
|
|
|
~wxPrivateDataObject();
|
1998-12-14 16:13:49 +00:00
|
|
|
|
|
|
|
virtual wxDataFormat GetFormat() const
|
|
|
|
{ return wxDF_PRIVATE; }
|
|
|
|
|
|
|
|
// the string ID identifies the format of clipboard or DnD data. a word
|
|
|
|
// processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
|
|
|
|
// to the clipboard - the latter with the Id "WXWORD_FORMAT".
|
|
|
|
|
|
|
|
void SetId( const wxString& id )
|
|
|
|
{ m_id = id; }
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
wxString GetId() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_id; }
|
|
|
|
|
|
|
|
// will make internal copy
|
|
|
|
void SetData( const char *data, size_t size );
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
size_t GetDataSize() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_size; }
|
|
|
|
|
1999-01-13 18:01:39 +00:00
|
|
|
char* GetData() const
|
1998-12-14 16:13:49 +00:00
|
|
|
{ return m_data; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
size_t m_size;
|
|
|
|
char* m_data;
|
|
|
|
wxString m_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
//__GTKDNDH__
|
|
|
|
|