Back to index

plt-scheme  4.2.1
Clipboard.h
Go to the documentation of this file.
00001 /* wx_clipb.h */
00002 /* Header file for clipboard class. */
00003 
00004 #ifndef __WX_CLIPBOARD__
00005 #define __WX_CLIPBOARD__
00006 
00007 class wxFrame;
00008 
00009 /* A clipboard client holds data belonging to the clipboard.
00010    For plain text, a client is not necessary. */
00011 class wxClipboardClient : public wxObject
00012 {
00013  public:
00014   /* This list should be filled in with strings indicating the formats
00015      this client can provide. Almost all clients will provide "TEXT".
00016      Format names should be 4 characters long, so things will work
00017      out on the Macintosh */
00018   wxStringList *formats;
00019 
00020   void *context; /* eventspace for the client */
00021 
00022   wxClipboardClient();
00023 
00024   /* This method is called when the client is losing the selection. */
00025   virtual void BeingReplaced(void) = 0;
00026 
00027   /* This method is called when someone wants the data this client is
00028      supplying to the clipboard. "format" is a string indicating the
00029      format of the data - one of the strings from the "formats"
00030      list. "*size" should be filled with the size of the resulting
00031      data. In the case of text, "*size" does not count the
00032      NULL terminator. */
00033   virtual char *GetData(char *format, long *size) = 0;
00034 };
00035 
00036 /* ONE instance of this class: */
00037 class wxClipboard : public wxObject
00038 {
00039  public:
00040   wxClipboardClient *clipOwner;
00041   char *cbString, *sentString, *receivedString;
00042   void *receivedTargets;
00043   long receivedLength;
00044   Bool is_sel, in_progress;
00045   void *saferef;
00046   double start_time;
00047   wxFrame *frame;
00048 
00049   wxClipboard();
00050   ~wxClipboard();
00051 
00052   /* Set the clipboard data owner. "time" comes from the event record. */
00053   void SetClipboardClient(wxClipboardClient *, long time);
00054 
00055   /* Set the clipboard string; does not require a client. */
00056   void SetClipboardString(char *, long time);
00057 
00058   /* Get data from the clipboard in the format "TEXT". */
00059   char *GetClipboardString(long time);
00060 
00061 
00062   void SetClipboardBitmap(wxBitmap *, long time);
00063   wxBitmap *GetClipboardBitmap(long time);
00064 
00065   /* Get data from the clipboard */
00066   char *GetClipboardData(char *format, long *length, long time, int alt_sel = 0);
00067 
00068   /* Get the clipboard client directly. Will be NULL if clipboard data
00069      is a string, or if some other application owns the clipboard. 
00070      This can be useful for shortcutting data translation, if the
00071      clipboard user can check for a specific client. (This is used
00072      by the wxMediaEdit class.) */
00073   wxClipboardClient *GetClipboardClient(void);
00074 };
00075 
00076 /* Initialize wxTheClipboard. Can be called repeatedly */
00077 void wxInitClipboard(void);
00078 
00079 /* The clipboard and selection: */
00080 extern wxClipboard *wxTheClipboard;
00081 extern wxClipboard *wxTheSelection;
00082 
00083 char *wxsGetDataInEventspace(wxClipboardClient *clipOwner, char *format, long *length);
00084 
00085 #endif
00086