-
- wxDataFormat();
- wxDataFormat( wxDataType type );
- wxDataFormat( const wxString &id );
- wxDataFormat( const wxChar *id );
- wxDataFormat( wxDataFormat &format );
- wxDataFormat( const GdkAtom atom );
-
- void SetType( wxDataType type );
- wxDataType GetType() const;
-
- wxString GetId() const;
- void SetId( const wxChar *id );
-
- GdkAtom GetAtom();
- void SetAtom(GdkAtom atom) { m_hasAtom = TRUE; m_atom = atom; }
-private:
-
- wxDataType m_type;
- wxString m_id;
- bool m_hasAtom;
- GdkAtom m_atom;
-};
+ // the clipboard formats under GDK are GdkAtoms
+ typedef GdkAtom NativeFormat;
+
+ wxDataFormat();
+ wxDataFormat( wxDataFormatId type );
+ wxDataFormat( const wxString &id );
+ wxDataFormat( const wxChar *id );
+ wxDataFormat( NativeFormat format );
+
+ wxDataFormat& operator=(NativeFormat format)
+ { SetId(format); return *this; }
+ wxDataFormat& operator=(const wxDataFormat& format)
+ { SetId(format); return *this; }
+
+ // comparison (must have both versions)
+ bool operator==(wxDataFormatId type) const
+ { return m_type == (wxDataFormatId)type; }
+ bool operator!=(wxDataFormatId type) const
+ { return m_type != (wxDataFormatId)type; }
+ bool operator==(NativeFormat format) const
+ { return m_format == (NativeFormat)format; }
+ bool operator!=(NativeFormat format) const
+ { return m_format != (NativeFormat)format; }
+ bool operator==(const wxDataFormat& format) const
+ { return m_format == format.m_format; }
+ bool operator!=(const wxDataFormat& format) const
+ { return m_format != format.m_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; }
+
+ // this only works with standard ids
+ void SetId( wxDataFormatId type );