home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 48 / SENT14D.ISO / tech / delphi / disk14 / doc.pak / CLIPBRD.INT < prev    next >
Encoding:
Text File  |  1995-08-24  |  3.2 KB  |  78 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {       Delphi Visual Component Library                 }
  4. {                                                       }
  5. {       Copyright (c) 1995 Borland International        }
  6. {                                                       }
  7. {*******************************************************}
  8.  
  9. unit Clipbrd;
  10.  
  11. interface
  12.  
  13. uses WinTypes, WinProcs, Messages, Classes, Graphics;
  14.  
  15. var
  16.   CF_PICTURE: Word;
  17.   CF_COMPONENT: Word;
  18.  
  19. { TClipboard }
  20.  
  21. { The clipboard object encapsulates the Windows clipboard.
  22.  
  23.   Assign - Assigns the given object to the clipboard.  If the object is
  24.     a TPicture or TGraphic desendent it will be placed on the clipboard
  25.     in the corresponding format (e.g. TBitmap will be placed on the
  26.     clipboard as a CF_BITMAP). Picture.Assign(Clipboard) and
  27.     Bitmap.Assign(Clipboard) are also supported to retrieve the contents
  28.     of the clipboard.
  29.   Clear - Clears the contents of the clipboard.  This is done automatically
  30.     when the clipboard object adds data to the clipboard.
  31.   Close - Closes the clipboard if it is open.  Open and close maintain a
  32.     count of the number of times the clipboard has been opened.  It will
  33.     not actually close the clipboard until it has been closed the same
  34.     number of times it has been opened.
  35.   Open - Open the clipboard and prevents all other applications from changeing
  36.     the clipboard.  This is call is not necessary if you are adding just one
  37.     item to the clipboard.  If you need to add more than one format to
  38.     the clipboard, call Open.  After all the formats have been added. Call
  39.     close.
  40.   HasFormat - Returns true if the given format is available on the clipboard.
  41.   GetAsHandle - Returns the data from the clipboard in a raw Windows handled
  42.     for the specified format.  The handle is not owned by the application and
  43.     the data should be copied.
  44.   SetAsHandle - Places the handle on the clipboard in the given format.  Once
  45.     a handle has been given to the clipboard it should *not* be deleted.  It
  46.     will be deleted by the clipboard.
  47.   GetTextBuf - Retrieves
  48.   AsText - Allows placing and retrieving text from the clipboard.  This property
  49.     is valid to retrieve if the CF_TEXT format is available.
  50.   FormatCount - The number of formats in the Formats array.
  51.   Formats - A list of all the formats available on the clipboard. }
  52.  
  53. type
  54.   TClipboard = class(TPersistent)
  55.   protected
  56.     procedure AssignTo(Dest: TPersistent); override;
  57.   public
  58.     procedure Assign(Source: TPersistent); override;
  59.     procedure Clear;
  60.     procedure Close;
  61.     function GetComponent(Owner, Parent: TComponent): TComponent;
  62.     function GetAsHandle(Format: Word): THandle;
  63.     function GetTextBuf(Buffer: PChar; BufSize: Integer): Integer;
  64.     function HasFormat(Format: Word): Boolean;
  65.     procedure Open;
  66.     procedure SetComponent(Component: TComponent);
  67.     procedure SetAsHandle(Format: Word; Value: THandle);
  68.     procedure SetTextBuf(Buffer: PChar);
  69.     property AsText: string;
  70.     property FormatCount: Integer;
  71.     property Formats[Index: Integer]: Word;
  72.   end;
  73.  
  74. var
  75.   Clipboard: TClipboard;
  76.  
  77. implementation
  78.