no message
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
60
include/wx/os2/dataform.h
Normal file
60
include/wx/os2/dataform.h
Normal file
@@ -0,0 +1,60 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gtk/dataform.h
|
||||
// Purpose: declaration of the wxDataFormat class
|
||||
// Author: David Webster (lifted from dnd.h)
|
||||
// Modified by:
|
||||
// Created: 10/21/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 David Webster
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_OS2_DATAFORM_H
|
||||
#define _WX_OS2_DATAFORM_H
|
||||
|
||||
class wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under GDK are GdkAtoms
|
||||
typedef unsigned short NativeFormat;
|
||||
|
||||
wxDataFormat();
|
||||
wxDataFormat( wxDataFormatId type );
|
||||
wxDataFormat( const wxString &id );
|
||||
wxDataFormat( const wxChar *id );
|
||||
wxDataFormat( NativeFormat format );
|
||||
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ SetId(format); return *this; }
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(NativeFormat format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(NativeFormat format) const
|
||||
{ return m_format != (NativeFormat)format; }
|
||||
|
||||
// explicit and implicit conversions to NativeFormat which is one of
|
||||
// standard data types (implicit conversion is useful for preserving the
|
||||
// compatibility with old code)
|
||||
NativeFormat GetFormatId() const { return m_format; }
|
||||
operator NativeFormat() const { return m_format; }
|
||||
|
||||
void SetId( NativeFormat format );
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId( const wxChar *id );
|
||||
|
||||
// implementation
|
||||
wxDataFormatId GetType() const;
|
||||
|
||||
private:
|
||||
wxDataFormatId m_type;
|
||||
NativeFormat m_format;
|
||||
|
||||
void PrepareFormats();
|
||||
void SetType( wxDataFormatId type );
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_DATAFORM_H
|
@@ -35,44 +35,6 @@ class WXDLLEXPORT wxFileDropTarget;
|
||||
|
||||
class WXDLLEXPORT wxDropSource;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataFormat (internal)
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxDataFormat : public wxObject
|
||||
{
|
||||
DECLARE_CLASS( wxDataFormat )
|
||||
|
||||
public:
|
||||
wxDataFormat();
|
||||
wxDataFormat( wxDataFormatId type );
|
||||
wxDataFormat( const wxString &id );
|
||||
wxDataFormat( const wxChar *id );
|
||||
wxDataFormat( const wxDataFormat &format );
|
||||
|
||||
void SetType( wxDataFormatId type );
|
||||
wxDataFormatId GetType() const;
|
||||
|
||||
/* 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 "application/wxword", an
|
||||
* image manipulation program would put a wxBitmapDataObject and a
|
||||
* wxPrivateDataObject to the clipboard - the latter with "image/png". */
|
||||
|
||||
wxString GetId() const;
|
||||
void SetId( const wxChar *id );
|
||||
|
||||
// implicit conversion to wxDataFormatId
|
||||
operator wxDataFormatId() const { return m_type; }
|
||||
|
||||
bool operator==(wxDataFormatId type) const { return m_type == type; }
|
||||
bool operator!=(wxDataFormatId type) const { return m_type != type; }
|
||||
|
||||
private:
|
||||
wxDataFormatId m_type;
|
||||
wxString m_id;
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataBroker (internal)
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -123,7 +85,7 @@ public:
|
||||
// wxDataObject
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataObject: public wxObject
|
||||
class WXDLLEXPORT wxDataObject: public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
// all data formats (values are the same as in windows.h, do not change!)
|
||||
@@ -165,34 +127,7 @@ public:
|
||||
// get the (total) size of data
|
||||
virtual size_t GetDataSize() const = 0;
|
||||
// copy raw data to provided pointer
|
||||
virtual void GetDataHere(void *pBuf) const = 0;
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextDataObject is a specialization of wxDataObject for text data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextDataObject : public wxDataObject
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxTextDataObject() { }
|
||||
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
|
||||
void Init(const wxString& strText) { m_strText = strText; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
{ return wxDF_TEXT; }
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return format == wxDF_TEXT; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
|
||||
virtual void GetDataHere(void *pBuf) const
|
||||
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
|
||||
|
||||
private:
|
||||
wxString m_strText;
|
||||
virtual bool GetDataHere(void *pBuf) const = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -212,10 +147,10 @@ public:
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
{ return wxDF_FILENAME; }
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return format == wxDF_FILENAME; }
|
||||
{ return format == (unsigned short)wxDF_FILENAME; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
|
||||
virtual void GetDataHere(void *pBuf) const
|
||||
virtual bool GetDataHere(void *pBuf) const
|
||||
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user