1999-05-26 22:39:42 +00: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 16:13:49 +00:00
|
|
|
#ifndef _WX_DATAOBJ_H_BASE_
|
|
|
|
#define _WX_DATAOBJ_H_BASE_
|
|
|
|
|
|
|
|
#if defined(__WXMSW__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/msw/ole/dataobj.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/motif/dataobj.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#elif defined(__WXGTK__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/gtk/dataobj.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#elif defined(__WXQT__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/qt/dnd.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#elif defined(__WXMAC__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/mac/dnd.h"
|
1999-07-28 03:38:12 +00:00
|
|
|
#elif defined(__WXPM__)
|
1999-08-02 04:44:01 +00:00
|
|
|
#include "wx/os2/dataobj.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#elif defined(__WXSTUBS__)
|
1999-05-26 22:39:42 +00:00
|
|
|
#include "wx/stubs/dnd.h"
|
1998-12-14 16:13:49 +00:00
|
|
|
#endif
|
|
|
|
|
1999-05-26 22:39:42 +00: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 10:03:44 +00:00
|
|
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
1999-06-08 14:30:26 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
|
|
|
#endif
|
1999-05-26 22:39:42 +00: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-29 00:34:17 +00:00
|
|
|
virtual wxDataFormat GetPreferredFormat() const
|
1999-05-26 22:39:42 +00: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 21:32:44 +00:00
|
|
|
void Free();
|
1999-05-26 22:39:42 +00:00
|
|
|
|
|
|
|
// the data
|
|
|
|
size_t m_size;
|
|
|
|
void *m_data;
|
|
|
|
|
1999-07-25 17:11:17 +00:00
|
|
|
#if !defined(__WXGTK__) && !defined(__WXMOTIF__)
|
1999-05-26 22:39:42 +00:00
|
|
|
// the data format
|
|
|
|
wxDataFormat m_format;
|
1999-07-25 17:11:17 +00:00
|
|
|
#endif
|
1999-05-26 22:39:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-12-14 16:13:49 +00:00
|
|
|
#endif
|
|
|
|
// _WX_DATAOBJ_H_BASE_
|