clipbrd.h 3.3 KB

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