{********************************************************************}
{                                                                    }
{ written by TMS Software                                            }
{            copyright ©  2013                                       }
{            Email : info@tmssoftware.com                            }
{            Web : http://www.tmssoftware.com                        }
{                                                                    }
{ The source code is given as is. The author is not responsible      }
{ for any possible damage done due to the use of this code.          }
{ The complete source code remains property of the author and may    }
{ not be distributed, published, given or sold in any form as such.  }
{ No parts of the source code can be included in any other component }
{ or application without written authorization of the author.        }
{********************************************************************}

unit FMX.TMSGridOptions;

interface

{$I TMSDEFS.INC}

uses
  Classes, Types, FMX.TMSBaseControl, FMX.Types, UITypes,
  {$IFNDEF ANDROID}
  FMX.Printer,
  {$ENDIF}
  FMX.TMSGridDataUtil, FMX.TMSGridCell, UIConsts, FMX.Styles
  {$IFDEF DELPHIXE5_LVL}
  , FMX.Graphics
  {$ENDIF}
  ;

type

  TTMSFMXCustomGridData = class(TTMSFMXCustomGridCellData);

  TTMSFMXGridTabKeyHandling = (tkhNextControl, tkhNextCell, tkhMixed);

  TTMSFMXGridTabKeyDirection = (tkdNextColumnCell, tkdNextRowCell);

  TTMSFMXGridPrintPosition = (ppTopLeft, ppTopCenter, ppTopRight, ppBottomLeft, ppBottomCenter, ppBottomRight);

  TTMSFMXGridPrintCellBackground = (cbNone, cbCellColor, cbFull);

  TTMSFMXGridScrollBarOptions = class(TPersistent)
  private
    FOnChange: TNotifyEvent;
    FVerticalScrollBarVisible: Boolean;
    FHorizontalScrollBarVisible: Boolean;
    procedure SetHorizontalScrollBarVisible(const Value: Boolean);
    procedure SetVerticalScrollBarVisible(const Value: Boolean);
  protected
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
  published
    property HorizontalScrollBarVisible: Boolean read FHorizontalScrollBarVisible write SetHorizontalScrollBarVisible default True;
    property VerticalScrollBarVisible: Boolean read FVerticalScrollBarVisible write SetVerticalScrollBarVisible default True;
  end;

  TTMSFMXGridHeaderOptions = class(TPersistent)
  private
    FVisible: Boolean;
    FOnChange: TNotifyEvent;
    procedure SetVisible(const Value: Boolean);
  protected
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
  published
    property Visible: Boolean read FVisible write SetVisible default False;
  end;

  TTMSFMXGridFooterOptions = class(TPersistent)
  private
    FVisible: Boolean;
    FOnChange: TNotifyEvent;
    procedure SetVisible(const Value: Boolean);
  protected
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
  published
    property Visible: Boolean read FVisible write SetVisible default False;
  end;

  TTMSFMXGridPrintingOptions = class(TPersistent)
  private
    FPageNumberFormat: String;
    FTitlePosition: TTMSFMXGridPrintPosition;
    FPageNumberPosition: TTMSFMXGridPrintPosition;
    FTitle: String;
    FDescriptionPosition: TTMSFMXGridPrintPosition;
    FDescription: String;
    FPrinterOrientation: TPrinterOrientation;
    FRepeatFixedRows: Boolean;
    FRepeatFixedColumns: Boolean;
    FPrintCellBackGround: TTMSFMXGridPrintCellBackground;
    FPrintMargins: TBounds;
    FDescriptionFont: TFont;
    FTitleFont: TFont;
    FPageNumberFont: TFont;
    FTitleColor: TAlphaColor;
    FPageNumberColor: TAlphaColor;
    FDescriptionColor: TAlphaColor;
    FDPI: TPoint;
    procedure SetDescriptionFont(const Value: TFont);
    procedure SetPageNumberFont(const Value: TFont);
    procedure SetTitleFont(const Value: TFont);
    procedure SetDescriptionColor(const Value: TAlphaColor);
    procedure SetPageNumberColor(const Value: TAlphaColor);
    procedure SetTitleColor(const Value: TAlphaColor);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
    property DPI: TPoint read FDPI write FDPI;
  published
    property TitleFont: TFont read FTitleFont write SetTitleFont;
    property DescriptionFont: TFont read FDescriptionFont write SetDescriptionFont;
    property PageNumberFont: TFont read FPageNumberFont write SetPageNumberFont;
    property TitleColor: TAlphaColor read FTitleColor write SetTitleColor default TAlphaColorRec.Black;
    property DescriptionColor: TAlphaColor read FDescriptionColor write SetDescriptionColor default TAlphaColorRec.Black;
    property PageNumberColor: TAlphaColor read FPageNumberColor write SetPageNumberColor default TAlphaColorRec.Black;
    property Title: String read FTitle write FTitle;
    property Description: String read FDescription write FDescription;
    property PageNumberPosition: TTMSFMXGridPrintPosition read FPageNumberPosition write FPageNumberPosition default ppBottomCenter;
    property TitlePosition: TTMSFMXGridPrintPosition read FTitlePosition write FTitlePosition default ppTopLeft;
    property DescriptionPosition: TTMSFMXGridPrintPosition read FDescriptionPosition write FDescriptionPosition default ppTopRight;
    property PageNumberFormat: String read FPageNumberFormat write FPageNumberFormat;
    property PrinterOrientation: TPrinterOrientation read FPrinterOrientation write FPrinterOrientation default TPrinterOrientation.poPortrait;
    property RepeatFixedRows: Boolean read FRepeatFixedRows write FRepeatFixedRows default False;
    property RepeatFixedColumns: Boolean read FRepeatFixedColumns write FRepeatFixedColumns default False;
    property PrintCellBackGround: TTMSFMXGridPrintCellBackground read FPrintCellBackGround write FPrintCellBackGround default cbNone;
    property PrintMargins: TBounds read FPrintMargins write FPrintMargins;
  end;

  TTMSFMXGridBandOptions = class(TPersistent)
  private
    FEnabled: Boolean;
    FOnChange: TNotifyEvent;
    FBandRowCount: integer;
    FNormalRowCount: integer;
    FTotalRowCount: integer;
    procedure SetEnabled(const Value: Boolean);
    procedure SetBandRowCount(const Value: integer);
    procedure SetNormalRowCount(const Value: integer);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    procedure Changed; virtual;
    property TotalRowCount: integer read FTotalRowCount;
  published
    property NormalRowCount: integer read FNormalRowCount write SetNormalRowCount default 1;
    property BandRowCount: integer read FBandRowCount write SetBandRowCount default 1;
    property Enabled: Boolean read FEnabled write SetEnabled default False;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  end;

  TTMSFMXGridFixedCellSelectionMode = (fcsAll, fcsRow, fcsColumn, fcsRowRange, fcsColumnRange, fcsDisjunctRow, fcsDisjunctColumn);

  TTMSFMXGridFixedCellSelection = set of TTMSFMXGridFixedCellSelectionMode;

  TTMSFMXGridMouseOptions = class(TPersistent)
  private
    FDirectEdit: boolean;
    FWheelScrollSize: Integer;
    FAutoDragging: Boolean;
    FFixedRowSizing: Boolean;
    FFixedColumnSizing: Boolean;
    FRowDragging: Boolean;
    FColumnDragging: Boolean;
    FAutoScrollingInterval: Integer;
    FRowSizing: Boolean;
    FColumnSizing: Boolean;
    FAutoScrollingSpeed: Integer;
    FAutoScrolling: Boolean;
    FDirectComboDrop: Boolean;
    FTouchScrolling: Boolean;
    FTouchScrollingSensitivity: Single;
    FFixedCellSelection: TTMSFMXGridFixedCellSelection;
    FRowAutoSizeOnDblClick: Boolean;
    FColumnAutoSizeOnDblClick: Boolean;
    FWheelScrollKeepSelection: Boolean;
    procedure SetWheelScrollSize(const Value: Integer);
    procedure SetAutoScrollingInterval(const Value: Integer);
    procedure SetTouchScrolling(const Value: Boolean);
    procedure SetWheelScrollKeepSelection(const Value: Boolean);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
  published
    property DirectEdit: boolean read FDirectEdit write FDirectEdit default false;
    property DirectComboDrop: Boolean read FDirectComboDrop write FDirectComboDrop default false;
    property WheelScrollSize: Integer read FWheelScrollSize write SetWheelScrollSize default 4;
    property WheelScrollKeepSelection: Boolean read FWheelScrollKeepSelection write SetWheelScrollKeepSelection default False;

    property ColumnSizing: Boolean read FColumnSizing write FColumnSizing default False;
    property RowSizing: Boolean read FRowSizing write FRowSizing default False;
    property FixedColumnSizing: Boolean read FFixedColumnSizing write FFixedColumnSizing default False;
    property FixedRowSizing: Boolean read FFixedRowSizing write FFixedRowSizing default False;
    property FixedCellSelection: TTMSFMXGridFixedCellSelection read FFixedCellSelection write FFixedCellSelection default [];

    property ColumnAutoSizeOnDblClick: Boolean read FColumnAutoSizeOnDblClick write FColumnAutoSizeOnDblClick default True;
    property RowAutoSizeOnDblClick: Boolean read FRowAutoSizeOnDblClick write FRowAutoSizeOnDblClick default True;

    property ColumnDragging: Boolean read FColumnDragging write FColumnDragging default False;
    property RowDragging: Boolean read FRowDragging write FRowDragging default False;

    property AutoScrolling: Boolean read FAutoScrolling write FAutoScrolling default True;
    property AutoDragging: Boolean read FAutoDragging write FAutoDragging default True;
    property AutoScrollingSpeed: Integer read FAutoScrollingSpeed write FAutoScrollingSpeed default 1;
    property AutoScrollingInterval: Integer read FAutoScrollingInterval write SetAutoScrollingInterval default 100;

    property TouchScrolling: Boolean read FTouchScrolling write SetTouchScrolling default False;
    property TouchScrollingSensitivity: Single read FTouchScrollingSensitivity write FTouchScrollingSensitivity;
  end;

  TTMSFMXGridInsertKeyHandling = (ikhNone, ikhInsertRowBefore, ikhInsertRowAfter);

  TTMSFMXGridEnterKeyHandling = (ekhNone, ekhNextColumn, ekhNextRow, ekhNextColumnInRow, ekhNextRowInColumn,
    ekhNextColumnAndAppend, ekhNextRowAndAppend, ekhNextRowAndColumnAppend, ekhNextColumnAndRowAppend);

  TTMSFMXGridDeleteKeyHandling = (dkhNone, dkhDeleteRow);

  TTMSFMXGridKeyboardOptions = class(TPersistent)
  private
    FTabKeyDirection: TTMSFMXGridTabKeyDirection;
    FTabKeyHandling: TTMSFMXGridTabKeyHandling;
    FPageScrollSize: Integer;
    FEnterKeyHandling: TTMSFMXGridEnterKeyHandling;
    FEnterKeyDirectEdit: Boolean;
    FDeleteKeyHandling: TTMSFMXGridDeleteKeyHandling;
    FInsertKeyHandling: TTMSFMXGridInsertKeyHandling;
    FTabKeyDirectEdit: Boolean;
    FArrowKeyDirectEdit: Boolean;
    FAllowCellMergeShortCut: boolean;
    procedure SetPageScrollSize(const Value: Integer);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
  published
    property AllowCellMergeShortCut: boolean read FAllowCellMergeShortCut write FAllowCellMergeShortCut default False;
    property TabKeyDirectEdit: Boolean read FTabKeyDirectEdit write FTabKeyDirectEdit default False;
    property ArrowKeyDirectEdit: Boolean read FArrowKeyDirectEdit write FArrowKeyDirectEdit default False;
    property InsertKeyHandling: TTMSFMXGridInsertKeyHandling read FInsertKeyHandling write FInsertKeyHandling default ikhInsertRowAfter;
    property DeleteKeyHandling: TTMSFMXGridDeleteKeyHandling read FDeleteKeyHandling write FDeleteKeyHandling default dkhDeleteRow;
    property EnterKeyHandling: TTMSFMXGridEnterKeyHandling read FEnterKeyHandling write FEnterKeyHandling default ekhNone;
    property EnterKeyDirectEdit: Boolean read FEnterKeyDirectEdit write FEnterKeyDirectEdit default False;
    property TabKeyHandling: TTMSFMXGridTabKeyHandling read FTabKeyHandling write FTabKeyHandling default tkhMixed;
    property TabKeyDirection: TTMSFMXGridTabKeyDirection read FTabKeyDirection write FTabKeyDirection default tkdNextColumnCell;
    property PageScrollSize: Integer read FPageScrollSize write SetPageScrollSize default 0;
  end;

  TTMSFMXGridSortBlankPosition = (blFirst,blLast);

  TTMSFMXGridSortingMode = (gsmNone, gsmNormal, gsmIndexed);

  TTMSFMXGridSortColumns = (scAll, scNormal, scSingle);

  TTMSFMXGridBorders = (bNone, bAll, bVertical, bHorizontal);

  TTMSFMXGridSortingOptions = class(TPersistent)
  private
    FMode: TTMSFMXGridSortingMode;
    FFixedColumns: boolean;
    FColumns: TTMSFMXGridSortColumns;
    FMultiColumn: boolean;
    FIgnoreCase: boolean;
    FIgnoreBlanks: boolean;
    FBlankPosition: TTMSFMXGridSortBlankPosition;
    procedure SetMode(const Value: TTMSFMXGridSortingMode);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
  published
    property BlankPosition: TTMSFMXGridSortBlankPosition read FBlankPosition write FBlankPosition default blFirst;
    property FixedColumns: boolean read FFixedColumns write FFixedColumns default false;
    property IgnoreCase: boolean read FIgnoreCase write FIgnoreCase default false;
    property IgnoreBlanks: boolean read FIgnoreBlanks write FIgnoreBlanks default false;
    property MultiColumn: boolean read FMultiColumn write FMultiColumn default true;
    property Mode: TTMSFMXGridSortingMode read FMode write SetMode default gsmNone;
    property Columns: TTMSFMXGridSortColumns read FColumns write FColumns default scAll;
  end;

  TTMSFMXGridBorderOptions = class(TPersistent)
  private
    FFixedCellBorders: TTMSFMXGridBorders;
    FCellBorders: TTMSFMXGridBorders;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
  published
    property FixedCellBorders: TTMSFMXGridBorders read FFixedCellBorders write FFixedCellBorders default bAll;
    property CellBorders: TTMSFMXGridBorders read FCellBorders write FCellBorders default bAll;
  end;

  TTMSFMXGridAutoComplete = (acDisabled, acNormal, acLookupList);

  TTMSFMXGridAutoPost = (apNone, apCell, apRow);

  TTMSFMXGridEditingOptions = class(TPersistent)
  private
    FEnabled: Boolean;
    FAutoComplete: TTMSFMXGridAutoComplete;
    FAutoCompleteItems: TStringList;
    FAutoHistory: boolean;
    FAutoCompleteCaseSensitive: boolean;
    FCalcFormat: string;
    FAutoPost: TTMSFMXGridAutoPost;
    FAutoCancel: Boolean;
    procedure SetAutoCompleteItems(const Value: TStringList);
    procedure SetAutoPost(const Value: TTMSFMXGridAutoPost);
    procedure SetAutoCancel(const Value: Boolean);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
    destructor Destroy; override;
  published
    property Enabled: Boolean read FEnabled write FEnabled default True;
    property AutoCompleteItems: TStringList read FAutoCompleteItems write SetAutoCompleteItems;
    property AutoComplete: TTMSFMXGridAutoComplete read FAutoComplete write FAutoComplete default acDisabled;
    property AutoHistory: boolean read FAutoHistory write FAutoHistory default false;
    property AutoCompleteCaseSensitive: boolean read FAutoCompleteCaseSensitive write FAutoCompleteCaseSensitive default true;
    property CalcFormat: string read FCalcFormat write FCalcFormat;
    property AutoPost: TTMSFMXGridAutoPost read FAutoPost write SetAutoPost default apNone;
    property AutoCancel: Boolean read FAutoCancel write SetAutoCancel default False;
  end;

  TTMSFMXGridLookupOptions = class(TPersistent)
  private
    FCaseSensitive: boolean;
    FIncremental: boolean;
    FEnabled: boolean;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create;
  published
    property CaseSensitive: boolean read FCaseSensitive write FCaseSensitive default false;
    property Enabled: boolean read FEnabled write FEnabled default false;
    property Incremental: boolean read FIncremental write FIncremental default true;
  end;

  TTMSFMXGridFilterRows = (frNormal, frAll);

  TTMSFMXGridFilteringOptions = class(TPersistent)
  private
    FRows: TTMSFMXGridFilterRows;
    FDropDownFixedRow: integer;
    FDropDown: boolean;
    FOnChange: TNotifyEvent;
    FDropDownHeight: integer;
    FDropDownWidth: integer;
    FMultiColumn: boolean;
    procedure SetDropDown(const Value: boolean);
    procedure SetDropDownFixedRow(const Value: integer);
  public
    constructor Create;
    procedure Assign(Source : TPersistent); override;
    procedure Changed;
  published
    property Rows: TTMSFMXGridFilterRows read FRows write FRows default frNormal;
    property DropDown: boolean read FDropDown write SetDropDown default false;
    property DropDownFixedRow: integer read FDropDownFixedRow write SetDropDownFixedRow default 0;
    property DropDownWidth: integer read FDropDownWidth write FDropDownWidth default 100;
    property DropDownHeight: integer read FDropDownHeight write FDropDownHeight default 120;
    property MultiColumn: boolean read FMultiColumn write FMultiColumn default false;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  end;

  TTMSFMXGridGroupingOptions = class(TPersistent)
  private
    FMergeHeader: Boolean;
    FMergeSummary: Boolean;
    FSummary: Boolean;
    FShowGroupCount: boolean;
    FCalcFormat: string;
    FAutoSelectGroup: boolean;
    FAutoCheckGroup: boolean;
    FGroupCountFormat: string;
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property AutoSelectGroup: boolean read FAutoSelectGroup write FAutoSelectGroup default False;
    property AutoCheckGroup: boolean read FAutoCheckGroup write FAutoCheckGroup default False;
    property CalcFormat: string read FCalcFormat write FCalcFormat;
    property MergeHeader: Boolean read FMergeHeader write FMergeHeader default false;
    property MergeSummary: Boolean read FMergeSummary write FMergeSummary default false;
    property ShowGroupCount: Boolean read FShowGroupCount write FShowGroupCount default false;
    property GroupCountFormat: string read FGroupCountFormat write FGroupCountFormat;
    property Summary: Boolean read FSummary write FSummary default false;
  end;

  TTMSFMXGridClipboardPasteAction = (paReplace, paInsert);

  TTMSFMXGridClipboardOptions = class(TPersistent)
  private
    FEnabled: boolean;
    FIgnoreReadOnly: boolean;
    FAllowColGrow: boolean;
    FAllowRowGrow: boolean;
    FPasteAction: TTMSFMXGridClipboardPasteAction;
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property Enabled: boolean read FEnabled write FEnabled default true;
    property IgnoreReadOnly: boolean read FIgnoreReadOnly write FIgnoreReadOnly default false;
    property AllowColGrow: boolean read FAllowColGrow write FAllowColGrow default false;
    property AllowRowGrow: boolean read FAllowRowGrow write FAllowRowGrow default false;
    property PasteAction: TTMSFMXGridClipboardPasteAction read FPasteAction write FPasteAction default paReplace;
  end;

  TTMSFMXGridHTMLExportOptions = class(TPersistent)
  private
    FHeaderFile: string;
    FFooterFile: string;
    FShow: boolean;
    FConvertSpecialChars: Boolean;
    FWidth: integer;
    FNonBreakingText: Boolean;
    FBorderSize: integer;
    FCellPadding: Integer;
    FPrefixTag: string;
    FSuffixTag: string;
    FSaveFonts: Boolean;
    FExportImages: boolean;
    FCellSpacing: Integer;
    FSummary: string;
    FSaveColors: Boolean;
    FXHTML: boolean;
    FTableStyle: string;
    FColumnWidths: TIntList;
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    property ColumnWidths: TIntList read FColumnWidths write FColumnWidths;
  published
    property BorderSize: integer read FBorderSize write FBorderSize default 1;
    property CellSpacing: Integer read FCellSpacing write FCellSpacing default 0;
    property CellPadding: Integer read FCellPadding write FCellPadding default 0;
    property ConvertSpecialChars: Boolean read FConvertSpecialChars write FConvertSpecialChars default False;
    property ExportImages: boolean read FExportImages write FExportImages default True;
    property FooterFile: string read FFooterFile write FFooterFile;
    property HeaderFile: string read FHeaderFile write FHeaderFile;
    property NonBreakingText: Boolean read FNonBreakingText write FNonBreakingText default False;
    property PrefixTag: string read FPrefixTag write FPrefixTag;
    property SaveColors: Boolean read FSaveColors write FSaveColors default True;
    property SaveFonts: Boolean read FSaveFonts write FSaveFonts default True;
    property SuffixTag: string read FSuffixTag write FSuffixTag;
    property Show: boolean read FShow write FShow default false;
    property Summary: string read FSummary write FSummary;
    property TableStyle: string read FTableStyle write FTableStyle;
    property Width: integer read FWidth write FWidth default 100;
    property XHTML: boolean read FXHTML write FXHTML default false;
  end;

  TTMSFMXGridURLOptions = class(TPersistent)
  private
    FUnderline: boolean;
    FColor: TAlphaColor;
    FShow: boolean;
    FOnChange: TNotifyEvent;
    FFull: boolean;
    FOpen: boolean;
    procedure SetColor(const Value: TAlphaColor);
    procedure SetUnderline(const Value: boolean);
    procedure SetFull(const Value: boolean);
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
    procedure Changed; virtual;
  published
    property Color: TAlphaColor read FColor write SetColor default claBlue;
    property Full: boolean read FFull write SetFull default true;
    property Open: boolean read FOpen write FOpen default true;
    property Show: boolean read FShow write FShow default true;
    property Underline: boolean read FUnderline write SetUnderline default true;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  end;

  TTMSFMXGridIOOptions = class(TPersistent)
  private
    FDelimiter: char;
    FQuoteEmptyCells: boolean;
    FXMLEncoding: string;
    FAlwaysQuotes: boolean;
    FSaveVirtualCellData: Boolean;
  public
    constructor Create;
    procedure Assign(Source: TPersistent); override;
  published
    property AlwaysQuotes: boolean read FAlwaysQuotes write FAlwaysQuotes default false;
    property Delimiter: char read FDelimiter write FDelimiter default #0;
    property QuoteEmptyCells: boolean read FQuoteEmptyCells write FQuoteEmptyCells default true;
    property XMLEncoding: string read FXMLEncoding write FXMLEncoding;
    property SaveVirtualCellData: Boolean read FSaveVirtualCellData write FSaveVirtualCellData default False;
  end;

  TTMSFMXGridOptions = class(TPersistent)
  private
    FMouse: TTMSFMXGridMouseOptions;
    FKeyboard: TTMSFMXGridKeyboardOptions;
    FSorting: TTMSFMXGridSortingOptions;
    FGrouping: TTMSFMXGridGroupingOptions;
    FFiltering: TTMSFMXGridFilteringOptions;
    FEditing: TTMSFMXGridEditingOptions;
    FPrinting: TTMSFMXGridPrintingOptions;
    FBorders: TTMSFMXGridBorderOptions;
    FLookup: TTMSFMXGridLookupOptions;
    FClipboard: TTMSFMXGridClipboardOptions;
    FHTMLExport: TTMSFMXGridHTMLExportOptions;
    FHeader: TTMSFMXGridHeaderOptions;
    FFooter: TTMSFMXGridFooterOptions;
    FBands: TTMSFMXGridBandOptions;
    FOnChange: TNotifyEvent;
    FURL: TTMSFMXGridURLOptions;
    FScrollBar: TTMSFMXGridScrollBarOptions;
    FIO: TTMSFMXGridIOOptions;
    procedure SetKeyboard(const Value: TTMSFMXGridKeyboardOptions);
    procedure SetMouse(const Value: TTMSFMXGridMouseOptions);
    procedure SetGrouping(const Value: TTMSFMXGridGroupingOptions);
    procedure SetSorting(const Value: TTMSFMXGridSortingOptions);
    procedure SetFiltering(const Value: TTMSFMXGridFilteringOptions);
    procedure SetEditing(const Value: TTMSFMXGridEditingOptions);
    procedure SetPrinting(const Value: TTMSFMXGridPrintingOptions);
    procedure SetBorders(const Value: TTMSFMXGridBorderOptions);
    procedure SetLookup(const Value: TTMSFMXGridLookupOptions);
    procedure SetClipboard(const Value: TTMSFMXGridClipboardOptions);
    procedure SetHTMLExport(const Value: TTMSFMXGridHTMLExportOptions);
    procedure SetFooter(const Value: TTMSFMXGridFooterOptions);
    procedure SetHeader(const Value: TTMSFMXGridHeaderOptions);
    procedure SetBands(const Value: TTMSFMXGridBandOptions);
    procedure SetURL(const Value: TTMSFMXGridURLOptions);
    procedure SetScrollBar(const Value: TTMSFMXGridScrollBarOptions);
    procedure SetIO(const Value: TTMSFMXGridIOOptions);
  public
    procedure DoChange(Sender: TObject);
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    property OnChange: TNotifyEvent read FOnChange write FOnChange;
  published
    property Bands: TTMSFMXGridBandOptions read FBands write SetBands;
    property Borders: TTMSFMXGridBorderOptions read FBorders write SetBorders;
    property Clipboard: TTMSFMXGridClipboardOptions read FClipboard write SetClipboard;
    property Editing: TTMSFMXGridEditingOptions read FEditing write SetEditing;
    property Filtering: TTMSFMXGridFilteringOptions read FFiltering write SetFiltering;
    property Footer: TTMSFMXGridFooterOptions read FFooter write SetFooter;
    property Grouping: TTMSFMXGridGroupingOptions read FGrouping write SetGrouping;
    property Header: TTMSFMXGridHeaderOptions read FHeader write SetHeader;
    property HTMLExport: TTMSFMXGridHTMLExportOptions read FHTMLExport write SetHTMLExport;
    property IO: TTMSFMXGridIOOptions read FIO write SetIO;
    property Keyboard: TTMSFMXGridKeyboardOptions read FKeyboard write SetKeyboard;
    property Lookup: TTMSFMXGridLookupOptions read FLookup write SetLookup;
    property Mouse: TTMSFMXGridMouseOptions read FMouse write SetMouse;
    property Printing: TTMSFMXGridPrintingOptions read FPrinting write SetPrinting;
    property Sorting: TTMSFMXGridSortingOptions read FSorting write SetSorting;
    property URL: TTMSFMXGridURLOptions read FURL write SetURL;
    property ScrollBar: TTMSFMXGridScrollBarOptions read FScrollBar write SetScrollBar;
  end;


implementation

{ TTMSFMXGridGroupingOptions }

procedure TTMSFMXGridGroupingOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridGroupingOptions) then
  begin
    FCalcFormat := (Source as TTMSFMXGridGroupingOptions).CalcFormat;
    FMergeHeader := (Source as TTMSFMXGridGroupingOptions).MergeHeader;
    FMergeSummary := (Source as TTMSFMXGridGroupingOptions).MergeSummary;
    FShowGroupCount := (Source as TTMSFMXGridGroupingOptions).ShowGroupCount;
    FAutoCheckGroup := (Source as TTMSFMXGridGroupingOptions).AutoCheckGroup;
    FAutoSelectGroup := (Source as TTMSFMXGridGroupingOptions).AutoSelectGroup;
    FGroupCountFormat := (Source as TTMSFMXGridGroupingOptions).GroupCountFormat;
  end;
end;

constructor TTMSFMXGridGroupingOptions.Create;
begin
  inherited Create;
  FCalcFormat := '%g';
  FGroupCountFormat := '(%d)';
end;

{ TTMSFMXGridOptions }

procedure TTMSFMXGridOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridOptions) then
  begin
    FMouse.Assign((Source as TTMSFMXGridOptions).Mouse);
    FKeyboard.Assign((Source as TTMSFMXGridOptions).Keyboard);
    FFiltering.Assign((Source as TTMSFMXGridOptions).Filtering);
    FSorting.Assign((Source as TTMSFMXGridOptions).Sorting);
    FGrouping.Assign((Source as TTMSFMXGridOptions).Grouping);
    FEditing.Assign((Source as TTMSFMXGridOptions).Editing);
    FPrinting.Assign((Source as TTMSFMXGridOptions).Printing);
    FBorders.Assign((Source as TTMSFMXGridOptions).Borders);
    FLookup.Assign((Source as TTMSFMXGridOptions).Lookup);
    FClipboard.Assign((Source as TTMSFMXGridOptions).Clipboard);
    FHeader.Assign((Source as TTMSFMXGridOptions).Header);
    FFooter.Assign((Source as TTMSFMXGridOptions).Footer);
    FBands.Assign((Source as TTMSFMXGridOptions).Bands);
    FHTMLExport.Assign((Source as TTMSFMXGridOptions).HTMLExport);
    FURL.Assign((Source as TTMSFMXGridOptions).URL);
    FScrollBar.Assign((Source as TTMSFMXGridOptions).ScrollBar);
    FIO.Assign((Source as TTMSFMXGridOptions).IO);
  end;
end;

constructor TTMSFMXGridOptions.Create;
begin
  inherited;
  FScrollBar := TTMSFMXGridScrollBarOptions.Create;
  FScrollBar.OnChange := DoChange;
  FMouse := TTMSFMXGridMouseOptions.Create;
  FKeyboard := TTMSFMXGridKeyboardOptions.Create;
  FSorting := TTMSFMXGridSortingOptions.Create;
  FGrouping := TTMSFMXGridGroupingOptions.Create;
  FFiltering := TTMSFMXGridFilteringOptions.Create;
  FFiltering.OnChange := DoChange;
  FEditing := TTMSFMXGridEditingOptions.Create;
  FPrinting := TTMSFMXGridPrintingOptions.Create;
  FBorders := TTMSFMXGridBorderOptions.Create;
  FLookup := TTMSFMXGridLookupOptions.Create;
  FClipboard := TTMSFMXGridClipboardOptions.Create;
  FHTMLExport := TTMSFMXGridHTMLExportOptions.Create;
  FIO := TTMSFMXGridIOOptions.Create;
  FHeader := TTMSFMXGridHeaderOptions.Create;
  FHeader.OnChange := DoChange;
  FFooter := TTMSFMXGridFooterOptions.Create;
  FFooter.OnChange := DoChange;
  FBands := TTMSFMXGridBandOptions.Create;
  FBands.OnChange := DoChange;
  FURL := TTMSFMXGridURLOptions.Create;
  FURL.OnChange := DoChange;
end;

destructor TTMSFMXGridOptions.Destroy;
begin
  FScrollBar.Free;
  FBands.Free;
  FFooter.Free;
  FHeader.Free;
  FBorders.Free;
  FPrinting.Free;
  FEditing.Free;
  FMouse.Free;
  FKeyboard.Free;
  FSorting.Free;
  FGrouping.Free;
  FFiltering.Free;
  FLookup.Free;
  FClipboard.Free;
  FHTMLExport.Free;
  FURL.Free;
  FIO.Free;
  inherited;
end;

procedure TTMSFMXGridOptions.DoChange(Sender: TObject);
begin
  if Assigned(OnChange) then
    OnChange(Self);
end;

procedure TTMSFMXGridOptions.SetBands(const Value: TTMSFMXGridBandOptions);
begin
  FBands.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetBorders(const Value: TTMSFMXGridBorderOptions);
begin
  FBorders.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetClipboard(
  const Value: TTMSFMXGridClipboardOptions);
begin
  FClipboard.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetEditing(const Value: TTMSFMXGridEditingOptions);
begin
  FEditing.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetFiltering(
  const Value: TTMSFMXGridFilteringOptions);
begin
  FFiltering.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetFooter(const Value: TTMSFMXGridFooterOptions);
begin
  FFooter.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetGrouping(
  const Value: TTMSFMXGridGroupingOptions);
begin
  FGrouping.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetHTMLExport(
  const Value: TTMSFMXGridHTMLExportOptions);
begin
  FHTMLExport.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetIO(const Value: TTMSFMXGridIOOptions);
begin
  FIO.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetHeader(const Value: TTMSFMXGridHeaderOptions);
begin
  FHeader.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetKeyboard(
  const Value: TTMSFMXGridKeyboardOptions);
begin
  FKeyboard.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetLookup(const Value: TTMSFMXGridLookupOptions);
begin
  FLookup.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetMouse(const Value: TTMSFMXGridMouseOptions);
begin
  FMouse.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetPrinting(
  const Value: TTMSFMXGridPrintingOptions);
begin
  FPrinting.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetScrollBar(
  const Value: TTMSFMXGridScrollBarOptions);
begin
  FScrollBar.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetSorting(const Value: TTMSFMXGridSortingOptions);
begin
  FSorting.Assign(Value);
end;

procedure TTMSFMXGridOptions.SetURL(const Value: TTMSFMXGridURLOptions);
begin
  FURL.Assign(Value);
end;

{ TTMSFMXGridMouseOptions }

procedure TTMSFMXGridMouseOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridMouseOptions) then
  begin
    FDirectEdit := (Source as TTMSFMXGridMouseOptions).DirectEdit;
    FWheelScrollSize := (Source as TTMSFMXGridMouseOptions).WheelScrollSize;
    FColumnSizing := (Source as TTMSFMXGridMouseOptions).ColumnSizing;
    FRowSizing := (Source as TTMSFMXGridMouseOptions).RowSizing;
    FFixedColumnSizing := (Source as TTMSFMXGridMouseOptions).FixedColumnSizing;
    FFixedRowSizing := (Source as TTMSFMXGridMouseOptions).FixedRowSizing;
    FColumnDragging := (Source as TTMSFMXGridMouseOptions).ColumnDragging;
    FRowDragging := (Source as TTMSFMXGridMouseOptions).RowDragging;
    FAutoScrolling := (Source as TTMSFMXGridMouseOptions).AutoScrolling;
    FAutoDragging := (Source as TTMSFMXGridMouseOptions).AutoDragging;
    FAutoScrollingSpeed := (Source as TTMSFMXGridMouseOptions).AutoScrollingSpeed;
    FAutoScrollingInterval := (Source as TTMSFMXGridMouseOptions).AutoScrollingInterval;
    FDirectComboDrop := (Source as TTMSFMXGridMouseOptions).DirectComboDrop;
    FTouchScrolling := (Source as TTMSFMXGridMouseOptions).TouchScrolling;
    FTouchScrollingSensitivity := (Source as TTMSFMXGridMouseOptions).TouchScrollingSensitivity;
    FFixedCellSelection := (Source as TTMSFMXGridMouseOptions).FixedCellSelection;
    FRowAutoSizeOnDblClick := (Source as TTMSFMXGridMouseOptions).RowAutoSizeOnDblClick;
    FColumnAutoSizeOnDblClick := (Source as TTMSFMXGridMouseOptions).ColumnAutoSizeOnDblClick;
    FWheelScrollKeepSelection := (Source as TTMSFMXGridMouseOptions).WheelScrollKeepSelection;
  end;
end;

constructor TTMSFMXGridMouseOptions.Create;
begin
  FTouchScrollingSensitivity := 0.1;
  FTouchScrolling := False;
  FDirectEdit := False;
  FDirectComboDrop := False;
  FWheelScrollSize := 4;
  FColumnSizing := False;
  FRowSizing := False;
  FFixedColumnSizing := False;
  FFixedRowSizing := False;
  FColumnDragging := False;
  FRowDragging := False;
  FAutoScrolling := True;
  FAutoDragging := True;
  FAutoScrollingSpeed := 1;
  FAutoScrollingInterval := 100;
  FFixedCellSelection := [];
  FRowAutoSizeOnDblClick := True;
  FColumnAutoSizeOnDblClick := True;
  FWheelScrollKeepSelection := False;
end;

procedure TTMSFMXGridMouseOptions.SetAutoScrollingInterval(
  const Value: Integer);
begin
  FAutoScrollingInterval := Value;
end;

procedure TTMSFMXGridMouseOptions.SetTouchScrolling(const Value: Boolean);
begin
  FTouchScrolling := Value;
end;

procedure TTMSFMXGridMouseOptions.SetWheelScrollKeepSelection(
  const Value: Boolean);
begin
  FWheelScrollKeepSelection := Value;
end;

procedure TTMSFMXGridMouseOptions.SetWheelScrollSize(const Value: Integer);
begin
  FWheelScrollSize := Value;
end;

{ TTMSFMXGridKeyboardOptions }

procedure TTMSFMXGridKeyboardOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridKeyboardOptions) then
  begin
    FTabKeyDirection := (Source as TTMSFMXGridKeyboardOptions).TabKeyDirection;
    FTabKeyHandling := (Source as TTMSFMXGridKeyboardOptions).TabKeyHandling;
    FEnterKeyHandling := (Source as TTMSFMXGridKeyboardOptions).EnterKeyHandling;
    FDeleteKeyHandling := (Source as TTMSFMXGridKeyboardOptions).DeleteKeyHandling;
    FInsertKeyHandling := (Source as TTMSFMXGridKeyboardOptions).InsertKeyHandling;
    FEnterKeyDirectEdit := (Source as TTMSFMXGridKeyboardOptions).EnterKeyDirectEdit;
    FTabKeyDirectEdit := (Source as TTMSFMXGridKeyboardOptions).TabKeyDirectEdit;
    FArrowKeyDirectEdit := (Source as TTMSFMXGridKeyboardOptions).ArrowKeyDirectEdit;
    FAllowCellMergeShortCut := (Source as TTMSFMXGridKeyboardOptions).AllowCellMergeShortCut;
  end;
end;

constructor TTMSFMXGridKeyboardOptions.Create;
begin
  FTabKeyDirection := tkdNextColumnCell;
  FTabKeyHandling := tkhMixed;
  FPageScrollSize := 0;
  FEnterKeyHandling := ekhNone;
  FDeleteKeyHandling := dkhDeleteRow;
  FInsertKeyHandling := ikhInsertRowAfter;
  FEnterKeyDirectEdit := False;
  FArrowKeyDirectEdit := False;
  FTabKeyDirectEdit := False;
  FAllowCellMergeShortCut := False;
end;

procedure TTMSFMXGridKeyboardOptions.SetPageScrollSize(const Value: Integer);
begin
  FPageScrollSize := Value;
end;

{ TTMSFMXGridSortingOptions }

procedure TTMSFMXGridSortingOptions.Assign(Source: TPersistent);
begin
  if Source is TTMSFMXGridSortingOptions then
  begin
    FMultiColumn := (Source as TTMSFMXGridSortingOptions).MultiColumn;
    FMode := (Source as TTMSFMXGridSortingOptions).Mode;
    FColumns := (Source as TTMSFMXGridSortingOptions).Columns;
    FFixedColumns := (Source as TTMSFMXGridSortingOptions).FixedColumns;
    FBlankPosition := (Source as TTMSFMXGridSortingOptions).BlankPosition;
    FIgnoreCase := (Source as TTMSFMXGridSortingOptions).IgnoreCase;
    FIgnoreBlanks := (Source as TTMSFMXGridSortingOptions).IgnoreBlanks;
  end;
end;

constructor TTMSFMXGridSortingOptions.Create;
begin
  inherited Create;
  FMode := gsmNone;
  FMultiColumn := true;
end;

procedure TTMSFMXGridSortingOptions.SetMode(
  const Value: TTMSFMXGridSortingMode);
begin
  FMode := Value;
end;

{ TTMSFMXGridEditingOptions }

procedure TTMSFMXGridEditingOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridEditingOptions) then
  begin
    FEnabled := (Source as TTMSFMXGridEditingOptions).Enabled;
    FAutoComplete := (Source as TTMSFMXGridEditingOptions).AutoComplete;
    FAutoCompleteItems.Assign((Source as TTMSFMXGridEditingOptions).AutoCompleteItems);
    FAutoHistory := (Source as TTMSFMXGridEditingOptions).AutoHistory;
    FAutoCompleteCaseSensitive := (Source as TTMSFMXGridEditingOptions).AutoCompleteCaseSensitive;
    FCalcFormat := (Source as TTMSFMXGridEditingOptions).CalcFormat;
    FAutoPost := (Source as TTMSFMXGridEditingOptions).AutoPost;
    FAutoCancel := (Source as TTMSFMXGridEditingOptions).AutoCancel;
  end;
end;

constructor TTMSFMXGridEditingOptions.Create;
begin
  inherited Create;
  FEnabled := True;
  FAutoCompleteItems := TStringList.Create;
  FAutoCompleteItems.Duplicates := dupIgnore;
  FAutoComplete := acDisabled;
  FAutoHistory := false;
  FAutoCompleteCaseSensitive := true;
  FCalcFormat := '%g';
  FAutoPost := apNone;
  FAutoCancel := False;
end;


destructor TTMSFMXGridEditingOptions.Destroy;
begin
  FAutoCompleteItems.Free;
  inherited;
end;

procedure TTMSFMXGridEditingOptions.SetAutoCompleteItems(
  const Value: TStringList);
begin
  FAutoCompleteItems.Assign(Value);
end;

procedure TTMSFMXGridEditingOptions.SetAutoCancel(const Value: Boolean);
begin
  FAutoCancel := Value;
end;

procedure TTMSFMXGridEditingOptions.SetAutoPost(
  const Value: TTMSFMXGridAutoPost);
begin
  FAutoPost := Value;
end;

{ TTMSFMXGridPrintingOptions }

procedure TTMSFMXGridPrintingOptions.Assign(Source: TPersistent);
begin
  if Source is TTMSFMXGridPrintingOptions then
  begin
    FTitle := (Source as TTMSFMXGridPrintingOptions).Title;
    FDescription := (Source as TTMSFMXGridPrintingOptions).Description;
    FPageNumberPosition := (Source as TTMSFMXGridPrintingOptions).PageNumberPosition;
    FTitlePosition := (Source as TTMSFMXGridPrintingOptions).TitlePosition;
    FDescriptionPosition := (Source as TTMSFMXGridPrintingOptions).DescriptionPosition;
    FPageNumberFormat := (Source as TTMSFMXGridPrintingOptions).PageNumberFormat;
    FPrinterOrientation := (Source as TTMSFMXGridPrintingOptions).PrinterOrientation;
    FRepeatFixedRows := (Source as TTMSFMXGridPrintingOptions).RepeatFixedRows;
    FRepeatFixedColumns := (Source as TTMSFMXGridPrintingOptions).RepeatFixedColumns;
    FPageNumberFont.Assign((Source as TTMSFMXGridPrintingOptions).PageNumberFont);
    FTitleFont.Assign((Source as TTMSFMXGridPrintingOptions).TitleFont);
    FDescriptionFont.Assign((Source as TTMSFMXGridPrintingOptions).DescriptionFont);
  end;
end;

constructor TTMSFMXGridPrintingOptions.Create;
begin
  FDPI.X := -1;
  FDPI.Y := -1;
  FTitleFont := TFont.Create;
  FPageNumberFont := TFont.Create;
  FDescriptionFont := TFont.Create;
  FPrintMargins := TBounds.Create(RectF(30, 30, 30, 30));
  FPrintCellBackGround := cbNone;
  FTitle := '';
  FDescription := '';
  FPageNumberPosition := ppBottomCenter;
  FTitlePosition := ppTopLeft;
  FDescriptionPosition := ppTopRight;
  FPageNumberFormat := '%g';
  FPrinterOrientation := TPrinterOrientation.poPortrait;
  FRepeatFixedRows := False;
  FRepeatFixedColumns := False;
  FDescriptionColor := TAlphaColorRec.Black;
  FTitleColor := TAlphaColorRec.Black;
  FPageNumberColor := TAlphaColorRec.Black;
end;

destructor TTMSFMXGridPrintingOptions.Destroy;
begin
  FPageNumberFont.Free;
  FTitleFont.Free;
  FDescriptionFont.Free;
  FPrintMargins.Free;
  inherited;
end;

procedure TTMSFMXGridPrintingOptions.SetDescriptionColor(
  const Value: TAlphaColor);
begin
  FDescriptionColor := Value;
end;

procedure TTMSFMXGridPrintingOptions.SetDescriptionFont(const Value: TFont);
begin
  if FDescriptionFont <> Value then
    FDescriptionFont.Assign(Value);
end;

procedure TTMSFMXGridPrintingOptions.SetPageNumberColor(
  const Value: TAlphaColor);
begin
  FPageNumberColor := Value;
end;

procedure TTMSFMXGridPrintingOptions.SetPageNumberFont(const Value: TFont);
begin
  if FPageNumberFont <> Value then
    FPageNumberFont.Assign(Value);
end;

procedure TTMSFMXGridPrintingOptions.SetTitleColor(const Value: TAlphaColor);
begin
  FTitleColor := Value;
end;

procedure TTMSFMXGridPrintingOptions.SetTitleFont(const Value: TFont);
begin
  if FTitleFont <> Value then
    FTitleFont.Assign(Value);
end;

{ TTMSFMXGridBorderOptions }

procedure TTMSFMXGridBorderOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridBorderOptions) then
  begin
    FFixedCellBorders := (Source as TTMSFMXGridBorderOptions).FixedCellBorders;
    FCellBorders := (Source as TTMSFMXGridBorderOptions).CellBorders;
  end;
end;

constructor TTMSFMXGridBorderOptions.Create;
begin
  FFixedCellBorders := bAll;
  FCellBorders := bAll;
end;

{ TTMSFMXGridLookupOptions }

procedure TTMSFMXGridLookupOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridLookupOptions) then
  begin
    FCaseSensitive := (Source as TTMSFMXGridLookupOptions).CaseSensitive;
    FIncremental := (Source as TTMSFMXGridLookupOptions).Incremental;
    FEnabled := (Source as TTMSFMXGridLookupOptions).Enabled;
  end;
end;

constructor TTMSFMXGridLookupOptions.Create;
begin
  inherited;
  FCaseSensitive := false;
  FIncremental := true;
end;

{ TTMSFMXGridClipboardOptions }

procedure TTMSFMXGridClipboardOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridClipboardOptions) then
  begin
    FEnabled := (Source as TTMSFMXGridClipboardOptions).Enabled;
    FIgnoreReadOnly := (Source as TTMSFMXGridClipboardOptions).IgnoreReadOnly;
    FAllowColGrow := (Source as TTMSFMXGridClipboardOptions).AllowColGrow;
    FAllowRowGrow := (Source as TTMSFMXGridClipboardOptions).AllowRowGrow;
    FPasteAction := (Source as TTMSFMXGridClipboardOptions).PasteAction;
  end;
end;

constructor TTMSFMXGridClipboardOptions.Create;
begin
  inherited;
  FEnabled := true;
  FIgnoreReadOnly := false;
  FAllowColGrow := false;
  FAllowRowGrow := false;
  FPasteAction := paReplace;
end;

{ TTMSFMXGridHTMLExportOptions }

procedure TTMSFMXGridHTMLExportOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridHTMLExportOptions) then
  begin
    FHeaderFile := (Source as TTMSFMXGridHTMLExportOptions).HeaderFile;
    FFooterFile := (Source as TTMSFMXGridHTMLExportOptions).FooterFile;
    FShow := (Source as TTMSFMXGridHTMLExportOptions).Show;
    FBorderSize := (Source as TTMSFMXGridHTMLExportOptions).BorderSize;
    FCellSpacing := (Source as TTMSFMXGridHTMLExportOptions).CellSpacing;
    FCellPadding := (Source as TTMSFMXGridHTMLExportOptions).CellPadding;
    FConvertSpecialChars := (Source as TTMSFMXGridHTMLExportOptions).ConvertSpecialChars;
    FExportImages := (Source as TTMSFMXGridHTMLExportOptions).ExportImages;
    FNonBreakingText := (Source as TTMSFMXGridHTMLExportOptions).NonBreakingText;
    FPrefixTag := (Source as TTMSFMXGridHTMLExportOptions).PrefixTag;
    FSaveColors := (Source as TTMSFMXGridHTMLExportOptions).SaveColors;
    FSaveFonts := (Source as TTMSFMXGridHTMLExportOptions).SaveFonts;
    FSuffixTag := (Source as TTMSFMXGridHTMLExportOptions).SuffixTag;
    FSummary := (Source as TTMSFMXGridHTMLExportOptions).Summary;
    FTableStyle := (Source as TTMSFMXGridHTMLExportOptions).TableStyle;
    FWidth := (Source as TTMSFMXGridHTMLExportOptions).Width;
    FXHTML := (Source as TTMSFMXGridHTMLExportOptions).XHTML;
  end;
end;

constructor TTMSFMXGridHTMLExportOptions.Create;
begin
  inherited Create;
  FShow := false;
  FSaveColors := True;
  FSaveFonts := True;
  FBorderSize := 1;
  FCellSpacing := 0;
  FCellPadding := 0;
  FWidth := 100;
  FExportImages := True;
  FColumnWidths := TIntList.Create;
end;


destructor TTMSFMXGridHTMLExportOptions.Destroy;
begin
  FColumnWidths.Free;
  inherited;
end;

{ TTMSFMXGridHeaderOptions }

procedure TTMSFMXGridHeaderOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridHeaderOptions) then
  begin
    FVisible := (Source as TTMSFMXGridHeaderOptions).Visible;
  end;
end;

constructor TTMSFMXGridHeaderOptions.Create;
begin
  FVisible := False;
end;

destructor TTMSFMXGridHeaderOptions.Destroy;
begin
  inherited;
end;

procedure TTMSFMXGridHeaderOptions.SetVisible(const Value: Boolean);
begin
  FVisible := Value;
  if Assigned(OnChange) then
    OnChange(Self);
end;

{ TTMSFMXGridFooterOptions }

procedure TTMSFMXGridFooterOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridFooterOptions) then
  begin
    FVisible := (Source as TTMSFMXGridFooterOptions).Visible;
  end;
end;

constructor TTMSFMXGridFooterOptions.Create;
begin
  FVisible := False;
end;

destructor TTMSFMXGridFooterOptions.Destroy;
begin
  inherited;
end;

procedure TTMSFMXGridFooterOptions.SetVisible(const Value: Boolean);
begin
  FVisible := Value;
  if Assigned(OnChange) then
    OnChange(Self);
end;

{ TTMSFMXGridBandOptions }

procedure TTMSFMXGridBandOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridBandOptions) then
  begin
    FEnabled := (Source as TTMSFMXGridBandOptions).Enabled;
  end;
end;

procedure TTMSFMXGridBandOptions.Changed;
begin
  if Assigned(OnChange) then
    OnChange(Self);
end;

constructor TTMSFMXGridBandOptions.Create;
begin
  inherited Create;
  FEnabled := False;
  FNormalRowCount := 1;
  FBandRowCount := 1;
end;

procedure TTMSFMXGridBandOptions.SetBandRowCount(const Value: integer);
begin
  if (Value > 0) and (FBandRowCount <> Value) then
  begin
    FBandRowCount := Value;
    FTotalRowCount := FNormalRowCount + FBandRowCount;
    Changed;
  end;
end;

procedure TTMSFMXGridBandOptions.SetEnabled(const Value: Boolean);
begin
  if (FEnabled <> Value) then
  begin
    FEnabled := Value;
    Changed;
  end;
end;

procedure TTMSFMXGridBandOptions.SetNormalRowCount(const Value: integer);
begin
  if (Value > 0) and (FNormalRowCount <> Value) then
  begin
    FNormalRowCount := Value;
    FTotalRowCount := FNormalRowCount + FBandRowCount;
    Changed;
  end;
end;

{ TTMSFMXGridURLOptions }

procedure TTMSFMXGridURLOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridURLOptions) then
  begin
    FShow := (Source as TTMSFMXGridURLOptions).Show;
    FUnderline := (Source as TTMSFMXGridURLOptions).Underline;
    FColor := (Source as TTMSFMXGridURLOptions).Color;
    FOpen := (Source as TTMSFMXGridURLOptions).Open;
    FFull := (Source as TTMSFMXGridURLOptions).Full;
  end;
end;

procedure TTMSFMXGridURLOptions.Changed;
begin
  if Assigned(OnChange) then
    OnChange(Self);
end;

constructor TTMSFMXGridURLOptions.Create;
begin
  inherited Create;
  FShow := true;
  FColor := claBlue;
  FUnderline := true;
  FFull := true;
  FOpen := True;
end;

procedure TTMSFMXGridURLOptions.SetColor(const Value: TAlphaColor);
begin
  if (FColor <> Value) then
  begin
    FColor := Value;
    Changed;
  end;
end;

procedure TTMSFMXGridURLOptions.SetFull(const Value: boolean);
begin
  if FFull <> Value then
  begin
    FFull := Value;
    Changed;
  end;
end;

procedure TTMSFMXGridURLOptions.SetUnderline(const Value: boolean);
begin
  if (FUnderLine <> Value) then
  begin
    FUnderline := Value;
    Changed;
  end;
end;

{ TTMSFMXGridFilteringOptions }

procedure TTMSFMXGridFilteringOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridFilteringOptions) then
  begin
    FRows := (Source as TTMSFMXGridFilteringOptions).Rows;
    FDropDown := (Source as TTMSFMXGridFilteringOptions).DropDown;
    FDropDownFixedRow := (Source as TTMSFMXGridFilteringOptions).DropDownFixedRow;
    FDropDownWidth := (Source as TTMSFMXGridFilteringOptions).DropDownWidth;
    FDropDownHeight := (Source as TTMSFMXGridFilteringOptions).DropDownHeight;
    FMultiColumn := (Source as TTMSFMXGridFilteringOptions).MultiColumn;
  end;
end;

procedure TTMSFMXGridFilteringOptions.Changed;
begin
  if Assigned(OnChange) then
    OnChange(Self);
end;

constructor TTMSFMXGridFilteringOptions.Create;
begin
  inherited Create;
  FRows := frNormal;
  FDropDown := false;
  FDropDownFixedRow := 0;
  FDropDownWidth := 100;
  FDropDownHeight := 120;
end;

procedure TTMSFMXGridFilteringOptions.SetDropDown(const Value: boolean);
begin
  if (FDropDown <> Value) then
  begin
    FDropDown := Value;
    Changed;
  end;
end;

procedure TTMSFMXGridFilteringOptions.SetDropDownFixedRow(const Value: integer);
begin
  if (FDropDownFixedRow <> Value) then
  begin
    FDropDownFixedRow := Value;
    Changed;
  end;
end;

{ TTMSFMXGridScrollBarOptions }

procedure TTMSFMXGridScrollBarOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridScrollBarOptions) then
  begin
    VerticalScrollBarVisible := (Source as TTMSFMXGridScrollBarOptions).VerticalScrollBarVisible;
    HorizontalScrollBarVisible := (Source as TTMSFMXGridScrollBarOptions).HorizontalScrollBarVisible;
  end;
end;

constructor TTMSFMXGridScrollBarOptions.Create;
begin
  FVerticalScrollBarVisible := True;
  FHorizontalScrollBarVisible := True;
end;

destructor TTMSFMXGridScrollBarOptions.Destroy;
begin
  inherited;
end;

procedure TTMSFMXGridScrollBarOptions.SetHorizontalScrollBarVisible(
  const Value: Boolean);
begin
  if FHorizontalScrollBarVisible <> Value then
  begin
    FHorizontalScrollBarVisible := Value;
    if Assigned(OnChange) then
      OnChange(Self);
  end;
end;

procedure TTMSFMXGridScrollBarOptions.SetVerticalScrollBarVisible(
  const Value: Boolean);
begin
  if FVerticalScrollBarVisible <> Value then
  begin
    FVerticalScrollBarVisible := Value;
    if Assigned(OnChange) then
      OnChange(Self);
  end;
end;

{ TTMSFMXIOOptions }

procedure TTMSFMXGridIOOptions.Assign(Source: TPersistent);
begin
  if (Source is TTMSFMXGridIOOptions) then
  begin
    FAlwaysQuotes := (Source as TTMSFMXGridIOOptions).AlwaysQuotes;
    FDelimiter := (Source as TTMSFMXGridIOOptions).Delimiter;
    FQuoteEmptyCells := (Source as TTMSFMXGridIOOptions).QuoteEmptyCells;
    FXMLEncoding := (Source as TTMSFMXGridIOOptions).XMLEncoding;
    FSaveVirtualCellData := (Source as TTMSFMXGridIOOptions).SaveVirtualCellData;
  end;
end;

constructor TTMSFMXGridIOOptions.Create;
begin
  inherited;
  FDelimiter := #0;
  FQuoteEmptyCells := true;
  FXMLEncoding := 'ISO-8859-1';
  FAlwaysQuotes := false;
  FSaveVirtualCellData := False;
end;

end.
