wxMSW wxClipboard implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -729,18 +729,25 @@ typedef enum
 | 
				
			|||||||
// Don't do parent client adjustments (for implementation only)
 | 
					// Don't do parent client adjustments (for implementation only)
 | 
				
			||||||
#define wxSIZE_NO_ADJUSTMENTS   0x0008
 | 
					#define wxSIZE_NO_ADJUSTMENTS   0x0008
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Data format for drag & drop and clipboard operations
 | 
					 | 
				
			||||||
 * numbers as per winuser.h */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
enum wxDataFormat
 | 
					enum wxDataFormat
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  wxDF_INVALID =          0,
 | 
				
			||||||
  wxDF_TEXT =             1,  /* CF_TEXT */
 | 
					  wxDF_TEXT =             1,  /* CF_TEXT */
 | 
				
			||||||
  wxDF_BITMAP =           2,  /* CF_BITMAP */
 | 
					  wxDF_BITMAP =           2,  /* CF_BITMAP */
 | 
				
			||||||
  wxDF_METAFILE =         3,  /* CF_METAFILEPICT */
 | 
					  wxDF_METAFILE =         3,  /* CF_METAFILEPICT */
 | 
				
			||||||
  wxDF_DIB =              8,  /* CF_DIB */
 | 
					  wxDF_SYLK =             4,
 | 
				
			||||||
 | 
					  wxDF_DIF =              5,
 | 
				
			||||||
 | 
					  wxDF_TIFF =             6,
 | 
				
			||||||
  wxDF_OEMTEXT =          7,  /* CF_OEMTEXT */
 | 
					  wxDF_OEMTEXT =          7,  /* CF_OEMTEXT */
 | 
				
			||||||
 | 
					  wxDF_DIB =              8,  /* CF_DIB */
 | 
				
			||||||
 | 
					  wxDF_PALETTE =          9,
 | 
				
			||||||
 | 
					  wxDF_PENDATA =          10,
 | 
				
			||||||
 | 
					  wxDF_RIFF =             11,
 | 
				
			||||||
 | 
					  wxDF_WAVE =             12,
 | 
				
			||||||
 | 
					  wxDF_UNICODETEXT =      13,
 | 
				
			||||||
 | 
					  wxDF_ENHMETAFILE =      14,
 | 
				
			||||||
  wxDF_FILENAME =         15, /* CF_HDROP */
 | 
					  wxDF_FILENAME =         15, /* CF_HDROP */
 | 
				
			||||||
 | 
					  wxDF_LOCALE =           16,
 | 
				
			||||||
  wxDF_PRIVATE =          20
 | 
					  wxDF_PRIVATE =          20
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ public:
 | 
				
			|||||||
  void SetText( const wxString& strText) 
 | 
					  void SetText( const wxString& strText) 
 | 
				
			||||||
    { m_strText = strText; }
 | 
					    { m_strText = strText; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetText() 
 | 
					  wxString GetText() const
 | 
				
			||||||
    { return m_strText; }
 | 
					    { return m_strText; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -95,7 +95,7 @@ public:
 | 
				
			|||||||
  void AddFile( const wxString &file )
 | 
					  void AddFile( const wxString &file )
 | 
				
			||||||
    { m_files += file; m_files += (char)0; }
 | 
					    { m_files += file; m_files += (char)0; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetFiles()
 | 
					  wxString GetFiles() const
 | 
				
			||||||
    { return m_files; }
 | 
					    { return m_files; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -121,7 +121,7 @@ public:
 | 
				
			|||||||
  void SetBitmap( const wxBitmap &bitmap )
 | 
					  void SetBitmap( const wxBitmap &bitmap )
 | 
				
			||||||
    { m_bitmap = bitmap; }
 | 
					    { m_bitmap = bitmap; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxBitmap GetBitmap()
 | 
					  wxBitmap GetBitmap() const
 | 
				
			||||||
    { return m_bitmap; }
 | 
					    { return m_bitmap; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -154,16 +154,16 @@ public:
 | 
				
			|||||||
  void SetId( const wxString& id )
 | 
					  void SetId( const wxString& id )
 | 
				
			||||||
    { m_id = id; }
 | 
					    { m_id = id; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetId()
 | 
					  wxString GetId() const
 | 
				
			||||||
    { return m_id; }
 | 
					    { return m_id; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // will make internal copy
 | 
					  // will make internal copy
 | 
				
			||||||
  void SetData( const char *data, size_t size );
 | 
					  void SetData( const char *data, size_t size );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  size_t GetDataSize()
 | 
					  size_t GetDataSize() const
 | 
				
			||||||
    { return m_size; }
 | 
					    { return m_size; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  char* GetData()
 | 
					  char* GetData() const
 | 
				
			||||||
    { return m_data; }
 | 
					    { return m_data; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ public:
 | 
				
			|||||||
  void SetText( const wxString& strText) 
 | 
					  void SetText( const wxString& strText) 
 | 
				
			||||||
    { m_strText = strText; }
 | 
					    { m_strText = strText; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetText() 
 | 
					  wxString GetText() const
 | 
				
			||||||
    { return m_strText; }
 | 
					    { return m_strText; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -95,7 +95,7 @@ public:
 | 
				
			|||||||
  void AddFile( const wxString &file )
 | 
					  void AddFile( const wxString &file )
 | 
				
			||||||
    { m_files += file; m_files += (char)0; }
 | 
					    { m_files += file; m_files += (char)0; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetFiles()
 | 
					  wxString GetFiles() const
 | 
				
			||||||
    { return m_files; }
 | 
					    { return m_files; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -121,7 +121,7 @@ public:
 | 
				
			|||||||
  void SetBitmap( const wxBitmap &bitmap )
 | 
					  void SetBitmap( const wxBitmap &bitmap )
 | 
				
			||||||
    { m_bitmap = bitmap; }
 | 
					    { m_bitmap = bitmap; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxBitmap GetBitmap()
 | 
					  wxBitmap GetBitmap() const
 | 
				
			||||||
    { return m_bitmap; }
 | 
					    { return m_bitmap; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
@@ -154,16 +154,16 @@ public:
 | 
				
			|||||||
  void SetId( const wxString& id )
 | 
					  void SetId( const wxString& id )
 | 
				
			||||||
    { m_id = id; }
 | 
					    { m_id = id; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  wxString GetId()
 | 
					  wxString GetId() const
 | 
				
			||||||
    { return m_id; }
 | 
					    { return m_id; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // will make internal copy
 | 
					  // will make internal copy
 | 
				
			||||||
  void SetData( const char *data, size_t size );
 | 
					  void SetData( const char *data, size_t size );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  size_t GetDataSize()
 | 
					  size_t GetDataSize() const
 | 
				
			||||||
    { return m_size; }
 | 
					    { return m_size; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  char* GetData()
 | 
					  char* GetData() const
 | 
				
			||||||
    { return m_data; }
 | 
					    { return m_data; }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,88 +23,59 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "wx/list.h"
 | 
					#include "wx/list.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// These functions superceded by wxClipboard, but retained in order to implement
 | 
				
			||||||
 | 
					// wxClipboard, and for compatibility.
 | 
				
			||||||
WXDLLEXPORT bool wxOpenClipboard(void);
 | 
					WXDLLEXPORT bool wxOpenClipboard(void);
 | 
				
			||||||
WXDLLEXPORT bool wxClipboardOpen(void);
 | 
					WXDLLEXPORT bool wxClipboardOpen(void);
 | 
				
			||||||
WXDLLEXPORT bool wxCloseClipboard(void);
 | 
					WXDLLEXPORT bool wxCloseClipboard(void);
 | 
				
			||||||
WXDLLEXPORT bool wxEmptyClipboard(void);
 | 
					WXDLLEXPORT bool wxEmptyClipboard(void);
 | 
				
			||||||
WXDLLEXPORT bool wxIsClipboardFormatAvailable(int dataFormat);
 | 
					WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
 | 
				
			||||||
WXDLLEXPORT bool wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0);
 | 
					WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width = 0, int height = 0);
 | 
				
			||||||
WXDLLEXPORT wxObject* wxGetClipboardData(int dataFormat, long *len = NULL);
 | 
					WXDLLEXPORT wxObject* wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL);
 | 
				
			||||||
WXDLLEXPORT int  wxEnumClipboardFormats(int dataFormat);
 | 
					WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat);
 | 
				
			||||||
WXDLLEXPORT int  wxRegisterClipboardFormat(char *formatName);
 | 
					WXDLLEXPORT int  wxRegisterClipboardFormat(char *formatName);
 | 
				
			||||||
WXDLLEXPORT bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount);
 | 
					WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* The following is Matthew Flatt's implementation of the MSW
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 * side of generic clipboard functionality.
 | 
					// wxClipboard
 | 
				
			||||||
 */
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* A clipboard client holds data belonging to the clipboard.
 | 
					class WXDLLEXPORT wxDataObject;
 | 
				
			||||||
   For plain text, a client is not necessary. */
 | 
					class WXDLLEXPORT wxClipboard: public wxObject
 | 
				
			||||||
class WXDLLEXPORT wxClipboardClient : public wxObject
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  DECLARE_ABSTRACT_CLASS(wxClipboardClient)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 public:
 | 
					 | 
				
			||||||
  /* This list should be filled in with strings indicating the formats
 | 
					 | 
				
			||||||
     this client can provide. Almost all clients will provide "TEXT".
 | 
					 | 
				
			||||||
     Format names should be 4 characters long, so things will work
 | 
					 | 
				
			||||||
     out on the Macintosh */
 | 
					 | 
				
			||||||
  wxStringList formats;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* This method is called when the client is losing the selection. */
 | 
					 | 
				
			||||||
  virtual void BeingReplaced(void) = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* This method is called when someone wants the data this client is
 | 
					 | 
				
			||||||
     supplying to the clipboard. "format" is a string indicating the
 | 
					 | 
				
			||||||
     format of the data - one of the strings from the "formats"
 | 
					 | 
				
			||||||
     list. "*size" should be filled with the size of the resulting
 | 
					 | 
				
			||||||
     data. In the case of text, "*size" does not count the
 | 
					 | 
				
			||||||
     NULL terminator. */
 | 
					 | 
				
			||||||
  virtual char *GetData(char *format, long *size) = 0;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* ONE instance of this class: */
 | 
					 | 
				
			||||||
class WXDLLEXPORT wxClipboard : public wxObject
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  DECLARE_DYNAMIC_CLASS(wxClipboard)
 | 
					  DECLARE_DYNAMIC_CLASS(wxClipboard)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 public:
 | 
					public:
 | 
				
			||||||
  wxClipboardClient *clipOwner;
 | 
					 
 | 
				
			||||||
  char *cbString, *sentString, *receivedString;
 | 
					 | 
				
			||||||
  void *receivedTargets;
 | 
					 | 
				
			||||||
  long receivedLength;
 | 
					 | 
				
			||||||
#ifdef __XVIEW__
 | 
					 | 
				
			||||||
  long sel_owner;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  wxClipboard();
 | 
					  wxClipboard();
 | 
				
			||||||
  ~wxClipboard();
 | 
					  ~wxClipboard();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Set the clipboard data owner. "time" comes from the event record. */
 | 
					  // open the clipboard before SetData() and GetData()
 | 
				
			||||||
  void SetClipboardClient(wxClipboardClient *, long time);
 | 
					  virtual bool Open();
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // close the clipboard after SetData() and GetData()
 | 
				
			||||||
 | 
					  virtual void Close();
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // can be called several times
 | 
				
			||||||
 | 
					  virtual bool SetData( wxDataObject *data );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Set the clipboard string; does not require a client. */
 | 
					  // format available on the clipboard ? 
 | 
				
			||||||
  void SetClipboardString(char *, long time);
 | 
					  // supply ID if private format, the same as wxPrivateDataObject::SetId() 
 | 
				
			||||||
 | 
					  virtual bool IsSupportedFormat( wxDataFormat format, const wxString &id = wxEmptyString );
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // fill data with data on the clipboard (if available)
 | 
				
			||||||
 | 
					  virtual bool GetData( wxDataObject *data );
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // clears wxTheClipboard and the system's clipboard if possible
 | 
				
			||||||
 | 
					  virtual void Clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Get data from the clipboard in the format "TEXT". */
 | 
					 // implementation 
 | 
				
			||||||
  char *GetClipboardString(long time);
 | 
					 
 | 
				
			||||||
 | 
					  bool              m_open;
 | 
				
			||||||
  /* Get data from the clipboard */
 | 
					 | 
				
			||||||
  char *GetClipboardData(char *format, long *length, long time);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* Get the clipboard client directly. Will be NULL if clipboard data
 | 
					 | 
				
			||||||
     is a string, or if some other application owns the clipboard. 
 | 
					 | 
				
			||||||
     This can be useful for shortcutting data translation, if the
 | 
					 | 
				
			||||||
     clipboard user can check for a specific client. (This is used
 | 
					 | 
				
			||||||
     by the wxMediaEdit class.) */
 | 
					 | 
				
			||||||
  wxClipboardClient *GetClipboardClient(void);
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Initialize wxTheClipboard. Can be called repeatedly */
 | 
					 | 
				
			||||||
WXDLLEXPORT void wxInitClipboard(void);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* The clipboard */
 | 
					/* The clipboard */
 | 
				
			||||||
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
 | 
					// WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // wxUSE_CLIPBOARD
 | 
					#endif // wxUSE_CLIPBOARD
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,69 +21,99 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if wxUSE_METAFILE
 | 
					#if wxUSE_METAFILE
 | 
				
			||||||
#include "wx/dc.h"
 | 
					#include "wx/dc.h"
 | 
				
			||||||
 | 
					#include "wx/gdiobj.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if wxUSE_DRAG_AND_DROP
 | 
				
			||||||
 | 
					#include "wx/dataobj.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Metafile and metafile device context classes - work in Windows 3.1 only
 | 
					 * Metafile and metafile device context classes
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLEXPORT wxDC;
 | 
					#define wxMetaFile wxMetafile
 | 
				
			||||||
class WXDLLEXPORT wxMetaFile: public wxObject
 | 
					#define wxMetaFileDC wxMetafileDC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WXDLLEXPORT wxMetafile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  DECLARE_DYNAMIC_CLASS(wxMetaFile)
 | 
					    friend class WXDLLEXPORT wxMetafile;
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    wxMetafileRefData(void);
 | 
				
			||||||
 | 
					    ~wxMetafileRefData(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    WXHANDLE m_metafile;
 | 
				
			||||||
 | 
					    int m_windowsMappingMode;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class WXDLLEXPORT wxMetafile: public wxGDIObject
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  DECLARE_DYNAMIC_CLASS(wxMetafile)
 | 
				
			||||||
 public:
 | 
					 public:
 | 
				
			||||||
  wxMetaFile(const wxString& file = "");
 | 
					  // Copy constructor
 | 
				
			||||||
  ~wxMetaFile(void);
 | 
					  inline wxMetafile(const wxMetafile& metafile)
 | 
				
			||||||
 | 
					  { Ref(metafile); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  wxMetafile(const wxString& file = "");
 | 
				
			||||||
 | 
					  ~wxMetafile(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // After this is called, the metafile cannot be used for anything
 | 
					  // After this is called, the metafile cannot be used for anything
 | 
				
			||||||
  // since it is now owned by the clipboard.
 | 
					  // since it is now owned by the clipboard.
 | 
				
			||||||
  virtual bool SetClipboard(int width = 0, int height = 0);
 | 
					  virtual bool SetClipboard(int width = 0, int height = 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  virtual bool Play(wxDC *dc);
 | 
					  virtual bool Play(wxDC *dc);
 | 
				
			||||||
  inline bool Ok(void) { return m_metaFile != 0; };
 | 
					  inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Implementation
 | 
					  // Implementation
 | 
				
			||||||
  inline WXHANDLE GetHMETAFILE(void) { return m_metaFile; }
 | 
					  inline WXHANDLE GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; }
 | 
				
			||||||
  inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
 | 
					  void SetHMETAFILE(WXHANDLE mf) ;
 | 
				
			||||||
  inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
 | 
					  inline int GetWindowsMappingMode(void) { return M_METAFILEDATA->m_windowsMappingMode; }
 | 
				
			||||||
  inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
 | 
					  void SetWindowsMappingMode(int mm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Operators
 | 
				
			||||||
 | 
					  inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
 | 
				
			||||||
 | 
					  inline bool operator == (const wxMetafile& metafile) { return m_refData == metafile.m_refData; }
 | 
				
			||||||
 | 
					  inline bool operator != (const wxMetafile& metafile) { return m_refData != metafile.m_refData; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  WXHANDLE m_metaFile;
 | 
					 | 
				
			||||||
  int m_windowsMappingMode;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WXDLLEXPORT wxMetaFileDC: public wxDC
 | 
					class WXDLLEXPORT wxMetafileDC: public wxDC
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
 | 
					  DECLARE_DYNAMIC_CLASS(wxMetafileDC)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 public:
 | 
					 public:
 | 
				
			||||||
  // Don't supply origin and extent
 | 
					  // Don't supply origin and extent
 | 
				
			||||||
  // Supply them to wxMakeMetaFilePlaceable instead.
 | 
					  // Supply them to wxMakeMetaFilePlaceable instead.
 | 
				
			||||||
  wxMetaFileDC(const wxString& file = "");
 | 
					  wxMetafileDC(const wxString& file = "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Supply origin and extent (recommended).
 | 
					  // Supply origin and extent (recommended).
 | 
				
			||||||
  // Then don't need to supply them to wxMakeMetaFilePlaceable.
 | 
					  // Then don't need to supply them to wxMakeMetaFilePlaceable.
 | 
				
			||||||
  wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
 | 
					  wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ~wxMetaFileDC(void);
 | 
					  ~wxMetafileDC(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Should be called at end of drawing
 | 
					  // Should be called at end of drawing
 | 
				
			||||||
  virtual wxMetaFile *Close(void);
 | 
					  virtual wxMetafile *Close(void);
 | 
				
			||||||
  virtual void SetMapMode(int mode);
 | 
					  virtual void SetMapMode(int mode);
 | 
				
			||||||
  virtual void GetTextExtent(const wxString& string, long *x, long *y,
 | 
					  virtual void GetTextExtent(const wxString& string, long *x, long *y,
 | 
				
			||||||
                     long *descent = NULL, long *externalLeading = NULL,
 | 
					                     long *descent = NULL, long *externalLeading = NULL,
 | 
				
			||||||
                     wxFont *theFont = NULL, bool use16bit = FALSE) const;
 | 
					                     wxFont *theFont = NULL, bool use16bit = FALSE) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Implementation
 | 
					  // Implementation
 | 
				
			||||||
  inline wxMetaFile *GetMetaFile(void) { return m_metaFile; }
 | 
					  inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
 | 
				
			||||||
  inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
 | 
					  inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
 | 
				
			||||||
  inline int GetWindowsMappingMode(void) { return m_windowsMappingMode; }
 | 
					  inline int GetWindowsMappingMode(void) const { return m_windowsMappingMode; }
 | 
				
			||||||
  inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
 | 
					  inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  int m_windowsMappingMode;
 | 
					  int           m_windowsMappingMode;
 | 
				
			||||||
  wxMetaFile *m_metaFile;
 | 
					  wxMetafile*   m_metaFile;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -94,11 +124,55 @@ protected:
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// No origin or extent
 | 
					// No origin or extent
 | 
				
			||||||
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
 | 
					#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable
 | 
				
			||||||
 | 
					bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Optional origin and extent
 | 
					// Optional origin and extent
 | 
				
			||||||
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
 | 
					bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// wxMetafileDataObject is a specialization of wxDataObject for metafile data
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: implement OLE side of things. At present, it's just for clipboard
 | 
				
			||||||
 | 
					// use.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if wxUSE_DRAG_AND_DROP
 | 
				
			||||||
 | 
					class WXDLLEXPORT wxMetafileDataObject : public wxDataObject
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					  // ctors
 | 
				
			||||||
 | 
					  wxMetafileDataObject() { m_width = 0; m_height = 0; };
 | 
				
			||||||
 | 
					  wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0):
 | 
				
			||||||
 | 
					    m_metafile(metafile), m_width(width), m_height(height) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0)
 | 
				
			||||||
 | 
					    { m_metafile = metafile; m_width = w; m_height = h; }
 | 
				
			||||||
 | 
					  wxMetafile GetMetafile() const { return m_metafile; }
 | 
				
			||||||
 | 
					  int GetWidth() const { return m_width; }
 | 
				
			||||||
 | 
					  int GetHeight() const { return m_height; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ??
 | 
				
			||||||
 | 
					  // implement base class pure virtuals
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetPreferredFormat() const
 | 
				
			||||||
 | 
					    { return (wxDataFormat) wxDataObject::Text; }
 | 
				
			||||||
 | 
					  virtual bool IsSupportedFormat(wxDataFormat format) const
 | 
				
			||||||
 | 
					    { return format == wxDataObject::Text || format == wxDataObject::Locale; }
 | 
				
			||||||
 | 
					  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:
 | 
				
			||||||
 | 
					  wxMetafile   m_metafile;
 | 
				
			||||||
 | 
					  int          m_width;
 | 
				
			||||||
 | 
					  int          m_height;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // wxUSE_METAFILE
 | 
					#endif // wxUSE_METAFILE
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    // _WX_METAFIILE_H_
 | 
					    // _WX_METAFIILE_H_
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,6 +73,9 @@ public:
 | 
				
			|||||||
    // retrieve IDataObject interface (for other OLE related classes)
 | 
					    // retrieve IDataObject interface (for other OLE related classes)
 | 
				
			||||||
  IDataObject *GetInterface() const { return m_pIDataObject; }
 | 
					  IDataObject *GetInterface() const { return m_pIDataObject; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ////// wxGTK compatibility: hopefully to become the preferred API.
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetFormat() const { return GetPreferredFormat(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  IDataObject *m_pIDataObject; // pointer to the COM interface
 | 
					  IDataObject *m_pIDataObject; // pointer to the COM interface
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -98,6 +101,11 @@ public:
 | 
				
			|||||||
  virtual void GetDataHere(void *pBuf) const
 | 
					  virtual void GetDataHere(void *pBuf) const
 | 
				
			||||||
    { memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
 | 
					    { memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ////// wxGTK compatibility: hopefully to become the preferred API.
 | 
				
			||||||
 | 
					  void SetText(const wxString& strText) { m_strText = strText; }
 | 
				
			||||||
 | 
					  wxString GetText() const { return m_strText; }
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetFormat() const { return wxDF_TEXT; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  wxString  m_strText;
 | 
					  wxString  m_strText;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -106,4 +114,42 @@ private:
 | 
				
			|||||||
// @@@ TODO: wx{Bitmap|Metafile|...}DataObject
 | 
					// @@@ TODO: wx{Bitmap|Metafile|...}DataObject
 | 
				
			||||||
// ----------------------------------------------------------------------------
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// wxBitmapDataObject is a specialization of wxDataObject for bitmap data
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: implement OLE side of things. At present, it's just for clipboard
 | 
				
			||||||
 | 
					// use.
 | 
				
			||||||
 | 
					class WXDLLEXPORT wxBitmapDataObject : public wxDataObject
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					  // ctors
 | 
				
			||||||
 | 
					  wxBitmapDataObject() {};
 | 
				
			||||||
 | 
					  wxBitmapDataObject(const wxBitmap& bitmap): m_bitmap(bitmap) {}
 | 
				
			||||||
 | 
					  void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
 | 
				
			||||||
 | 
					  wxBitmap GetBitmap() const { return m_bitmap; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetFormat() const { return wxDF_BITMAP; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ??
 | 
				
			||||||
 | 
					  // implement base class pure virtuals
 | 
				
			||||||
 | 
					  virtual wxDataFormat GetPreferredFormat() const
 | 
				
			||||||
 | 
					    { return (wxDataFormat) wxDataObject::Text; }
 | 
				
			||||||
 | 
					  virtual bool IsSupportedFormat(wxDataFormat format) const
 | 
				
			||||||
 | 
					    { return format == wxDataObject::Text || format == wxDataObject::Locale; }
 | 
				
			||||||
 | 
					  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:
 | 
				
			||||||
 | 
					  wxBitmap  m_bitmap;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// wxMetaFileDataObject: see metafile.h is a specialization of wxDataObject for bitmap data
 | 
				
			||||||
 | 
					// ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  //_WX_OLEDATAOBJ_H
 | 
					#endif  //_WX_OLEDATAOBJ_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,6 +142,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
 | 
				
			|||||||
          m_strText("wxWindows drag & drop works :-)")
 | 
					          m_strText("wxWindows drag & drop works :-)")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  SetBackgroundColour(* wxWHITE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // frame icon and status bar
 | 
					  // frame icon and status bar
 | 
				
			||||||
  SetIcon(wxICON(mondrian));
 | 
					  SetIcon(wxICON(mondrian));
 | 
				
			||||||
@@ -233,7 +234,7 @@ void DnDFrame::OnPaint(wxPaintEvent& /*event*/)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  wxPaintDC dc(this);
 | 
					  wxPaintDC dc(this);
 | 
				
			||||||
  dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL ) );
 | 
					  dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL ) );
 | 
				
			||||||
  dc.DrawText( "Drag text from here!", 20, h-20 );
 | 
					  dc.DrawText( "Drag text from here!", 20, h-30 );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DnDFrame::OnDrag(wxCommandEvent& /* event */)
 | 
					void DnDFrame::OnDrag(wxCommandEvent& /* event */)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,18 +35,27 @@
 | 
				
			|||||||
#include "wx/utils.h"
 | 
					#include "wx/utils.h"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if wxUSE_METAFILE
 | 
				
			||||||
#include "wx/metafile.h"
 | 
					#include "wx/metafile.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "wx/clipbrd.h"
 | 
					#include "wx/clipbrd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <windows.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HICON myIcon;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "wx/msw/private.h"
 | 
					#include "wx/msw/private.h"
 | 
				
			||||||
#include "wx/msw/dib.h"
 | 
					#include "wx/msw/dib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <string.h>
 | 
					// wxDataObject is tied to OLE/drag and drop implementation,
 | 
				
			||||||
 | 
					// therefore so is wxClipboard :-(
 | 
				
			||||||
#if !USE_SHARED_LIBRARY
 | 
					#if wxUSE_DRAG_AND_DROP
 | 
				
			||||||
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
 | 
					#include "wx/dataobj.h"
 | 
				
			||||||
IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxClipboardIsOpen = FALSE;
 | 
					bool wxClipboardIsOpen = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxOpenClipboard(void)
 | 
					bool wxOpenClipboard(void)
 | 
				
			||||||
@@ -78,12 +87,12 @@ bool wxClipboardOpen(void)
 | 
				
			|||||||
  return wxClipboardIsOpen;
 | 
					  return wxClipboardIsOpen;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxIsClipboardFormatAvailable(int dataFormat)
 | 
					bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return (::IsClipboardFormatAvailable(dataFormat) != 0);
 | 
					  return (::IsClipboardFormatAvailable(dataFormat) != 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
 | 
					bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int height)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  switch (dataFormat)
 | 
					  switch (dataFormat)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -135,7 +144,7 @@ bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
 | 
				
			|||||||
#if wxUSE_METAFILE
 | 
					#if wxUSE_METAFILE
 | 
				
			||||||
    case wxDF_METAFILE:
 | 
					    case wxDF_METAFILE:
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      wxMetaFile *wxMF = (wxMetaFile *)obj;
 | 
					      wxMetafile *wxMF = (wxMetafile *)obj;
 | 
				
			||||||
      HANDLE data = GlobalAlloc(GHND, sizeof(METAFILEPICT) + 1);
 | 
					      HANDLE data = GlobalAlloc(GHND, sizeof(METAFILEPICT) + 1);
 | 
				
			||||||
#ifdef __WINDOWS_386__
 | 
					#ifdef __WINDOWS_386__
 | 
				
			||||||
      METAFILEPICT *mf = (METAFILEPICT *)MK_FP32(GlobalLock(data));
 | 
					      METAFILEPICT *mf = (METAFILEPICT *)MK_FP32(GlobalLock(data));
 | 
				
			||||||
@@ -200,7 +209,7 @@ bool wxSetClipboardData(int dataFormat, wxObject *obj, int width, int height)
 | 
				
			|||||||
  return FALSE;
 | 
					  return FALSE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxObject *wxGetClipboardData(int dataFormat, long *len)
 | 
					wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  switch (dataFormat)
 | 
					  switch (dataFormat)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@@ -299,9 +308,9 @@ wxObject *wxGetClipboardData(int dataFormat, long *len)
 | 
				
			|||||||
  return NULL;
 | 
					  return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int  wxEnumClipboardFormats(int dataFormat)
 | 
					wxDataFormat  wxEnumClipboardFormats(wxDataFormat dataFormat)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return ::EnumClipboardFormats(dataFormat);
 | 
					  return (wxDataFormat) ::EnumClipboardFormats(dataFormat);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int  wxRegisterClipboardFormat(char *formatName)
 | 
					int  wxRegisterClipboardFormat(char *formatName)
 | 
				
			||||||
@@ -309,158 +318,166 @@ int  wxRegisterClipboardFormat(char *formatName)
 | 
				
			|||||||
  return ::RegisterClipboardFormat(formatName);
 | 
					  return ::RegisterClipboardFormat(formatName);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount)
 | 
					bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return (::GetClipboardFormatName(dataFormat, formatName, maxCount) > 0);
 | 
					  return (::GetClipboardFormatName((int) dataFormat, formatName, maxCount) > 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Generalized clipboard implementation by Matthew Flatt
 | 
					 * wxClipboard
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxClipboard *wxTheClipboard = NULL;
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					// wxClipboard
 | 
				
			||||||
 | 
					//-----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxInitClipboard(void)
 | 
					IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  if (!wxTheClipboard)
 | 
					 | 
				
			||||||
    wxTheClipboard = new wxClipboard;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxClipboard::wxClipboard()
 | 
					wxClipboard::wxClipboard()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  clipOwner = NULL;
 | 
					    m_open = FALSE;
 | 
				
			||||||
  cbString = NULL;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxClipboard::~wxClipboard()
 | 
					wxClipboard::~wxClipboard()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (clipOwner)
 | 
					    Clear();  
 | 
				
			||||||
    clipOwner->BeingReplaced();
 | 
					 | 
				
			||||||
  if (cbString)
 | 
					 | 
				
			||||||
    delete[] cbString;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int FormatStringToID(char *str)
 | 
					void wxClipboard::Clear()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (!strcmp(str, "TEXT"))
 | 
					 | 
				
			||||||
    return wxDF_TEXT;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return wxRegisterClipboardFormat(str);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxClipboard::SetClipboardClient(wxClipboardClient *client, long time)
 | 
					bool wxClipboard::Open()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  bool got_selection;
 | 
					    wxCHECK_MSG( !m_open, FALSE, "clipboard already open" );
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (clipOwner)
 | 
					 | 
				
			||||||
    clipOwner->BeingReplaced();
 | 
					 | 
				
			||||||
  clipOwner = client;
 | 
					 | 
				
			||||||
  if (cbString) {
 | 
					 | 
				
			||||||
    delete[] cbString;
 | 
					 | 
				
			||||||
    cbString = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (wxOpenClipboard()) {
 | 
					 | 
				
			||||||
    char **formats, *data;
 | 
					 | 
				
			||||||
         int i;
 | 
					 | 
				
			||||||
    int ftype;
 | 
					 | 
				
			||||||
    long size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    formats = clipOwner->formats.ListToArray(FALSE);
 | 
					 | 
				
			||||||
    for (i = clipOwner->formats.Number(); i--; ) {
 | 
					 | 
				
			||||||
      ftype = FormatStringToID(formats[i]);
 | 
					 | 
				
			||||||
      data = clipOwner->GetData(formats[i], &size);
 | 
					 | 
				
			||||||
      if (!wxSetClipboardData(ftype, (wxObject *)data, size, 1)) {
 | 
					 | 
				
			||||||
        got_selection = FALSE;
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (i < 0)
 | 
					 | 
				
			||||||
      got_selection = wxCloseClipboard();
 | 
					 | 
				
			||||||
  } else
 | 
					 | 
				
			||||||
    got_selection = FALSE;
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  got_selection = FALSE; // Assume another process takes over
 | 
					    m_open = TRUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!got_selection) {
 | 
					    return wxOpenClipboard();
 | 
				
			||||||
    clipOwner->BeingReplaced();
 | 
					 | 
				
			||||||
         clipOwner = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxClipboardClient *wxClipboard::GetClipboardClient()
 | 
					bool wxClipboard::SetData( wxDataObject *data )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return clipOwner;
 | 
					#if wxUSE_DRAG_AND_DROP
 | 
				
			||||||
 | 
					    wxCHECK_MSG( data, FALSE, "data is invalid" );
 | 
				
			||||||
 | 
					    wxCHECK_MSG( m_open, FALSE, "clipboard not open" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    switch (data->GetFormat())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        case wxDF_TEXT:
 | 
				
			||||||
 | 
					        case wxDF_OEMTEXT:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            wxTextDataObject* textDataObject = (wxTextDataObject*) data;
 | 
				
			||||||
 | 
					            wxString str(textDataObject->GetText());
 | 
				
			||||||
 | 
					            return wxSetClipboardData(data->GetFormat(), (wxObject*) (const char*) str);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        case wxDF_BITMAP:
 | 
				
			||||||
 | 
					        case wxDF_DIB:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
 | 
				
			||||||
 | 
					            wxBitmap bitmap(bitmapDataObject->GetBitmap());
 | 
				
			||||||
 | 
					            return wxSetClipboardData(data->GetFormat(), & bitmap);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#if wxUSE_METAFILE
 | 
				
			||||||
 | 
					        case wxDF_METAFILE:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            wxMetafileDataObject* metaFileDataObject = (wxMetafileDataObject*) data;
 | 
				
			||||||
 | 
					            wxMetafile metaFile = metaFileDataObject->GetMetafile();
 | 
				
			||||||
 | 
					            return wxSetClipboardData(wxDF_METAFILE, & metaFile, metaFileDataObject->GetWidth(), metaFileDataObject->GetHeight());
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxClipboard::SetClipboardString(char *str, long time)
 | 
					void wxClipboard::Close()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  bool got_selection;
 | 
					    wxCHECK_RET( m_open, "clipboard not open" );
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  if (clipOwner) {
 | 
					    m_open = FALSE;
 | 
				
			||||||
    clipOwner->BeingReplaced();
 | 
					    wxCloseClipboard();
 | 
				
			||||||
    clipOwner = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (cbString)
 | 
					 | 
				
			||||||
    delete[] cbString;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  cbString = str;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (wxOpenClipboard()) {
 | 
					 | 
				
			||||||
    if (!wxSetClipboardData(wxDF_TEXT, (wxObject *)str))
 | 
					 | 
				
			||||||
      got_selection = FALSE;
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
                got_selection = wxCloseClipboard();
 | 
					 | 
				
			||||||
  } else
 | 
					 | 
				
			||||||
    got_selection = FALSE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  got_selection = FALSE; // Assume another process takes over
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!got_selection) {
 | 
					 | 
				
			||||||
    delete[] cbString;
 | 
					 | 
				
			||||||
    cbString = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *wxClipboard::GetClipboardString(long time)
 | 
					bool wxClipboard::IsSupportedFormat( wxDataFormat format, const wxString& WXUNUSED(id) )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  char *str;
 | 
					    return wxIsClipboardFormatAvailable(format);
 | 
				
			||||||
  long length;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  str = GetClipboardData("TEXT", &length, time);
 | 
					 | 
				
			||||||
  if (!str) {
 | 
					 | 
				
			||||||
    str = new char[1];
 | 
					 | 
				
			||||||
    *str = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return str;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char *wxClipboard::GetClipboardData(char *format, long *length, long time)
 | 
					bool wxClipboard::GetData( wxDataObject *data )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (clipOwner)  {
 | 
					    wxCHECK_MSG( m_open, FALSE, "clipboard not open" );
 | 
				
			||||||
         if (clipOwner->formats.Member(format))
 | 
					    
 | 
				
			||||||
      return clipOwner->GetData(format, length);
 | 
					#if wxUSE_DRAG_AND_DROP
 | 
				
			||||||
    else
 | 
					    switch (data->GetFormat())
 | 
				
			||||||
      return NULL;
 | 
					    {
 | 
				
			||||||
  } else if (cbString) {
 | 
					        case wxDF_TEXT:
 | 
				
			||||||
    if (!strcmp(format, "TEXT"))
 | 
					        case wxDF_OEMTEXT:
 | 
				
			||||||
      return copystring(cbString);
 | 
					        {
 | 
				
			||||||
    else
 | 
					            wxTextDataObject* textDataObject = (wxTextDataObject*) data;
 | 
				
			||||||
      return NULL;
 | 
					            char* s = (char*) wxGetClipboardData(data->GetFormat());
 | 
				
			||||||
  } else {
 | 
					            if (s)
 | 
				
			||||||
    if (wxOpenClipboard()) {
 | 
					            {
 | 
				
			||||||
      receivedString = (char *)wxGetClipboardData(FormatStringToID(format), 
 | 
					                textDataObject->SetText(s);
 | 
				
			||||||
                                                  length);
 | 
					                delete[] s;
 | 
				
			||||||
      wxCloseClipboard();
 | 
					                return TRUE;
 | 
				
			||||||
    } else
 | 
					            }
 | 
				
			||||||
      receivedString = NULL;
 | 
					            else
 | 
				
			||||||
 | 
					                return FALSE;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        case wxDF_BITMAP:
 | 
				
			||||||
 | 
					        case wxDF_DIB:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data;
 | 
				
			||||||
 | 
					            wxBitmap* bitmap = (wxBitmap*) wxGetClipboardData(data->GetFormat());
 | 
				
			||||||
 | 
					            if (bitmap)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                bitmapDataObject->SetBitmap(* bitmap);
 | 
				
			||||||
 | 
					                delete bitmap;
 | 
				
			||||||
 | 
					                return TRUE;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                return FALSE;
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					#if wxUSE_METAFILE
 | 
				
			||||||
 | 
					        case wxDF_METAFILE:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            wxMetafileDataObject* metaFileDataObject = (wxMetafileDataObject*) data;
 | 
				
			||||||
 | 
					            wxMetafile* metaFile = (wxMetafile*) wxGetClipboardData(wxDF_METAFILE);
 | 
				
			||||||
 | 
					            if (metaFile)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                metaFileDataObject->SetMetafile(* metaFile);
 | 
				
			||||||
 | 
					                delete metaFile;
 | 
				
			||||||
 | 
					                return TRUE;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return receivedString;
 | 
					            break;
 | 
				
			||||||
  }
 | 
					        }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return FALSE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif // wxUSE_CLIPBOARD
 | 
					#endif // wxUSE_CLIPBOARD
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1626,10 +1626,10 @@ $(DOCDIR)\html\wx\wx.htm:         $(DOCDIR)\latex\wx\classes.tex $(DOCDIR)\latex
 | 
				
			|||||||
        -mkdir $(DOCDIR)\html\wx
 | 
					        -mkdir $(DOCDIR)\html\wx
 | 
				
			||||||
        -start /w tex2rtf $(DOCDIR)\latex\wx\manual.tex $(DOCDIR)\html\wx\wx.htm -twice -html
 | 
					        -start /w tex2rtf $(DOCDIR)\latex\wx\manual.tex $(DOCDIR)\html\wx\wx.htm -twice -html
 | 
				
			||||||
        -erase $(DOCDIR)\html\wx\*.con
 | 
					        -erase $(DOCDIR)\html\wx\*.con
 | 
				
			||||||
#        -erase $(DOCDIR)\html\wx\*.ref
 | 
					        -erase $(DOCDIR)\html\wx\*.ref
 | 
				
			||||||
#        -erase $(DOCDIR)\latex\wx\*.con
 | 
					        -erase $(DOCDIR)\latex\wx\*.con
 | 
				
			||||||
#        -erase $(DOCDIR)\latex\wx\*.ref
 | 
					        -erase $(DOCDIR)\latex\wx\*.ref
 | 
				
			||||||
#        cd $(THISDIR)
 | 
					         cd $(THISDIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(DOCDIR)\html\porting\port.htm:         $(DOCDIR)\latex\porting\porting.tex
 | 
					$(DOCDIR)\html\porting\port.htm:         $(DOCDIR)\latex\porting\porting.tex
 | 
				
			||||||
        cd $(DOCDIR)\latex\porting
 | 
					        cd $(DOCDIR)\latex\porting
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
/////////////////////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Name:        metafile.cpp
 | 
					// Name:        metafile.cpp
 | 
				
			||||||
// Purpose:     wxMetaFileDC etc.
 | 
					// Purpose:     wxMetafileDC etc.
 | 
				
			||||||
// Author:      Julian Smart
 | 
					// Author:      Julian Smart
 | 
				
			||||||
// Modified by:
 | 
					// Modified by:
 | 
				
			||||||
// Created:     04/01/98
 | 
					// Created:     04/01/98
 | 
				
			||||||
@@ -41,53 +41,90 @@
 | 
				
			|||||||
extern bool wxClipboardIsOpen;
 | 
					extern bool wxClipboardIsOpen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !USE_SHARED_LIBRARY
 | 
					#if !USE_SHARED_LIBRARY
 | 
				
			||||||
IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject)
 | 
					IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
 | 
				
			||||||
IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC)
 | 
					IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Metafiles - Windows 3.1 only
 | 
					 * Metafiles
 | 
				
			||||||
 * Currently, the only purpose for making a metafile is to put
 | 
					 * Currently, the only purpose for making a metafile is to put
 | 
				
			||||||
 * it on the clipboard.
 | 
					 * it on the clipboard.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMetaFile::wxMetaFile(const wxString& file)
 | 
					wxMetafileRefData::wxMetafileRefData(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_windowsMappingMode = MM_ANISOTROPIC;
 | 
					    m_metafile = 0;
 | 
				
			||||||
  m_metaFile = 0;
 | 
					    m_windowsMappingMode = MM_ANISOTROPIC;
 | 
				
			||||||
  if (!file.IsNull() && file == "")
 | 
					 | 
				
			||||||
    m_metaFile = (WXHANDLE) GetMetaFile(file);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMetaFile::~wxMetaFile(void)
 | 
					wxMetafileRefData::~wxMetafileRefData(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (m_metaFile)
 | 
					    if (m_metafile)
 | 
				
			||||||
    { DeleteMetaFile((HMETAFILE) m_metaFile); m_metaFile = 0; }
 | 
					    {
 | 
				
			||||||
 | 
					        DeleteMetaFile((HMETAFILE) m_metafile);
 | 
				
			||||||
 | 
					        m_metafile = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxMetaFile::SetClipboard(int width, int height)
 | 
					wxMetafile::wxMetafile(const wxString& file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  bool alreadyOpen=wxClipboardOpen();
 | 
					    m_refData = new wxMetafileRefData;
 | 
				
			||||||
  if (!alreadyOpen)
 | 
					
 | 
				
			||||||
  {
 | 
					    M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC;
 | 
				
			||||||
    wxOpenClipboard();
 | 
					    M_METAFILEDATA->m_metafile = 0;
 | 
				
			||||||
    if (!wxEmptyClipboard()) return FALSE;
 | 
					    if (!file.IsNull() && file == "")
 | 
				
			||||||
  }
 | 
					        M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
 | 
				
			||||||
  bool success = wxSetClipboardData(wxDF_METAFILE,this, width,height);
 | 
					 | 
				
			||||||
  if (!alreadyOpen) wxCloseClipboard();
 | 
					 | 
				
			||||||
  return (bool) success;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxMetaFile::Play(wxDC *dc)
 | 
					wxMetafile::~wxMetafile(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  dc->BeginDrawing();
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (dc->GetHDC() && m_metaFile)
 | 
					bool wxMetafile::SetClipboard(int width, int height)
 | 
				
			||||||
    PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) m_metaFile);
 | 
					{
 | 
				
			||||||
 | 
					    if (!m_refData)
 | 
				
			||||||
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  dc->EndDrawing();
 | 
					    bool alreadyOpen=wxClipboardOpen();
 | 
				
			||||||
 | 
					    if (!alreadyOpen)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        wxOpenClipboard();
 | 
				
			||||||
 | 
					        if (!wxEmptyClipboard()) return FALSE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    bool success = wxSetClipboardData(wxDF_METAFILE, this, width,height);
 | 
				
			||||||
 | 
					    if (!alreadyOpen) wxCloseClipboard();
 | 
				
			||||||
 | 
					    return (bool) success;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return TRUE;
 | 
					bool wxMetafile::Play(wxDC *dc)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (!m_refData)
 | 
				
			||||||
 | 
					        return FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dc->BeginDrawing();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
 | 
				
			||||||
 | 
					        PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dc->EndDrawing();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return TRUE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wxMetafile::SetHMETAFILE(WXHANDLE mf)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (m_refData)
 | 
				
			||||||
 | 
					        m_refData = new wxMetafileRefData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    M_METAFILEDATA->m_metafile = mf;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void wxMetafile::SetWindowsMappingMode(int mm)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (m_refData)
 | 
				
			||||||
 | 
					        m_refData = new wxMetafileRefData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    M_METAFILEDATA->m_windowsMappingMode = mm;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -96,8 +133,8 @@ bool wxMetaFile::Play(wxDC *dc)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Original constructor that does not takes origin and extent. If you use this,
 | 
					// Original constructor that does not takes origin and extent. If you use this,
 | 
				
			||||||
// *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
 | 
					// *DO* give origin/extent arguments to wxMakeMetafilePlaceable.
 | 
				
			||||||
wxMetaFileDC::wxMetaFileDC(const wxString& file)
 | 
					wxMetafileDC::wxMetafileDC(const wxString& file)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_metaFile = NULL;
 | 
					  m_metaFile = NULL;
 | 
				
			||||||
  m_minX = 10000;
 | 
					  m_minX = 10000;
 | 
				
			||||||
@@ -123,8 +160,8 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// New constructor that takes origin and extent. If you use this, don't
 | 
					// New constructor that takes origin and extent. If you use this, don't
 | 
				
			||||||
// give origin/extent arguments to wxMakeMetaFilePlaceable.
 | 
					// give origin/extent arguments to wxMakeMetafilePlaceable.
 | 
				
			||||||
wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
 | 
					wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_minX = 10000;
 | 
					  m_minX = 10000;
 | 
				
			||||||
  m_minY = 10000;
 | 
					  m_minY = 10000;
 | 
				
			||||||
@@ -144,12 +181,12 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, i
 | 
				
			|||||||
  SetMapMode(MM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 | 
					  SetMapMode(MM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMetaFileDC::~wxMetaFileDC(void)
 | 
					wxMetafileDC::~wxMetafileDC(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_hDC = 0;
 | 
					  m_hDC = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxMetaFileDC::GetTextExtent(const wxString& string, long *x, long *y,
 | 
					void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y,
 | 
				
			||||||
                                 long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const
 | 
					                                 long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wxFont *fontToUse = theFont;
 | 
					  wxFont *fontToUse = theFont;
 | 
				
			||||||
@@ -171,14 +208,14 @@ void wxMetaFileDC::GetTextExtent(const wxString& string, long *x, long *y,
 | 
				
			|||||||
  if (externalLeading) *externalLeading = tm.tmExternalLeading;
 | 
					  if (externalLeading) *externalLeading = tm.tmExternalLeading;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wxMetaFile *wxMetaFileDC::Close(void)
 | 
					wxMetafile *wxMetafileDC::Close(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  SelectOldObjects(m_hDC);
 | 
					  SelectOldObjects(m_hDC);
 | 
				
			||||||
  HANDLE mf = CloseMetaFile((HDC) m_hDC);
 | 
					  HANDLE mf = CloseMetaFile((HDC) m_hDC);
 | 
				
			||||||
  m_hDC = 0;
 | 
					  m_hDC = 0;
 | 
				
			||||||
  if (mf)
 | 
					  if (mf)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    wxMetaFile *wx_mf = new wxMetaFile;
 | 
					    wxMetafile *wx_mf = new wxMetafile;
 | 
				
			||||||
    wx_mf->SetHMETAFILE((WXHANDLE) mf);
 | 
					    wx_mf->SetHMETAFILE((WXHANDLE) mf);
 | 
				
			||||||
    wx_mf->SetWindowsMappingMode(m_windowsMappingMode);
 | 
					    wx_mf->SetWindowsMappingMode(m_windowsMappingMode);
 | 
				
			||||||
    return wx_mf;
 | 
					    return wx_mf;
 | 
				
			||||||
@@ -186,7 +223,7 @@ wxMetaFile *wxMetaFileDC::Close(void)
 | 
				
			|||||||
  return NULL;
 | 
					  return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wxMetaFileDC::SetMapMode(int mode)
 | 
					void wxMetafileDC::SetMapMode(int mode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_mappingMode = mode;
 | 
					  m_mappingMode = mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -271,12 +308,12 @@ struct mfPLACEABLEHEADER {
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
bool wxMakeMetaFilePlaceable(const wxString& filename, float scale)
 | 
					bool wxMakeMetafilePlaceable(const wxString& filename, float scale)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return wxMakeMetaFilePlaceable(filename, 0, 0, 0, 0, scale, FALSE);
 | 
					  return wxMakeMetafilePlaceable(filename, 0, 0, 0, 0, scale, FALSE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent)
 | 
					bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  // I'm not sure if this is the correct way of suggesting a scale
 | 
					  // I'm not sure if this is the correct way of suggesting a scale
 | 
				
			||||||
  // to the client application, but it's the only way I can find.
 | 
					  // to the client application, but it's the only way I can find.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user