dataform.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/dataform.h
  3. // Purpose: declaration of the wxDataFormat class
  4. // Author: Stefan Csomor (lifted from dnd.h)
  5. // Modified by:
  6. // Created: 10/21/99
  7. // Copyright: (c) 1999 Stefan Csomor
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MAC_DATAFORM_H
  11. #define _WX_MAC_DATAFORM_H
  12. class WXDLLIMPEXP_CORE wxDataFormat
  13. {
  14. public:
  15. typedef unsigned long NativeFormat;
  16. wxDataFormat();
  17. wxDataFormat(wxDataFormatId vType);
  18. wxDataFormat(const wxDataFormat& rFormat);
  19. wxDataFormat(const wxString& rId);
  20. wxDataFormat(const wxChar* pId);
  21. wxDataFormat(NativeFormat vFormat);
  22. ~wxDataFormat();
  23. wxDataFormat& operator=(NativeFormat vFormat)
  24. { SetId(vFormat); return *this; }
  25. // comparison (must have both versions)
  26. bool operator==(const wxDataFormat& format) const ;
  27. bool operator!=(const wxDataFormat& format) const
  28. { return ! ( *this == format ); }
  29. bool operator==(wxDataFormatId format) const
  30. { return m_type == (wxDataFormatId)format; }
  31. bool operator!=(wxDataFormatId format) const
  32. { return m_type != (wxDataFormatId)format; }
  33. wxDataFormat& operator=(const wxDataFormat& format);
  34. // explicit and implicit conversions to NativeFormat which is one of
  35. // standard data types (implicit conversion is useful for preserving the
  36. // compatibility with old code)
  37. NativeFormat GetFormatId() const { return m_format; }
  38. operator NativeFormat() const { return m_format; }
  39. void SetId(NativeFormat format);
  40. // string ids are used for custom types - this SetId() must be used for
  41. // application-specific formats
  42. wxString GetId() const;
  43. void SetId(const wxString& pId);
  44. // implementation
  45. wxDataFormatId GetType() const { return m_type; }
  46. void SetType( wxDataFormatId type );
  47. // returns true if the format is one of those defined in wxDataFormatId
  48. bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; }
  49. private:
  50. wxDataFormatId m_type;
  51. NativeFormat m_format;
  52. // indicates the type in case of wxDF_PRIVATE :
  53. wxString m_id ;
  54. };
  55. #endif // _WX_MAC_DATAFORM_H