{$I OVC.INC}

{$B-} {Complete Boolean Evaluation}
{$I+} {Input/Output-Checking}
{$P+} {Open Parameters}
{$T-} {Typed @ Operator}
{$W-} {Windows Stack Frame}
{$X+} {Extended Syntax}

{$IFNDEF Win32}
{$G+} {286 Instructions}
{$N+} {Numeric Coprocessor}
{$C MOVEABLE,DEMANDLOAD,DISCARDABLE}
{$ENDIF}

{*********************************************************}
{*                   OVCXFER.PAS 2.00                    *}
{*     Copyright (c) TurboPower Software Co 1995-96      *}
{*                 All rights reserved.                  *}
{*********************************************************}

unit OvcXfer;
  {-Data transfer non-visual component}

interface

uses
  {$IFDEF Win32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
  Classes, Controls, ExtCtrls, Forms, StdCtrls, SysUtils,
  OvcAe, OvcConst, OvcData, OvcEf, OvcExcpt, OvcMisc, OvcRLbl;

{***************************************************************
 Supported types             Data to transfer
----------------------------------------------------------------
  TLabel                       ShortString
  TPanel                       ShortString
  TEdit                        ShortString
  TMemo                        TStrings
  TCheckBox                    Boolean
  TRadioButton                 Boolean
  TListBox                     Integer, TStrings
  TComboBox                    Integer, string, TStrings
  TOvcRotatedLabel             ShortString
  TOvcBaseEntryField           variable (size obtained from field)
*****************************************************************}

type
  {structure used to transfer data for a TListBox component}
  PListBoxTransfer = ^TListBoxTransfer;
  TListBoxTransfer = packed record
    ItemIndex : Integer;
    Items     : TStrings;
  end;

  {structure used to transfer data for a TComboBox component}
  PComboBoxTransfer = ^TComboBoxTransfer;
  TComboBoxTransfer = packed record
    ItemIndex : Integer;
    Text      : string[255];
    Items     : TStrings;
  end;

type
  TOvcTransfer = class(TComponent)
  {.Z+}
  protected {private}
    xfrList : TList;

    {internal methods}
    procedure xfrFillTransferList(L : TList);
      {-build list of all components that require data transfer}
    function xfrGetComponentDataSize(C : TComponent) : Word;
      {-return the size of the data for this component}
    function xfrGetTransferBufferSize(L : TList) : Word;
      {-return the expected size of the transfer buffer}

  public
    {for internal use by the property editor}
    procedure GetTransferList(L : TList);
      {-return the list of components}
  {.Z-}

    function GetTransferBufferSize(CNA : array of TComponent) : Word;
      {-return the required size for the transfer buffer}
    procedure TransferFromForm(CNA : array of TComponent; var Data);
      {-transfer forms data to structure pointed to by Data}
    procedure TransferToForm(CNA : array of TComponent; const Data);
      {-transfer data from structure pointed to by Data to form}
  end;


implementation
