From 2e1a688e3e9c6c265620e4f05d579077367e9fdb Mon Sep 17 00:00:00 2001 From: David Webster Date: Thu, 21 Oct 1999 22:37:14 +0000 Subject: [PATCH] no message git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/dataform.h | 60 +++++++++++++++++ include/wx/os2/dnd.h | 73 ++------------------- src/os2/makefile.va | 132 +++++++++++++++++--------------------- 3 files changed, 124 insertions(+), 141 deletions(-) create mode 100644 include/wx/os2/dataform.h diff --git a/include/wx/os2/dataform.h b/include/wx/os2/dataform.h new file mode 100644 index 0000000000..2bcddb8680 --- /dev/null +++ b/include/wx/os2/dataform.h @@ -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 diff --git a/include/wx/os2/dnd.h b/include/wx/os2/dnd.h index ce6d0e9d01..980be8b731 100644 --- a/include/wx/os2/dnd.h +++ b/include/wx/os2/dnd.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: diff --git a/src/os2/makefile.va b/src/os2/makefile.va index 0ce8ecf830..5ed4f0da98 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -140,14 +140,14 @@ COMMONOBJS = \ ..\common\$D\config.obj \ ..\common\$D\ctrlcmn.obj \ ..\common\$D\date.obj \ - ..\common\$D\datastrm.obj \ - ..\common\$D\dcbase.obj \ + ..\common\$D\datstrm.obj \ ..\common\$D\db.obj \ ..\common\$D\dbtable.obj \ + ..\common\$D\dcbase.obj \ ..\common\$D\dlgcmn.obj \ + ..\common\$D\dobjcmn.obj \ ..\common\$D\docmdi.obj \ ..\common\$D\docview.obj \ - ..\common\$D\docmdi.obj \ ..\common\$D\dynarray.obj \ ..\common\$D\dynlib.obj \ ..\common\$D\event.obj \ @@ -175,7 +175,6 @@ COMMONOBJS = \ ..\common\$D\imagpcx.obj \ ..\common\$D\imagpng.obj \ ..\common\$D\imagpnm.obj \ - ..\common\$D\init.obj \ ..\common\$D\intl.obj \ ..\common\$D\ipcbase.obj \ ..\common\$D\layout.obj \ @@ -194,7 +193,6 @@ COMMONOBJS = \ ..\common\$D\prntbase.obj \ ..\common\$D\process.obj \ ..\common\$D\protocol.obj \ - ..\common\$D\resourc2.obj \ ..\common\$D\resource.obj \ ..\common\$D\sckaddr.obj \ ..\common\$D\sckfile.obj \ @@ -208,8 +206,6 @@ COMMONOBJS = \ ..\common\$D\string.obj \ ..\common\$D\tbarbase.obj \ ..\common\$D\tbarsmpl.obj \ - ..\common\$D\textfile.obj \ - ..\common\$D\textsmpl.obj \ ..\common\$D\textcmn.obj \ ..\common\$D\textfile.obj \ ..\common\$D\time.obj \ @@ -238,14 +234,14 @@ COMLIBOBJS1 = \ config.obj \ ctrlcmn.obj \ date.obj \ - datastrm.obj \ - dcbase.obj \ + datstrm.obj \ db.obj \ dbtable.obj \ + dcbase.obj \ dlgcmn.obj \ + dobjcmn.obj \ docmdi.obj \ docview.obj \ - docmdi.obj \ dynarray.obj \ dynlib.obj \ event.obj \ @@ -273,14 +269,13 @@ COMLIBOBJS1 = \ imagpcx.obj \ imagpng.obj \ imagpnm.obj \ - init.obj \ intl.obj \ ipcbase.obj \ - layout.obj + layout.obj \ + list.obj \ + log.obj COMLIBOBJS2 = \ - list.obj \ - log.obj \ longlong.obj \ matrix.obj \ memory.obj \ @@ -294,7 +289,6 @@ COMLIBOBJS2 = \ prntbase.obj \ process.obj \ protocol.obj \ - resourc2.obj \ resource.obj \ sckaddr.obj \ sckfile.obj \ @@ -308,8 +302,6 @@ COMLIBOBJS2 = \ string.obj \ tbarbase.obj \ tbarsmpl.obj \ - textfile.obj \ - textsmpl.obj \ textcmn.obj \ textfile.obj \ time.obj \ @@ -329,7 +321,7 @@ COMLIBOBJS2 = \ wxexpr.obj \ y_tab.obj \ zipstrm.obj \ - zstream.obj \ + zstream.obj OS2OBJS = \ ..\os2\$D\accel.obj \ @@ -540,14 +532,14 @@ $(COMLIBOBJS1): copy ..\common\$D\config.obj copy ..\common\$D\ctrlcmn.obj copy ..\common\$D\date.obj - copy ..\common\$D\datastrm.obj - copy ..\common\$D\dcbase.obj + copy ..\common\$D\datstrm.obj copy ..\common\$D\db.obj copy ..\common\$D\dbtable.obj + copy ..\common\$D\dcbase.obj copy ..\common\$D\dlgcmn.obj + copy ..\common\$D\dobjcmn.obj copy ..\common\$D\docmdi.obj copy ..\common\$D\docview.obj - copy ..\common\$D\docmdi.obj copy ..\common\$D\dynarray.obj copy ..\common\$D\dynlib.obj copy ..\common\$D\event.obj @@ -575,62 +567,58 @@ $(COMLIBOBJS1): copy ..\common\$D\imagpcx.obj copy ..\common\$D\imagpng.obj copy ..\common\$D\imagpnm.obj - copy ..\common\$D\init.obj copy ..\common\$D\intl.obj copy ..\common\$D\ipcbase.obj copy ..\common\$D\layout.obj - -$(COMLIBOBJS2): copy ..\common\$D\list.obj copy ..\common\$D\log.obj - copy ..\common\$D\longlong.obj - copy ..\common\$D\matrix.obj - copy ..\common\$D\memory.obj - copy ..\common\$D\mimetype.obj - copy ..\common\$D\module.obj - copy ..\common\$D\mstream.obj - copy ..\common\$D\object.obj - copy ..\common\$D\objstrm.obj - copy ..\common\$D\odbc.obj - copy ..\common\$D\paper.obj - copy ..\common\$D\prntbase.obj - copy ..\common\$D\process.obj - copy ..\common\$D\protocol.obj - copy ..\common\$D\resourc2.obj - copy ..\common\$D\resource.obj - copy ..\common\$D\sckaddr.obj - copy ..\common\$D\sckfile.obj - copy ..\common\$D\sckipc.obj - copy ..\common\$D\sckstrm.obj - copy ..\common\$D\serbase.obj - copy ..\common\$D\sizer.obj - copy ..\common\$D\socket.obj - copy ..\common\$D\strconv.obj - copy ..\common\$D\stream.obj - copy ..\common\$D\string.obj - copy ..\common\$D\tbarbase.obj - copy ..\common\$D\tbarsmpl.obj - copy ..\common\$D\textfile.obj - copy ..\common\$D\textsmpl.obj - copy ..\common\$D\textcmn.obj - copy ..\common\$D\textfile.obj - copy ..\common\$D\time.obj - copy ..\common\$D\timercmn.obj - copy ..\common\$D\tokenzr.obj - copy ..\common\$D\txtstrm.obj - copy ..\common\$D\unzip.obj - copy ..\common\$D\url.obj - copy ..\common\$D\utilscmn.obj - copy ..\common\$D\valgen.obj - copy ..\common\$D\validate.obj - copy ..\common\$D\valtext.obj - copy ..\common\$D\variant.obj - copy ..\common\$D\wfstream.obj - copy ..\common\$D\wincmn.obj - copy ..\common\$D\wxchar.obj - copy ..\common\$D\wxexpr.obj - copy ..\common\$D\y_tab.obj - copy ..\common\$D\zipstrm.obj + +$(COMLIBOBJS2): + copy ..\common\$D\longlong.obj \ + copy ..\common\$D\matrix.obj \ + copy ..\common\$D\memory.obj \ + copy ..\common\$D\mimetype.obj \ + copy ..\common\$D\module.obj \ + copy ..\common\$D\mstream.obj \ + copy ..\common\$D\object.obj \ + copy ..\common\$D\objstrm.obj \ + copy ..\common\$D\odbc.obj \ + copy ..\common\$D\paper.obj \ + copy ..\common\$D\prntbase.obj \ + copy ..\common\$D\process.obj \ + copy ..\common\$D\protocol.obj \ + copy ..\common\$D\resource.obj \ + copy ..\common\$D\sckaddr.obj \ + copy ..\common\$D\sckfile.obj \ + copy ..\common\$D\sckipc.obj \ + copy ..\common\$D\sckstrm.obj \ + copy ..\common\$D\serbase.obj \ + copy ..\common\$D\sizer.obj \ + copy ..\common\$D\socket.obj \ + copy ..\common\$D\strconv.obj \ + copy ..\common\$D\stream.obj \ + copy ..\common\$D\string.obj \ + copy ..\common\$D\tbarbase.obj \ + copy ..\common\$D\tbarsmpl.obj \ + copy ..\common\$D\textcmn.obj \ + copy ..\common\$D\textfile.obj \ + copy ..\common\$D\time.obj \ + copy ..\common\$D\timercmn.obj \ + copy ..\common\$D\tokenzr.obj \ + copy ..\common\$D\txtstrm.obj \ + copy ..\common\$D\unzip.obj \ + copy ..\common\$D\url.obj \ + copy ..\common\$D\utilscmn.obj \ + copy ..\common\$D\valgen.obj \ + copy ..\common\$D\validate.obj \ + copy ..\common\$D\valtext.obj \ + copy ..\common\$D\variant.obj \ + copy ..\common\$D\wfstream.obj \ + copy ..\common\$D\wincmn.obj \ + copy ..\common\$D\wxchar.obj \ + copy ..\common\$D\wxexpr.obj \ + copy ..\common\$D\y_tab.obj \ + copy ..\common\$D\zipstrm.obj \ copy ..\common\$D\zstream.obj $(GENLIBOBJS): -- 2.45.2