home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 August / VPR9608A.BIN / del20try / install / data.z / CLIPBRD.INT < prev    next >
Text File  |  1996-05-08  |  3KB  |  81 lines

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