Added wxClipboard and wxDataObject (and friends) declarations and stubs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
52
include/wx/cocoa/clipbrd.h
Normal file
52
include/wx/cocoa/clipbrd.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/cocoa/clipboard.h
|
||||||
|
// Purpose: wxClipboard
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __WX_COCOA_CLIPBRD_H__
|
||||||
|
#define __WX_COCOA_CLIPBRD_H__
|
||||||
|
|
||||||
|
#include "wx/dataobj.h"
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// wxClipboard
|
||||||
|
//=========================================================================
|
||||||
|
class wxClipboard : public wxClipboardBase
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||||
|
public:
|
||||||
|
wxClipboard();
|
||||||
|
~wxClipboard();
|
||||||
|
|
||||||
|
// open the clipboard before SetData() and GetData()
|
||||||
|
virtual bool Open();
|
||||||
|
|
||||||
|
// close the clipboard after SetData() and GetData()
|
||||||
|
virtual void Close();
|
||||||
|
|
||||||
|
// query whether the clipboard is opened
|
||||||
|
virtual bool IsOpened() const;
|
||||||
|
|
||||||
|
// set the clipboard data. all other formats will be deleted.
|
||||||
|
virtual bool SetData( wxDataObject *data );
|
||||||
|
|
||||||
|
// add to the clipboard data.
|
||||||
|
virtual bool AddData( wxDataObject *data );
|
||||||
|
|
||||||
|
// ask if data in correct format is available
|
||||||
|
virtual bool IsSupported( const wxDataFormat& format );
|
||||||
|
|
||||||
|
// fill data with data on the clipboard (if available)
|
||||||
|
virtual bool GetData( wxDataObject& data );
|
||||||
|
|
||||||
|
// clears wxTheClipboard and the system's clipboard if possible
|
||||||
|
virtual void Clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__WX_COCOA_CLIPBRD_H__
|
51
include/wx/cocoa/dataform.h
Normal file
51
include/wx/cocoa/dataform.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/cocoa/dataform.h
|
||||||
|
// Purpose: declaration of the wxDataFormat class
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __WX_COCOA_DATAFORM_H__
|
||||||
|
#define __WX_COCOA_DATAFORM_H__
|
||||||
|
|
||||||
|
class wxDataFormat
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; }
|
||||||
|
wxDataFormat(const wxChar* zFormat) { SetId(zFormat); }
|
||||||
|
|
||||||
|
wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); }
|
||||||
|
wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Comparison (must have both versions)
|
||||||
|
//
|
||||||
|
bool operator==(wxDataFormatId eFormat) const { return (m_uFormat == (unsigned int)eFormat); }
|
||||||
|
bool operator!=(wxDataFormatId eFormat) const { return (m_uFormat != (unsigned int)eFormat); }
|
||||||
|
bool operator==(const wxDataFormat& rFormat) const { return (m_uFormat == rFormat.m_uFormat); }
|
||||||
|
bool operator!=(const wxDataFormat& rFormat) const { return (m_uFormat != rFormat.m_uFormat); }
|
||||||
|
operator unsigned int(void) const { return m_uFormat; }
|
||||||
|
|
||||||
|
unsigned int GetFormatId(void) const { return (unsigned int)m_uFormat; }
|
||||||
|
unsigned int GetType(void) const { return (unsigned int)m_uFormat; }
|
||||||
|
|
||||||
|
bool IsStandard(void) const;
|
||||||
|
|
||||||
|
void SetType(unsigned int uType){ m_uFormat = uType; }
|
||||||
|
|
||||||
|
//
|
||||||
|
// String ids are used for custom types - this SetId() must be used for
|
||||||
|
// application-specific formats
|
||||||
|
//
|
||||||
|
wxString GetId(void) const;
|
||||||
|
void SetId(const wxChar* pId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int m_uFormat;
|
||||||
|
}; // end of CLASS wxDataFormat
|
||||||
|
|
||||||
|
#endif // __WX_COCOA_DATAFORM_H__
|
24
include/wx/cocoa/dataobj.h
Normal file
24
include/wx/cocoa/dataobj.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/cocoa/dataobj.h
|
||||||
|
// Purpose: declaration of the wxDataObject
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __WX_COCOA_DATAOBJ_H__
|
||||||
|
#define __WX_COCOA_DATAOBJ_H__
|
||||||
|
|
||||||
|
class wxDataObject : public wxDataObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDataObject();
|
||||||
|
virtual ~wxDataObject();
|
||||||
|
virtual bool IsSupportedFormat(const wxDataFormat& format,
|
||||||
|
Direction dir = Get) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __WX_COCOA_DATAOBJ_H__
|
84
include/wx/cocoa/dataobj2.h
Normal file
84
include/wx/cocoa/dataobj2.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/cocoa/dataobj2.h
|
||||||
|
// Purpose: declaration of standard wxDataObjectSimple-derived classes
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __WX_COCOA_DATAOBJ2_H__
|
||||||
|
#define __WX_COCOA_DATAOBJ2_H__
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
||||||
|
//=========================================================================
|
||||||
|
class wxBitmapDataObject : public wxBitmapDataObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// ctors
|
||||||
|
wxBitmapDataObject();
|
||||||
|
wxBitmapDataObject(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
// destr
|
||||||
|
~wxBitmapDataObject();
|
||||||
|
|
||||||
|
// override base class virtual to update PNG data too
|
||||||
|
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||||
|
|
||||||
|
// implement base class pure virtuals
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
virtual size_t GetDataSize() const { return m_pngSize; }
|
||||||
|
virtual bool GetDataHere(void *buf) const;
|
||||||
|
virtual bool SetData(size_t len, const void *buf);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
|
||||||
|
void Clear() { free(m_pngData); }
|
||||||
|
void ClearAll() { Clear(); Init(); }
|
||||||
|
|
||||||
|
size_t m_pngSize;
|
||||||
|
void *m_pngData;
|
||||||
|
|
||||||
|
void DoConvertToPng();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// virtual function hiding supression
|
||||||
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
|
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
|
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||||
|
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
//=========================================================================
|
||||||
|
// wxFileDataObject is a specialization of wxDataObject for file names
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
class wxFileDataObject : public wxFileDataObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// implement base class pure virtuals
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
void AddFile( const wxString &filename );
|
||||||
|
|
||||||
|
virtual size_t GetDataSize() const;
|
||||||
|
virtual bool GetDataHere(void *buf) const;
|
||||||
|
virtual bool SetData(size_t len, const void *buf);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// virtual function hiding supression
|
||||||
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
|
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||||
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
|
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||||
|
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__WX_COCOA_DATAOBJ2_H__
|
68
src/cocoa/clipbrd.mm
Normal file
68
src/cocoa/clipbrd.mm
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/cocoa/clipbrd.mm
|
||||||
|
// Purpose: wxClipboard
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_CLIPBOARD
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
#include "wx/clipbrd.h"
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
||||||
|
|
||||||
|
wxClipboard::wxClipboard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxClipboard::~wxClipboard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::Open()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClipboard::Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::IsOpened() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::SetData(wxDataObject *data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::AddData(wxDataObject *data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::IsSupported(const wxDataFormat& format)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxClipboard::GetData(wxDataObject& data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClipboard::Clear()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //wxUSE_CLIPBOARD
|
60
src/cocoa/dataobj.mm
Normal file
60
src/cocoa/dataobj.mm
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/cocoa/dataobj.mm
|
||||||
|
// Purpose: wxDataObject
|
||||||
|
// Author: David Elliott <dfe@cox.net>
|
||||||
|
// Modified by:
|
||||||
|
// Created: 2003/07/23
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2003 David Elliott
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_DATAOBJ
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
#include "wx/dataobj.h"
|
||||||
|
|
||||||
|
wxDataObject::wxDataObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataObject::~wxDataObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format,
|
||||||
|
Direction dir) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmapDataObject::wxBitmapDataObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmapDataObject::wxBitmapDataObject(const wxBitmap& bitmap)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmapDataObject::~wxBitmapDataObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapDataObject::SetBitmap(const wxBitmap& bitmap)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxBitmapDataObject::SetData(size_t len, const void *buf)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxBitmapDataObject::GetDataHere(void *buf) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //wxUSE_DATAOBJ
|
Reference in New Issue
Block a user