1999-05-26 18:39:42 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dataobj.h
|
|
|
|
// Purpose: common data object classes
|
|
|
|
// Author: Robert Roebling, Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 26.05.99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) wxWindows Team
|
|
|
|
// Licence: wxWindows license
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-12-14 11:13:49 -05:00
|
|
|
#ifndef _WX_DATAOBJ_H_BASE_
|
|
|
|
#define _WX_DATAOBJ_H_BASE_
|
|
|
|
|
|
|
|
#if defined(__WXMSW__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/msw/ole/dataobj.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#elif defined(__WXMOTIF__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/motif/dataobj.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#elif defined(__WXGTK__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/gtk/dataobj.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#elif defined(__WXQT__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/qt/dnd.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#elif defined(__WXMAC__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/mac/dnd.h"
|
1999-07-27 23:38:12 -04:00
|
|
|
#elif defined(__WXPM__)
|
1999-08-02 00:44:01 -04:00
|
|
|
#include "wx/os2/dataobj.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#elif defined(__WXSTUBS__)
|
1999-05-26 18:39:42 -04:00
|
|
|
#include "wx/stubs/dnd.h"
|
1998-12-14 11:13:49 -05:00
|
|
|
#endif
|
|
|
|
|
1999-05-26 18:39:42 -04:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// wxPrivateDataObject is a specialization of wxDataObject for app specific
|
|
|
|
// data (of some given kind, derive directly from wxDataObject if you wish to
|
|
|
|
// efficiently support multiple formats)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
|
|
|
|
{
|
1999-06-23 06:03:44 -04:00
|
|
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
1999-06-08 10:30:26 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
|
|
|
#endif
|
1999-05-26 18:39:42 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
wxPrivateDataObject();
|
|
|
|
virtual ~wxPrivateDataObject() { Free(); }
|
|
|
|
|
|
|
|
// get the format object - it is used to decide whether we support the
|
|
|
|
// given output format or not
|
|
|
|
wxDataFormat& GetFormat() { return m_format; }
|
|
|
|
|
|
|
|
// set data. will make copy of the data
|
|
|
|
void SetData( const void *data, size_t size );
|
|
|
|
|
|
|
|
// returns pointer to data
|
|
|
|
void *GetData() const { return m_data; }
|
|
|
|
|
|
|
|
// get the size of the data
|
|
|
|
virtual size_t GetSize() const;
|
|
|
|
|
|
|
|
// copy data to the given buffer
|
|
|
|
virtual void WriteData( void *dest ) const;
|
|
|
|
|
|
|
|
// these functions are provided for wxGTK compatibility, their usage is
|
|
|
|
// deprecated - use GetFormat().SetId() instead
|
|
|
|
void SetId( const wxString& id ) { m_format.SetId(id); }
|
|
|
|
wxString GetId() const { return m_format.GetId(); }
|
|
|
|
|
|
|
|
// implement the base class pure virtuals
|
1999-05-28 20:34:17 -04:00
|
|
|
virtual wxDataFormat GetPreferredFormat() const
|
1999-05-26 18:39:42 -04:00
|
|
|
{ return m_format; }
|
|
|
|
virtual bool IsSupportedFormat(wxDataFormat format) const
|
|
|
|
{ return m_format == format; }
|
|
|
|
virtual size_t GetDataSize() const
|
|
|
|
{ return m_size; }
|
|
|
|
virtual void GetDataHere(void *dest) const
|
|
|
|
{ WriteData(dest); }
|
|
|
|
|
|
|
|
// the function which really copies the data - called by WriteData() above
|
|
|
|
// and uses GetSize() to get the size of the data
|
|
|
|
void WriteData( const void *data, void *dest ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// free the data
|
1999-06-20 17:32:44 -04:00
|
|
|
void Free();
|
1999-05-26 18:39:42 -04:00
|
|
|
|
|
|
|
// the data
|
|
|
|
size_t m_size;
|
|
|
|
void *m_data;
|
|
|
|
|
1999-07-25 13:11:17 -04:00
|
|
|
#if !defined(__WXGTK__) && !defined(__WXMOTIF__)
|
1999-05-26 18:39:42 -04:00
|
|
|
// the data format
|
|
|
|
wxDataFormat m_format;
|
1999-07-25 13:11:17 -04:00
|
|
|
#endif
|
1999-05-26 18:39:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-12-14 11:13:49 -05:00
|
|
|
#endif
|
|
|
|
// _WX_DATAOBJ_H_BASE_
|