clipbrd.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/clipbrd.h
  3. // Purpose: wxClipboad class and clipboard functions for MSW
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_CLIPBRD_H_
  11. #define _WX_CLIPBRD_H_
  12. #if wxUSE_CLIPBOARD
  13. // These functions superceded by wxClipboard, but retained in order to
  14. // implement wxClipboard, and for compatibility.
  15. // open/close the clipboard
  16. WXDLLIMPEXP_CORE bool wxOpenClipboard();
  17. WXDLLIMPEXP_CORE bool wxIsClipboardOpened();
  18. #define wxClipboardOpen wxIsClipboardOpened
  19. WXDLLIMPEXP_CORE bool wxCloseClipboard();
  20. // get/set data
  21. WXDLLIMPEXP_CORE bool wxEmptyClipboard();
  22. WXDLLIMPEXP_CORE bool wxSetClipboardData(wxDataFormat dataFormat,
  23. const void *data,
  24. int width = 0, int height = 0);
  25. WXDLLIMPEXP_CORE void* wxGetClipboardData(wxDataFormat dataFormat,
  26. long *len = NULL);
  27. // clipboard formats
  28. WXDLLIMPEXP_CORE bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
  29. WXDLLIMPEXP_CORE wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat);
  30. WXDLLIMPEXP_CORE int wxRegisterClipboardFormat(wxChar *formatName);
  31. WXDLLIMPEXP_CORE bool wxGetClipboardFormatName(wxDataFormat dataFormat,
  32. wxChar *formatName,
  33. int maxCount);
  34. //-----------------------------------------------------------------------------
  35. // wxClipboard
  36. //-----------------------------------------------------------------------------
  37. class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
  38. {
  39. public:
  40. wxClipboard();
  41. virtual ~wxClipboard();
  42. // open the clipboard before SetData() and GetData()
  43. virtual bool Open();
  44. // close the clipboard after SetData() and GetData()
  45. virtual void Close();
  46. // query whether the clipboard is opened
  47. virtual bool IsOpened() const;
  48. // set the clipboard data. all other formats will be deleted.
  49. virtual bool SetData( wxDataObject *data );
  50. // add to the clipboard data.
  51. virtual bool AddData( wxDataObject *data );
  52. // ask if data in correct format is available
  53. virtual bool IsSupported( const wxDataFormat& format );
  54. // fill data with data on the clipboard (if available)
  55. virtual bool GetData( wxDataObject& data );
  56. // clears wxTheClipboard and the system's clipboard if possible
  57. virtual void Clear();
  58. // flushes the clipboard: this means that the data which is currently on
  59. // clipboard will stay available even after the application exits (possibly
  60. // eating memory), otherwise the clipboard will be emptied on exit
  61. virtual bool Flush();
  62. private:
  63. IDataObject *m_lastDataObject;
  64. bool m_isOpened;
  65. DECLARE_DYNAMIC_CLASS(wxClipboard)
  66. };
  67. #endif // wxUSE_CLIPBOARD
  68. #endif // _WX_CLIPBRD_H_