dataform.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/dataform.h
  3. // Purpose: declaration of the wxDataFormat class
  4. // Author: Robert Roebling
  5. // Modified by:
  6. // Created: 19.10.99 (extracted from motif/dataobj.h)
  7. // Copyright: (c) 1999 Robert Roebling
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MOTIF_DATAFORM_H
  11. #define _WX_MOTIF_DATAFORM_H
  12. class WXDLLIMPEXP_CORE wxDataFormat
  13. {
  14. public:
  15. // the clipboard formats under Xt are Atoms
  16. typedef Atom NativeFormat;
  17. wxDataFormat();
  18. wxDataFormat( wxDataFormatId type );
  19. wxDataFormat( const wxString &id );
  20. wxDataFormat( NativeFormat format );
  21. wxDataFormat& operator=(NativeFormat format)
  22. { SetId(format); return *this; }
  23. // comparison (must have both versions)
  24. bool operator==(NativeFormat format) const
  25. { return m_format == (NativeFormat)format; }
  26. bool operator!=(NativeFormat format) const
  27. { return m_format != (NativeFormat)format; }
  28. bool operator==(wxDataFormatId format) const
  29. { return m_type == (wxDataFormatId)format; }
  30. bool operator!=(wxDataFormatId format) const
  31. { return m_type != (wxDataFormatId)format; }
  32. // explicit and implicit conversions to NativeFormat which is one of
  33. // standard data types (implicit conversion is useful for preserving the
  34. // compatibility with old code)
  35. NativeFormat GetFormatId() const { return m_format; }
  36. operator NativeFormat() const { return m_format; }
  37. void SetId( NativeFormat format );
  38. // string ids are used for custom types - this SetId() must be used for
  39. // application-specific formats
  40. wxString GetId() const;
  41. void SetId( const wxString& id );
  42. // implementation
  43. wxDataFormatId GetType() const;
  44. private:
  45. wxDataFormatId m_type;
  46. NativeFormat m_format;
  47. void PrepareFormats();
  48. void SetType( wxDataFormatId type );
  49. };
  50. #endif // _WX_MOTIF_DATAFORM_H