Motif compile fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,53 +13,6 @@
|
||||
#define _WX_DATAOBJ_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat identifies the single format of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under Win32 are UINTs
|
||||
typedef unsigned int NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ m_format = format; return *this; }
|
||||
|
||||
// defautl copy ctor/assignment operators ok
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(wxDataFormatId format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(wxDataFormatId 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 format) { m_format = format; }
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId(const wxChar *format);
|
||||
|
||||
private:
|
||||
// returns TRUE if the format is one of those defined in wxDataFormatId
|
||||
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
|
||||
|
||||
NativeFormat m_format;
|
||||
};
|
||||
|
||||
#include "wx/msw/ole/dataobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dataobj.h"
|
||||
@@ -81,7 +34,7 @@ private:
|
||||
|
||||
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
||||
#endif
|
||||
|
||||
|
@@ -1347,6 +1347,9 @@ typedef void* WXFont;
|
||||
typedef void* WXImage;
|
||||
typedef void* WXCursor;
|
||||
typedef void* WXFontList;
|
||||
|
||||
typedef unsigned long Atom; /* this might fail on a few architectures */
|
||||
|
||||
#endif // Motif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include "wx/defs.h"
|
||||
#include "wx/setup.h"
|
||||
|
||||
#include "wx/dataobj.h"
|
||||
|
||||
#include "wx/list.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
@@ -69,10 +71,15 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
/// If primary == TRUE, use primary selection in all further ops,
|
||||
/// primary=FALSE resets it.
|
||||
inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; }
|
||||
|
||||
// implementation
|
||||
|
||||
bool m_open;
|
||||
wxList m_data;
|
||||
bool m_usePrimary;
|
||||
};
|
||||
|
||||
/* The clipboard */
|
||||
|
@@ -23,149 +23,124 @@
|
||||
// classes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataObject;
|
||||
class WXDLLEXPORT wxTextDataObject;
|
||||
class WXDLLEXPORT wxBitmapDataObject;
|
||||
class WXDLLEXPORT wxPrivateDataObject;
|
||||
class WXDLLEXPORT wxFileDataObject;
|
||||
class wxDataFormat;
|
||||
class wxDataObject;
|
||||
class wxTextDataObject;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataObject
|
||||
// wxDataFormat
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataObject: public wxObject
|
||||
class wxDataFormat : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS( wxDataObject )
|
||||
DECLARE_CLASS( wxDataFormat )
|
||||
|
||||
public:
|
||||
wxDataFormat();
|
||||
wxDataFormat( wxDataFormatId type );
|
||||
wxDataFormat( const wxString &id );
|
||||
wxDataFormat( const wxChar *id );
|
||||
wxDataFormat( const wxDataFormat &format );
|
||||
wxDataFormat( const Atom atom );
|
||||
|
||||
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 );
|
||||
|
||||
Atom GetAtom();
|
||||
void SetAtom(Atom atom) { m_hasAtom = TRUE; m_atom = atom; }
|
||||
|
||||
// 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;
|
||||
bool m_hasAtom;
|
||||
Atom m_atom;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxDataObject to be placed in wxDataBroker
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class wxDataObject : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxDataObject )
|
||||
|
||||
public:
|
||||
|
||||
wxDataObject() {}
|
||||
~wxDataObject() {}
|
||||
/* constructor */
|
||||
wxDataObject();
|
||||
|
||||
virtual wxDataFormat GetFormat() const = 0;
|
||||
|
||||
// implementation
|
||||
/* destructor */
|
||||
~wxDataObject();
|
||||
|
||||
/* write data to dest */
|
||||
virtual void WriteData( void *dest ) const = 0;
|
||||
|
||||
/* get size of data */
|
||||
virtual size_t GetSize() const = 0;
|
||||
|
||||
/* implementation */
|
||||
|
||||
wxDataFormat &GetFormat();
|
||||
|
||||
wxDataFormatId GetFormatType() const;
|
||||
wxString GetFormatId() const;
|
||||
Atom GetFormatAtom() const;
|
||||
|
||||
wxDataFormat m_format;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
// wxTextDataObject is a specialization of wxDataObject for text data
|
||||
// ----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextDataObject : public wxDataObject
|
||||
class wxTextDataObject : public wxDataObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxTextDataObject )
|
||||
|
||||
public:
|
||||
|
||||
wxTextDataObject() {}
|
||||
wxTextDataObject( const wxString& strText )
|
||||
: m_strText(strText) { }
|
||||
|
||||
virtual wxDataFormat GetFormat() const
|
||||
{ return wxDF_TEXT; }
|
||||
|
||||
void SetText( const wxString& strText)
|
||||
{ m_strText = strText; }
|
||||
|
||||
wxString GetText() const
|
||||
{ return m_strText; }
|
||||
/* default constructor. call SetText() later or override
|
||||
WriteData() and GetSize() for working on-demand */
|
||||
wxTextDataObject();
|
||||
|
||||
private:
|
||||
wxString m_strText;
|
||||
/* constructor */
|
||||
wxTextDataObject( const wxString& data );
|
||||
|
||||
};
|
||||
/* set current text data */
|
||||
void SetText( const wxString& data );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDataObject is a specialization of wxDataObject for file names
|
||||
// ----------------------------------------------------------------------------
|
||||
/* get current text data */
|
||||
wxString GetText() const;
|
||||
|
||||
class WXDLLEXPORT wxFileDataObject : public wxDataObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxFileDataObject )
|
||||
/* by default calls WriteString() with string set by constructor or
|
||||
by SetText(). can be overridden for working on-demand */
|
||||
virtual void WriteData( void *dest ) const;
|
||||
|
||||
public:
|
||||
/* by default, returns length of string as set by constructor or
|
||||
by SetText(). can be overridden for working on-demand */
|
||||
virtual size_t GetSize() const;
|
||||
|
||||
wxFileDataObject(void) {}
|
||||
|
||||
virtual wxDataFormat GetFormat() const
|
||||
{ return wxDF_FILENAME; }
|
||||
|
||||
void AddFile( const wxString &file )
|
||||
{ m_files += file; m_files += (char)0; }
|
||||
|
||||
wxString GetFiles() const
|
||||
{ return m_files; }
|
||||
|
||||
private:
|
||||
wxString m_files;
|
||||
|
||||
};
|
||||
/* write string to dest */
|
||||
void WriteString( const wxString &str, void *dest ) const;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
||||
// ----------------------------------------------------------------------------
|
||||
/* implementation */
|
||||
|
||||
class WXDLLEXPORT wxBitmapDataObject : public wxDataObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxBitmapDataObject )
|
||||
|
||||
public:
|
||||
|
||||
wxBitmapDataObject(void) {}
|
||||
|
||||
virtual wxDataFormat GetFormat() const
|
||||
{ return wxDF_BITMAP; }
|
||||
|
||||
void SetBitmap( const wxBitmap &bitmap )
|
||||
{ m_bitmap = bitmap; }
|
||||
|
||||
wxBitmap GetBitmap() const
|
||||
{ return m_bitmap; }
|
||||
|
||||
private:
|
||||
wxBitmap m_bitmap;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPrivateDataObject is a specialization of wxDataObject for app specific data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
||||
|
||||
public:
|
||||
|
||||
wxPrivateDataObject();
|
||||
|
||||
~wxPrivateDataObject();
|
||||
|
||||
virtual wxDataFormat GetFormat() const
|
||||
{ return wxDF_PRIVATE; }
|
||||
|
||||
// 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 "WXWORD_FORMAT".
|
||||
|
||||
void SetId( const wxString& id )
|
||||
{ m_id = id; }
|
||||
|
||||
wxString GetId() const
|
||||
{ return m_id; }
|
||||
|
||||
// will make internal copy
|
||||
void SetData( const char *data, size_t size );
|
||||
|
||||
size_t GetDataSize() const
|
||||
{ return m_size; }
|
||||
|
||||
char* GetData() const
|
||||
{ return m_data; }
|
||||
|
||||
private:
|
||||
size_t m_size;
|
||||
char* m_data;
|
||||
wxString m_id;
|
||||
wxString m_data;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -84,6 +84,9 @@ public:
|
||||
virtual int ShowModal();
|
||||
virtual void EndModal(int retCode);
|
||||
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
int GetReturnCode() const { return m_returnCode; }
|
||||
|
||||
// Standard buttons
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnApply(wxCommandEvent& event);
|
||||
@@ -104,6 +107,7 @@ public:
|
||||
//// Motif-specific
|
||||
bool m_modalShowing;
|
||||
wxString m_dialogTitle;
|
||||
int m_returnCode;
|
||||
|
||||
protected:
|
||||
virtual void DoSetSize(int x, int y,
|
||||
|
@@ -209,6 +209,7 @@ protected:
|
||||
int GetPixmapWidth() const { return m_pixmapWidth; }
|
||||
int GetPixmapHeight() const { return m_pixmapHeight; }
|
||||
|
||||
public:
|
||||
// Change properties
|
||||
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
|
||||
virtual void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
|
||||
@@ -220,6 +221,7 @@ protected:
|
||||
// Change foreground colour using current foreground colour setting
|
||||
virtual void ChangeForegroundColour();
|
||||
|
||||
protected:
|
||||
// Adds the widget to the hash table and adds event handlers.
|
||||
bool AttachWidget(wxWindow* parent, WXWidget mainWidget,
|
||||
WXWidget formWidget, int x, int y, int width, int height);
|
||||
|
@@ -12,6 +12,53 @@
|
||||
#ifndef _WX_OLEDATAOBJ_H
|
||||
#define _WX_OLEDATAOBJ_H
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat identifies the single format of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataFormat
|
||||
{
|
||||
public:
|
||||
// the clipboard formats under Win32 are UINTs
|
||||
typedef unsigned int NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
|
||||
wxDataFormat& operator=(NativeFormat format)
|
||||
{ m_format = format; return *this; }
|
||||
|
||||
// defautl copy ctor/assignment operators ok
|
||||
|
||||
// comparison (must have both versions)
|
||||
bool operator==(wxDataFormatId format) const
|
||||
{ return m_format == (NativeFormat)format; }
|
||||
bool operator!=(wxDataFormatId 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 format) { m_format = format; }
|
||||
|
||||
// string ids are used for custom types - this SetId() must be used for
|
||||
// application-specific formats
|
||||
wxString GetId() const;
|
||||
void SetId(const wxChar *format);
|
||||
|
||||
private:
|
||||
// returns TRUE if the format is one of those defined in wxDataFormatId
|
||||
bool IsStandard() const { return m_format > 0 && m_format < wxDF_MAX; }
|
||||
|
||||
NativeFormat m_format;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user