{ ------------------------------------------------------------- }
{ Purpose : NextGrid 6                                          }
{ By      : Bojan Nikolic                                       }
{ For     : BergSoft                                            }
{ ------------------------------------------------------------- }
{ Copyright (C) BergSoft.net 2021. All Rights Reserved.         }
{ ------------------------------------------------------------- }
{$I '..\NxSuite6.inc'}

unit NxColumns6;

interface

uses
  { Standard }
  Classes, Types, Windows, Graphics, Controls, StdCtrls, Forms,
  ImgList, {$IFDEF UI_TYPES}UITypes,{$ENDIF}
  { Next Standard 6 }
  NxClasses6, NxTypes6, NxIntf6, NxEdit6, NxPopupCtrls6, NxConsts6,
  NxHTML6, NxStyles6, NxControls6;

const
  szDefaultColumnWidth = 80;
  szMinColumnWidth = 8;
  szProgressTextWidth = 32;

const
  stFormatMask = '#,##0.00';

const
  { Exceptions }
  exColumnNotExists = 'Column (%d) out of bounds.';

type
  TNxColumnState = set of (csLeftSet, csWidthSet);
  TNxColumnSettings = set of (csInplaceEditing, csPaintInsert, csSortable);
  TNxGridArea = (gaAll, gaBody, gaFooter, gaHeader, gaHeaderClient, gaHeaderDropButton, gaInsertRow);

type
  TNxColumnFooter = class;
  TNxColumnHeader = class;

  TNxColumn6 = class;
  TNxColumns6 = class;

  { TNxCellPadding }

  TNxCellPadding = class(TPadding)
  published
    property Left default pdHorz;
    property Top default pdVert;
    property Right default pdHorz;
    property Bottom default pdVert;
  end;

  { INxCellOwner }

  INxCellOwner = interface
    ['{FCB33B07-64F8-4083-AABB-3B23A064C8A7}']
    procedure LocateCell(ACol, ARow: Integer);
  end;

  { INxSelectionChanging }

  INxMoveSelection = interface
    ['{5C04B939-DAF9-4422-B14E-F9C65FF5DED4}']
    function GetInteractionMoveSelection: Boolean;
  end;

  { INxColumnView }

  INxParentColumnView = interface
    ['{04206854-F888-4170-A1FE-8BD701F7F515}']
    procedure DoGetCellColor(ACol, ARow: Integer; var CellColor: TColor; State: TNxCellPaintingState);
    function GetSelectionStyle: TNxSelectionStyle;
  end;

  TNxViewSettings = set of (
    vtActive,
    vtAlternated,
    vtBoldSelectedText,
    vtEditing,
    vtHideSelection,
    vtHideWhenEmpty,
    vtHintIndicators,
    vtSelected
  );

  INxColumnView = interface(INxObjectView)
    ['{84A23EDE-79CD-490D-9D6A-3C3FDC35DE9D}']
    { Property Getters }
    function GetActive: Boolean;
    function GetAlternated: Boolean;
    function GetAlternatingRowColor: TColor;
    function GetBestSize: TSize;
    function GetBoldSelectedText: Boolean;
    function GetCaptured: Boolean;
    function GetCell: INxBaseCell;
    function GetColumn: TNxColumn6;
    function GetContentHeight: Integer;
    function GetContentRect: TRect;
    function GetContentSize: TSize;
    function GetDrawingOptions: TNxDrawingOptions;
    function GetEditing: Boolean;
    function GetEmptyCaption: WideString;
    function GetHideSelection: Boolean;
    function GetHideWhenEmpty: Boolean;
    function GetHintIndicators: Boolean;
    function GetInactiveSelectionColor: TColor;
    function GetInteractiveRect: TRect;
    function GetLocation: TPoint;
    function GetOwner: INxCellOwner;
    function GetParent: INxParentColumnView;
    function GetPressed: Boolean;
    function GetSelected: Boolean;
    function GetSelectionColor: TColor;
    function GetSelectionTextColor: TColor;
    function GetState: TNxButtonState;
    { Property Setters }
    procedure SetActive(const Value: Boolean);
    procedure SetAlternated(const Value: Boolean);
    procedure SetAlternatingRowColor(const Value: TColor);
    procedure SetBoldSelectedText(const Value: Boolean);
    procedure SetCaptured(const Value: Boolean);
    procedure SetCell(const Value: INxBaseCell);
    procedure SetColumn(const Value: TNxColumn6);
    procedure SetDrawingOptions(const Value: TNxDrawingOptions);
    procedure SetEditing(const Value: Boolean);
    procedure SetEmptyCaption(const Value: WideString);
    procedure SetHideSelection(const Value: Boolean);
    procedure SetHideWhenEmpty(const Value: Boolean);
    procedure SetHintIndicators(const Value: Boolean);
    procedure SetInactiveSelectionColor(const Value: TColor);
    procedure SetLocation(const Value: TPoint);
    procedure SetOwner(const Value: INxCellOwner);
    procedure SetParent(const Value: INxParentColumnView);
    procedure SetPressed(const Value: Boolean);
    procedure SetSelected(const Value: Boolean);
    procedure SetSelectionColor(const Value: TColor);
    procedure SetSelectionTextColor(const Value: TColor);
    procedure SetState(const Value: TNxButtonState);
    { Methods }
    procedure AdjustEditRect(var EditRect: TRect);
    procedure Changed;
    function ClassType: TClass;
    function Clone: INxColumnView;
    function IsResponsive: Boolean;
    function CanFitText: Boolean;
    function InteractiveHitTest(X, Y: Integer): Boolean;
    procedure Reset;
    { Properties }
    property Active: Boolean read GetActive write SetActive;
    property Alternated: Boolean read GetAlternated write SetAlternated;
    property AlternatingRowColor: TColor read GetAlternatingRowColor write SetAlternatingRowColor;
    property BoldSelectedText: Boolean read GetBoldSelectedText write SetBoldSelectedText;
    property BestSize: TSize read GetBestSize;
    property Captured: Boolean read GetCaptured write SetCaptured;
    property Cell: INxBaseCell read GetCell write SetCell;
    property Column: TNxColumn6 read GetColumn write SetColumn;
    property ContentHeight: Integer read GetContentHeight;
    property ContentRect: TRect read GetContentRect;
    property ContentSize: TSize read GetContentSize;
    property DrawingOptions: TNxDrawingOptions read GetDrawingOptions write SetDrawingOptions;
    property Editing: Boolean read GetEditing write SetEditing;
    property EmptyCaption: WideString read GetEmptyCaption write SetEmptyCaption;
    property HideSelection: Boolean read GetHideSelection write SetHideSelection;
    property HideWhenEmpty: Boolean read GetHideWhenEmpty write SetHideWhenEmpty;
    property HintIndicators: Boolean read GetHintIndicators write SetHintIndicators;
    property InactiveSelectionColor: TColor read GetInactiveSelectionColor write SetInactiveSelectionColor;
    property InteractiveRect: TRect read GetInteractiveRect;
    property Location: TPoint read GetLocation write SetLocation;
    property Owner: INxCellOwner read GetOwner write SetOwner;
    property Parent: INxParentColumnView read GetParent write SetParent;
    property Pressed: Boolean read GetPressed write SetPressed;
    property Selected: Boolean read GetSelected write SetSelected;
    property SelectionColor: TColor read GetSelectionColor write SetSelectionColor;
    property SelectionTextColor: TColor read GetSelectionTextColor write SetSelectionTextColor;
    property State: TNxButtonState read GetState write SetState;
  end;

  { TNxColumnView }

  TNxColumnView = class(TNxObjectView, INxColumnView)
  private
    { Fields }
    FActive: Boolean;
    FAlternated: Boolean;
    FAlternatingRowColor: TColor;
    FBoldSelectedText: Boolean;
    FCaptured: Boolean;
    FCell: INxBaseCell;
    FColumn: TNxColumn6;
    FDrawingOptions: TNxDrawingOptions;
    FEditing: Boolean;
    FEmptyCaption: WideString;
    FHideSelection: Boolean;
    FHideWhenEmpty: Boolean;
    FHintIndicators: Boolean;
    FInactiveSelectionColor: TColor;
    FLocation: TPoint;
    FOwner: INxCellOwner;
    FParent: INxParentColumnView;
    FPressed: Boolean;
    FSelected: Boolean;
    FSelectionColor: TColor;
    FSelectionTextColor: TColor;
    { Property Accessors }
    function GetActive: Boolean;
    function GetAlternated: Boolean;
    function GetAlternatingRowColor: TColor;
    function GetBoldSelectedText: Boolean;
    function GetCaptured: Boolean;
    function GetCell: INxBaseCell;
    function GetColumn: TNxColumn6;
    function GetContentHeight: Integer;
    function GetDrawingOptions: TNxDrawingOptions;
    function GetEditing: Boolean;
    function GetEmptyCaption: WideString;
    function GetHideSelection: Boolean;
    function GetHideWhenEmpty: Boolean;
    function GetHintIndicators: Boolean;
    function GetInactiveSelectionColor: TColor;
    function GetLocation: TPoint;
    function GetOwner: INxCellOwner;
    function GetParent: INxParentColumnView;
    function GetPressed: Boolean;
    function GetSelected: Boolean;
    function GetSelectionColor: TColor;
    function GetSelectionTextColor: TColor;
    function GetState: TNxButtonState;
    function GetStyledControl: INxStyledControl;
    procedure SetActive(const Value: Boolean);
    procedure SetAlternated(const Value: Boolean);
    procedure SetAlternatingRowColor(const Value: TColor);
    procedure SetBoldSelectedText(const Value: Boolean);
    procedure SetCaptured(const Value: Boolean);
    procedure SetCell(const Value: INxBaseCell);
    procedure SetColumn(const Value: TNxColumn6);
    procedure SetDrawingOptions(const Value: TNxDrawingOptions);
    procedure SetEditing(const Value: Boolean);
    procedure SetEmptyCaption(const Value: WideString);
    procedure SetHideSelection(const Value: Boolean);
    procedure SetHideWhenEmpty(const Value: Boolean);
    procedure SetHintIndicators(const Value: Boolean);
    procedure SetInactiveSelectionColor(const Value: TColor);
    procedure SetLocation(const Value: TPoint);
    procedure SetOwner(const Value: INxCellOwner);
    procedure SetParent(const Value: INxParentColumnView);
    procedure SetPressed(const Value: Boolean);
    procedure SetSelected(const Value: Boolean);
    procedure SetSelectionColor(const Value: TColor);
    procedure SetSelectionTextColor(const Value: TColor);
    procedure SetState(const Value: TNxButtonState);
  protected
    FState: TNxButtonState;
    { Protected Methods }
    procedure Changed; virtual;
    function GetBestSize: TSize; virtual;
    function GetContentRect: TRect; virtual;
    function GetContentSize: TSize;
    function GetInteractiveRect: TRect; virtual;
    procedure PaintContent; virtual; abstract;
    procedure PaintEmptyContent; virtual;
    procedure PaintHintMark(CellRect: TRect);
    procedure PaintNullContent; virtual;
    procedure Prepare; virtual;
    procedure Reset; virtual;
    procedure StateChanged(Value: TNxButtonState); virtual;
  public
    procedure AdjustEditRect(var EditRect: TRect); virtual;
    procedure Assign(Source: TObject); override;
    function CanFitText: Boolean;
    function CanStyle(Option: TNxStyleOption): Boolean;
    function Clone: INxColumnView;
    function InteractiveHitTest(X, Y: Integer): Boolean;
    constructor Create; virtual;
    { Virtual Methods }
    function IsResponsive: Boolean; virtual;
    procedure KeyDown(var Key: Word; Shift: TShiftState); override;
    procedure KeyUp(var Key: Word; Shift: TShiftState); overload; override;
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); overload; override;
    procedure Paint; override;
    { Properties }
    property Active: Boolean read GetActive;
    property Alternated: Boolean read GetAlternated write SetAlternated;
    property AlternatingRowColor: TColor read GetAlternatingRowColor write SetAlternatingRowColor;
    property BoldSelectedText: Boolean read GetBoldSelectedText write SetBoldSelectedText;
    property BestSize: TSize read GetBestSize;
    property Captured: Boolean read GetCaptured write SetCaptured;
    property Cell: INxBaseCell read GetCell write SetCell;
    property Column: TNxColumn6 read GetColumn write SetColumn;
    property ContentHeight: Integer read GetContentHeight;
    property ContentRect: TRect read GetContentRect;
    property ContentSize: TSize read GetContentSize;
    property DrawingOptions: TNxDrawingOptions read GetDrawingOptions write SetDrawingOptions;
    property Editing: Boolean read GetEditing write SetEditing;
    property EmptyCaption: WideString read GetEmptyCaption write SetEmptyCaption;
    property HideSelection: Boolean read GetHideSelection write SetHideSelection;
    property HideWhenEmpty: Boolean read GetHideWhenEmpty write SetHideWhenEmpty;
    property HintIndicators: Boolean read GetHintIndicators write SetHintIndicators;
    property InactiveSelectionColor: TColor read GetInactiveSelectionColor write SetInactiveSelectionColor;
    property InteractiveRect: TRect read GetInteractiveRect;
    property Location: TPoint read GetLocation write SetLocation;
    property Owner: INxCellOwner read GetOwner write SetOwner;
    property Parent: INxParentColumnView read GetParent write SetParent;
    property Pressed: Boolean read GetPressed write SetPressed;
    property Selected: Boolean read GetSelected write SetSelected;
    property SelectionColor: TColor read GetSelectionColor write SetSelectionColor;
    property SelectionTextColor: TColor read GetSelectionTextColor write SetSelectionTextColor;
    property State: TNxButtonState read GetState write SetState;
    property StyledControl: INxStyledControl read GetStyledControl;
  end;

  { TNxColumnPart }

  TNxColumnPart = class(TPersistent)
  private
    { Property Fields }
    FAlignment: TAlignment;
    FCaption: WideString;
    FColor: TColor;
    FColumn: TNxColumn6;
    FDisplayMode: TNxDisplayMode;
    FDrawingOptions: TNxDrawingOptions;
    FFont: TFont;
    FGlyph: TPicture;
    FHint: WideString;
    FMultiLine: Boolean;
    FOrientation: TNxOrientation;
    FParentFont: Boolean;
    FTextTransform: TNxTextTransform;
    FTransparentGlyph: Boolean;
    { Property Setters }
    procedure SetAlignment(const Value: TAlignment);
    procedure SetCaption(const Value: WideString);
    procedure SetColor(const Value: TColor);
    procedure SetDisplayMode(const Value: TNxDisplayMode);
    procedure SetDrawingOptions(const Value: TNxDrawingOptions);
    procedure SetFont(const Value: TFont);
    procedure SetGlyph(const Value: TPicture);
    procedure SetMultiLine(const Value: Boolean);
    procedure SetOrientation(const Value: TNxOrientation);
    procedure SetParentFont(const Value: Boolean);
    procedure SetTextTransform(const Value: TNxTextTransform);
    procedure SetTransparentGlyph(const Value: Boolean);
  protected
    procedure Changed; virtual;
    { Event Handlers }
    procedure DoFontChange(Sender: TObject);
    procedure DoGlyphChange(Sender: TObject);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create(Column: TNxColumn6); virtual;
    destructor Destroy; override;
  published
    { Properties }
    property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
    property Caption: WideString read FCaption write SetCaption;
    property Color: TColor read FColor write SetColor;
    property DisplayMode: TNxDisplayMode read FDisplayMode write SetDisplayMode default dmTextOnly;
    property DrawingOptions: TNxDrawingOptions read FDrawingOptions write SetDrawingOptions default [doBackground, doContent];
    property Font: TFont read FFont write SetFont;
    property Glyph: TPicture read FGlyph write SetGlyph;
    property Hint: WideString read FHint write FHint;
    property MultiLine: Boolean read FMultiLine write SetMultiLine default False;
    property Orientation: TNxOrientation read FOrientation write SetOrientation default orHorizontal;
    property ParentFont: Boolean read FParentFont write SetParentFont default True;
    property TextTransform: TNxTextTransform read FTextTransform write SetTextTransform default ttNone;
    property TransparentGlyph: Boolean read FTransparentGlyph write SetTransparentGlyph default True;
  end;

  { TNxColumnHeader }

  TNxColumnHeader = class(TNxColumnPart)
  private
    FClickable: Boolean;
    FHideArrow: Boolean;
    FShortCaption: WideString;
    FShowButton: Boolean;
    procedure SetHideArrow(const Value: Boolean);
    procedure SetShortCaption(const Value: WideString);
    procedure SetShowButton(const Value: Boolean);
  protected
    procedure Changed; override;
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create(Column: TNxColumn6); override;
  published
    { Properties }
    property Clickable: Boolean read FClickable write FClickable default True;
    property Color default clBtnFace;
    property HideArrow: Boolean read FHideArrow write SetHideArrow default False;
    property ShortCaption: WideString read FShortCaption write SetShortCaption;
    property ShowButton: Boolean read FShowButton write SetShowButton default False;
  end;

  { TNxColumnFooter }

  TNxTextDisplayMode = set of (tmCaption, tmFormula);

  TNxColumnFooter = class(TNxColumnPart)
  private
    { Property Fields }
    FFormatMask: string;
    FFormulaKind: TNxFormulaKind;
    FValue: Extended;
    FSum: Extended;
    FTextAfter: WideString;
    FTextBefore: WideString;
    { Property Accessors }
    procedure SetFormatMask(const Value: string);
    procedure SetFormulaKind(const Value: TNxFormulaKind);
    procedure SetTextAfter(const Value: WideString);
    procedure SetTextBefore(const Value: WideString);
    procedure SetValue(const Value: Extended);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create(Column: TNxColumn6); override;
    { Methods }
    function GetDisplayText: WideString;
    function GetHTML: WideString;
    { Properties }
    property Sum: Extended read FSum write FSum;
  published
    { Properties }
    property Alignment default taRightJustify;
    property Color default clWindow;
    property TextAfter: WideString read FTextAfter write SetTextAfter;
    property TextBefore: WideString read FTextBefore write SetTextBefore;
    property FormulaKind: TNxFormulaKind read FFormulaKind write SetFormulaKind default fkNone;
    property FormatMask: string read FFormatMask write SetFormatMask;
    property Value: Extended read FValue write SetValue;
  end;

  { TNxSlideBounds }

  TNxSlideBounds = class(TPersistent)
  private
    FOwner: TNxColumn6;
    { Property Fields }
    FLeft: Integer;
    FTop: Integer;
    FHeight: Integer;
    FWidth: Integer;
    { Property Accessors }
    function GetBottom: Integer;
    function GetBoundsRect: TRect;
    function GetRight: Integer;
    procedure SetBoundsRect(const Value: TRect);
    procedure SetHeight(const Value: Integer);
    procedure SetLeft(const Value: Integer);
    procedure SetTop(const Value: Integer);
    procedure SetWidth(const Value: Integer);
  protected
    { Protected Methods }
    procedure Changed; dynamic;
  public
    constructor Create(AOwner: TNxColumn6); virtual;
    procedure Assign(Source: TPersistent); override;
    { Public Properties }
    property Bottom: Integer read GetBottom;
    property BoundsRect: TRect read GetBoundsRect write SetBoundsRect;
    property Right: Integer read GetRight;
  published
    { Properties }
    property Height: Integer read FHeight write SetHeight default 16;
    property Left: Integer read FLeft write SetLeft default 8;
    property Top: Integer read FTop write SetTop default 8;
    property Width: Integer read FWidth write SetWidth default 80;
  end;

  { TNxColumn6 }

  TNxCalculateEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: Double) of object;
  TNxCalculatedEvent = procedure (Sender: TObject; Index: Integer; var Value: Double) of object;

  TNxGetTextEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Text: WideString) of object;
  TNxSetCellProp = procedure (Sender: TObject; ACol, ARow: Integer; Cell: INxBaseCell) of object;

  TNxDrawCellEvent = procedure (Sender: TObject; ACol, ARow: Integer; CellRect: TRect; State: TNxCellPaintingState) of object;

  TNxCellNotifyEvent = procedure (Sender: TObject; ACol, ARow: Integer) of object;
  TNxCellQueryEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Accept: Boolean) of object;

  TNxHeaderButtonClickEvent = procedure (Sender: TObject; X, Y: Integer;
    var Accept: Boolean) of object;

  TNxColumn6 = class(TComponent, INxCustomDrawable)
  private
    { Property Fields }
    FAlignment: TAlignment;
    FAutoDestroyInplaceEdit: Boolean;
    FAutoEditing: Boolean;
    FAutoSize: Boolean;
    FAutoWidth: Integer;
    FCollection: TNxColumns6;
    FColor: TColor;
    FCursor: TCursor;
    FDefaultWidth: Integer;
    FDrawingOptions: TNxDrawingOptions;
    FEditing: Boolean;
    FEmptyCaption: WideString;
    FEnabled: Boolean;
    FFilterEnabled: Boolean;
    FFont: TFont;
    FFooter: TNxColumnFooter;
    FHeader: TNxColumnHeader;
    FHideSelection: Boolean;
    FHideWhenEmpty: Boolean;
    FInplaceEdit: INxInplaceEdit;
    FInsertCaption: WideString;
    FInserting: Boolean;
    FInsertValue: INxBaseCell;
    FInteractive: Boolean;
    FLeft: Integer;
    FMinWidth: Integer;
    FNotificationList: TInterfaceList;
    FOnCalculated: TNxCalculatedEvent;
    FOnCellCalculate: TNxCalculateEvent;
    FOnDrawBackground: TNxDrawCellEvent;
    FOnDrawContent: TNxDrawCellEvent;
    FOnGetHint: TNxGetTextEvent;
    FOnGetText: TNxGetTextEvent;
    FOnHeaderButtonClick: TNxHeaderButtonClickEvent;
    FOnHeaderClick: TNotifyEvent;
    FOnResize: TNotifyEvent;
    FOnSetCell: TNxSetCellProp;
    FPadding: TPadding;
    FParentColor: Boolean;
    FParentFont: Boolean;
    FPlaceholderText: string;
    FResizeable: Boolean;
    FSelectable: Boolean;
    FSizeFactor: Extended;
    FSortable: Boolean;
    FSorted: Boolean;
    FSortKind: TNxSortKind;
    FSortType: TNxSortType;
    FState: TNxColumnState;
    FStoredPosition: Integer;
    FUnique: Boolean;
    FVerticalAlignment: TVerticalAlignment;
    FView: INxColumnView;
    FVisible: Boolean;
    FVisibleIndex: Integer;
    FWidth: Integer;
    { Property Accessors }
    function GetBoundsRect: TRect;
    function GetClientWidth: Integer;
    function GetColor: TColor;
    function GetDrawingOptions: TNxDrawingOptions;
    function GetIncrementalSearch: Boolean;
    function GetIndex: Integer;
    function GetLocation: TNxColumnLocation;
    function GetNext: TNxColumn6;
    function GetPosition: Integer;
    function GetPrev: TNxColumn6;
    function GetRight: Integer;
    function GetSortedIndex: Integer;
    function GetWidth: Integer;
    procedure SetAlignment(const Value: TAlignment);
    procedure SetAutoEditing(const Value: Boolean);
    procedure SetAutoSize(const Value: Boolean);
    procedure SetAutoWidth(const Value: Integer);
    procedure SetColor(const Value: TColor);
    procedure SetDrawingOptions(const Value: TNxDrawingOptions);
    procedure SetEditing(const Value: Boolean);
    procedure SetEmptyCaption(const Value: WideString);
    procedure SetEnabled(const Value: Boolean);
    procedure SetFilterEnabled(const Value: Boolean);
    procedure SetFont(const Value: TFont);
    procedure SetFooter(const Value: TNxColumnFooter);
    procedure SetHeader(const Value: TNxColumnHeader);
    procedure SetHideSelection(const Value: Boolean);
    procedure SetHideWhenEmpty(const Value: Boolean);
    procedure SetIncrementalSearch(const Value: Boolean);
    procedure SetIndex(const Value: Integer);
    procedure SetInplaceEdit(const Value: INxInplaceEdit);
    procedure SetInsertCaption(const Value: WideString);
    procedure SetInserting(const Value: Boolean);
    procedure SetInsertValue(const Value: INxBaseCell);
    procedure SetInteractive(const Value: Boolean);
    procedure SetLeft(const Value: Integer);
    procedure SetMinWidth(const Value: Integer);
    procedure SetPadding(const Value: TPadding);
    procedure SetParentColor(const Value: Boolean);
    procedure SetParentFont(const Value: Boolean);
    procedure SetPosition(const Value: Integer);
    procedure SetResizeable(const Value: Boolean);
    procedure SetSelectable(const Value: Boolean);
    procedure SetSorted(const Value: Boolean);
    procedure SetSortKind(const Value: TNxSortKind);
    procedure SetSortType(const Value: TNxSortType);
    procedure SetUnique(const Value: Boolean);
    procedure SetVerticalAlignment(const Value: TVerticalAlignment);
    procedure SetVisible(const Value: Boolean);
    procedure SetWidth(const Value: Integer);
  protected
    FStyle: TNxColumnSettings;
    function ToObject: TObject;
    { DFM Methods }
    procedure DefineProperties(Filer: TFiler); override;
    procedure ReadInsertValue(Reader: TReader);
    procedure WriteInsertValue(Writer: TWriter);
    procedure SetName(const NewName: TComponentName); override;
    { Virtual Methods }
    procedure AssignInplaceEdit; virtual;
    procedure CreateInplaceEdit; virtual;
    procedure DoDrawBackground(ACol, ARow: Integer; CellRect: TRect; State: TNxCellPaintingState); dynamic;
    procedure DoDrawContent(ACol, ARow: Integer; CellRect: TRect; State: TNxCellPaintingState); dynamic;
    procedure DoGetText(ACol, ARow: Integer; var Text: WideString); dynamic;
    procedure PropertyChanged;
    { Event Handlers }
    procedure DoFontChange(Sender: TObject);
    function GetDataType: TNxDataType; virtual;
    function GetPlaceholderText: string; virtual;
    function GetView: INxColumnView; virtual;
    procedure Resized(Delta: Integer); virtual;
    procedure ShiftBy(Delta: Integer);
    property SizeFactor: Extended read FSizeFactor write FSizeFactor;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Public Methods }
    procedure AdjustEditRect(var EditRect: TRect); virtual;
    procedure AssignEditValue(Cell: INxBase; InplaceEdit: INxInplaceEdit); virtual;
    procedure Assign(Source: TPersistent); override;
    procedure AssignDefaultValue(Cell: INxBase); virtual;
    { Event Handlers }
    procedure DoCalculated(Index: Integer; var Value: Double); dynamic;
    procedure DoCellCalculate(ACol, ARow: Integer; var Value: Double); dynamic;
    procedure DoGetHint(ACol, ARow: Integer; var Text: WideString); dynamic;
    procedure DoHeaderButtonClick(X, Y: Integer; var Accept: Boolean); dynamic;
    procedure DoHeaderClick; dynamic;
    procedure DoResize;
    procedure DoSetCell(ACol, ARow: Integer; Cell: INxBaseCell); dynamic;
    function CreateView: INxColumnView; virtual; abstract;
    procedure BeginEditing; virtual;
    procedure EndEditing; virtual;
    function CanEdit: Boolean; virtual;
    function CanInsert: Boolean; virtual;
    function CanInteract: Boolean; virtual;
    function CanSelect: Boolean;
    function CanSort: Boolean;
    procedure Changed(Area: TNxGridArea = gaBody); virtual;
    procedure Hide;
    function CanPaintContent(Cell: INxBase): Boolean;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; virtual;
    function GetEditText(Cell: INxBase; ACol, ARow: Integer): WideString; virtual;
    function GetHintText(Cell: INxBase; ACol, ARow: Integer): WideString; virtual;
    function GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString; virtual;
    function IsEmpty(Cell: INxBase): Boolean; virtual;
    function IsHidden(Cell: INxBase): Boolean;
    function IsMatchFilter(Cell: INxBase): Boolean; virtual;
    procedure Remove;
    procedure SetProp(const ALeft, APosition, AIndex: Integer);
    procedure SetSizeFactor(const Value: Extended);
    procedure SetWidthSilent(Value: Integer);
    { Protected Methods }
    procedure PropertyNotification(Listener: INxPropertyListener);
    { Sorting }
    procedure DeleteMultiSorted;
    procedure Resort;
    procedure ReverseSort;
    procedure SetMultiSorted(const Value: Boolean; Add: Boolean);
    procedure SetSort(ASorted: Boolean; ASortType: TNxSortType; ASortKind: TNxSortKind);
    { Stream Methods }
    procedure SetParentComponent(Value: TComponent); override;
    function GetParentComponent: TComponent; override;
    function HasParent: Boolean; override;
    function HasOwner: Boolean;
    { Properties }
    property BoundsRect: TRect read GetBoundsRect;
    property ClientWidth: Integer read GetClientWidth;
    property Columns: TNxColumns6 read FCollection write FCollection;
    property DataType: TNxDataType read GetDataType;
    property Left: Integer read FLeft write SetLeft;
    property Location: TNxColumnLocation read GetLocation;
    property Next: TNxColumn6 read GetNext;
    property Prev: TNxColumn6 read GetPrev;
    property Right: Integer read GetRight;
    property Style: TNxColumnSettings read FStyle;
    property View: INxColumnView read GetView;
  published
    { Properties }
    property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
    property AutoEditing: Boolean read FAutoEditing write SetAutoEditing default False;
    property AutoSize: Boolean read FAutoSize write SetAutoSize default False;
    property Color: TColor read GetColor write SetColor default clWindow;
    property Cursor: TCursor read FCursor write FCursor default crDefault;
    property DrawingOptions: TNxDrawingOptions read FDrawingOptions write SetDrawingOptions default [doBackground, doContent];
    property Editing: Boolean read FEditing write SetEditing default False;
    property EmptyCaption: WideString read FEmptyCaption write SetEmptyCaption;
    property Enabled: Boolean read FEnabled write SetEnabled default True;
    property FilterEnabled: Boolean read FFilterEnabled write SetFilterEnabled default False;
    property FixedWidth: Integer read FWidth;
    property Font: TFont read FFont write SetFont;
    property Footer: TNxColumnFooter read FFooter write SetFooter;
    property Header: TNxColumnHeader read FHeader write SetHeader;
    property HideSelection: Boolean read FHideSelection write SetHideSelection default False;
    property HideWhenEmpty: Boolean read FHideWhenEmpty write SetHideWhenEmpty default False;
    property IncrementalSearch: Boolean read GetIncrementalSearch write SetIncrementalSearch default False;
    property Index: Integer read GetIndex write SetIndex;
    property InplaceEdit: INxInplaceEdit read FInplaceEdit write SetInplaceEdit;
    property InsertCaption: WideString read FInsertCaption write SetInsertCaption;
    property Inserting: Boolean read FInserting write SetInserting default True;
    property InsertValue: INxBaseCell read FInsertValue write SetInsertValue;
    property Interactive: Boolean read FInteractive write SetInteractive default True;
    property MinWidth: Integer read FMinWidth write SetMinWidth default szMinColumnWidth;
    property Padding: TPadding read FPadding write SetPadding;
    property ParentColor: Boolean read FParentColor write SetParentColor default True;
    property ParentFont: Boolean read FParentFont write SetParentFont default True;
    property PlaceholderText: string read GetPlaceholderText write FPlaceholderText;
    property Position: Integer read GetPosition write SetPosition;
    property Resizeable: Boolean read FResizeable write SetResizeable default True;
    property Selectable: Boolean read FSelectable write SetSelectable default True;
    property Sortable: Boolean read FSortable write FSortable default True;
    property Sorted: Boolean read FSorted write SetSorted default False;
    property SortedIndex: Integer read GetSortedIndex;
    property SortKind: TNxSortKind read FSortKind write SetSortKind default skAscending;
    property SortType: TNxSortType read FSortType write SetSortType default stAlphabetic;
    property Unique: Boolean read FUnique write SetUnique default False;
    property VerticalAlignment: TVerticalAlignment read FVerticalAlignment write SetVerticalAlignment default taVerticalCenter;
    property Visible: Boolean read FVisible write SetVisible default True;
    property VisibleIndex: Integer read FVisibleIndex;
    property Width: Integer read GetWidth write SetWidth default szDefaultColumnWidth;
    { Events }
    property OnCalculated: TNxCalculatedEvent read FOnCalculated write FOnCalculated;
    property OnCellCalculate: TNxCalculateEvent read FOnCellCalculate write FOnCellCalculate;
    property OnDrawBackground: TNxDrawCellEvent read FOnDrawBackground write FOnDrawBackground;
    property OnDrawContent: TNxDrawCellEvent read FOnDrawContent write FOnDrawContent;
    property OnGetHint: TNxGetTextEvent read FOnGetHint write FOnGetHint;
    property OnGetText: TNxGetTextEvent read FOnGetText write FOnGetText;
    property OnHeaderButtonClick: TNxHeaderButtonClickEvent read FOnHeaderButtonClick write FOnHeaderButtonClick;
    property OnHeaderClick: TNotifyEvent read FOnHeaderClick write FOnHeaderClick;
    property OnResize: TNotifyEvent read FOnResize write FOnResize;
    property OnSetCell: TNxSetCellProp read FOnSetCell write FOnSetCell;
  end;

  TNxColumnClass = class of TNxColumn6;

  { TNxColumns6 }

  TNxColumnAddEvent = procedure (Sender: TNxColumns6; Index: Integer = -1) of object;
  TNxColumnChangedEvent = procedure (Sender: TNxColumn6; Area: TNxGridArea) of object;
  TNxColumnResizedEvent = procedure (Sender: TNxColumn6; Delta: Integer) of object;
  TNxColumnNotifyEvent = procedure (Sender: TNxColumn6) of object;
  TNxColumnIndexEvent = procedure (Sender: TNxColumn6; Index: Integer) of object;

  TNxSizeShiftDirection = (sdLeftToRight, sdBoth);

  TNxColumns6 = class
  private
    FItems: TList;
    FLastAdded: TNxColumn6;
    FOnAdd: TNxColumnAddEvent;
    FOnChanged: TNxColumnChangedEvent;
    FOnFilter: TNotifyEvent;
    FOnRemove: TNxColumnIndexEvent;
    FOnResized: TNxColumnResizedEvent;
    FOnSort: TNxColumnNotifyEvent;
    FOnUpdate: TNotifyEvent;
    FOwner: TComponent;
    FPositions: TList;
    FSearchingColumn: TNxColumn6;
    FSortedColumn: TNxColumn6;
    FSortedList: TList;
    FVisibleCount: Integer;
    FClientWidth: Integer;
    function GetCount: Integer;
    function GetFixedWidth: Integer;
    function GetFlexibleWidth: Integer;
    function GetInsertValue(Index: Integer): INxBaseCell;
    function GetItem(Index: Integer): TNxColumn6;
    function GetItemBy(Index: Variant): TNxColumn6;
    function GetMultiSortedColumn(const Index: Integer): TNxColumn6;
    function GetMultiSortedCount: Integer;
    function GetPositionItem(Index: Integer): TNxColumn6;
    function GetVisibleWidth: Integer;
    procedure SetPositionItem(Index: Integer; const Value: TNxColumn6);
    function GetFirstVisible: Integer;
  protected
    { Protected Methods }
    procedure DestroyItems; virtual;
    procedure Show(Column: TNxColumn6; Visible: Boolean);
    { Event Handlers }
    procedure DoAdd(Index: Integer = -1); dynamic;
    procedure DoChanged(Sender: TNxColumn6; Area: TNxGridArea); dynamic;
    procedure DoFilter; dynamic;
    procedure DoRemove(Sender: TNxColumn6; Index: Integer); dynamic;
    procedure DoResized(Sender: TNxColumn6; Delta: Integer); dynamic;
    procedure DoSort(Sender: TNxColumn6); dynamic;
    procedure DoUpdate; dynamic;
  public
    constructor Create(AOwner: TComponent);
    destructor Destroy; override;
    { Public Methods }
    function Add(ColumnClass: TNxColumnClass; Caption: WideString = ''; ShortCaption: WideString = ''): TNxColumn6; overload;
    procedure Add(Column: TNxColumn6); overload;
    procedure AddSorted(Column: TNxColumn6);
    function Check(const Index: Integer): Boolean;
    function Clone(Source: TNxColumn6): TNxColumn6;
    procedure Clear;
    procedure Delete(const Index: Integer);
    procedure DeleteSorted(const Index: Integer); overload;
    procedure DeleteSorted(Column: TNxColumn6); overload;
    function Exist(const Index: Integer): Boolean;
    procedure FitInSpace(Space, Delta: Integer; Index: Integer = -1);
    function GetAtPos(X, Y: Integer): TNxColumn6;
    function HasItems: Boolean;
    procedure Move(CurIndex, NewIndex: Integer);
    function IndexOf(Column: TNxColumn6): Integer;
    procedure Insert(Index: Integer; Column: TNxColumn6); overload;
    function Insert(Index: Integer; ColumnClass: TNxColumnClass): TNxColumn6; overload;
    function LeftOf(Index: Integer): Integer;
    function PositionOf(Column: TNxColumn6): Integer;
    procedure Remove(Column: TNxColumn6);
    procedure UpdateAutoSizes(Index: Integer = -1);
    procedure UpdateSizeFactors(Max: Integer; Index: Integer = -1);
    procedure SetParentProp(Column: TNxColumn6);
    procedure ShiftSizeFactors(Index: Integer; Delta: Extended;
      Direction: TNxSizeShiftDirection);
    function SortedIndexOf(Column: TNxColumn6): Integer;
    function UniqueName(const BaseName: string): string;
    procedure UnsortAll;
    procedure Update(AIndex: Integer = 0);
    procedure UpdateStoredPositions;
    { Properties }
    property ClientWidth: Integer read FClientWidth write FClientWidth;
    property Count: Integer read GetCount;
    property FirstVisible: Integer read GetFirstVisible;
    property FixedWidth: Integer read GetFixedWidth;
    property FlexibleWidth: Integer read GetFlexibleWidth;
    property InsertValue[Index: Integer]: INxBaseCell read GetInsertValue;
    property Item[Index: Integer]: TNxColumn6 read GetItem; default;
    property ItemBy[Index: Variant]: TNxColumn6 read GetItemBy;
    property LastAdded: TNxColumn6 read FLastAdded;
    property MultiSortedColumn[const Index: Integer]: TNxColumn6 read GetMultiSortedColumn;
    property MultiSortedCount: Integer read GetMultiSortedCount;
    property Owner: TComponent read FOwner;
    property PositionItem[Index: Integer]: TNxColumn6 read GetPositionItem write SetPositionItem;
    property SearchingColumn: TNxColumn6 read FSearchingColumn;
    property SortedColumn: TNxColumn6 read FSortedColumn;
    property VisibleCount: Integer read FVisibleCount;
    property VisibleWidth: Integer read GetVisibleWidth;
    { Events }
    property OnAdd: TNxColumnAddEvent read FOnAdd write FOnAdd;
    property OnChanged: TNxColumnChangedEvent read FOnChanged write FOnChanged;
    property OnFilter: TNotifyEvent read FOnFilter write FOnFilter;
    property OnRemove: TNxColumnIndexEvent read FOnRemove write FOnRemove;
    property OnResized: TNxColumnResizedEvent read FOnResized write FOnResized;
    property OnSort: TNxColumnNotifyEvent read FOnSort write FOnSort;
    property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate;
  end;

  { TNxTextColumn6 }

  TNxGetStringValueEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: WideString) of object;
  TNxStyleTextEvent = procedure (Sender: TObject; ACol, ARow: Integer;
    var FontColor: TColor; FillColor: TColor;
    var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState) of object;

  INxStyledTextContent = interface
    ['{93924427-8AE9-4BE1-BF55-BE8FFC8215FB}']
    procedure DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
      var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
  end;

  TNxTextColumn6 = class(TNxColumn6, INxWrapable, INxTextContent, INxStyledTextContent)
  private
    { Fields }
    FDefaultValue: WideString;
    FEditCharCase: TEditCharCase;
    FEditOptions: TNxEditOptions;
    FFilter: WideString;
    FFilterOptions: TNxStringFilterOptions;
    FMaxLength: Integer;
    FMultiLine: Boolean;
    FOnGetValue: TNxGetStringValueEvent;
    FOnStyleTextEvent: TNxStyleTextEvent;
    FPasswordChar: TChar;
    FShowTextFitHint: Boolean;
//    FStyleTextEvent: TNxStyleTextEvent;
    FTextAfter: WideString;
    FTextBefore: WideString;
    FTextTransform: TNxTextTransform;
    FWrapKind: TNxWrapKind;
    { Property Setters }
    function GetShowTextFitHint: Boolean;
    function GetWrapKind: TNxWrapKind;
    procedure SetEditOptions(const Value: TNxEditOptions);
    procedure SetFilter(const Value: WideString);
    procedure SetFilterOptions(const Value: TNxStringFilterOptions);
    procedure SetMaxLength(const Value: Integer);
    procedure SetMultiline(const Value: Boolean);
    procedure SetPasswordChar(const Value: TChar);
    procedure SetShowTextFitHint(const Value: Boolean);
    procedure SetTextAfter(const Value: WideString);
    procedure SetTextBefore(const Value: WideString);
    procedure SetTextTransform(const Value: TNxTextTransform);
    procedure SetWrapKind(const Value: TNxWrapKind);
  protected
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
    procedure DoGetValue(ACol, ARow: Integer; var Value: WideString); dynamic;
    procedure DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
      var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState); dynamic;
  public
    procedure Assign(Source: TPersistent); override;
    procedure AssignDefaultValue(Cell: INxBase); override;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Virtual Methods }
    function CreateView: INxColumnView; override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): WideString;
    function IsEmpty(Cell: INxBase): Boolean; override;
    function IsMatchFilter(Cell: INxBase): Boolean; override;
  published
    property DefaultValue: WideString read FDefaultValue write FDefaultValue;
    property EditCharCase: TEditCharCase read FEditCharCase write FEditCharCase default ecNormal;
    property EditOptions: TNxEditOptions read FEditOptions write SetEditOptions default [edPaste, edTyping];
    property Filter: WideString read FFilter write SetFilter;
    property FilterOptions: TNxStringFilterOptions read FFilterOptions write SetFilterOptions default [];
    property MaxLength: Integer read FMaxLength write SetMaxLength default 0;
    property MultiLine: Boolean read FMultiLine write SetMultiline default False;
    property PasswordChar: TChar read FPasswordChar write SetPasswordChar default #0;
    property ShowTextFitHint: Boolean read GetShowTextFitHint write SetShowTextFitHint default True;
    property TextAfter: WideString read FTextAfter write SetTextAfter;
    property TextBefore: WideString read FTextBefore write SetTextBefore;
    property TextTransform: TNxTextTransform read FTextTransform write SetTextTransform default ttNone;
    property WrapKind: TNxWrapKind read GetWrapKind write SetWrapKind default wkEllipsis;
    { Events }
    property OnStyleText: TNxStyleTextEvent read FOnStyleTextEvent write FOnStyleTextEvent;
    property OnGetValue: TNxGetStringValueEvent read FOnGetValue write FOnGetValue;
  end;

  { TNxButtonColumn6 }

  TNxButtonColumn6 = class(TNxTextColumn6)
  private
    FAlwaysShowButton: Boolean;
    FAutoText: WideString;
    FButtonCaption: WideString;
    FButtonGlyph: TPicture;
    FButtonWidth: Integer;
    FOnButtonClick: TNotifyEvent;
    FButtonHeight: Integer;
    procedure SetAlwaysShowButton(const Value: Boolean);
    procedure SetButtonGlyph(const Value: TPicture);
    procedure SetButtonHeight(const Value: Integer);
    procedure SetButtonWidth(const Value: Integer);
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function CreateView: INxColumnView; override;
    procedure AdjustEditRect(var EditRect: TRect); override;
  published
    property AutoText: WideString read FAutoText write FAutoText;
    property AlwaysShowButton: Boolean read FAlwaysShowButton write SetAlwaysShowButton default False;
    property ButtonCaption: WideString read FButtonCaption write FButtonCaption;
    property ButtonGlyph: TPicture read FButtonGlyph write SetButtonGlyph;
    property ButtonHeight: Integer read FButtonHeight write SetButtonHeight default 0;
    property ButtonWidth: Integer read FButtonWidth write SetButtonWidth default szExecuteButton;
    property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
  end;

  { TNxIntegerColumn6 }

  TNxGetIntegerValueEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: Integer) of object;

  TNxIntegerColumn6 = class(TNxColumn6)
  private
    FFilter: string;
    FOnGetValue: TNxGetIntegerValueEvent;
    { Property Accessors }
    procedure SetFilter(const Value: string);
  protected
    { Event Handlers }
    procedure DoGetValue(ACol, ARow: Integer; var Value: Integer); dynamic;
    function GetDataType: TNxDataType; override;
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    constructor Create(AOwner: TComponent); override;
    function CreateView: INxColumnView; override;
    { Methods }
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Integer; virtual;
    function IsMatchFilter(Cell: INxBase): Boolean; override;
  published
    { Properties }
    property Filter: string read FFilter write SetFilter;
    { Events }
    property OnGetValue: TNxGetIntegerValueEvent read FOnGetValue write FOnGetValue;
  end;

  { TNxFloatColumn6 }

  TNxGetFloatValueEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: Double) of object;

  TNxFloatEvaluateKind = (ekInclusion, ekRange, ekLargerThan, ekSmallerThan);

  INxFloatCellValue = interface
    ['{8E5DA7ED-A204-4D46-9EBF-AC09195CBB7B}']
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Double;
  end;

  TNxFloatColumn6 = class(TNxColumn6, INxRanged, INxFloatCellValue)
  private
    FDefaultValue: Double;
    FEditOptions: TNxEditOptions;
    FEmptyValue: Double;
    FFilter: string;
    FFormatMask: string;
    FMax: Double;
    FMin: Double;
    FNumericEditOptions: TNxNumericEditOptions;
    FOnGetValue: TNxGetFloatValueEvent;
    FPrecision: Integer;
    FTextAfter: WideString;
    FTextBefore: WideString;
    { Property Getters }
    function GetMax: Double;
    function GetMin: Double;
    { Property Setters }
    procedure SetEditOptions(const Value: TNxEditOptions);
    procedure SetEmptyValue(const Value: Double);
    procedure SetFilter(const Value: string);
    procedure SetFormatMask(const Value: string);
    procedure SetMax(const Value: Double);
    procedure SetMin(const Value: Double);
    procedure SetNumericEditOptions(const Value: TNxNumericEditOptions);
    procedure SetPrecision(const Value: Integer);
    procedure SetTextAfter(const Value: WideString);
    procedure SetTextBefore(const Value: WideString);
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure DoGetValue(ACol, ARow: Integer; var Value: Double); dynamic;
    function GetDataType: TNxDataType; override;
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    procedure AssignDefaultValue(Cell: INxBase); override;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetEditText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Double;
    function IsEmpty(Cell: INxBase): Boolean; override;
    function IsMatchFilter(Cell: INxBase): Boolean; override;
  published
    property DefaultValue: Double read FDefaultValue write FDefaultValue;
    property EditOptions: TNxEditOptions read FEditOptions write SetEditOptions default [edPaste, edTyping];
    property EmptyValue: Double read FEmptyValue write SetEmptyValue;
    property Filter: string read FFilter write SetFilter;
    property FormatMask: string read FFormatMask write SetFormatMask;
    property Max: Double read GetMax write SetMax;
    property Min: Double read GetMin write SetMin;
    property NumericEditOptions: TNxNumericEditOptions read FNumericEditOptions write SetNumericEditOptions default [ednDecimals, ednSigns];
    property Precision: Integer read FPrecision write SetPrecision default 2;
    property SortType default stNumeric;
    property TextAfter: WideString read FTextAfter write SetTextAfter;
    property TextBefore: WideString read FTextBefore write SetTextBefore;
    { Events }
    property OnGetValue: TNxGetFloatValueEvent read FOnGetValue write FOnGetValue;
  end;

  { TNxNumberColumn6 }

  TNxNumberColumn6 = class(TNxFloatColumn6, INxWrapable, INxTextContent, INxStyledTextContent)
  private
    FIncrement: Double;
    FOnStyleText: TNxStyleTextEvent;
    FShowTextFitHint: Boolean;
    FSpinButtons: Boolean;
    FWrapKind: TNxWrapKind;
    function GetShowTextFitHint: Boolean;
    function GetWrapKind: TNxWrapKind;
    procedure SetSpinButtons(const Value: Boolean);
    procedure SetShowTextFitHint(const Value: Boolean);
    procedure SetWrapKind(const Value: TNxWrapKind);
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
    procedure DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
      var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create(AOwner: TComponent); override;
    function CreateView: INxColumnView; override;
  published
    property Alignment default taRightJustify;
    property Increment: Double read FIncrement write FIncrement;
    property ShowTextFitHint: Boolean read GetShowTextFitHint write SetShowTextFitHint default True;
    property SpinButtons: Boolean read FSpinButtons write SetSpinButtons default True;
    property WrapKind: TNxWrapKind read GetWrapKind write SetWrapKind default wkEllipsis;
    property OnStyleText: TNxStyleTextEvent read FOnStyleText write FOnStyleText;
  end;

  { TNxIncrementColumn6 }

  TNxIncrementColumn6 = class(TNxIntegerColumn6, INxWrapable)
  private
    FOffset: Integer;
    FTextAfter: WideString;
    FTextBefore: WideString;
    FWrapKind: TNxWrapKind;
    { Property Accessors }
    function GetWrapKind: TNxWrapKind;
    procedure SetOffset(const Value: Integer);
    procedure SetTextAfter(const Value: WideString);
    procedure SetTextBefore(const Value: WideString);
    procedure SetWrapKind(const Value: TNxWrapKind);
  protected
    procedure CreateInplaceEdit; override;
    function GetDataType: TNxDataType; override;
  public
    constructor Create(AOwner: TComponent); override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Integer; override;
  published
    property Offset: Integer read FOffset write SetOffset default 1;
    property TextAfter: WideString read FTextAfter write SetTextAfter;
    property TextBefore: WideString read FTextBefore write SetTextBefore;
    property WrapKind: TNxWrapKind read GetWrapKind write SetWrapKind default wkEllipsis;
  end;

  { TNxMemoColumn6 }

  TNxMemoColumn6 = class(TNxColumn6, INxTextContent)
  private
    FEditOptions: TNxEditOptions;
    FShowTextFitHint: Boolean;
    FMultiLineEditOptions: TNxMultiLineEditOptions;
    function GetShowTextFitHint: Boolean;
    procedure SetEditOptions(const Value: TNxEditOptions);
    procedure SetShowTextFitHint(const Value: Boolean);
    procedure SetMultiLineEditOptions(const Value: TNxMultiLineEditOptions);
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    constructor Create(AOwner: TComponent); override;
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property EditOptions: TNxEditOptions read FEditOptions write SetEditOptions default [edPaste, edTyping];
    property MultiLineEditOptions: TNxMultiLineEditOptions read FMultiLineEditOptions write SetMultiLineEditOptions default [];
    property ShowTextFitHint: Boolean read GetShowTextFitHint write SetShowTextFitHint default True;
  end;

  { TNxDateColumn6 }

  TNxGetDateValueEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: TDateTime) of object;

  TNxDateColumn6 = class(TNxColumn6, INxWrapable)
  private
    FAutoClose: Boolean;
    FDefaultValue: TDateTime;
    FEditOptions: TNxEditOptions;
    FEmptyValue: TDateTime;
    FFilter: string;
    FFilterOptions: TNxDateFilterOptions;
    FFormatMask: string;
    FOnGetValue: TNxGetDateValueEvent;
    FPopupAnchor: TNxPopupAnchor;
    FWrapKind: TNxWrapKind;
    function GetWrapKind: TNxWrapKind;
    procedure SetEditOptions(const Value: TNxEditOptions);
    procedure SetEmptyValue(const Value: TDateTime);
    procedure SetFilter(const Value: string);
    procedure SetFilterOptions(const Value: TNxDateFilterOptions);
    procedure SetFormatMask(const Value: string);
    procedure SetWrapKind(const Value: TNxWrapKind);
  protected
    { Overrided Methods }
    procedure CreateInplaceEdit; override;
    procedure DoGetValue(ACol, ARow: Integer; var Value: TDateTime); dynamic;
    function GetDataType: TNxDataType; override;
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    procedure AssignDefaultValue(Cell: INxBase); override;
    procedure AssignInplaceEdit; override;
    constructor Create(AOwner: TComponent); override;
    function CreateView: INxColumnView; override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): TDateTime; virtual;
    function IsEmpty(Cell: INxBase): Boolean; override;
    function IsMatchFilter(Cell: INxBase): Boolean; override;
  published
    property AutoClose: Boolean read FAutoClose write FAutoClose default True;
    property DefaultValue: TDateTime read FDefaultValue write FDefaultValue;
    property EditOptions: TNxEditOptions read FEditOptions write SetEditOptions default [edPaste, edTyping];
    property EmptyValue: TDateTime read FEmptyValue write SetEmptyValue;
    property Filter: string read FFilter write SetFilter;
    property FilterOptions: TNxDateFilterOptions read FFilterOptions write SetFilterOptions default foUserDefined;
    property FormatMask: string read FFormatMask write SetFormatMask;
    property PopupAnchor: TNxPopupAnchor read FPopupAnchor write FPopupAnchor default paLeft;
    property SortType default stDate;
    property WrapKind: TNxWrapKind read GetWrapKind write SetWrapKind default wkEllipsis;
    property OnGetValue: TNxGetDateValueEvent read FOnGetValue write FOnGetValue;
  end;

  { TNxCheckBoxColumn6 }

  TNxGetBooleanValueEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: Boolean) of object;

  INxCheckBoxColumn = interface
    ['{61E386C1-04A5-4C4E-8FAC-AF4BB9F223E4}']
    function DoPaintImage(Checked: Boolean; var AImages: TCustomImageList; var AImageIndex: TImageIndex): Boolean;
    procedure DoCheckedChanged(ACol, ARow: Integer);
    procedure DoCheckedQuery(ACol, ARow: Integer; var Accept: Boolean);
    function GetShowText: Boolean;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Boolean;
    procedure SetValue(Cell: INxBase; ACol, ARow: Integer; Value: Boolean);
    property ShowText: Boolean read GetShowText;
  end;

  TNxCheckBoxColumn6 = class(TNxColumn6, INxCheckBoxColumn, INxMoveSelection, INxStyledTextContent)
  private
    { Fields }
    FCheckedImageIndex: TImageIndex;
    FDefaultValue: Boolean;
    FFilter: string;
    FImages: TCustomImageList;
    FInteractionMoveSelection: Boolean;
    FOnCheckedChanged: TNxCellNotifyEvent;
    FOnCheckedQuery: TNxCellQueryEvent;
    FOnGetValue: TNxGetBooleanValueEvent;
    FOnStyleText: TNxStyleTextEvent;
    FShowText: Boolean;
    FUncheckedImageIndex: TImageIndex;
    function GetInteractionMoveSelection: Boolean;
    function GetShowText: Boolean;
    procedure SetCheckedImageIndex(const Value: TImageIndex);
    procedure SetImages(const Value: TCustomImageList);
    procedure SetFilter(const Value: string);
    procedure SetShowText(const Value: Boolean);
    procedure SetUncheckedImageIndex(const Value: TImageIndex);
  protected
    function DoPaintImage(Checked: Boolean; var AImages: TCustomImageList;
      var AImageIndex: TImageIndex): Boolean;
    procedure DoCheckedQuery(ACol, ARow: Integer; var Accept: Boolean); dynamic;
    procedure DoCheckedChanged(ACol, ARow: Integer); dynamic;
    procedure DoGetValue(ACol, ARow: Integer; var Value: Boolean); dynamic;
    function GetDataType: TNxDataType; override;
    { INxStyledTextContent }
    procedure DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
      var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    procedure AssignDefaultValue(Cell: INxBase); override;
    constructor Create(AOwner: TComponent); override;
    function CreateView: INxColumnView; override;
    function GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetValue(Cell: INxBase; ACol, ARow: Integer): Boolean; virtual;
    function IsEmpty(Cell: INxBase): Boolean; override;
    function IsMatchFilter(Cell: INxBase): Boolean; override;
    procedure SetValue(Cell: INxBase; ACol, ARow: Integer; Value: Boolean); virtual;
  published
    property CheckedImageIndex: TImageIndex read FCheckedImageIndex write SetCheckedImageIndex;
    property DefaultValue: Boolean read FDefaultValue write FDefaultValue default False;
    property Filter: string read FFilter write SetFilter;
    property Images: TCustomImageList read FImages write SetImages;
    property InteractionMoveSelection: Boolean read FInteractionMoveSelection write FInteractionMoveSelection default True;
    property ShowText: Boolean read GetShowText write SetShowText default False;
    property SortType default stBoolean;
    property UncheckedImageIndex: TImageIndex read FUncheckedImageIndex write SetUncheckedImageIndex;

    property OnCheckedChanged: TNxCellNotifyEvent read FOnCheckedChanged write FOnCheckedChanged;
    property OnCheckedQuery: TNxCellQueryEvent read FOnCheckedQuery write FOnCheckedQuery;
    property OnGetValue: TNxGetBooleanValueEvent read FOnGetValue write FOnGetValue;
    property OnStyleText: TNxStyleTextEvent read FOnStyleText write FOnStyleText;
  end;

  { TNxComboBoxColumn6 }

  TNxComboBoxColumn6 = class(TNxTextColumn6)
  private
    FAutoComplete: Boolean;
    FAutoDropDown: Boolean;
    FDisplayMode: TNxStringsDisplayMode;
    FItemHeight: Integer;
    FItems: TStrings;
    FItemsAlignment: TAlignment;
    FListWidth: Integer;
    FPopupAnchor: TNxPopupAnchor;
    FStyle: TNxDropDownStyle;
    procedure SetItems(const Value: TStrings);
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property AutoComplete: Boolean read FAutoComplete write FAutoComplete default False;
    property AutoDropDown: Boolean read FAutoDropDown write FAutoDropDown default False;
    property DisplayMode: TNxStringsDisplayMode read FDisplayMode write FDisplayMode default dmDefault;
    property ItemHeight: Integer read FItemHeight write FItemHeight default szItemHeight;
    property Items: TStrings read FItems write SetItems;
    property ItemsAlignment: TAlignment read FItemsAlignment write FItemsAlignment default taLeftJustify;
    property ListWidth: Integer read FListWidth write FListWidth default 0;
    property PopupAnchor: TNxPopupAnchor read FPopupAnchor write FPopupAnchor default paLeft;
    property Style: TNxDropDownStyle read FStyle write FStyle default dsDropDown;
  end;

  { TNxListColumn6 }

  TNxListColumn6 = class(TNxIntegerColumn6, INxWrapable)
  private
    FImmediateAssign: Boolean;
    FItemHeight: Integer;
    FItems: TStrings;
    FWrapKind: TNxWrapKind;
    { Property Accessors }
    function GetWrapKind: TNxWrapKind;
    procedure SetItems(const Value: TStrings);
    procedure SetWrapKind(const Value: TNxWrapKind);
  protected
    procedure DoInplaceEditSelect(Sender: TObject);
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
    function GetPlaceholderText: string; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure AssignEditValue(Cell: INxBase; InplaceEdit: INxInplaceEdit); override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    function GetEditText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
  published
    property ImmediateAssign: Boolean read FImmediateAssign write FImmediateAssign default False;
    property ItemHeight: Integer read FItemHeight write FItemHeight default szItemHeight;
    property Items: TStrings read FItems write SetItems;
    property WrapKind: TNxWrapKind read GetWrapKind write SetWrapKind default wkEllipsis;
  end;

  { TNxCheckComboBoxColumn6 }

  TNxCheckComboBoxColumn6 = class(TNxComboBoxColumn6)
  private
    FDelimiter: Char;
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    constructor Create(AOwner: TComponent); override;
  published
    property Delimiter: Char read FDelimiter write FDelimiter default ',';
  end;

  { TNxToolbarColumn6 }

  TNxToolbarColumn6 = class;

  TNxToolbarColumnButton = class(TCollectionItem)
  private
    FDivider: Boolean;
    FHint: WideString;
    FImageIndex: TImageIndex;
    FText: WideString;
    FVisible: Boolean;
    procedure SetImageIndex(const Value: TImageIndex);
    procedure SetText(const Value: WideString);
    procedure SetDivider(const Value: Boolean);
    procedure SetVisible(const Value: Boolean);
  public
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    constructor Create(Collection: TCollection); override;
  published
    property Divider: Boolean read FDivider write SetDivider default False;
    property Hint: WideString read FHint write FHint;
    property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default Undefined;
    property Text: WideString read FText write SetText;
    property Visible: Boolean read FVisible write SetVisible;
  end;

  TNxToolbarColumnButtons = class(TCollection)
  private
    FOwner: TNxToolbarColumn6;
    function GetCheckedCount: Integer;
    function GetItem(Index: Integer): TNxToolbarColumnButton;
    procedure SetItem(Index: Integer; const Value: TNxToolbarColumnButton);
  protected
    procedure Check(Button: TNxToolbarColumnButton);
    function CanUncheck: Boolean;
    function GetOwner: TPersistent; override;
  public
    constructor Create(AOwner: TNxToolbarColumn6);
    function Add: TNxToolbarColumnButton;
    property CheckedCount: Integer read GetCheckedCount;
    property Items[Index: Integer]: TNxToolbarColumnButton read GetItem write SetItem; default;
  end;

  TNxToolButtonClickEvent = procedure (Sender: TObject; Index: Integer) of object;

  INxToolbarCollection = interface
    ['{935EE402-0C78-42D8-B631-D0EA23CACA5C}']
    function GetImages: TCustomImageList;
    function GetItems: TNxToolbarColumnButtons;
    function GetCount: Integer;
    { Event Handlers }
    procedure DoButtonClick(Index: Integer);
    { Properties }
    property Count: Integer read GetCount;
    property Images: TCustomImageList read GetImages;
    property Items: TNxToolbarColumnButtons read GetItems;
  end;

  TNxToolbarColumn6 = class(TNxColumn6, INxToolbarCollection)
  private
    { Property Fields }
    FImages: TCustomImageList;
    FItems: TNxToolbarColumnButtons;
    FOnButtonClick: TNxToolButtonClickEvent;
    { Property Accessors }
    function GetCount: Integer;
    function GetImages: TCustomImageList;
    function GetItems: TNxToolbarColumnButtons;
    procedure SetImages(const Value: TCustomImageList);
    procedure SetItems(const Value: TNxToolbarColumnButtons);
  protected
    function GetDataType: TNxDataType; override;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
    procedure DoButtonClick(Index: Integer); dynamic;
  published
    property Count: Integer read GetCount;
    property Images: TCustomImageList read GetImages write SetImages;
    property Items: TNxToolbarColumnButtons read GetItems write SetItems;
    { Events }
    property OnButtonClick: TNxToolButtonClickEvent read FOnButtonClick write FOnButtonClick;
  end;

  { TNxSideEditNumberColumn6 }

  INxSideEditColumn = interface
    ['{0DCB5535-5546-44D3-8AD5-3C859916244A}']
    function GetShowText: Boolean;
    function GetTextWidth: Integer;
    { Properties }
    property ShowText: Boolean read GetShowText;
    property TextWidth: Integer read GetTextWidth;
  end;

  TNxSideEditNumberColumn6 = class(TNxNumberColumn6, INxSideEditColumn)
  private
    FShowText: Boolean;
    FTextWidth: Integer;
    { Property Accessors }
    function GetShowText: Boolean;
    function GetTextWidth: Integer;
    procedure SetShowText(const Value: Boolean);
    procedure SetTextWidth(const Value: Integer);
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure AdjustEditRect(var EditRect: TRect); override;
    procedure Assign(Source: TPersistent); override;
    function CanEdit: Boolean; override;
  published
    { Properties }
    property ShowText: Boolean read GetShowText write SetShowText default True;
    property TextWidth: Integer read GetTextWidth write SetTextWidth default 0;
  end;

  { TNxProgressColumn6 }

  TNxProgressTextPosition = (tpInside, tpBeside);

  TNxProgressColumn6 = class(TNxSideEditNumberColumn6)
  private
    FProgressColor: TColor;
    FProgressHeight: Integer;
    FProgressMargin: Integer;
    FProgressStyle: TNxProgressBarStyle;
    FTextPosition: TNxProgressTextPosition;
    FTextWidth: Integer;
    FTransparent: Boolean;
    procedure SetProgressColor(const Value: TColor);
    procedure SetProgressHeight(const Value: Integer);
    procedure SetProgressMargin(const Value: Integer);
    procedure SetProgressStyle(const Value: TNxProgressBarStyle);
    procedure SetTextPosition(const Value: TNxProgressTextPosition);
    procedure SetTransparent(const Value: Boolean);
  protected
    { Overrided Methods }
    function GetDataType: TNxDataType; override;
    function GetPlaceholderText: string; override;
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
    function GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString; override;
  published
    { Properties }
    property ProgressColor: TColor read FProgressColor write SetProgressColor default clHighlight;
    property ProgressHeight: Integer read FProgressHeight write SetProgressHeight default 0;
    property ProgressMargin: Integer read FProgressMargin write SetProgressMargin default 0;
    property ProgressStyle: TNxProgressBarStyle read FProgressStyle write SetProgressStyle default pbSolid;
    property SortType default stNumeric;
    property TextPosition: TNxProgressTextPosition read FTextPosition write SetTextPosition default tpBeside;
    property Transparent: Boolean read FTransparent write SetTransparent default False;
  end;

  { TNxIconColumn6 }

  INxGraphicCells = interface
    ['{DE9CA1A2-6EAF-43C8-9533-E946C1041116}']
    function GetGraphic(Cell: INxBase; ACol, ARow: Integer): TGraphic;
    procedure SaveToPath(const Path: string);
//    procedure SaveGraphic(Cell: INxBase; ACol, ARow: Integer);
  end;

  TNxIconColumn6 = class(TNxIntegerColumn6, INxGraphicCells)
  private
    FButton: Boolean;
    FButtonText: WideString;
    FCycleImages: Boolean;
    FHint: string;
    FImages: TCustomImageList;
    FOnButtonClick: TNotifyEvent;
    FPath: string;
    procedure SetButtonText(const Value: WideString);
    procedure SetImages(const Value: TCustomImageList);
  protected
    function GetDataType: TNxDataType; override;
    function GetPlaceholderText: string; override;
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
    { INxGraphicCells }
    function GetGraphic(Cell: INxBase; ACol, ARow: Integer): TGraphic;
    function GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    procedure SaveToPath(const Path: string);
  published
    { Properties }
    property Button: Boolean read FButton write FButton default False;
    property ButtonText: WideString read FButtonText write SetButtonText;
    property CycleImages: Boolean read FCycleImages write FCycleImages default False;
    property Hint: string read FHint write FHint;
    property Images: TCustomImageList read FImages write SetImages;
    property SortType default stNumeric;
    { Events }
    property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
  end;

  { TNxGraphicsColumn6 }

  TNxGraphicColumn6 = class(TNxColumn6, INxGraphicCells)
  private
    FBorderColor: TColor;
    FBorderWidth: Integer;
    FEffects: TNxPaintEffects;
    FFillMode: TNxFillMode;
    FPath: string;
    FSelectedBorderColor: TColor;
    procedure SetBorderColor(const Value: TColor);
    procedure SetBorderWidth(const Value: Integer);
    procedure SetEffects(const Value: TNxPaintEffects);
    procedure SetFillMode(const Value: TNxFillMode);
    procedure SetSelectedBorderColor(const Value: TColor);
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
    function GetGraphic(Cell: INxBase; ACol, ARow: Integer): TGraphic;
    function GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString; override;
    procedure SaveToPath(const Path: string);
  published
    property BorderColor: TColor read FBorderColor write SetBorderColor default clBtnFace;
    property BorderWidth: Integer read FBorderWidth write SetBorderWidth default 0;
    property Effects: TNxPaintEffects read FEffects write SetEffects default [];
    property FillMode: TNxFillMode read FFillMode write SetFillMode default fmAspectFit;
    property SelectedBorderColor: TColor read FSelectedBorderColor write SetSelectedBorderColor
      default clHighlightText;
  end;

  { TNxColorColumn6 }

  TNxColorColumn6 = class(TNxColumn6)
  private
    FColorKind: TNxColorKind;
    function GetColorKind: TNxColorKind;
  protected
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    function CreateView: INxColumnView; override;
  published
    property ColorKind: TNxColorKind read GetColorKind write FColorKind default ckDelphi;
  end;

  { TNxTrackBarColumn6 }

  INxTrackBar = interface
    ['{F2832698-4151-4B0F-B0EC-DA53340B368B}']
    function GetTrackHeight: Integer;
    { Properties }
    property TrackHeight: Integer read GetTrackHeight;
  end;

  TNxTrackbarColumn6 = class(TNxSideEditNumberColumn6, INxTrackBar, INxMoveSelection)
  private
    FInteractionMoveSelection: Boolean;
    FTrackHeight: Integer;
    { Property Acessors }
    function GetInteractionMoveSelection: Boolean;
    function GetTrackHeight: Integer;
    procedure SetTrackHeight(const Value: Integer);
  protected
    { Overrided Methods }
    function GetPlaceholderText: string; override;
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property CanChangeSelection: Boolean read FInteractionMoveSelection write FInteractionMoveSelection default True;
    property InteractionMoveSelection: Boolean read FInteractionMoveSelection write FInteractionMoveSelection default True;
    property TrackHeight: Integer read GetTrackHeight write SetTrackHeight default 4;
  end;

  { TNxHTMLColumn6 }

  TNxHTMLColumn6 = class(TNxColumn6, INxHTML)
  private
    FStylesSheet: TNxStylesSheet6;
    FOnLinkClick: TNxLinkHitEvent;
    { Property Accessors }
    function GetStylesSheet: TNxStylesSheet6;
    procedure SetStylesSheet(const Value: TNxStylesSheet6);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Event Handlers }
    procedure DoLinkClick(Href: WideString); dynamic;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property StylesSheet: TNxStylesSheet6 read GetStylesSheet write SetStylesSheet;
    property OnLinkClick: TNxLinkHitEvent read FOnLinkClick write FOnLinkClick;
  end;

  { TNxTreeColumn6 }

  TNxTreeColumn6 = class(TNxTextColumn6, INxTreeProperties, INxMoveSelection)
  private
    FClientRectToggle: Boolean;
    FImages: TCustomImageList;
    FInteractionMoveSelection: Boolean;
    FShowLines: Boolean;
    FToggleButtonStyle: TNxToggleButtonStyle;
    FLinesColor: TColor;
    function GetClientRectToogle: Boolean;
    function GetImages: TCustomImageList;
    function GetInteractionMoveSelection: Boolean;
    function GetLinesColor: TColor;
    function GetShowLines: Boolean;
    function GetToggleButtonStyle: TNxToggleButtonStyle;
    procedure SetImages(const Value: TCustomImageList);
    procedure SetShowLines(const Value: Boolean);
    procedure SetToggleButtonStyle(const Value: TNxToggleButtonStyle);
    procedure SetLinesColor(const Value: TColor);
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure AdjustEditRect(var EditRect: TRect); override;
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property ClientRectToggle: Boolean read GetClientRectToogle write FClientRectToggle default False;
    property Images: TCustomImageList read FImages write SetImages;
    property InteractionMoveSelection: Boolean read FInteractionMoveSelection write FInteractionMoveSelection default True;
    property LinesColor: TColor read FLinesColor write SetLinesColor default clGrayText;
    property ShowLines: Boolean read FShowLines write SetShowLines default False;
    property ToggleButtonStyle: TNxToggleButtonStyle read GetToggleButtonStyle write SetToggleButtonStyle default tsStyleNative;
  end;

  { TNxTimeColumn6 }

  TNxTimeColumn6 = class(TNxTextColumn6)
  private
    FMinutesText: string;
    FHoursText: string;
    FOptions: TNxTimeShowOptions;
  protected
    { Overrided Methods }
    procedure AssignInplaceEdit; override;
    procedure CreateInplaceEdit; override;
  public
    constructor Create(AOwner: TComponent); override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
  published
    property HoursText: string read FHoursText write FHoursText;
    property MinutesText: string read FMinutesText write FMinutesText;
  end;

  { TNxRateColumn6 }

  INxRateViewOwner = interface
    ['{5D6C3C0F-C0BA-4BEA-B834-0E17B68774B2}']
    function GetGlyph: TPicture;
    function GetGlyphEmpty: TPicture;
    function GetMax: Integer;
    function GetSpacing: Integer;
    property Glyph: TPicture read GetGlyph;
    property GlyphEmpty: TPicture read GetGlyphEmpty;
    property Max: Integer read GetMax;
    property Spacing: Integer read GetSpacing;
  end;

  TNxRateColumn6 = class(TNxIntegerColumn6, INxRateViewOwner)
  private
    FGlyph: TPicture;
    FGlyphEmpty: TPicture;
    FMax: Integer;
    FSpacing: Integer;
    function GetGlyph: TPicture;
    function GetGlyphEmpty: TPicture;
    function GetMax: Integer;
    function GetSpacing: Integer;
    procedure SetGlyph(const Value: TPicture);
    procedure SetGlyphEmpty(const Value: TPicture);
    procedure SetMax(const Value: Integer);
    procedure SetSpacing(const Value: Integer);
  protected
    procedure DoGlyphChanged(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property Glyph: TPicture read FGlyph write SetGlyph;
    property GlyphEmpty: TPicture read FGlyphEmpty write SetGlyphEmpty;
    property Max: Integer read FMax write SetMax default 5;
    property Spacing: Integer read FSpacing write SetSpacing default 2;
  end;

  { TNxChartColumn6 }

  TNxChartStyles = set of (csBars, csLine, csFilledLine, csDots);

  INxChart = interface
    ['{E8758345-8C74-4147-A573-19634E0CD47B}']
    function GetBarWidth: Integer;
    function GetBaseLinePen: TPen;
    function GetChartStyles: TNxChartStyles;
    function GetDotSize: TSize;
    function GetFillBrush: TBrush;
    function GetLinePen: TPen;
    function GetShowBaseLine: Boolean;
    procedure DoChartColor(Index: Integer; var BorderColor, FillColor: TColor);
    property BarWidth: Integer read GetBarWidth;
    property BaseLinePen: TPen read GetBaseLinePen;
    property ChartStyles: TNxChartStyles read GetChartStyles;
    property DotSize: TSize read GetDotSize;
    property FillBrush: TBrush read GetFillBrush;
    property LinePen: TPen read GetLinePen;
    property ShowBaseLine: Boolean read GetShowBaseLine;
  end;

  TNxChartColorEvent = procedure (Sender: TObject; Index: Integer; var BorderColor, FillColor: TColor) of object;

  TNxChartColumn6 = class(TNxColumn6, INxChart)
  private
    FBarWidth: Integer;
    FBaseLinePen: TPen;
    FChartStyles: TNxChartStyles;
    FDotSize: TSize;
    FFillBrush: TBrush;
    FLinePen: TPen;
    FShowBaseLine: Boolean;
    FOnChartColor: TNxChartColorEvent;
    function GetBarWidth: Integer;
    function GetBaseLinePen: TPen;
    function GetChartStyles: TNxChartStyles;
    function GetDotSize: TSize;
    function GetFillBrush: TBrush;
    function GetLinePen: TPen;
    function GetShowBaseLine: Boolean;
    procedure SetBarWidth(const Value: Integer);
    procedure SetBaseLinePen(const Value: TPen);
    procedure SetChartStyles(const Value: TNxChartStyles);
    procedure SetDotSize(const Value: TSize);
    procedure SetLinePen(const Value: TPen);
    procedure SetFillBrush(const Value: TBrush);
    procedure SetShowBaseLine(const Value: Boolean);
  protected
    procedure DoChartColor(Index: Integer; var BorderColor, FillColor: TColor); dynamic;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Overrided Methods }
    procedure Assign(Source: TPersistent); override;
    function CreateView: INxColumnView; override;
  published
    property BarWidth: Integer read GetBarWidth write SetBarWidth default 6;
    property BaseLinePen: TPen read GetBaseLinePen write SetBaseLinePen;
    property ChartStyles: TNxChartStyles read GetChartStyles write SetChartStyles default [csLine, csDots];
    property DotSize: TSize read GetDotSize write SetDotSize;
    property LinePen: TPen read GetLinePen write SetLinePen;
    property FillBrush: TBrush read GetFillBrush write SetFillBrush;
    property ShowBaseLine: Boolean read GetShowBaseLine write SetShowBaseLine default True;
    property OnChartColor: TNxChartColorEvent read FOnChartColor write FOnChartColor;
  end;

  { TNxColumnStyleClipBoard }

  TNxColumnStyle = class
  private
    FAlignment: TAlignment;
    FColor: TColor;
    FEditing: Boolean;
    FHeaderColor: TColor;
    FHeaderParentFont: Boolean;
    FInserting: Boolean;
    FInteractive: Boolean;
    FParentColor: Boolean;
  public
    constructor Create;
    destructor Destroy; override;
    { Methods }
    procedure Copy(Source: TNxColumn6);
    procedure Paste(Dest: TNxColumn6);
  end;

  function EvalBool(E: string; Value: Boolean): Boolean;
  function EvalDate(E: string; Value: TDateTime): Boolean;
  function EvalFloat(E: string; Value: Double): Boolean;

implementation

uses
  { Standard }
  SysUtils, StrUtils, DateUtils, Math, Dialogs, Variants,
  NxGraphics6,
  { NextGrid 6 }
  NxCustomGrid6, NxColumnViewClasses6, NxCells6;

{ Utils }

{ ToDo: Add for string col !! }

function EvalBool(E: string; Value: Boolean): Boolean;
var
  i: Integer;
  S: string;
  C: Char;
  Negation: Boolean;
  Value1: Boolean;

  procedure Add;
  begin
    Value1 := StrToBoolEx(S);
    if Negation then Value1 := not Value1;

    Result := Result or (Value1 = Value)
  end;

  procedure Clear;
  begin
    S := '';
    Value1 := False;
    Negation := False;
  end;

begin
  { Default }
  Result := False;

  E := Trim(E);

  { Do filter? }
  if E <> '' then
  begin
    Clear;

    for i := 1 to Length(E) do
    begin
      C := E[i];

      if C = '!' then
      begin
        Negation := not Negation;

        Continue;
      end;

      { Separator }
      if CharInSet(C, [',', ';']) then
      begin

        { Aloc. & add }
        Add;

        Clear;

        Continue;
      end;

      { Concat }
      S := S + C;
    end;

    if S <> ''
      then Add;
  end
  else Result := True; { nothing to filter }

end;

function EvalDate(E: string; Value: TDateTime): Boolean;
var
  i: Integer;
  Value1, Value2: TDateTime;
  S: string;
  C: Char;
  Kind: TNxFloatEvaluateKind;
  Negation: Boolean;

  procedure Add;
  begin
    { Finalize }
    case Kind of
      ekInclusion,
      ekLargerThan,
      ekSmallerThan:  Value1 := StrToFloatDef(S, 0);
      ekRange:        Value2 := StrToFloatDef(S, 0);
    end;

    { Evaluate }
    case Kind of
      ekInclusion:    if Negation
                        then Result := Result and not (Value = Value1)
                        else Result := Result or (Value = Value1);

      ekRange:        if Negation
                        then Result := Result and not Math.InRange(Value, Value1, Value2)
                        else Result := Result or Math.InRange(Value, Value1, Value2);

      ekLargerThan:   if Negation
                        then Result := Result and not (Value > Value1)
                        else Result := Result and (Value > Value1);

      ekSmallerThan:  if Negation
                        then Result := Result and not (Value < Value1)
                        else Result := Result and (Value < Value1);
    end;
  end;

  procedure Clear;
  begin
    S := '';
    Kind := ekInclusion;
    Value1 := 0;
    Value2 := 0;
    Negation := False;
  end;

begin
  { Default }
  Result := False;

  E := Trim(E);

  { Do filter? }
  if E <> '' then
  begin
    Clear;

    for i := 1 to Length(E) do
    begin
      C := E[i];

      if C = '!' then
      begin
        Negation := not Negation;

        Continue;
      end;

      if C = '>' then
      begin
        Kind := ekLargerThan;

        Continue;
      end;

      if C = '<' then
      begin
        Kind := ekSmallerThan;

        Continue;
      end;

      if C = '-' then
      begin
        Kind := ekRange;

        Value1 := StrToFloatDef(S, 0);

        { Get Value2 }
        S := '';

        Continue;
      end;

      { Separator }
      if CharInSet(C, [',', ';']) then
      begin

        { Aloc. & add }
        Add;

        Clear;

        Continue;
      end;

      if not CharInSet(C, ['0'..'9', LocalSettings.DateSeparator])
        then Continue;

      { Concat }
      S := S + C;
    end;

    if S <> ''
      then Add;
  end
  else Result := True; { nothing to filter }

end;

function EvalFloat(E: string; Value: Double): Boolean;
var
  i: Integer;
  Value1, Value2: Double;
  S: string;
  C: Char;
  Kind: TNxFloatEvaluateKind;
  Negation: Boolean;

  procedure Add;
  begin
    { Finalize }
    case Kind of
      ekInclusion,
      ekLargerThan,
      ekSmallerThan:  Value1 := StrToFloatDef(S, 0);
      ekRange:        Value2 := StrToFloatDef(S, 0);
    end;

    { Evaluate }
    case Kind of
      ekInclusion:    if Negation
                        then Result := Result and not (Value = Value1)
                        else Result := Result or (Value = Value1);
                      
      ekRange:        if Negation
                        then Result := Result and not Math.InRange(Value, Value1, Value2)
                        else Result := Result or Math.InRange(Value, Value1, Value2);

      ekLargerThan:   if Negation
                        then Result := Result and not (Value > Value1)
                        else Result := Result and (Value > Value1);

      ekSmallerThan:  if Negation
                        then Result := Result and not (Value < Value1)
                        else Result := Result and (Value < Value1);
    end;
  end;

  procedure Clear;
  begin
    S := '';
    Kind := ekInclusion;
    Value1 := 0;
    Value2 := 0;
    Negation := False;
  end;

begin
  { Default }
  Result := False;

  E := Trim(E);

  { Do filter? }
  if E <> '' then
  begin
    Clear;

    for i := 1 to Length(E) do
    begin
      C := E[i];

      if C = '!' then
      begin
        Negation := not Negation;

        Continue;
      end;

      if C = '>' then
      begin
        Kind := ekLargerThan;

        Continue;
      end;

      if C = '<' then
      begin
        Kind := ekSmallerThan;

        Continue;
      end;

      if C = '-' then
      begin
        Kind := ekRange;

        Value1 := StrToFloatDef(S, 0);

        { Get Value2 }
        S := '';

        Continue;
      end;

      { Separator }
      if CharInSet(C, [',', ';']) then
      begin

        { Aloc. & add }
        Add;

        Clear;

        Continue;
      end;

      if not CharInSet(C, ['0'..'9', LocalSettings.DecimalSeparator, '-', '+', 'e', 'E'])
        then Continue;

      { Concat }
      S := S + C;
    end;

    if S <> ''
      then Add;
  end
  else Result := True; { nothing to filter }

end;

{ TNxColumnView }

procedure TNxColumnView.AdjustEditRect(var EditRect: TRect);
begin
end;

procedure TNxColumnView.Assign(Source: TObject);
begin
  inherited;
  if Source is TNxColumnView then
  begin
    Alternated := TNxColumnView(Source).Alternated;
    Cell := TNxColumnView(Source).Cell;
    Column := TNxColumnView(Source).Column;
    DrawingOptions := TNxColumnView(Source).DrawingOptions;
    HideWhenEmpty := TNxColumnView(Source).HideWhenEmpty;
    HintIndicators := TNxColumnView(Source).HintIndicators;
    InactiveSelectionColor := TNxColumnView(Source).InactiveSelectionColor;
    Location := TNxColumnView(Source).Location;
    Owner := TNxColumnView(Source).Owner;
    Parent := TNxColumnView(Source).Parent;
    Pressed := TNxColumnView(Source).Pressed;
    Selected := TNxColumnView(Source).Selected;
    SelectionColor := TNxColumnView(Source).SelectionColor;
    SelectionTextColor := TNxColumnView(Source).SelectionTextColor;
    State := TNxColumnView(Source).State;
  end;
end;

function TNxColumnView.CanFitText: Boolean;
begin
  Result := ContentSize.cx > BestSize.cx;
end;

function TNxColumnView.CanStyle(Option: TNxStyleOption): Boolean;
begin
  Result := StyledControl.CanStyle(Option);
end;

procedure TNxColumnView.Changed;
begin

end;

function TNxColumnView.Clone: INxColumnView;
var
  ClassType: TNxColumnViewClass;
begin
  ClassType := TNxColumnViewClass(Self.ClassType);

  { Create & Copy }
  Result := ClassType.Create;
  Result.Assign(Self as TObject);
end;

constructor TNxColumnView.Create;
begin
  FAlternated := False;
  FCaptured := False;
end;

function TNxColumnView.GetActive: Boolean;
begin
  Result := FActive;
end;

function TNxColumnView.GetAlternated: Boolean;
begin
  Result := FAlternated;
end;

function TNxColumnView.GetAlternatingRowColor: TColor;
begin
  Result := FAlternatingRowColor;
end;

function TNxColumnView.GetBestSize: TSize;
begin
  { Set Font }
  Prepare;

  Result.cx := 0;
  Result.cy := 0;
end;

function TNxColumnView.GetBoldSelectedText: Boolean;
begin
  Result := FBoldSelectedText;
end;

function TNxColumnView.GetCaptured: Boolean;
begin
  Result := FCaptured;
end;

function TNxColumnView.GetCell: INxBaseCell;
begin
//  Owner.LocateCell(Location.X, Location.Y);
  Result := FCell;
end;

function TNxColumnView.GetColumn: TNxColumn6;
begin
  Result := FColumn;
end;

function TNxColumnView.GetContentHeight: Integer;
begin
  Result := ContentRect.Bottom - ContentRect.Top;
end;

function TNxColumnView.GetContentRect: TRect;
begin
  { Use ClientRect & Add Padding }
  Result := ClientRect;

  { Add Padding }
  InflateRectScaled(Result, Column.Padding);
end;

function TNxColumnView.GetContentSize: TSize;
begin
  Result := Size(RectWidth(ContentRect), RectHeight(ContentRect));
end;

function TNxColumnView.GetDrawingOptions: TNxDrawingOptions;
begin
  Result := FDrawingOptions;
end;

function TNxColumnView.GetEditing: Boolean;
begin
  Result := FEditing;
end;

function TNxColumnView.GetEmptyCaption: WideString;
begin
  Result := FEmptyCaption;
end;

function TNxColumnView.GetHideSelection: Boolean;
begin
  Result := FHideSelection;
end;

function TNxColumnView.GetHideWhenEmpty: Boolean;
begin
  Result := FHideWhenEmpty;
end;

function TNxColumnView.GetHintIndicators: Boolean;
begin
  Result := FHintIndicators;
end;

function TNxColumnView.GetInactiveSelectionColor: TColor;
begin
  Result := FInactiveSelectionColor;
end;

function TNxColumnView.GetInteractiveRect: TRect;
begin
  Result := ContentRect;
end;

function TNxColumnView.GetLocation: TPoint;
begin
  Result := FLocation;
end;

function TNxColumnView.GetOwner: INxCellOwner;
begin
  Result := FOwner;
end;

function TNxColumnView.GetParent: INxParentColumnView;
begin
  Result := FParent;
end;

function TNxColumnView.GetPressed: Boolean;
begin
  Result := FPressed;
end;

function TNxColumnView.GetSelected: Boolean;
begin
  Result := FSelected;
end;

function TNxColumnView.GetSelectionColor: TColor;
begin
  Result := FSelectionColor;
end;

function TNxColumnView.GetSelectionTextColor: TColor;
begin
  Result := FSelectionTextColor;
end;

function TNxColumnView.GetState: TNxButtonState;
begin
  Result := FState;
end;

function TNxColumnView.GetStyledControl: INxStyledControl;
begin
  if not Supports(Control, INxStyledControl, Result) then Result := nil;
end;

function TNxColumnView.InteractiveHitTest(X, Y: Integer): Boolean;
begin
  Result := Column.Interactive and PtInRect(InteractiveRect, Point(X, Y));
end;

function TNxColumnView.IsResponsive: Boolean;
begin
  Result := False;
end;

procedure TNxColumnView.KeyDown(var Key: Word; Shift: TShiftState);
begin
  Column.DoSetCell(Location.X, Location.Y, Cell);
end;

procedure TNxColumnView.KeyUp(var Key: Word; Shift: TShiftState);
begin
  inherited;
  Column.DoSetCell(Location.X, Location.Y, Cell);

  { Note: Descendants should call inherited
          method at the end }
  State := State - [bsPressed];

  { Release capture }
  Captured := False;
end;

procedure TNxColumnView.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
  Y: Integer);
begin
  Column.DoSetCell(Location.X, Location.Y, Cell);
end;

procedure TNxColumnView.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
  Column.DoSetCell(Location.X, Location.Y, Cell);
end;

procedure TNxColumnView.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
  Y: Integer);
begin
  Column.DoSetCell(Location.X, Location.Y, Cell);

  { Note: Descendants should call inherited
          method at the end }
  State := State - [bsPressed];

  { Release capture }
  Captured := False;
end;

procedure TNxColumnView.Paint;
var
  BorderRect: TRect;
  CellColor, BackColor, FontColor, FillColor: TColor;
  CellHint: WideString;
  CellRef: INxCell;
  CellState: TNxCellPaintingState;
  FontStyle: TFontStyles;
  StyleTextContent: INxStyledTextContent;
begin
  inherited;

  if not Active then Reset;

  { Set Font }
  Prepare;

  CellState := [];
  if Selected and not Column.HideSelection then
  begin
    Include(CellState, csSelected);
  end;

  if Pressed then
  begin
    Include(CellState, csPressed);
  end;

  if Control.Focused then Include(CellState, csFocused);

  with Cell do
  begin
    { Call event }
    Column.DoSetCell(Location.X, Location.Y, Cell);

    { Note: Empty is user-defined state,
            IsSet is cell state }
    if Empty or Column.IsEmpty(Cell)
      then Include(CellState, csEmpty);

    //TODO: DoBeforeCellPaint

    { Background }
    if doBackground in DrawingOptions then
      with Canvas do
      begin

        if ParentColor then BackColor := Column.Color
          else BackColor := Color;

        if Alternated then BackColor := AlternatingRowColor;

        FontColor := Font.Color;

        CellColor := BackColor;

        if csSelected in CellState then
        begin
          if csFocused in CellState then
          begin
            CellColor := SelectionColor;
            FontColor := SelectionTextColor;
          end else
            if not HideSelection
              then CellColor := InactiveSelectionColor;
        end;

        { Trigger event }
        if Assigned(Parent) then
        begin
          // TODO:

          Parent.DoGetCellColor(Location.X, Location.Y, CellColor, CellState);

          case Parent.GetSelectionStyle of
            stAlphaBlended:
            begin
              Pen.Color := CellColor;
              Brush.Color := BlendColor(CellColor, BackColor, 57);
              Rectangle(ClientRect);
            end;
            stSolid:
            begin
              Brush.Color := CellColor;
              FillRect(ClientRect);
            end;
            stFramed:
            begin
              BorderRect := ClientRect;
              Brush.Color := CellColor;
              FrameRect(BorderRect);
              InflateRect(BorderRect, -1, -1);
              FrameRect(BorderRect);
              InflateRect(BorderRect, -1, -1);
              Brush.Color := BackColor;
              FillRect(BorderRect);
            end;

          end;

          Brush.Color := CellColor;

        end;

      end;

    { Background (owned) }
    if doCustom in DrawingOptions then
    begin
      Column.DoDrawBackground(Location.X, Location.Y, ClientRect, CellState);
    end;

    { Content }
    if doContent in DrawingOptions then
    begin
      FontStyle := Canvas.Font.Style;

      { Disabled content }
      if not Cell.Enabled or not Column.Enabled
        then Include(FState, bsDisabled)
          else Exclude(FState, bsDisabled);

      if BoldSelectedText and (csSelected in CellState) then
        Include(FontStyle, fsBold);

      if Supports(Column, INxStyledTextContent, StyleTextContent) then
      begin
        StyleTextContent.DoStyleText(Location.X, Location.Y, FontColor, FillColor,
          FontStyle, Cell, CellState);
      end;

      { Set back to Canvas }
      Canvas.Font.Style := FontStyle;
      Canvas.Font.Color := FontColor;

      if IsNull then PaintNullContent
      else if HideWhenEmpty and (csEmpty in CellState) then PaintEmptyContent
      else PaintContent;
    end;

    { Content (owned) }
    if doCustom in DrawingOptions then
    begin
      Column.DoDrawContent(Location.X, Location.Y, ContentRect, CellState);
    end;

    { Hint Mark }
    if HintIndicators and Supports(Cell, INxCell, CellRef) then
    begin
      CellHint := CellRef.Hint;
      Column.DoGetHint(Location.X, Location.Y, CellHint);
      if CellHint <> EmptyStr
        then PaintHintMark(ClientRect);
    end;

  end;

end;

procedure TNxColumnView.PaintEmptyContent;
begin
  Canvas.Font.Color := clGrayText;

  DrawTextRect(Canvas, ContentRect, Column.Alignment, taVerticalCenter, EmptyCaption, wkEllipsis);
end;

procedure TNxColumnView.PaintHintMark(CellRect: TRect);
const
  MarkSize = 5;
var
  PixelSize: Integer;
begin
  PixelSize := DotToPixel(MarkSize);
  with Canvas do
  begin
    Brush.Color := clRed;
    Pen.Color := Brush.Color;
    Polygon([
      Point(CellRect.Right, CellRect.Top),
      Point(CellRect.Right -PixelSize, CellRect.Top),
      Point(CellRect.Right, CellRect.Top + PixelSize)
    ]);
  end;
end;

procedure TNxColumnView.PaintNullContent;
begin
  Canvas.Font.Color := clGrayText;
  DrawTextRect(Canvas, ContentRect, Column.Alignment, taVerticalCenter, Cell.AsString, wkEllipsis);
end;

procedure TNxColumnView.Prepare;
var
  Ref: INxCell;
begin
  Canvas.Font.Assign(Column.Font);

  if Supports(Cell, INxCell, Ref) then
  begin
    if Ref.IsFontSet then
      Canvas.Font.Assign(Ref.Font);
  end;
end;

procedure TNxColumnView.Reset;
begin
  FState := [];
end;

procedure TNxColumnView.SetActive(const Value: Boolean);
begin
  FActive := Value;
end;

procedure TNxColumnView.SetAlternated(const Value: Boolean);
begin
  FAlternated := Value;
end;

procedure TNxColumnView.SetAlternatingRowColor(const Value: TColor);
begin
  FAlternatingRowColor := Value;
end;

procedure TNxColumnView.SetBoldSelectedText(const Value: Boolean);
begin
  FBoldSelectedText := Value;
end;

procedure TNxColumnView.SetCaptured(const Value: Boolean);
begin
  FCaptured := Value;
end;

procedure TNxColumnView.SetCell(const Value: INxBaseCell);
begin
  FCell := Value;
end;

procedure TNxColumnView.SetColumn(const Value: TNxColumn6);
begin
  FColumn := Value;
end;

procedure TNxColumnView.SetDrawingOptions(const Value: TNxDrawingOptions);
begin
  FDrawingOptions := Value;
end;

procedure TNxColumnView.SetEditing(const Value: Boolean);
begin
  FEditing := Value;
end;

procedure TNxColumnView.SetEmptyCaption(const Value: WideString);
begin
  FEmptyCaption := Value;
end;

procedure TNxColumnView.SetHideSelection(const Value: Boolean);
begin
  FHideSelection := Value;
end;

procedure TNxColumnView.SetHideWhenEmpty(const Value: Boolean);
begin
  FHideWhenEmpty := Value;
end;

procedure TNxColumnView.SetHintIndicators(const Value: Boolean);
begin
  FHintIndicators := Value;
end;

procedure TNxColumnView.SetInactiveSelectionColor(const Value: TColor);
begin
  FInactiveSelectionColor := Value;
end;

procedure TNxColumnView.SetLocation(const Value: TPoint);
begin
  FLocation := Value;
end;

procedure TNxColumnView.SetOwner(const Value: INxCellOwner);
begin
  FOwner := Value;
end;

procedure TNxColumnView.SetParent(const Value: INxParentColumnView);
begin
  FParent := Value;
end;

procedure TNxColumnView.SetPressed(const Value: Boolean);
begin
  FPressed := Value;
end;

procedure TNxColumnView.SetSelected(const Value: Boolean);
begin
  FSelected := Value;
end;

procedure TNxColumnView.SetSelectionColor(const Value: TColor);
begin
  FSelectionColor := Value;
end;

procedure TNxColumnView.SetSelectionTextColor(const Value: TColor);
begin
  FSelectionTextColor := Value;
end;

procedure TNxColumnView.SetState(const Value: TNxButtonState);
begin
  if FState <> Value then
  begin
    FState := Value;

    { Refresh }
    StateChanged(FState);
  end;
end;

procedure TNxColumnView.StateChanged(Value: TNxButtonState);
begin

end;

{ TNxColumnPart }

procedure TNxColumnPart.Assign(Source: TPersistent);
begin
  if Source is TNxColumnPart then
  begin
    Alignment := TNxColumnPart(Source).Alignment;
    Caption := TNxColumnPart(Source).Caption;
    Color := TNxColumnPart(Source).Color;
    DisplayMode := TNxColumnPart(Source).DisplayMode;
    DrawingOptions := TNxColumnPart(Source).DrawingOptions;
    Font.Assign(TNxColumnPart(Source).Font);
    Glyph.Assign(TNxColumnPart(Source).Glyph);
    Hint := TNxColumnPart(Source).Hint;
    MultiLine := TNxColumnPart(Source).MultiLine;
    Orientation := TNxColumnPart(Source).Orientation;
    ParentFont := TNxColumnPart(Source).ParentFont;
    TextTransform := TNxColumnPart(Source).TextTransform;
    TransparentGlyph := TNxColumnPart(Source).TransparentGlyph;
  end;
end;

procedure TNxColumnPart.Changed;
begin
  FColumn.Changed(gaFooter);
end;

constructor TNxColumnPart.Create(Column: TNxColumn6);
begin
  FAlignment := taLeftJustify;
  FColumn := Column;
  FDisplayMode := dmTextOnly;
  FDrawingOptions := [doBackground, doContent];
  FFont := TFont.Create;
  FFont.OnChange := DoFontChange;
  FGlyph := TPicture.Create;
  FGlyph.OnChange := DoGlyphChange;
  FMultiLine := False;
  FOrientation := orHorizontal;
  FParentFont := True;
  FTextTransform := ttNone;
  FTransparentGlyph := True;
end;

destructor TNxColumnPart.Destroy;
begin
  { Destroy Obj. }
  FreeAndNil(FFont);
  FreeAndNil(FGlyph);
  inherited;
end;

procedure TNxColumnPart.DoFontChange(Sender: TObject);
begin
  if not(csReading in FColumn.ComponentState) then
  begin
    ParentFont := False;

    Changed; { Notify }
  end;
end;

procedure TNxColumnPart.DoGlyphChange(Sender: TObject);
begin
  Changed; { Notify }
end;

procedure TNxColumnPart.SetAlignment(const Value: TAlignment);
begin
  if Value <> FAlignment then
  begin
    FAlignment := Value;

    Changed; { Notify }
  end;
end;

procedure TNxColumnPart.SetCaption(const Value: WideString);
begin
  if Value <> FCaption then
  begin
    FCaption := Value;

    Changed; { Notify Control }

    { Notify Listeners }
    FColumn.PropertyChanged;
  end;
end;

procedure TNxColumnPart.SetColor(const Value: TColor);
begin
  if Value <> FColor then
  begin
    FColor := Value;

    Changed; { Notify }
  end;
end;

procedure TNxColumnPart.SetDisplayMode(const Value: TNxDisplayMode);
begin
  if Value <> FDisplayMode then
  begin
    FDisplayMode := Value;

    Changed; { Notify }
  end;
end;

procedure TNxColumnPart.SetDrawingOptions(const Value: TNxDrawingOptions);
begin
  if Value <> FDrawingOptions then
  begin
    FDrawingOptions := Value;
    Changed;
  end;
end;

procedure TNxColumnPart.SetFont(const Value: TFont);
begin
  FFont.OnChange := nil;
  FFont.Assign(Value);
  FFont.OnChange := DoFontChange;
  Changed;
end;

procedure TNxColumnPart.SetGlyph(const Value: TPicture);
begin
  FGlyph.Assign(Value);
  if Assigned(FGlyph) then FGlyph.OnChange := DoGlyphChange;
  Changed;
end;

procedure TNxColumnPart.SetMultiLine(const Value: Boolean);
begin
  if Value <> FMultiLine then
  begin
    FMultiLine := Value;
    Changed;
  end;
end;

procedure TNxColumnPart.SetOrientation(const Value: TNxOrientation);
begin
  if Value <> FOrientation then
  begin
    FOrientation := Value;
    Changed;
  end;
end;

procedure TNxColumnPart.SetParentFont(const Value: Boolean);
begin
  FParentFont := Value;

  if Value and FColumn.HasOwner then
    try
      { Prevent recursion }
      FFont.OnChange := nil;
      FFont.Assign(TNxCustomGrid6(FColumn.GetParentComponent).Font);
    finally
      FFont.OnChange := DoFontChange;
    end;
end;

procedure TNxColumnPart.SetTextTransform(const Value: TNxTextTransform);
begin
  if Value <> FTextTransform then
  begin
    FTextTransform := Value;

    Changed; { Notify }
  end;
end;

procedure TNxColumnPart.SetTransparentGlyph(const Value: Boolean);
begin
  if Value <> FTransparentGlyph then
  begin
    FTransparentGlyph := Value;

    Changed; { Notify }
  end;
end;

{ TNxColumnHeader }

procedure TNxColumnHeader.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxColumnHeader then
  begin
    Clickable := TNxColumnHeader(Source).Clickable;
    HideArrow := TNxColumnHeader(Source).HideArrow;
    ShortCaption := TNxColumnHeader(Source).ShortCaption;
    ShowButton := TNxColumnHeader(Source).ShowButton;
  end;
end;

procedure TNxColumnHeader.Changed;
begin
  FColumn.Changed(gaHeader);
end;

constructor TNxColumnHeader.Create(Column: TNxColumn6);
begin
  inherited;
  Color := clBtnFace;
  FClickable := True;
  FHideArrow := False;
  FShortCaption := EmptyStr;
  FShowButton := False;
end;

procedure TNxColumnHeader.SetHideArrow(const Value: Boolean);
begin
  FHideArrow := Value;

  Changed; { Notify }
end;

procedure TNxColumnHeader.SetShortCaption(const Value: WideString);
begin
  FShortCaption := Value;

  Changed; { Notify }
end;

procedure TNxColumnHeader.SetShowButton(const Value: Boolean);
begin
  if Value <> FShowButton then
  begin
    FShowButton := Value;

    Changed; { Notify }
  end;
end;

{ TNxColumnFooter }

procedure TNxColumnFooter.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxColumnFooter then
  begin
    FormatMask := TNxColumnFooter(Source).FormatMask;
    FormulaKind := TNxColumnFooter(Source).FormulaKind;
    Sum := TNxColumnFooter(Source).Sum;
    TextAfter := TNxColumnFooter(Source).TextAfter;
    TextBefore := TNxColumnFooter(Source).TextBefore;
    Value := TNxColumnFooter(Source).Value;
  end;
end;

constructor TNxColumnFooter.Create(Column: TNxColumn6);
begin
  inherited;
  FAlignment := taRightJustify;
  FColor := clWindow;
  FFormatMask := stFormatMask;
  FFormulaKind := fkNone;
  FSum := 0;
  FTextAfter := EmptyStr;
  FTextBefore := EmptyStr;
  FValue := 0;
end;

function TNxColumnFooter.GetDisplayText: WideString;
begin
  Result := EmptyStr;

  { Show Value? }
  if FormulaKind <> fkNone then
  begin
    if FormatMask <> EmptyStr
      then Result := FormatFloat(FormatMask, Value)
      else Result := FloatToStr(Value);
  end;

  { Concat }
  Result := Concat(Caption, FTextBefore, Result, FTextAfter);

  { Transform }
  Result := TNxPaintStyle6.TransformText(Result, TextTransform);
end;

function TNxColumnFooter.GetHTML: WideString;
begin
  Result := GetDisplayText;
  if Result = '' then Result := '&nbsp;';
end;

procedure TNxColumnFooter.SetFormatMask(const Value: string);
begin
  if Value <> FFormatMask then
  begin
    FFormatMask := Value;
  end;
end;

procedure TNxColumnFooter.SetFormulaKind(const Value: TNxFormulaKind);
begin
  FFormulaKind := Value;
end;

procedure TNxColumnFooter.SetTextAfter(const Value: WideString);
begin
  if Value <> FTextAfter then
  begin
    FTextAfter := Value;

    Changed;
  end;
end;

procedure TNxColumnFooter.SetTextBefore(const Value: WideString);
begin
  if Value <> FTextBefore then
  begin
    FTextBefore := Value;

    Changed;
  end;
end;

procedure TNxColumnFooter.SetValue(const Value: Extended);
begin
  if Value <> FValue then
  begin
    FValue := Value;

    Changed;
  end;
end;

{ TNxSlideBounds }

procedure TNxSlideBounds.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxSlideBounds then
  begin
    Height := TNxSlideBounds(Source).Height;
    Left := TNxSlideBounds(Source).Left;
    Top := TNxSlideBounds(Source).Top;
    Width := TNxSlideBounds(Source).Width;
  end
end;

procedure TNxSlideBounds.Changed;
begin

end;

constructor TNxSlideBounds.Create(AOwner: TNxColumn6);
begin
  FOwner := AOwner;
  FHeight := 16;
  FLeft := 8;
  FTop := 8;
  FWidth := 80;
end;

function TNxSlideBounds.GetBottom: Integer;
begin
  Result := Top + Height;
end;

function TNxSlideBounds.GetBoundsRect: TRect;
begin
  Result := Bounds(Left, Top, Width, Height);
end;

function TNxSlideBounds.GetRight: Integer;
begin
  Result := Left + Width;
end;

procedure TNxSlideBounds.SetBoundsRect(const Value: TRect);
begin
  Left := Value.Left;
  Top := Value.Top;
  Width := Value.Right - Value.Left;
  Height := Value.Bottom - Value.Top;
end;

procedure TNxSlideBounds.SetHeight(const Value: Integer);
begin
  if Value <> FHeight then
  begin
    FHeight := Value;
    Changed;
  end;
end;

procedure TNxSlideBounds.SetLeft(const Value: Integer);
begin
  if Value <> FLeft then
  begin
    FLeft := Value;
    Changed;
  end;
end;

procedure TNxSlideBounds.SetTop(const Value: Integer);
begin
  if Value <> FTop then
  begin
    FTop := Value;
    Changed;
  end;
end;

procedure TNxSlideBounds.SetWidth(const Value: Integer);
begin
  if Value <> FWidth then
  begin
    FWidth := Value;
    Changed;
  end;
end;

{ TNxColumn }

procedure TNxColumn6.AdjustEditRect(var EditRect: TRect);
begin
  InflateRect(EditRect, -1, -1);
end;

procedure TNxColumn6.Assign(Source: TPersistent);
begin
  if Source is TNxColumn6 then
  begin
    Alignment := TNxColumn6(Source).Alignment;
    AutoEditing := TNxColumn6(Source).AutoEditing;
    AutoSize := TNxColumn6(Source).AutoSize;
    Color := TNxColumn6(Source).Color;
    DrawingOptions := TNxColumn6(Source).DrawingOptions;
    Editing := TNxColumn6(Source).Editing;
    EmptyCaption := TNxColumn6(Source).EmptyCaption;
    FilterEnabled := TNxColumn6(Source).FilterEnabled;
    Footer.Assign(TNxColumn6(Source).Footer);
    Header.Assign(TNxColumn6(Source).Header);
    HideSelection := TNxColumn6(Source).HideSelection;
    HideWhenEmpty := TNxColumn6(Source).HideWhenEmpty;
    InsertCaption := TNxColumn6(Source).InsertCaption;
    Inserting := TNxColumn6(Source).Inserting;
    Interactive := TNxColumn6(Source).Interactive;
    MinWidth := TNxColumn6(Source).MinWidth;
    Padding.Assign(TNxColumn6(Source).Padding);
    ParentColor := TNxColumn6(Source).ParentColor;
    ParentFont := TNxColumn6(Source).ParentFont;
    Position := TNxColumn6(Source).Position;
    Resizeable := TNxColumn6(Source).Resizeable;
    Selectable := TNxColumn6(Source).Selectable;
    Sortable := TNxColumn6(Source).Sortable;
    Sorted := TNxColumn6(Source).Sorted;
    SortKind := TNxColumn6(Source).SortKind;
    SortType := TNxColumn6(Source).SortType;
    Unique := TNxColumn6(Source).Unique;
    VerticalAlignment := TNxColumn6(Source).VerticalAlignment;
    Visible := TNxColumn6(Source).Visible;
    Width := TNxColumn6(Source).Width;
  end;
end;

procedure TNxColumn6.AssignDefaultValue(Cell: INxBase);
begin

end;

procedure TNxColumn6.AssignEditValue(Cell: INxBase; InplaceEdit: INxInplaceEdit);
var
  PropertyIntf: INxProperty;
begin
  if Supports(InplaceEdit, INxProperty, PropertyIntf) then
  begin
    Cell.AsString := PropertyIntf.AsString;
  end
  else Cell.AsString := FInplaceEdit.Text;
end;

procedure TNxColumn6.AssignInplaceEdit;
begin
  FInplaceEdit.Font := Font;
end;

procedure TNxColumn6.BeginEditing;
begin
  if not Assigned(FInplaceEdit) then
  begin
    { Column Responsible for destroying }
    FAutoDestroyInplaceEdit := True;

    { Create FInplaceEdit }
    CreateInplaceEdit;

    if Assigned(FInplaceEdit) then
    begin
      { Set Properties & Events }
      AssignInplaceEdit;
    end;
  end;
end;

function TNxColumn6.CanEdit: Boolean;
begin
  Result := Editing;
end;

function TNxColumn6.CanInsert: Boolean;
begin
  Result := Inserting;
end;

function TNxColumn6.CanInteract: Boolean;
begin
  Result := CanEdit;
end;

function TNxColumn6.CanPaintContent(Cell: INxBase): Boolean;
begin
  Result := not IsHidden(Cell) and not Cell.IsNull;
end;

function TNxColumn6.CanSelect: Boolean;
begin
  Result := Visible and Enabled and Selectable; 
end;

function TNxColumn6.CanSort: Boolean;
begin
  Result := (SortType <> stNone) and (csSortable in Style);
end;

procedure TNxColumn6.Changed;
begin
  { Trigger event }
  if Assigned(FCollection) then
  begin
    FCollection.DoChanged(Self, Area);
  end;
end;

constructor TNxColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FAlignment := taLeftJustify;
  FAutoDestroyInplaceEdit := False;
  FAutoEditing := False;
  FAutoSize := False;
  FColor := clWindow;
  FCursor := crDefault;
  FDefaultWidth := szDefaultColumnWidth;
  FDrawingOptions := [doBackground, doContent];
  FEditing := False;
  FEmptyCaption := EmptyStr;
  FEnabled := True;
  FFilterEnabled := False;
  FFont := TFont.Create;
  FFont.OnChange := DoFontChange;
  FFooter := TNxColumnFooter.Create(Self);
  FHeader := TNxColumnHeader.Create(Self);
  FHideSelection := False;
  FHideWhenEmpty := False;
  FInserting := True;
  FInsertValue := CreateCell(DataType);
  FInsertValue.Color := FColor;
  FInteractive := True;
  FLeft := -1;
  FMinWidth := szMinColumnWidth;
  FNotificationList := TInterfaceList.Create;
  FPadding := TNxCellPadding.Create(nil);
  FPadding.SetBounds(pdHorz, pdVert, pdHorz, pdVert);
  FParentColor := True;
  FParentFont := True;
  FPlaceholderText := '';
  FResizeable := True;
  FSelectable := True;
  FSortable := True;
  FSorted := False;
  FSortKind := skAscending;
  FSortType := stAlphabetic;
  FState := [];
  FStoredPosition := -1;
  FStyle := [csInplaceEditing, csPaintInsert, csSortable];
  FUnique := False;
  FVerticalAlignment := taVerticalCenter;
  FVisible := True;
  FVisibleIndex := 0;
  FView := CreateView;
  FView.Column := Self;
  FWidth := szDefaultColumnWidth;
end;

procedure TNxColumn6.CreateInplaceEdit;
begin

end;

procedure TNxColumn6.DefineProperties(Filer: TFiler);
begin
  inherited;
  Filer.DefineProperty('InsertString', ReadInsertValue, WriteInsertValue, FInsertValue.AsString <> '');
end;

procedure TNxColumn6.DeleteMultiSorted;
begin
  FSorted := False;
  FSortKind := skAscending;
  Columns.DeleteSorted(Self);
  Resort;
end;

destructor TNxColumn6.Destroy;
begin
  FInplaceEdit := nil;

  FView := nil;

  { Update TList & notify Grid }
  if Assigned(Owner) and Assigned(Columns) then Columns.Remove(Self);

  Columns.DeleteSorted(Self);

  { Destroy Interf. }
  FInsertValue := nil;

  { Destroy Objects }
  FreeAndNil(FFont);
  FreeAndNil(FFooter);
  FreeAndNil(FHeader);
  FreeAndNil(FPadding);

  FreeAndNil(FNotificationList);

  inherited Destroy;
end;

procedure TNxColumn6.DoSetCell(ACol, ARow: Integer; Cell: INxBaseCell);
begin
  if Assigned(FOnSetCell) then FOnSetCell(Self, ACol, ARow, Cell);
end;

procedure TNxColumn6.DoCalculated(Index: Integer; var Value: Double);
begin
  if Assigned(FOnCalculated) then FOnCalculated(Self, Index, Value);
end;

procedure TNxColumn6.DoCellCalculate(ACol, ARow: Integer; var Value: Double);
begin
  if Assigned(FOnCellCalculate) then FOnCellCalculate(Self, ACol, ARow, Value);
end;

procedure TNxColumn6.DoDrawBackground(ACol, ARow: Integer;
  CellRect: TRect; State: TNxCellPaintingState);
begin
  if Assigned(FOnDrawBackground) then FOnDrawBackground(Self, ACol, ARow, CellRect, State);
end;

procedure TNxColumn6.DoDrawContent(ACol, ARow: Integer; CellRect: TRect;
  State: TNxCellPaintingState);
begin
  if Assigned(FOnDrawContent) then FOnDrawContent(Self, ACol, ARow, CellRect, State);
end;

procedure TNxColumn6.DoFontChange(Sender: TObject);
begin
  ParentFont := False;
  Changed(gaBody);
end;

procedure TNxColumn6.DoGetHint(ACol, ARow: Integer; var Text: WideString);
begin
  if Assigned(FOnGetHint) then FOnGetHint(Self, ACol, ARow, Text);
end;

procedure TNxColumn6.DoGetText(ACol, ARow: Integer;
  var Text: WideString);
begin
  if Assigned(OnGetText) then OnGetText(Self, ACol, ARow, Text);
end;

procedure TNxColumn6.DoHeaderButtonClick(X, Y: Integer;
  var Accept: Boolean);
begin
  if Assigned(FOnHeaderButtonClick) then FOnHeaderButtonClick(Self, X, Y, Accept);  
end;

procedure TNxColumn6.DoHeaderClick;
begin
  if Assigned(FOnHeaderClick) then FOnHeaderClick(Self);  
end;

procedure TNxColumn6.DoResize;
begin
  if Assigned(FOnResize) then
    FOnResize(Self);
end;

procedure TNxColumn6.EndEditing;
begin
  { Hide, but not yet release (deprecated) }
//  ShowWindow(FInplaceEdit.Handle, SW_HIDE);

  { Better to delete }
  if Assigned(FInplaceEdit) then
  begin
    FInplaceEdit.Parent := nil;
  end;

  if FAutoDestroyInplaceEdit then
  begin
    FInplaceEdit := nil;
  end;

  { Reset Flag }
  FAutoDestroyInplaceEdit := False;
end;

function TNxColumn6.GetBoundsRect: TRect;
begin
  Result := Bounds(Left, 0, Width, 0);
end;

function TNxColumn6.GetClientWidth: Integer;
begin
  Result := Width - Padding.Left - Padding.Right;
end;

function TNxColumn6.GetColor: TColor;
begin
  { Default }
  Result := FColor;

  if ParentColor and HasOwner
    then Result := TNxCustomGrid6(GetParentComponent).Color;
end;

function TNxColumn6.GetDataType: TNxDataType;
begin
  Result := dtString;
end;

function TNxColumn6.GetDisplayText(Cell: INxBase;
  ACol, ARow: Integer): WideString;
begin
  { Descendants should override this method }

  if IsHidden(Cell)
    then Result := EmptyCaption
    else Result := Cell.AsString;

  { Adjust values (event) }
  DoGetText(ACol, ARow, Result);
end;

function TNxColumn6.GetDrawingOptions: TNxDrawingOptions;
begin
  Result := FDrawingOptions;
end;

function TNxColumn6.GetEditText(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  Result := Cell.AsString;
end;

function TNxColumn6.GetHintText(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  { Descendant Classes may override this Method }
  Result := GetDisplayText(Cell, ACol, ARow);
end;

function TNxColumn6.GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  Result := GetDisplayText(Cell, ACol, ARow);
  if Result = '' then Result := '&nbsp;';
end;

function TNxColumn6.GetIncrementalSearch: Boolean;
begin
  Result := Assigned(Columns) and (Columns.SearchingColumn = TNxColumn6(Self));
end;

function TNxColumn6.GetIndex: Integer;
begin
  if Assigned(Columns) then Result := Columns.IndexOf(Self)
    else Result := -1;
end;

function TNxColumn6.GetLocation: TNxColumnLocation;
begin
  { Default }
  Result := clAlone;

  { Not alone }
  if Columns.VisibleCount > 1 then
  begin
    if FVisibleIndex = 0
      then Result := clLeftSide
    else
      if FVisibleIndex = Pred(Columns.VisibleCount)
        then Result := clRightSide
    else
      Result := clMiddle;
  end;
end;

function TNxColumn6.GetNext: TNxColumn6;
var
  i: Integer;
begin
  { Last visible }
  Result := nil;

  for i := Succ(Position) to Pred(Columns.Count) do
    if Columns.PositionItem[i].Visible then
    begin
      Result := Columns.PositionItem[i];
      Exit;
    end;
end;

function TNxColumn6.GetParentComponent: TComponent;
begin
  if Assigned(FCollection) then
  begin
    { Grid }
    Result := FCollection.FOwner;
  end
  else Result := nil;
end;

function TNxColumn6.GetPlaceholderText: string;
begin
  Result := FPlaceholderText;
end;

function TNxColumn6.GetPosition: Integer;
begin
  Result := Columns.PositionOf(Self);
end;

function TNxColumn6.GetPrev: TNxColumn6;
var
  i: Integer;
  Column: TNxColumn6;
begin
  Result := nil;

  if Assigned(Columns) then
  begin

    for i := Pred(Position) downto 0 do
    begin
      Column := Columns.PositionItem[i];
      if Column.Enabled and Column.Visible then
      begin
        Result := Column;
        Exit;
      end;
    end;

  end;

end;

function TNxColumn6.GetRight: Integer;
begin
  Result := Left + MulDiv(Width, Screen.PixelsPerInch, 96);
end;

function TNxColumn6.GetSortedIndex: Integer;
begin
  Result := -1;
  if Assigned(Columns) then Result := Columns.SortedIndexOf(Self as TNxColumn6);
end;

function TNxColumn6.GetView: INxColumnView;
begin
  Result := FView;
end;

function TNxColumn6.GetWidth: Integer;
begin
  if AutoSize then Result := FAutoWidth else Result := FWidth;
end;

function TNxColumn6.HasOwner: Boolean;
begin
  Result := Assigned(Columns);
end;

function TNxColumn6.HasParent: Boolean;
begin
  Result := True;
end;

procedure TNxColumn6.Hide;
begin
  Visible := False;
end;

function TNxColumn6.IsEmpty(Cell: INxBase): Boolean;
begin
  Result := False;
end;

function TNxColumn6.IsHidden(Cell: INxBase): Boolean;
begin
  Result := IsEmpty(Cell) and HideWhenEmpty
end;

function TNxColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  { Don't filter }
  Result := True;
end;

procedure TNxColumn6.PropertyChanged;
var
  i: Integer;
begin
  if Assigned(FNotificationList) then
    for i := 0 to Pred(FNotificationList.Count) do
    begin
      INxPropertyListener(FNotificationList.Items[i]).PropertyChanged(Self);
    end;
end;

procedure TNxColumn6.PropertyNotification(Listener: INxPropertyListener);
begin
  if FNotificationList.IndexOf(Listener) = -1 then
    FNotificationList.Add(Listener as INxPropertyListener);
end;

procedure TNxColumn6.ReadInsertValue(Reader: TReader);
begin
  if Assigned(FInsertValue) then
  begin
    FInsertValue.AsString := Reader.ReadString;
  end;
end;

procedure TNxColumn6.Remove;
begin
  if Assigned(Owner) then Owner.RemoveComponent(Self);  
end;

procedure TNxColumn6.Resized(Delta: Integer);
begin
  FCollection.DoResized(Self, Delta);
end;

procedure TNxColumn6.Resort;
begin
  if Assigned(FCollection) then FCollection.DoSort(Self);
end;

procedure TNxColumn6.ReverseSort;
begin
  if SortKind = skAscending
    then SortKind := skDescending
      else SortKind := skAscending;
end;

procedure TNxColumn6.SetAlignment(const Value: TAlignment);
begin
  if Value <> FAlignment then
  begin
    FAlignment := Value;
    Changed;
  end;
end;

procedure TNxColumn6.SetAutoEditing(const Value: Boolean);
begin
  FAutoEditing := Value;
end;

procedure TNxColumn6.SetAutoSize(const Value: Boolean);
begin
  if Value <> FAutoSize then
  begin
    if Value then
    begin
      FAutoWidth := FWidth;

      { Total size that can be used for
        AutoSize cols. }
      if Assigned(Columns) then
      begin

        if Columns.FlexibleWidth = 0 then
        begin
          FSizeFactor := 1;
        end else
        begin
          FSizeFactor := FixedWidth / Columns.FlexibleWidth;
          Columns.ShiftSizeFactors(Position, -FSizeFactor, sdBoth);
        end;

      end;
    end;

    { Set Value }
    FAutoSize := Value;

    Columns.UpdateAutoSizes;

    { Notify Listeners }
    PropertyChanged;
  end;
end;

procedure TNxColumn6.SetAutoWidth(const Value: Integer);
begin
  if Value <> FAutoWidth then
  begin
    FAutoWidth := Value;
  end;
end;

procedure TNxColumn6.SetColor(const Value: TColor);
begin
  if Value <> FColor then
  begin
    FColor := Value;

    { Not anymore }
    FParentColor := False;

    Changed;

    { Notify other controls }
    PropertyChanged;
  end;
end;

procedure TNxColumn6.SetDrawingOptions(const Value: TNxDrawingOptions);
begin
  if Value <> FDrawingOptions then
  begin
    FDrawingOptions := Value;
    Changed;
  end;
end;

procedure TNxColumn6.SetEditing(const Value: Boolean);
begin
  FEditing := Value;

  Changed;

  { Notify Listeners }
  PropertyChanged;
end;

procedure TNxColumn6.SetEmptyCaption(const Value: WideString);
begin
  FEmptyCaption := Value;
  Changed;
end;

procedure TNxColumn6.SetEnabled(const Value: Boolean);
begin
  FEnabled := Value;
  Changed;
end;

procedure TNxColumn6.SetFilterEnabled(const Value: Boolean);
begin
  if Value <> FFilterEnabled then
  begin
    FFilterEnabled := Value;
    if Assigned(FCollection) then FCollection.DoFilter;
  end;
end;

procedure TNxColumn6.SetFont(const Value: TFont);
begin
  FFont.OnChange := nil;
  FFont.Assign(Value);
  FFont.OnChange := DoFontChange;
end;

procedure TNxColumn6.SetFooter(const Value: TNxColumnFooter);
begin
  FFooter.Assign(Value);
end;

procedure TNxColumn6.SetHeader(const Value: TNxColumnHeader);
begin
  FHeader.Assign(Value);
end;

procedure TNxColumn6.SetHideSelection(const Value: Boolean);
begin
  if Value <> FHideSelection then
  begin
    FHideSelection := Value;
    Changed;
  end;
end;

procedure TNxColumn6.SetHideWhenEmpty(const Value: Boolean);
begin
  if Value <> FHideWhenEmpty then
  begin
    FHideWhenEmpty := Value;
    Changed;
  end;
end;

procedure TNxColumn6.SetIncrementalSearch(const Value: Boolean);
begin
  if Assigned(Columns) then
  begin
    Columns.FSearchingColumn := TNxColumn6(Self);
  end;
end;

procedure TNxColumn6.SetIndex(const Value: Integer);
begin

end;

procedure TNxColumn6.SetInplaceEdit(const Value: INxInplaceEdit);
begin
  FInplaceEdit := Value;
end;

procedure TNxColumn6.SetInsertCaption(const Value: WideString);
begin
  if Value <> FInsertCaption then
  begin
    FInsertCaption := Value;
    Changed(gaInsertRow);
  end;
end;

procedure TNxColumn6.SetInserting(const Value: Boolean);
begin
  FInserting := Value;
end;

procedure TNxColumn6.SetInsertValue(const Value: INxBaseCell);
begin

end;

procedure TNxColumn6.SetInteractive(const Value: Boolean);
begin
  FInteractive := Value;
end;

procedure TNxColumn6.SetLeft(const Value: Integer);
var
  OldLeft: Integer;
begin

  { Recursion? }
  if not (csLeftSet in FState) then

    if Position = 0 then FLeft := 0 else
      try
        Include(FState, csLeftSet);

        OldLeft := FLeft;

        { Note: Need to set it here to prevent
                Recursion }
        FLeft := Value;

        if OldLeft > -1 then
        begin
          { Adjust Prev Col. There must be a Prev Col. }
          Prev.Width := Prev.Width + Value - OldLeft;
        end;

        { Adjust Next Col. }
        if Assigned(Next) then Next.Left := Next.Left + FLeft - OldLeft;

      finally
        Exclude(FState, csLeftSet);
      end;
end;

procedure TNxColumn6.SetMinWidth(const Value: Integer);
begin
  FMinWidth := Value;
end;

procedure TNxColumn6.SetMultiSorted(const Value: Boolean; Add: Boolean);
var
  DoSort: Boolean;
begin
  if Value <> FSorted then
  begin
    DoSort := FSorted;

    { Set Value }
    if not Value or CanSort then DoSort := Value;

    { Unsort All, if it's not MultiSort }
    if DoSort and not Add then
      Columns.UnsortAll;

    FSorted := DoSort;

    if FSorted then
    begin
      if SortedIndex = -1 then
        Columns.AddSorted(Self);
    end else
      if SortedIndex <> -1 then
        Columns.DeleteSorted(SortedIndex);

    { Notify & do sorting }
    if FSorted then Resort;

    { Update arrow }
    Changed(gaHeader);
  end;
end;

procedure TNxColumn6.SetName(const NewName: TComponentName);
begin
  inherited;
  PropertyChanged;
end;

procedure TNxColumn6.SetPadding(const Value: TPadding);
begin
  FPadding.Assign(Value);
end;

procedure TNxColumn6.SetParentColor(const Value: Boolean);
begin
  FParentColor := Value;

  if Value and HasOwner then
    try
      { Prevent recursion }
      Color := TNxCustomGrid6(GetParentComponent).Color;
    finally

    end;
end;

procedure TNxColumn6.SetParentComponent(Value: TComponent);
begin
  if Value is TNxCustomGrid6 then
  begin
    Columns := TNxCustomGrid6(Value).Columns;
    Columns.Add(Self);
//    Columns := TNxCustomGrid6(Value).Columns;
  end;
end;

procedure TNxColumn6.SetParentFont(const Value: Boolean);
begin
  { Assign }
  FParentFont := Value;

  if Value and HasOwner then
    try
      { Prevent recursion }
      FFont.OnChange := nil;
      FFont.Assign(TNxCustomGrid6(GetParentComponent).Font);
    finally
      FFont.OnChange := DoFontChange;
    end;
end;

procedure TNxColumn6.SetPosition(const Value: Integer);
var
  OldPosition: Integer;
begin
  if csReading in ComponentState then
  begin
    FStoredPosition := Value
  end else
  begin
    if Assigned(Columns) then
    begin
      OldPosition := Position;
      if Value <> OldPosition then
        with Columns do
        begin
          FPositions.Move(OldPosition, Value);
          Update;
        end;
    end;
  end;
end;

procedure TNxColumn6.SetProp(const ALeft, APosition, AIndex: Integer);
begin
  FLeft := ALeft;
  FVisibleIndex := AIndex;
end;

procedure TNxColumn6.SetResizeable(const Value: Boolean);
begin
  FResizeable := Value;

  { Notify Listeners }
  PropertyChanged;
end;

procedure TNxColumn6.SetSelectable(const Value: Boolean);
begin
  FSelectable := Value;
end;

procedure TNxColumn6.SetSizeFactor(const Value: Extended);
begin
  FSizeFactor := Value;
end;

procedure TNxColumn6.SetSort(ASorted: Boolean; ASortType: TNxSortType;
  ASortKind: TNxSortKind);
begin
  { Unsort All Cols. }
  if ASorted then
    Columns.UnsortAll;

  FSorted := ASorted;
  FSortType := ASortType;
  FSortKind := ASortKind;

  { Sort }
  if FSorted then Resort;
end;

procedure TNxColumn6.SetSorted(const Value: Boolean);
begin
  SetMultiSorted(Value, False);
end;

procedure TNxColumn6.SetSortKind(const Value: TNxSortKind);
begin
  if Value <> FSortKind then
  begin
    FSortKind := Value;

    { Notify }
    Resort;

    { Update arrow }
    if Sorted then Changed(gaHeader);
  end;
end;

procedure TNxColumn6.SetSortType(const Value: TNxSortType);
begin
  if Value <> FSortType then
  begin
    FSortType := Value;

    { Notify }
    Resort;
  end;
end;

procedure TNxColumn6.SetUnique(const Value: Boolean);
begin
  FUnique := Value;
end;

procedure TNxColumn6.SetVerticalAlignment(const Value: TVerticalAlignment);
begin
  if Value <> FVerticalAlignment then
  begin
    FVerticalAlignment := Value;
    Changed;
  end;
end;

procedure TNxColumn6.SetVisible(const Value: Boolean);
begin
  if Value <> FVisible then
  begin
    FVisible := Value;

    { Update VisibleCount, VisibleIndex etc. }
    if Assigned(Columns) then Columns.Show(Self, Value);
  end;
end;

procedure TNxColumn6.SetWidth(const Value: Integer);
var
  Delta, T, Max: Integer;
begin
  { Recursion? }
  if not ((csWidthSet in FState)
    or (csLeftSet in FState)) then
  begin

    T := Width;

    if not AutoSize then
    begin

      FWidth := Value;

      { Min Size }
      if FWidth < FMinWidth
        then FWidth := FMinWidth;

      Delta := FWidth - T;

    end else
    begin
      Max := Columns.ClientWidth - Right;

      FAutoWidth := Value;

      Delta := FAutoWidth - T;

//      OldFactor := FSizeFactor;

      { Set new SizeFactor }
      if Columns.FlexibleWidth = 0
        then FSizeFactor := 1
          else FSizeFactor := FAutoWidth / Columns.FlexibleWidth;

//      FactorDelta := Max / Columns.FlexibleWidth;

    //  if not (csLoading in ComponentState) then
      if Max > 0 then
      begin
        if Assigned(Columns) then

          Columns.FitInSpace(Max, -Delta, Position);
      end;
//      Columns.ShiftSizeFactors(Position, FactorDelta, sdLeftToRight);

    end;

    { Set Left of other }
    if not (csLoading in ComponentState)
      and Assigned(Columns) then
    begin
      try
        { Left prop update Width, so we
          prevent recursion }
        Include(FState, csWidthSet);

        { Update other }
       // ShiftBy(Delta);
      finally
        Exclude(FState, csWidthSet);
      end;

      Columns.UpdateAutoSizes;

      Resized(Delta); { Refresh }
    end;
  end;
end;

procedure TNxColumn6.SetWidthSilent(Value: Integer);
begin
  if AutoSize
    then FAutoWidth := Value
    else FWidth := Value;
end;

procedure TNxColumn6.ShiftBy(Delta: Integer);
begin
  if Assigned(Next) then
    Next.Left := Next.Left + Delta;
end;

function TNxColumn6.ToObject: TObject;
begin
  Result := Self;
end;

procedure TNxColumn6.WriteInsertValue(Writer: TWriter);
begin
  if Assigned(FInsertValue) then
  begin
    Writer.WriteString(InsertValue.AsString);
  end;
end;

{ TNxColumns }

function TNxColumns6.Add(ColumnClass: TNxColumnClass; Caption: WideString;
  ShortCaption: WideString): TNxColumn6;
begin
  try
    Result := ColumnClass.Create(FOwner);

    Result.Header.Caption := Caption;
    Result.Header.ShortCaption := ShortCaption;

    { Add Column into Lists }
    Add(Result);
  except
    FreeAndNil(Result);
    raise;
  end;
end;

procedure TNxColumns6.Add(Column: TNxColumn6);
begin
  if Assigned(Column) then
  begin
    { Add into actual List }
    FItems.Add(TNxColumn6(Column));

    { Add into position List }
    FPositions.Add(TNxColumn6(Column));

    { Associate }
    Column.Columns := Self;

    if Column.Visible then
    begin
      { Set Left, Position & VisibleIndex Prop. }
      Column.SetProp(LeftOf(Column.Index), Column.Index, FVisibleCount);

      { Increment VisibleCount }
      Inc(FVisibleCount);
    end;

    { ParentColor & ParentFont }
    SetParentProp(Column);

    { LastAdded Prop. }
    FLastAdded := Column;

    { Trigger Event }
    DoAdd;

  end else
    raise EInvalidInsert.Create(exNilParameter);
end;

procedure TNxColumns6.AddSorted(Column: TNxColumn6);
begin
  FSortedList.Add(Column);
end;

function TNxColumns6.Check(const Index: Integer): Boolean;
begin
  Result := Exist(Index);

  { Raise Exception }
  if not Result then
    raise Exception.CreateFmt(exColumnNotExists, [Index]);
end;

procedure TNxColumns6.Clear;
begin
  FSortedColumn := nil;
  DestroyItems;
end;

function TNxColumns6.Clone(Source: TNxColumn6): TNxColumn6;
begin
  if Assigned(Source) then
  begin
    { Create New Column with same type as Source }
    Result := Add(TNxColumnClass(Source.ClassType));

    { Copy Properties }
    Result.Assign(TPersistent(Source));
  end else Result := nil;
end;

constructor TNxColumns6.Create;
begin
  FItems := TList.Create;
  FLastAdded := nil;
  FOwner := AOwner;
  FPositions := TList.Create;
  FSearchingColumn := nil;
  FSortedColumn := nil;
  FSortedList := TList.Create;
  FVisibleCount := 0;
end;

procedure TNxColumns6.Delete(const Index: Integer);
begin
  if Item[Index].Sorted then FSortedColumn := nil;

  { Destructor will update TList & notify Grid }
  Item[Index].Free;
end;

procedure TNxColumns6.DeleteSorted(const Index: Integer);
begin
  if InRange(Index, 0, FSortedList.Count - 1) then FSortedList.Delete(Index);
end;

procedure TNxColumns6.DeleteSorted(Column: TNxColumn6);
begin
  if IndexOf(Column) > -1 then FSortedList.Delete(FSortedList.IndexOf(Column));
end;

destructor TNxColumns6.Destroy;
begin
  Clear;
  FreeAndNil(FItems);
  FreeAndNil(FPositions);
  FreeAndNil(FSortedList);
  inherited;
end;

procedure TNxColumns6.DestroyItems;
var
  i: Integer;
begin
  for i := Pred(Count) downto 0 do Item[i].Free;

  { Clear TLists }
  FItems.Clear;
  FPositions.Clear;

  { Reset VisibleCount }
  FVisibleCount := 0;
end;

procedure TNxColumns6.DoAdd(Index: Integer);
begin
  if Assigned(FOnAdd) then FOnAdd(Self, Index);
end;

procedure TNxColumns6.DoChanged(Sender: TNxColumn6; Area: TNxGridArea);
begin
  if Assigned(FOnChanged) then FOnChanged(Sender, Area);
end;

procedure TNxColumns6.DoFilter;
begin
  if Assigned(FOnFilter) then FOnFilter(Self);
end;

procedure TNxColumns6.DoRemove(Sender: TNxColumn6; Index: Integer);
begin
  if Assigned(FOnRemove) then FOnRemove(Sender, Index);
end;

procedure TNxColumns6.DoResized(Sender: TNxColumn6; Delta: Integer);
begin
  if Assigned(FOnResized) then FOnResized(Sender, Delta);
end;

procedure TNxColumns6.DoSort(Sender: TNxColumn6);
begin
  { Set Prop. }
  if Sender.Sorted
    then FSortedColumn := Sender;

  { OnSort trigger OnAfterSort }
  if Assigned(FOnSort) then FOnSort(Sender);
end;

procedure TNxColumns6.DoUpdate;
begin
  if Assigned(FOnUpdate) then FOnUpdate(Self);
end;

function TNxColumns6.Exist(const Index: Integer): Boolean;
begin
  Result := HasItems and InRange(Index, 0, Pred(Count));
end;

procedure TNxColumns6.FitInSpace(Space, Delta, Index: Integer);
var
  i, Size, Sum, E: Integer;
  F: Extended;
begin
  Sum := 0;
//  X := Delta / Space;
  for i := Succ(Index) to Pred(Count) do
    with PositionItem[i] do
      if AutoSize and Visible then
      begin
        // Procenat
        F := Width / Space;

        // Parce u px.
        E := Round(Delta * F);

        Size := Width + E;

        Inc(Sum, Abs(Size));
        if Sum > Space then Dec(Sum);

        if FlexibleWidth = 0
          then SizeFactor := 1
            else SizeFactor := Size / FlexibleWidth;
      end;
end;

function TNxColumns6.GetAtPos(X, Y: Integer): TNxColumn6;
var
  i: Integer;
  Col: TNxColumn6;
begin
  Result := nil;

  for i := 0 to Pred(Count) do
  begin
    Col := PositionItem[i];

    if Col.Visible
      and InRange(X, Col.Left, Col.Right) then
    begin
      Result := Col;

      { Done }
      Exit;
    end;
  end;

end;

function TNxColumns6.GetCount: Integer;
begin
  Result := FItems.Count;
end;

function TNxColumns6.GetFirstVisible: Integer;
var
  i: Integer;
begin
  Result := -1;
  for i := 0 to Pred(Count) do
  begin
    if Item[i].Visible then
    begin
      Result := i;
      Exit;
    end;
  end;
end;

function TNxColumns6.GetFixedWidth: Integer;
var
  i: Integer;
begin
  Result := 0;
  for i := 0 to Pred(Count) do
    if Item[i].Visible and not Item[i].AutoSize then
      Inc(Result, MulDiv(Item[i].FixedWidth, Screen.PixelsPerInch, 96));
end;

function TNxColumns6.GetFlexibleWidth: Integer;
var
  i: Integer;
begin
  Result := 0;
  for i := 0 to Pred(Count) do
    if Item[i].Visible and Item[i].AutoSize
      then Inc(Result, MulDiv(Item[i].Width, Screen.PixelsPerInch, 96));
end;

function TNxColumns6.GetInsertValue(Index: Integer): INxBaseCell;
begin
  Result := TNxColumn6(FItems[Index]).InsertValue;
end;

function TNxColumns6.GetItem(Index: Integer): TNxColumn6;
begin
  try
    Result := TNxColumn6(FItems[Index]);
  except
    raise EAccessViolation.CreateFmt(exColumnNotExists, [Index]);
  end;
end;

function TNxColumns6.GetItemBy(Index: Variant): TNxColumn6;
var
  i: Integer;
begin
  Result := nil;

  if VarIsStr(Index) then
  begin

    for i := 0 to Pred(Count) do
      if CompareText(Index, Item[i].Name) = EqualsValue then
      begin
        Result := Item[i];

        { Done }
        Exit;
      end;

    if CompareText(Index, 'first') = EqualsValue
      then Result := Item[0]
    else if CompareText(Index, 'last') = EqualsValue
      then Result := Item[Pred(Count)]
    else if CompareText(Index, 'sorted') = EqualsValue
      then Result := SortedColumn;

    { Cancel }
    Exit;
  end;

  if VarIsNumeric(Index)
    then Result := Item[Index];

end;

function TNxColumns6.GetMultiSortedColumn(const Index: Integer): TNxColumn6;
begin
  Result := TNxColumn6(FSortedList[Index]);
end;

function TNxColumns6.GetMultiSortedCount: Integer;
begin
  Result := FSortedList.Count;
end;

function TNxColumns6.GetPositionItem(Index: Integer): TNxColumn6;
begin
  Result := TNxColumn6(FPositions[Index]);
end;

function TNxColumns6.GetVisibleWidth: Integer;
var
  i: Integer;
begin
  Result := 0;
  for i := 0 to Pred(Count)
    do if Item[i].Visible then Inc(Result, Item[i].Width);
end;

function TNxColumns6.HasItems: Boolean;
begin
  Result := Count > 0;
end;

function TNxColumns6.IndexOf(Column: TNxColumn6): Integer;
begin
  Result := FItems.IndexOf(Column);
end;

procedure TNxColumns6.Insert(Index: Integer; Column: TNxColumn6);
begin
  if Assigned(Column) then
  begin
    { Add into actual List }
    FItems.Insert(Index, Column);

    { Add into position List. Position will be last }
    FPositions.Add(Column);

    { Associate }
    Column.Columns := Self;

    { Increment VisibleCount }
    if Column.Visible then
    begin
      Inc(FVisibleCount);

      { Set Prop. start with this }
      Update(Column.Index);
    end;

    { ParentColor & ParentFont }
    SetParentProp(Column);

    { LastAdded Prop. }
    FLastAdded := Column;

    { Trigger Event }
    DoAdd;


  end else
    raise EInvalidInsert.Create('Can''t insert nil as Column parameter');
end;

function TNxColumns6.Insert(Index: Integer; ColumnClass: TNxColumnClass): TNxColumn6;
begin
  try
    Result := ColumnClass.Create(nil);

    Insert(Index, Result);
  except
    FreeAndNil(Result);
    raise;
  end;
end;

function TNxColumns6.LeftOf(Index: Integer): Integer;
var
  i: Integer;
begin
  Result := 0;
  if Exist(Index) then
    for i := 0 to Pred(Index) do
      if Item[i].Visible then
        Inc(Result, MulDiv(Item[i].Width, Screen.PixelsPerInch, 96));
end;

procedure TNxColumns6.Move(CurIndex, NewIndex: Integer);
begin
  if Exist(CurIndex) and Exist(NewIndex)
    and (CurIndex <> NewIndex) then
  begin
    { Positions will NOT be changed }
    FItems.Move(CurIndex, NewIndex);

    { Update Left }
    Update;
  end;
end;

function TNxColumns6.PositionOf(Column: TNxColumn6): Integer;
begin
  Result := FPositions.IndexOf(Column);
end;

procedure TNxColumns6.Remove(Column: TNxColumn6);
var
  ColIndex: Integer;
begin
  if Column = FLastAdded
    then FLastAdded := nil;

  ColIndex := Column.Index;

  FItems.Remove(Column);
  FPositions.Remove(Column);
  FSortedList.Remove(Column);

  if Column.Visible then Dec(FVisibleCount);

  { Notify Grid }
  DoRemove(Column, ColIndex);

  { Update Left & Pos }
  Update;
end;

procedure TNxColumns6.UpdateSizeFactors(Max: Integer;
  Index: Integer = -1);
var
  i: Integer;
  Ratio: Extended;
begin
  for i := Succ(Index) to Pred(Count) do
  begin

    if PositionItem[i].Visible then
    begin
      if PositionItem[i].AutoSize then
      begin
        Ratio := Item[i].FixedWidth / Max;

        PositionItem[i].SetSizeFactor(Ratio);
      end;
    end;

  end;

end;

procedure TNxColumns6.UpdateStoredPositions;
var
  i: Integer;
begin
  for i := 0 to Pred(FPositions.Count) do
  begin
    FPositions[Item[i].FStoredPosition] := Item[i];
  end;
end;

procedure TNxColumns6.UpdateAutoSizes(Index: Integer);
var
  i, FlexibleSpace, AWidth, Sum: Integer;
begin
  FlexibleSpace := ClientWidth - FixedWidth;

  Sum := 0;

  for i := Index + 1 to Pred(Count) do
  begin

    if PositionItem[i].Visible then
    begin
      if PositionItem[i].AutoSize then
      begin
        AWidth := Round(FlexibleSpace * PositionItem[i].SizeFactor);

        Sum := Sum + AWidth;

        if Sum > FlexibleSpace then Dec(AWidth);

        PositionItem[i].SetAutoWidth(AWidth);
      end;
    end;

  end;

  { Trigger event }
  DoUpdate;

  { Set Left & Position }
  Update;
end;

procedure TNxColumns6.SetParentProp(Column: TNxColumn6);
begin
  with Column do
  begin
    if ParentColor then ParentColor := True;
    if ParentFont then ParentFont := True;
  end;
end;

procedure TNxColumns6.SetPositionItem(Index: Integer; const Value: TNxColumn6);
begin
  FPositions[Index] := Value;
end;

procedure TNxColumns6.ShiftSizeFactors(Index: Integer; Delta: Extended;
  Direction: TNxSizeShiftDirection);
var
  i: Integer;
begin
  case Direction of
    sdLeftToRight:
      for i := Succ(Index) to Pred(Count) do
        with PositionItem[i] do SizeFactor := SizeFactor * Delta;
    else
      for i := 0 to Pred(Count) do
        if i <> Index then
          with PositionItem[i] do if AutoSize then SizeFactor := SizeFactor + SizeFactor * Delta;
  end;
end;

procedure TNxColumns6.Show(Column: TNxColumn6; Visible: Boolean);
begin
  Update;

  { VisibleCount }
  Inc(FVisibleCount, IfThen(Visible, 1, -1));

  DoResized(Column, 0);
end;

function TNxColumns6.SortedIndexOf(Column: TNxColumn6): Integer;
begin
  Result := FSortedList.IndexOf(Column);
end;

function TNxColumns6.UniqueName(const BaseName: string): string;
var
  i: Integer;
begin
  i := 1;
//  while Control.Owner.Owner.FindComponent(BaseName + IntToStr(i)) <> nil do Inc(i);
  Result := BaseName + IntToStr(i);
end;

procedure TNxColumns6.UnsortAll;
var
  i: Integer;
begin
  for i := 0 to Pred(Count) do
    Item[i].Sorted := False;
end;

procedure TNxColumns6.Update(AIndex: Integer = 0);
var
  APosition, ALeft: Integer;
begin
  { Start }
  ALeft := 0;
  APosition := 0;

  { Not first? }
  if AIndex > 0 then
  begin
    ALeft := LeftOf(AIndex);
    APosition := Item[AIndex].Position;
  end;

  while APosition < Count do
    with PositionItem[APosition] do
    begin

      { Shift Left & VisibleIndex }
      if Visible then
      begin
        { Set Left, Position, VisibleIndex }
        SetProp(ALeft, APosition, AIndex);

        Inc(ALeft, MulDiv(Width, Screen.PixelsPerInch, 96));
        Inc(AIndex);
      end
      else
        SetProp(0, APosition, -1);

      { Shift Position }
      Inc(APosition);
    end;
end;

{ TNxTextColumn6 }

procedure TNxTextColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxTextColumn6 then
  begin
    EditCharCase := TNxTextColumn6(Source).EditCharCase;
    EditOptions := TNxTextColumn6(Source).EditOptions;
    Filter := TNxTextColumn6(Source).Filter;
    FilterOptions := TNxTextColumn6(Source).FilterOptions;
    MaxLength := TNxTextColumn6(Source).MaxLength;
    MultiLine := TNxTextColumn6(Source).MultiLine;
    PasswordChar := TNxTextColumn6(Source).PasswordChar;
    TextAfter := TNxTextColumn6(Source).TextAfter;
    TextBefore := TNxTextColumn6(Source).TextBefore;
    TextTransform := TNxTextColumn6(Source).TextTransform;
    WrapKind := TNxTextColumn6(Source).WrapKind;
  end;
end;

procedure TNxTextColumn6.AssignDefaultValue(Cell: INxBase);
begin
  Cell.AsString := DefaultValue;
end;

procedure TNxTextColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxEdit6(GetComponent(FInplaceEdit)) do
  begin
    EditCharCase := Self.EditCharCase;
    EditOptions := Self.EditOptions;
    MaxLength := Self.MaxLength;
  end;
end;

constructor TNxTextColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FDefaultValue := EmptyStr;
  FEditCharCase := ecNormal;
  FEditOptions := [edPaste, edTyping];
  FFilterOptions := [];
  FMaxLength := 0;
  FMultiLine := False;
  FPasswordChar := #0;
  FPlaceholderText := 'Text Text';
  FShowTextFitHint := True;
  FTextAfter := '';
  FTextBefore := '';
  FTextTransform := ttNone;
  FWrapKind := wkEllipsis;
end;

procedure TNxTextColumn6.CreateInplaceEdit;
begin
  inherited;
  FInplaceEdit := TNxEdit6.Create(Self);
end;

function TNxTextColumn6.CreateView: INxColumnView;
begin
  Result := TNxTextColumnView.Create;
end;

destructor TNxTextColumn6.Destroy;
begin
  inherited;

end;

procedure TNxTextColumn6.DoGetValue(ACol, ARow: Integer; var Value: WideString);
begin
  if Assigned(FOnGetValue) then FOnGetValue(Self, ACol, ARow, Value);
end;

procedure TNxTextColumn6.DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor; var FontStyle: TFontStyles;
  CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  if Assigned(FOnStyleTextEvent) then FOnStyleTextEvent(Self, ACol, ARow, FontColor, FillColor, FontStyle, CellValue, CellState);
end;

function TNxTextColumn6.GetDisplayText(Cell: INxBase;
  ACol, ARow: Integer): WideString;
begin
  if CanPaintContent(Cell) then
  begin
    Result := Concat(FTextBefore, GetValue(Cell, ACol, ARow), FTextAfter);

    { PasswordChar is Set }
    if PasswordChar <> #0 then
    begin
      Result := StringOfChar(PasswordChar, Length(Result));
    end;

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);
  end
  else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxTextColumn6.GetShowTextFitHint: Boolean;
begin
  Result := FShowTextFitHint;
end;

function TNxTextColumn6.GetValue(Cell: INxBase;
  ACol, ARow: Integer): WideString;
var
  S: WideString;
begin
  { Actual value }
  Result := Cell.AsString;

  case FTextTransform of
    ttNone: ;
    ttUpperCase: S := UpperCase(Result);
    ttLowerCase: S := LowerCase(Result);
    ttCapitalize: if Length(Result) > 0 then S := UpperCase(Result[1]);
  end;

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxTextColumn6.GetWrapKind: TNxWrapKind;
begin
  Result := FWrapKind;
end;

function TNxTextColumn6.IsEmpty(Cell: INxBase): Boolean;
begin
  Result := Cell.AsString = EmptyStr;
end;

function TNxTextColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  { Don't filter }
  Result := inherited IsMatchFilter(Cell);

  if Filter <> EmptyStr then
    case foCaseSensitive in FFilterOptions of
      True:
        case foExactMatch in FFilterOptions of
          True: Result := WideCompareStr(Cell.AsString, Filter) = CompareEqual;
          else Result := Pos(Filter, Cell.AsString) > 0;
        end;
      else
        case foExactMatch in FFilterOptions of
          True: Result := WideCompareText(Cell.AsString, Filter) = CompareEqual;
          else Result := Pos(WideLowerCase(Filter), WideLowerCase(Cell.AsString)) > 0;
        end;
    end;
end;

procedure TNxTextColumn6.SetEditOptions(const Value: TNxEditOptions);
begin
  FEditOptions := Value;
end;

procedure TNxTextColumn6.SetFilter(const Value: WideString);
begin
  FFilter := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

procedure TNxTextColumn6.SetFilterOptions(const Value: TNxStringFilterOptions);
begin
  FFilterOptions := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

procedure TNxTextColumn6.SetMaxLength(const Value: Integer);
begin
  if InRange(Value, 0, MaxInt) then
  begin
    FMaxLength := Value;

    Changed; { Notify }
  end;
end;

procedure TNxTextColumn6.SetMultiline(const Value: Boolean);
begin
  FMultiLine := Value;

  Changed; { Notify }
end;

procedure TNxTextColumn6.SetPasswordChar(const Value: TChar);
begin
  FPasswordChar := Value;

  Changed; { Notify }
end;

procedure TNxTextColumn6.SetShowTextFitHint(const Value: Boolean);
begin
  FShowTextFitHint := Value;
end;

procedure TNxTextColumn6.SetTextAfter(const Value: WideString);
begin
  FTextAfter := Value;

  Changed; { Notify }
end;

procedure TNxTextColumn6.SetTextBefore(const Value: WideString);
begin
  FTextBefore := Value;

  Changed; { Notify }
end;

procedure TNxTextColumn6.SetTextTransform(const Value: TNxTextTransform);
begin
  FTextTransform := Value;

  Changed; { Notify }
end;

procedure TNxTextColumn6.SetWrapKind(const Value: TNxWrapKind);
begin
  if Value <> FWrapKind then
  begin
    FWrapKind := Value;

    Changed; { Notify }
  end;
end;

{ TNxIntegerColumn6 }

procedure TNxIntegerColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxIntegerColumn6 then
  begin
    Filter := TNxIntegerColumn6(Source).Filter;
  end;
end;

constructor TNxIntegerColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FFilter := EmptyStr;
  FPlaceholderText := '3';
end;

function TNxIntegerColumn6.CreateView: INxColumnView;
begin
  Result := TNxTextColumnView.Create;
end;

procedure TNxIntegerColumn6.DoGetValue(ACol, ARow: Integer; var Value: Integer);
begin
  if Assigned(OnGetValue) then OnGetValue(Self, ACol, ARow, Value);
end;

function TNxIntegerColumn6.GetDataType: TNxDataType;
begin
  Result := dtInteger;
end;

function TNxIntegerColumn6.GetDisplayText(Cell: INxBase;
  ACol, ARow: Integer): WideString;
begin
  if CanPaintContent(Cell) then
  begin
    Result := IntToStr(GetValue(Cell, ACol, ARow));

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);

  end else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxIntegerColumn6.GetValue(Cell: INxBase; ACol, ARow: Integer): Integer;
begin
  { Actual value }
  Result := Cell.AsInteger;

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxIntegerColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  Result := EvalFloat(Filter, Cell.AsInteger);
end;

procedure TNxIntegerColumn6.SetFilter(const Value: string);
begin
  FFilter := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

{ TNxFloatColumn }

procedure TNxFloatColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxFloatColumn6 then
  begin
    EditOptions := TNxFloatColumn6(Source).EditOptions;
    EmptyValue := TNxFloatColumn6(Source).EmptyValue;
    Filter := TNxFloatColumn6(Source).Filter;
    FormatMask := TNxFloatColumn6(Source).FormatMask;
    Max := TNxFloatColumn6(Source).Max;
    Min := TNxFloatColumn6(Source).Min;
    NumericEditOptions := TNxFloatColumn6(Source).NumericEditOptions;
    Precision := TNxFloatColumn6(Source).Precision;
    TextAfter := TNxFloatColumn6(Source).TextAfter;
    TextBefore := TNxFloatColumn6(Source).TextBefore;
  end;
end;

procedure TNxFloatColumn6.AssignDefaultValue(Cell: INxBase);
begin
  Cell.AsFloat := DefaultValue;
end;

procedure TNxFloatColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxSpinEdit6(GetComponent(FInplaceEdit)) do
  begin
    EditOptions := Self.EditOptions;
    Max := Self.Max;
    Min := Self.Min;
    NumericEditOptions := Self.NumericEditOptions;
    Precision := Self.Precision;
  end;
end;

constructor TNxFloatColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FDefaultValue := 0;
  FEditOptions := [edPaste, edTyping];
  FFormatMask := stFormatMask;
  FFilter := '';
  FMax := 0;
  FMin := 0;
  FNumericEditOptions := [ednDecimals, ednSigns];
  FPrecision := 2;
  FSortType := stNumeric;
end;

destructor TNxFloatColumn6.Destroy;
begin
  inherited;
end;

procedure TNxFloatColumn6.DoGetValue(ACol, ARow: Integer; var Value: Double);
begin
  if Assigned(FOnGetValue) then FOnGetValue(Self, ACol, ARow, Value);
end;

function TNxFloatColumn6.GetDataType: TNxDataType;
begin
  Result := dtFloat;
end;

function TNxFloatColumn6.GetDisplayText(Cell: INxBase;
  ACol, ARow: Integer): WideString;
begin
  if CanPaintContent(Cell) then
  begin
    if FormatMask = EmptyStr
      then Result := FloatToStrF(GetValue(Cell, ACol, ARow), ffNumber, 18, FPrecision)
      else Result := FormatFloat(FormatMask, GetValue(Cell, ACol, ARow));

    Result := Concat(FTextBefore, Result, FTextAfter);

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);

  end else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxFloatColumn6.GetEditText(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  Result := FloatToStrF(GetValue(Cell, ACol, ARow), ffNumber, 18, FPrecision);
end;

function TNxFloatColumn6.GetMax: Double;
begin
  Result := FMax;
end;

function TNxFloatColumn6.GetMin: Double;
begin
  Result := FMin;
end;

function TNxFloatColumn6.GetValue(Cell: INxBase; ACol, ARow: Integer): Double;
begin
  { Actual value }
  Result := Cell.AsFloat;

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxFloatColumn6.IsEmpty(Cell: INxBase): Boolean;
begin
  Result := Cell.AsFloat = EmptyValue;
end;

function TNxFloatColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  Result := EvalFloat(Filter, Cell.AsFloat);
end;

procedure TNxFloatColumn6.SetEditOptions(const Value: TNxEditOptions);
begin
  FEditOptions := Value;
end;

procedure TNxFloatColumn6.SetEmptyValue(const Value: Double);
begin
  FEmptyValue := Value;
end;

procedure TNxFloatColumn6.SetFilter(const Value: string);
begin
  FFilter := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

procedure TNxFloatColumn6.SetFormatMask(const Value: string);
begin
  FFormatMask := Value;
end;

procedure TNxFloatColumn6.SetMax(const Value: Double);
begin
  FMax := Value;
end;

procedure TNxFloatColumn6.SetMin(const Value: Double);
begin
  FMin := Value;
end;

procedure TNxFloatColumn6.SetNumericEditOptions(
  const Value: TNxNumericEditOptions);
begin
  FNumericEditOptions := Value;
end;

procedure TNxFloatColumn6.SetPrecision(const Value: Integer);
begin
  FPrecision := Value;
end;

procedure TNxFloatColumn6.SetTextAfter(const Value: WideString);
begin
  FTextAfter := Value;
end;

procedure TNxFloatColumn6.SetTextBefore(const Value: WideString);
begin
  FTextBefore := Value;
end;

{ TNxIncrementColumn6 }

constructor TNxIncrementColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FStyle := [];

  { Init. fields }
  FOffset := 1;
  FPlaceholderText := '1';
  FTextAfter := EmptyStr;
  FTextBefore := EmptyStr;
  FWrapKind := wkEllipsis;
end;

procedure TNxIncrementColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := nil;
end;

function TNxIncrementColumn6.GetDataType: TNxDataType;
begin
  Result := dtAutoInc;
end;

function TNxIncrementColumn6.GetDisplayText(Cell: INxBase; ACol,
  ARow: Integer): WideString;
begin
  if CanPaintContent(Cell) then
  begin
    Result := TextBefore + IntToStr(GetValue(Cell, ACol, ARow)) + TextAfter;

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);

  end else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxIncrementColumn6.GetValue(Cell: INxBase; ACol, ARow: Integer): Integer;
begin
  { Actual value }
  Result := Cell.AsInteger;

  Inc(Result, FOffset);

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxIncrementColumn6.GetWrapKind: TNxWrapKind;
begin
  Result := FWrapKind;
end;

procedure TNxIncrementColumn6.SetOffset(const Value: Integer);
begin
  if Value <> FOffset then
  begin
    FOffset := Value;
    Changed;
  end;
end;

procedure TNxIncrementColumn6.SetTextAfter(const Value: WideString);
begin
  if Value <> FTextAfter then
  begin
    FTextAfter := Value;
    Changed;
  end;
end;

procedure TNxIncrementColumn6.SetTextBefore(const Value: WideString);
begin
  if Value <> FTextBefore then
  begin
    FTextBefore := Value;
    Changed;
  end;
end;

procedure TNxIncrementColumn6.SetWrapKind(const Value: TNxWrapKind);
begin
  if Value <> FWrapKind then
  begin
    FWrapKind := Value;
    Changed(gaBody);
  end;
end;

{ TNxNumberColumn6 }

procedure TNxNumberColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxNumberColumn6 then
  begin
    Increment := TNxNumberColumn6(Source).Increment;
    SpinButtons := TNxNumberColumn6(Source).SpinButtons;
  end;
end;

procedure TNxNumberColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxSpinEdit6(GetComponent(FInplaceEdit)) do
  begin
    Increment := FIncrement;
    SpinButtons := FSpinButtons;
    Precision := FPrecision;
  end;
end;

constructor TNxNumberColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FAlignment := taRightJustify;
  FIncrement := 1;
  FPlaceholderText := '1742.50';
  FShowTextFitHint := True;
  FSpinButtons := True;
  FWrapKind := wkEllipsis;
end;

procedure TNxNumberColumn6.CreateInplaceEdit;
begin
  inherited;
  FInplaceEdit := TNxSpinEdit6.Create(Self);
end;

function TNxNumberColumn6.CreateView: INxColumnView;
begin
  Result := TNxTextColumnView.Create;
end;

procedure TNxNumberColumn6.DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
  var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  if Assigned(FOnStyleText) then FOnStyleText(Self, ACol, ARow, FontColor, FillColor, FontStyle, CellValue, CellState);
end;

function TNxNumberColumn6.GetShowTextFitHint: Boolean;
begin
  Result := FShowTextFitHint;
end;

function TNxNumberColumn6.GetWrapKind: TNxWrapKind;
begin
  Result := FWrapKind;
end;

procedure TNxNumberColumn6.SetShowTextFitHint(const Value: Boolean);
begin
  FShowTextFitHint := Value;
end;

procedure TNxNumberColumn6.SetSpinButtons(const Value: Boolean);
begin
  FSpinButtons := Value;
end;

procedure TNxNumberColumn6.SetWrapKind(const Value: TNxWrapKind);
begin
  if Value <> FWrapKind then
  begin
    FWrapKind := Value;
    Changed(gaBody);
  end;
end;

{ TNxButtonColumn }

procedure TNxButtonColumn6.AdjustEditRect(var EditRect: TRect);
begin
  inherited;
  if AlwaysShowButton then EditRect.Right := EditRect.Right - ButtonWidth - Padding.Right;
end;

procedure TNxButtonColumn6.AssignInplaceEdit;
begin
  inherited;
  with GetComponent(FInplaceEdit) as TNxButtonEdit6 do
  begin
    ShowButton := not AlwaysShowButton;
    AutoText := Self.AutoText;
    ButtonCaption := Self.ButtonCaption;
    ButtonGlyph := Self.ButtonGlyph;
    ButtonWidth := Self.ButtonWidth;
    OnButtonClick := Self.OnButtonClick;
  end;
end;

constructor TNxButtonColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FAlwaysShowButton := False;
  FAutoText := '';
  FButtonGlyph := TPicture.Create;
  FButtonWidth := szExecuteButton;
  FButtonHeight := 0;
end;

procedure TNxButtonColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxButtonEdit6.Create(Self);
end;

function TNxButtonColumn6.CreateView: INxColumnView;
begin
  Result := TNxButtonColumnView.Create;
end;

destructor TNxButtonColumn6.Destroy;
begin
  FreeAndNil(FButtonGlyph);
  inherited;
end;

procedure TNxButtonColumn6.SetAlwaysShowButton(const Value: Boolean);
begin
  if Value <> FAlwaysShowButton then
  begin
    FAlwaysShowButton := Value;
    Changed;
  end;
end;

procedure TNxButtonColumn6.SetButtonGlyph(const Value: TPicture);
begin
  FButtonGlyph.Assign(Value);
  Changed;
end;

procedure TNxButtonColumn6.SetButtonHeight(const Value: Integer);
begin
  if Value <> ButtonHeight then
  begin
    FButtonHeight := Value;
    Changed;
  end;
end;

procedure TNxButtonColumn6.SetButtonWidth(const Value: Integer);
begin
  if Value <> FButtonWidth then
  begin
    FButtonWidth := Value;
    Changed;
  end;
end;

{ TNxMemoColumn6 }

procedure TNxMemoColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxMemoColumn6 then
  begin
    EditOptions := TNxMemoColumn6(Source).EditOptions;
    MultiLineEditOptions := TNxMemoColumn6(Source).MultiLineEditOptions;
    ShowTextFitHint := TNxMemoColumn6(Source).ShowTextFitHint;
  end;
end;

procedure TNxMemoColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxMemo6(FInplaceEdit) do
  begin
    EditOptions := FEditOptions;
    WordWrap := meWordWrap in FMultiLineEditOptions;
  end;
end;

constructor TNxMemoColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FEditOptions := [edPaste, edTyping];
  FMultiLineEditOptions := [];
  FPlaceholderText := 'The quick brown fox jumps over the lazy dog';
  FShowTextFitHint := True;
end;

procedure TNxMemoColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxMemo6.Create(Self);
end;

function TNxMemoColumn6.CreateView: INxColumnView;
begin
  Result := TNxMemoColumnView.Create;
end;

function TNxMemoColumn6.GetShowTextFitHint: Boolean;
begin
  Result := FShowTextFitHint;
end;

procedure TNxMemoColumn6.SetEditOptions(const Value: TNxEditOptions);
begin
  FEditOptions := Value;
end;

procedure TNxMemoColumn6.SetMultiLineEditOptions(
  const Value: TNxMultiLineEditOptions);
begin
  FMultiLineEditOptions := Value;
end;

procedure TNxMemoColumn6.SetShowTextFitHint(const Value: Boolean);
begin
  FShowTextFitHint := Value;
end;

{ TNxDateColumn6 }

procedure TNxDateColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxDateColumn6 then
  begin
    AutoClose := TNxDateColumn6(Source).AutoClose;
    EditOptions := TNxDateColumn6(Source).EditOptions;
    EmptyValue := TNxDateColumn6(Source).EmptyValue;
    Filter := TNxDateColumn6(Source).Filter;
    FilterOptions := TNxDateColumn6(Source).FilterOptions;
    PopupAnchor := TNxDateColumn6(Source).PopupAnchor;
    WrapKind := TNxDateColumn6(Source).WrapKind;
  end;
end;

procedure TNxDateColumn6.AssignDefaultValue(Cell: INxBase);
begin
  Cell.AsDateTime := DefaultValue;
end;

procedure TNxDateColumn6.AssignInplaceEdit;
begin
  inherited;
  with GetComponent(FInplaceEdit) as TNxDatePicker6 do
  begin
    EditOptions := FEditOptions;
    PopupAnchor := FPopupAnchor;
  end;
end;

constructor TNxDateColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FAutoClose := True;
  FDefaultValue := 0;
  FEditOptions := [edPaste, edTyping];
  FEmptyValue := 0;
  FFilter := '';
  FFilterOptions := foUserDefined;
  FFormatMask := '';
  FPlaceholderText := DateToStr(Today);
  FPopupAnchor := paLeft;
  FSortType := stDate;
  FWrapKind := wkEllipsis;
end;

procedure TNxDateColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxDatePicker6.Create(Self);
end;

function TNxDateColumn6.CreateView: INxColumnView;
begin
  Result := TNxTextColumnView.Create;
end;

procedure TNxDateColumn6.DoGetValue(ACol, ARow: Integer; var Value: TDateTime);
begin
  if Assigned(FOnGetValue) then FOnGetValue(Self, ACol, ARow, Value);
end;

function TNxDateColumn6.GetDataType: TNxDataType;
begin
  Result := dtDateTime;
end;

function TNxDateColumn6.GetDisplayText(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  { Check is not Hidder or Nil }
  if CanPaintContent(Cell) then
  begin
    if FormatMask = EmptyStr
      then Result := DateTimeToStr(GetValue(Cell, ACol, ARow))
      else Result := FormatDateTime(FormatMask, GetValue(Cell, ACol, ARow));

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);

  end else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxDateColumn6.GetValue(Cell: INxBase; ACol, ARow: Integer): TDateTime;
begin
  { Actual value }
  Result := Cell.AsDateTime;

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxDateColumn6.GetWrapKind: TNxWrapKind;
begin
  Result := FWrapKind;
end;

function TNxDateColumn6.IsEmpty(Cell: INxBase): Boolean;
begin
  Result := Cell.AsDateTime = EmptyValue;
end;

function TNxDateColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  Result := inherited IsMatchFilter(Cell);

  case FilterOptions of
    foTomorrow: Result := TDate(Cell.AsDateTime) = Tomorrow;
    foToday: Result := TDate(Cell.AsDateTime) = Today;
    foYesterday: Result := TDate(Cell.AsDateTime) = Yesterday;
    foThisWeek: Result := (WeekOf(Cell.AsDateTime) = WeekOf(Today)) and (YearOf(Cell.AsDateTime) = YearOf(Today));
    foThisMonth: Result := (MonthOf(Cell.AsDateTime) = MonthOf(Today)) and (YearOf(Cell.AsDateTime) = YearOf(Today));
    foThisYear: Result := YearOf(Cell.AsDateTime) = YearOf(Today);
    foUserDefined: Result := EvalDate(Filter, Cell.AsDateTime);
  end;
end;

procedure TNxDateColumn6.SetEditOptions(const Value: TNxEditOptions);
begin
  FEditOptions := Value;
end;

procedure TNxDateColumn6.SetEmptyValue(const Value: TDateTime);
begin
  FEmptyValue := Value;
end;

procedure TNxDateColumn6.SetFilter(const Value: string);
begin
  FFilter := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

procedure TNxDateColumn6.SetFilterOptions(const Value: TNxDateFilterOptions);
begin
  FFilterOptions := Value;
  if Assigned(FCollection) then FCollection.DoFilter;
end;

procedure TNxDateColumn6.SetFormatMask(const Value: string);
begin
  if Value <> FFormatMask then
  begin
    FFormatMask := Value;
    Changed(gaBody);
  end;
end;

procedure TNxDateColumn6.SetWrapKind(const Value: TNxWrapKind);
begin
  if Value <> FWrapKind then
  begin
    FWrapKind := Value;
    Changed(gaBody);
  end;
end;

{ TNxTimeColumn6 }

procedure TNxTimeColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxTimeColumn6 then
  begin
    HoursText := TNxTimeColumn6(Source).HoursText;
    MinutesText := TNxTimeColumn6(Source).MinutesText;
  end;
end;

procedure TNxTimeColumn6.AssignInplaceEdit;
var
  TimeControl: INxTimeControl;
begin
  inherited;
  if Supports(FInplaceEdit, INxTimeControl, TimeControl) then
  begin
    TimeControl.HoursText := HoursText;
    TimeControl.MinutesText := MinutesText;
  end;
end;

constructor TNxTimeColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FHoursText := 'H';
  FMinutesText := 'M';
  FOptions := [to24HourDay, toMinutes];
end;

procedure TNxTimeColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxTimePicker6.Create(Self);
end;

{ TNxCheckBoxColumn6 }

procedure TNxCheckBoxColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxCheckBoxColumn6 then
  begin
    CheckedImageIndex := TNxCheckBoxColumn6(Source).CheckedImageIndex;
    Images := TNxCheckBoxColumn6(Source).Images;
    UncheckedImageIndex := TNxCheckBoxColumn6(Source).UncheckedImageIndex;
  end;
end;

procedure TNxCheckBoxColumn6.AssignDefaultValue(Cell: INxBase);
begin
  Cell.AsBoolean := DefaultValue;
end;

constructor TNxCheckBoxColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FCheckedImageIndex := -1;
  FImages := nil;
  FInteractionMoveSelection := True;
  FDefaultValue := False;
  FPlaceholderText := BoolToStr(True, True);
  FShowText := False;
  FSortType := stBoolean;
  FUncheckedImageIndex := -1;
end;

function TNxCheckBoxColumn6.CreateView: INxColumnView;
begin
  Result := TNxCheckBoxColumnView.Create;
end;

procedure TNxCheckBoxColumn6.DoCheckedChanged(ACol, ARow: Integer);
begin
  if Assigned(FOnCheckedChanged) then FOnCheckedChanged(Self, ACol, ARow);
end;

procedure TNxCheckBoxColumn6.DoCheckedQuery(ACol, ARow: Integer; var Accept: Boolean);
begin
  if Assigned(FOnCheckedQuery) then FOnCheckedQuery(Self, ACol, ARow, Accept);
end;

procedure TNxCheckBoxColumn6.DoGetValue(ACol, ARow: Integer; var Value: Boolean);
begin
  if Assigned(FOnGetValue) then FOnGetValue(Self, ACol, ARow, Value);
end;

function TNxCheckBoxColumn6.DoPaintImage(Checked: Boolean; var AImages: TCustomImageList;
  var AImageIndex: TImageIndex): Boolean;
begin
  AImages := Images;
  AImageIndex := IfThen(Checked, FCheckedImageIndex, FUncheckedImageIndex);
  Result := Assigned(Images) and InRange(AImageIndex, 0, Pred(Images.Count));
end;

procedure TNxCheckBoxColumn6.DoStyleText(ACol, ARow: Integer; var FontColor, FillColor: TColor;
  var FontStyle: TFontStyles; CellValue: INxBase; CellState: TNxCellPaintingState);
begin
  if Assigned(FOnStyleText) then FOnStyleText(Self, ACol, ARow, FontColor, FillColor, FontStyle, CellValue, CellState);
end;

function TNxCheckBoxColumn6.GetInteractionMoveSelection: Boolean;
begin
  Result := FInteractionMoveSelection;
end;

function TNxCheckBoxColumn6.GetDataType: TNxDataType;
begin
  Result := dtBoolean;
end;

function TNxCheckBoxColumn6.GetHTML(Cell: INxBase; ACol,
  ARow: Integer): WideString;
begin
  Result := '<input type="checkbox" disabled' + IfThen(Cell.AsBoolean, ' checked', '') + ' />';
end;

function TNxCheckBoxColumn6.GetShowText: Boolean;
begin
  Result := FShowText;
end;

function TNxCheckBoxColumn6.GetValue(Cell: INxBase; ACol, ARow: Integer): Boolean;
begin
  { Actual value }
  Result := Cell.AsBoolean;

  { Trigger event }
  DoGetValue(ACol, ARow, Result);
end;

function TNxCheckBoxColumn6.IsEmpty(Cell: INxBase): Boolean;
begin
  Result := Cell.AsBoolean = False;
end;

function TNxCheckBoxColumn6.IsMatchFilter(Cell: INxBase): Boolean;
begin
  Result := EvalBool(Filter, Cell.AsBoolean);
end;

procedure TNxCheckBoxColumn6.SetCheckedImageIndex(const Value: TImageIndex);
begin
  if Value <> FCheckedImageIndex then
  begin
    FCheckedImageIndex := Value;
    if Assigned(Images) then Changed;
  end;
end;

procedure TNxCheckBoxColumn6.SetFilter(const Value: string);
begin
  if Value <> FFilter then
  begin
    FFilter := Value;
    if Assigned(FCollection) then FCollection.DoFilter;
  end;
end;

procedure TNxCheckBoxColumn6.SetImages(const Value: TCustomImageList);
begin
  if Value <> FImages then
  begin
    FImages := Value;
    Changed;
  end;
end;

procedure TNxCheckBoxColumn6.SetShowText(const Value: Boolean);
begin
  if Value <> FShowText then
  begin
    FShowText := Value;
    Changed;
  end;
end;

procedure TNxCheckBoxColumn6.SetUncheckedImageIndex(const Value: TImageIndex);
begin
  if Value <> FUncheckedImageIndex then
  begin
    FUncheckedImageIndex := Value;
    if Assigned(Images) then Changed;
  end;
end;

procedure TNxCheckBoxColumn6.SetValue(Cell: INxBase; ACol, ARow: Integer; Value: Boolean);
begin
  Cell.AsBoolean := Value;
end;

{ TNxComboBoxColumn6 }

procedure TNxComboBoxColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxComboBoxColumn6 then
  begin
    AutoComplete := TNxComboBoxColumn6(Source).AutoComplete;
    AutoDropDown := TNxComboBoxColumn6(Source).AutoDropDown;
    DisplayMode := TNxComboBoxColumn6(Source).DisplayMode;
    ItemHeight := TNxComboBoxColumn6(Source).ItemHeight;
    Items.Assign(TNxComboBoxColumn6(Source).Items);
    ItemsAlignment := TNxComboBoxColumn6(Source).ItemsAlignment;
    PopupAnchor := TNxComboBoxColumn6(Source).PopupAnchor;
    Style := TNxComboBoxColumn6(Source).Style;
  end;
end;

procedure TNxComboBoxColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxComboBox6(GetComponent(FInplaceEdit)) do
  begin
    AutoComplete := Self.AutoComplete;
    AutoDropDown := Self.AutoDropDown;
    DisplayMode := Self.DisplayMode;
    ItemsAlignment := Self.ItemsAlignment;
    ItemHeight := Self.ItemHeight;
    Items := Self.Items;
    PopupAnchor := Self.PopupAnchor;
    Style := Self.Style;
  end;
end;

constructor TNxComboBoxColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FAutoComplete := False;
  FAutoDropDown := False;
  FDisplayMode := dmDefault;
  FItemHeight := szItemHeight;
  FItems := TNxStringList.Create;
  FItemsAlignment := taLeftJustify;
  FListWidth := 0;
  FPopupAnchor := paLeft;
  FStyle := dsDropDown;
end;

procedure TNxComboBoxColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxComboBox6.Create(Self);
end;

destructor TNxComboBoxColumn6.Destroy;
begin
  FItems.Free;
  inherited;
end;

procedure TNxComboBoxColumn6.SetItems(const Value: TStrings);
begin
  FItems.Assign(Value);
end;

{ TNxListColumn6 }

procedure TNxListColumn6.AssignEditValue(Cell: INxBase;
  InplaceEdit: INxInplaceEdit);
var
  Intf: INxProperty;
begin
  if Supports(InplaceEdit, INxProperty, Intf) then
  begin
    Cell.AsInteger := Intf.AsInteger;
  end;
end;

procedure TNxListColumn6.AssignInplaceEdit;
begin
  inherited;
  with TNxComboBox6(GetComponent(FInplaceEdit)) do
  begin
    Items := Self.Items;
    ItemHeight := Self.ItemHeight;
    Style := dsDropDownList;
    OnSelect := DoInplaceEditSelect;
  end;
end;

constructor TNxListColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FImmediateAssign := False;
  FItemHeight := szItemHeight;
  FItems := TStringList.Create;
  FPlaceholderText := '0';
  FWrapKind := wkEllipsis;
end;

procedure TNxListColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxComboBox6.Create(Self);
end;

destructor TNxListColumn6.Destroy;
begin
  FreeAndNil(FItems);
  inherited;
end;

procedure TNxListColumn6.DoInplaceEditSelect(Sender: TObject);
begin
  if ImmediateAssign and Assigned(FInplaceEdit.OnAssignEditing) then
    FInplaceEdit.OnAssignEditing(Self);
end;

function TNxListColumn6.GetDisplayText(Cell: INxBase; ACol,
  ARow: Integer): WideString;
var
  Index: Integer;
begin
  if CanPaintContent(Cell) then
  begin
    Index := GetValue(Cell, ACol, ARow);

    if InRange(Index, 0, Pred(FItems.Count)) then
    begin
      Result := FItems[Index];
    end
    else Result := EmptyStr;

    { Adjust values (event) }
    DoGetText(ACol, ARow, Result);

  end else Result := inherited GetDisplayText(Cell, ACol, ARow);
end;

function TNxListColumn6.GetEditText(Cell: INxBase; ACol,
  ARow: Integer): WideString;
begin
  Result := GetDisplayText(Cell, ACol, ARow);
end;

function TNxListColumn6.GetPlaceholderText: string;
begin
  if InRange(StrToIntDef(FPlaceholderText, -1), 0, Pred(Items.Count)) then Result := FPlaceholderText else FPlaceholderText := '-1';
end;

function TNxListColumn6.GetWrapKind: TNxWrapKind;
begin
  Result := FWrapKind;
end;

procedure TNxListColumn6.SetItems(const Value: TStrings);
begin
  FItems.Assign(Value);
end;

procedure TNxListColumn6.SetWrapKind(const Value: TNxWrapKind);
begin
  if Value <> FWrapKind then
  begin
    FWrapKind := Value;
    Changed;
  end;
end;

{ TNxCheckComboBoxColumn6 }

procedure TNxCheckComboBoxColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxCheckBoxColumn6 then
  begin
    Delimiter := TNxCheckComboBoxColumn6(Source).Delimiter;
  end;
end;

procedure TNxCheckComboBoxColumn6.AssignInplaceEdit;
begin
  inherited;
  with GetComponent(FInplaceEdit) as TNxCheckComboBox6 do
  begin
    Delimiter := Self.Delimiter;
  end;
end;

constructor TNxCheckComboBoxColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FDelimiter := ',';
end;

procedure TNxCheckComboBoxColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxCheckComboBox6.Create(Self);
end;

{ TNxToolbarColumn6 }

procedure TNxToolbarColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxToolbarColumn6 then
  begin
    Images := TNxToolbarColumn6(Source).Images;
    Items.Assign(TNxToolbarColumn6(Source).Items);
  end;
end;

constructor TNxToolbarColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FStyle := [csPaintInsert];
  FItems := TNxToolbarColumnButtons.Create(Self);
end;

function TNxToolbarColumn6.CreateView: INxColumnView;
begin
  Result := TNxToolbarColumnView.Create;
end;

destructor TNxToolbarColumn6.Destroy;
begin
  { Destroy Obj. }
  FItems.Free;
  inherited;
end;

procedure TNxToolbarColumn6.DoButtonClick(Index: Integer);
begin
  if Assigned(FOnButtonClick) then FOnButtonClick(Self, Index);
end;

function TNxToolbarColumn6.GetCount: Integer;
begin
  Result := FItems.Count;
end;

function TNxToolbarColumn6.GetDataType: TNxDataType;
begin
  Result := dtInteger;
end;

function TNxToolbarColumn6.GetImages: TCustomImageList;
begin
  Result := FImages;
end;

function TNxToolbarColumn6.GetItems: TNxToolbarColumnButtons;
begin
  Result := FItems;
end;

procedure TNxToolbarColumn6.SetImages(const Value: TCustomImageList);
begin
  FImages := Value;
end;

procedure TNxToolbarColumn6.SetItems(const Value: TNxToolbarColumnButtons);
begin
  FItems.Assign(Value);
end;

{ TNxToolbarColumnButton }

procedure TNxToolbarColumnButton.Assign(Source: TPersistent);
begin
  inherited;

end;

constructor TNxToolbarColumnButton.Create(Collection: TCollection);
begin
  inherited;
  FHint := EmptyStr;
  FImageIndex := Undefined;
  FText := EmptyStr;
  FVisible := True;
end;

procedure TNxToolbarColumnButton.SetDivider(const Value: Boolean);
begin
  FDivider := Value;
end;

procedure TNxToolbarColumnButton.SetImageIndex(const Value: TImageIndex);
begin
  FImageIndex := Value;
end;

procedure TNxToolbarColumnButton.SetText(const Value: WideString);
begin
  FText := Value;
end;

procedure TNxToolbarColumnButton.SetVisible(const Value: Boolean);
begin
  FVisible := Value;
end;

{ TNxSideEditNumberColumn6 }

procedure TNxSideEditNumberColumn6.AdjustEditRect(var EditRect: TRect);
begin
  inherited AdjustEditRect(EditRect);

  { Decrease size }
  EditRect.Right := EditRect.Left + TextWidth;
end;

procedure TNxSideEditNumberColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxSideEditNumberColumn6 then
  begin
    ShowText := TNxSideEditNumberColumn6(Source).ShowText;
    TextWidth := TNxSideEditNumberColumn6(Source).TextWidth;
  end;
end;

function TNxSideEditNumberColumn6.CanEdit: Boolean;
begin
  Result := inherited CanEdit and ShowText;
end;

constructor TNxSideEditNumberColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FShowText := True;
  FTextWidth := szProgressTextWidth;
end;

function TNxSideEditNumberColumn6.GetShowText: Boolean;
begin
  Result := FShowText;
end;

function TNxSideEditNumberColumn6.GetTextWidth: Integer;
begin
  Result := FTextWidth;
end;

procedure TNxSideEditNumberColumn6.SetShowText(const Value: Boolean);
begin
  FShowText := Value;

  Changed; { Notify }
end;

procedure TNxSideEditNumberColumn6.SetTextWidth(const Value: Integer);
begin
  FTextWidth := Value;

  Changed; { Notify }
end;

{ TNxProgressColumn6 }

procedure TNxProgressColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxProgressColumn6 then
  begin
    ProgressColor := TNxProgressColumn6(Source).ProgressColor;
    ProgressHeight := TNxProgressColumn6(Source).ProgressHeight;
    ProgressMargin := TNxProgressColumn6(Source).ProgressMargin;
    ProgressStyle := TNxProgressColumn6(Source).ProgressStyle;
    TextPosition := TNxProgressColumn6(Source).TextPosition;
    Transparent := TNxProgressColumn6(Source).Transparent;
  end;
end;

constructor TNxProgressColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FFormatMask := '';
  FMax := 100;
  FMin := 0;
  FPrecision := 0;
  FProgressColor := clHighlight;
  FProgressHeight := 10;
  FProgressMargin := 0;
  FProgressStyle := pbSolid;
  FTextPosition := tpBeside;
  FTextWidth := szProgressTextWidth;
  FTransparent := False;
end;

function TNxProgressColumn6.CreateView: INxColumnView;
begin
  Result := TNxProgressColumnView.Create;
end;

function TNxProgressColumn6.GetDataType: TNxDataType;
begin
  Result := dtFloat;
end;

function TNxProgressColumn6.GetDisplayText(Cell: INxBase;
  ACol, ARow: Integer): WideString;
begin
  Result := inherited GetDisplayText(Cell, ACol, ARow) + '%';
end;

function TNxProgressColumn6.GetPlaceholderText: string;
begin
  if InRange(StrToFloatDef(FPlaceholderText, 0), Min, Max) then Result := FPlaceholderText else Result := FloatToStr((Max - Min) / 2);
end;

procedure TNxProgressColumn6.SetProgressColor(const Value: TColor);
begin
  FProgressColor := Value;

  Changed; { Notify }
end;

procedure TNxProgressColumn6.SetProgressHeight(const Value: Integer);
begin
  FProgressHeight := Value;

  Changed; { Notify }
end;

procedure TNxProgressColumn6.SetProgressMargin(const Value: Integer);
begin
  FProgressMargin := Value;

  Changed; { Notify }
end;

procedure TNxProgressColumn6.SetProgressStyle(const Value: TNxProgressBarStyle);
begin
  FProgressStyle := Value;

  Changed; { Notify }
end;

procedure TNxProgressColumn6.SetTextPosition(
  const Value: TNxProgressTextPosition);
begin
  FTextPosition := Value;

  Changed; { Notify }
end;

procedure TNxProgressColumn6.SetTransparent(const Value: Boolean);
begin
  FTransparent := Value;

  Changed; { Notify }
end;

{ TNxToolbarColumnButtons }

function TNxToolbarColumnButtons.Add: TNxToolbarColumnButton;
begin
  Result := TNxToolbarColumnButton(inherited Add);
end;

function TNxToolbarColumnButtons.CanUncheck: Boolean;
begin
  Result := True;
end;

procedure TNxToolbarColumnButtons.Check(Button: TNxToolbarColumnButton);
begin
end;

constructor TNxToolbarColumnButtons.Create(AOwner: TNxToolbarColumn6);
begin
  inherited Create(TNxToolbarColumnButton);
  FOwner := AOwner;
end;

function TNxToolbarColumnButtons.GetCheckedCount: Integer;
begin
  Result := 0;
end;

function TNxToolbarColumnButtons.GetItem(
  Index: Integer): TNxToolbarColumnButton;
begin
  Result := TNxToolbarColumnButton(inherited GetItem(Index));
end;

function TNxToolbarColumnButtons.GetOwner: TPersistent;
begin
  Result := FOwner;
end;

procedure TNxToolbarColumnButtons.SetItem(Index: Integer;
  const Value: TNxToolbarColumnButton);
begin
  inherited SetItem(Index, Value);
end;

{ TNxIconColumn6 }

procedure TNxIconColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxIconColumn6 then
  begin
    Button := TNxIconColumn6(Source).Button;
    CycleImages := TNxIconColumn6(Source).CycleImages;
    Hint := TNxIconColumn6(Source).Hint;
    Images := TNxIconColumn6(Source).Images;
  end;
end;

constructor TNxIconColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FButton := False;
  FCycleImages := False;
  FHint := EmptyStr;
  FImages := nil;
  FPlaceholderText := '0';
  FSortType := stNumeric;
end;

function TNxIconColumn6.CreateView: INxColumnView;
begin
  Result := TNxIconColumnView.Create;
end;

function TNxIconColumn6.GetDataType: TNxDataType;
begin
  Result := dtInteger;
end;

function TNxIconColumn6.GetGraphic(Cell: INxBase; ACol, ARow: Integer): TGraphic;
begin
  Result := nil;
end;

function TNxIconColumn6.GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  Result := '<img src="' + FPath + LowerCase(Name) + '_' + IntToStr(Cell.AsInteger) + '.bmp" />';
end;

function TNxIconColumn6.GetPlaceholderText: string;
begin
  if Assigned(FImages) and InRange(StrToIntDef(FPlaceholderText, -1), 0, FImages.Count - 1)
    then Result := FPlaceholderText;
end;

procedure TNxIconColumn6.SaveToPath(const Path: string);
var
  i: Integer;
  Bitmap: TBitmap;
begin
  FPath := Path;
  if Assigned(Images) then
  begin
    for i := 0 to Pred(Images.Count) do
    begin
      Bitmap := TBitmap.Create;
      Images.GetBitmap(i, Bitmap);
      Bitmap.SaveToFile(Path + LowerCase(Name) + '_' + IntToStr(i) + '.bmp');
      FreeAndNil(Bitmap);
    end;
  end;
end;

procedure TNxIconColumn6.SetButtonText(const Value: WideString);
begin
  if Value <> FButtonText then
  begin
    FButtonText := Value;

    { Notify }
    Changed;
  end;
end;

procedure TNxIconColumn6.SetImages(const Value: TCustomImageList);
begin
  if Value <> FImages then
  begin
    FImages := Value;

    { Notify }
    Changed;
  end;
end;

{ TNxGraphicsColumn6 }

procedure TNxGraphicColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxGraphicColumn6 then
  begin
    BorderColor := TNxGraphicColumn6(Source).BorderColor;
    BorderWidth := TNxGraphicColumn6(Source).BorderWidth;
    Effects := TNxGraphicColumn6(Source).Effects;
    FillMode := TNxGraphicColumn6(Source).FillMode;
    SelectedBorderColor := TNxGraphicColumn6(Source).SelectedBorderColor;
  end;
end;

constructor TNxGraphicColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FBorderColor := clBtnFace;
  FBorderWidth := 0;
  FEffects := [];
  FFillMode := fmAspectFit;
  FSelectedBorderColor := clHighlightText;
end;

function TNxGraphicColumn6.CreateView: INxColumnView;
begin
  Result := TNxGraphicColumnView.Create;
end;

function TNxGraphicColumn6.GetGraphic(Cell: INxBase; ACol, ARow: Integer): TGraphic;
begin
  Result := TGraphic(INxCell(Cell).Data);
end;

function TNxGraphicColumn6.GetHTML(Cell: INxBase; ACol, ARow: Integer): WideString;
begin
  Result := '<img src="' + FPath + LowerCase(Name) + '_' + IntToStr(ACol) + '_' + IntToStr(ARow) + '.png" />';
end;

procedure TNxGraphicColumn6.SaveToPath(const Path: string);
begin
  FPath := Path;
end;

procedure TNxGraphicColumn6.SetBorderColor(const Value: TColor);
begin
  if Value <> FBorderColor then
  begin
    FBorderColor := Value;
    Changed;
  end;
end;

procedure TNxGraphicColumn6.SetBorderWidth(const Value: Integer);
begin
  if Value <> FBorderWidth then
  begin
    FBorderWidth := Value;
    Changed;
  end;
end;

procedure TNxGraphicColumn6.SetEffects(const Value: TNxPaintEffects);
begin
  if Value <> FEffects then
  begin
    FEffects := Value;
    Changed;
  end;
end;

procedure TNxGraphicColumn6.SetFillMode(const Value: TNxFillMode);
begin
  if Value <> FFillMode then
  begin
    FFillMode := Value;
    Changed;
  end;
end;

procedure TNxGraphicColumn6.SetSelectedBorderColor(const Value: TColor);
begin
  if Value <> FSelectedBorderColor then
  begin
    FSelectedBorderColor := Value;
    Changed;
  end;
end;

{ TNxColorColumn6 }

procedure TNxColorColumn6.AssignInplaceEdit;
var
  ColorControl: INxColorControl;
begin
  inherited;
  if Supports(InplaceEdit, INxColorControl, ColorControl) then
  begin

  end;
end;

procedure TNxColorColumn6.CreateInplaceEdit;
begin
  FInplaceEdit := TNxColorPicker6.Create(Self);
end;

function TNxColorColumn6.CreateView: INxColumnView;
begin
  Result := TNxColorColumnView.Create;
end;

function TNxColorColumn6.GetColorKind: TNxColorKind;
begin
  Result := FColorKind;
end;

{ TNxTrackbarColumn6 }

procedure TNxTrackbarColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxTrackbarColumn6 then
  begin
    CanChangeSelection := TNxTrackbarColumn6(Source).CanChangeSelection;
    Max := TNxTrackbarColumn6(Source).Max;
    PlaceholderText := TNxTrackbarColumn6(Source).PlaceholderText;
    TrackHeight := TNxTrackbarColumn6(Source).TrackHeight;
  end;
end;

constructor TNxTrackbarColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FInteractionMoveSelection := True;
  FMax := 100;
  FTrackHeight := 4;
  FPlaceholderText := '25';
end;

function TNxTrackbarColumn6.CreateView: INxColumnView;
begin
  Result := TNxTrackBarColumnView.Create;
end;

function TNxTrackbarColumn6.GetInteractionMoveSelection: Boolean;
begin
  Result := FInteractionMoveSelection;
end;

function TNxTrackbarColumn6.GetPlaceholderText: string;
begin
  if InRange(StrToFloatDef(FPlaceholderText, 0), Min, Max) then Result := FPlaceholderText else Result := FloatToStr((Max - Min) / 2);
end;

function TNxTrackbarColumn6.GetTrackHeight: Integer;
begin
  Result := FTrackHeight;
end;

procedure TNxTrackbarColumn6.SetTrackHeight(const Value: Integer);
begin
  if Value <> FTrackHeight then
  begin
    FTrackHeight := Value;
    Changed;
  end;
end;

{ TNxHTMLColumn6 }

procedure TNxHTMLColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxHTMLColumn6 then
  begin
    StylesSheet := TNxHTMLColumn6(Source).StylesSheet;
  end;
end;

constructor TNxHTMLColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FPlaceholderText := '<a href="#">NextSuite</a> <strong>v6</strong> <em>sample</em>';
  FStylesSheet := nil;
end;

function TNxHTMLColumn6.CreateView: INxColumnView;
begin
  Result := TNxHTMLColumnView.Create;
end;

destructor TNxHTMLColumn6.Destroy;
begin

  inherited;
end;

procedure TNxHTMLColumn6.DoLinkClick(Href: WideString);
begin
  if Assigned(FOnLinkClick) then FOnLinkClick(Self, Href);  
end;

function TNxHTMLColumn6.GetStylesSheet: TNxStylesSheet6;
begin
  Result := FStylesSheet;
end;

procedure TNxHTMLColumn6.SetStylesSheet(const Value: TNxStylesSheet6);
begin
  FStylesSheet := Value;
end;

{ TNxTreeColumn6 }

procedure TNxTreeColumn6.AdjustEditRect(var EditRect: TRect);
begin
  inherited;
  View.AdjustEditRect(EditRect);
end;

procedure TNxTreeColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxTreeColumn6 then
  begin
    Images := TNxTreeColumn6(Source).Images;
    InteractionMoveSelection := TNxTreeColumn6(Source).InteractionMoveSelection;
    LinesColor := TNxTreeColumn6(Source).LinesColor;
    ShowLines := TNxTreeColumn6(Source).ShowLines;
    ToggleButtonStyle := TNxTreeColumn6(Source).ToggleButtonStyle;
  end;
end;

constructor TNxTreeColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FClientRectToggle := False;
  FImages := nil;
  FInteractionMoveSelection := True;
  FLinesColor := clGrayText;
  FShowLines := False;
  FToggleButtonStyle := tsStyleNative;
end;

function TNxTreeColumn6.CreateView: INxColumnView;
begin
  Result := TNxTreeColumnView.Create;
end;

function TNxTreeColumn6.GetClientRectToogle: Boolean;
begin
  Result := FClientRectToggle;
end;

function TNxTreeColumn6.GetImages: TCustomImageList;
begin
  Result := FImages;
end;

function TNxTreeColumn6.GetInteractionMoveSelection: Boolean;
begin
  Result := FInteractionMoveSelection;
end;

function TNxTreeColumn6.GetLinesColor: TColor;
begin
  Result := FLinesColor;
end;

function TNxTreeColumn6.GetShowLines: Boolean;
begin
  Result := FShowLines;
end;

function TNxTreeColumn6.GetToggleButtonStyle: TNxToggleButtonStyle;
begin
  Result := FToggleButtonStyle;
end;

procedure TNxTreeColumn6.SetImages(const Value: TCustomImageList);
begin
  if Value <> FImages then
  begin
    FImages := Value;
    Changed;
  end;
end;

procedure TNxTreeColumn6.SetLinesColor(const Value: TColor);
begin
  if Value <> FLinesColor then
  begin
    FLinesColor := Value;
    Changed;
  end;
end;

procedure TNxTreeColumn6.SetShowLines(const Value: Boolean);
begin
  if Value <> FShowLines then
  begin
    FShowLines := Value;
    Changed;
  end;
end;

procedure TNxTreeColumn6.SetToggleButtonStyle(const Value: TNxToggleButtonStyle);
begin
  if Value <> FToggleButtonStyle then
  begin
    FToggleButtonStyle := Value;
    Changed;
  end;
end;

{ TNxRateColumn6 }

procedure TNxRateColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxRateColumn6 then
  begin
    Glyph.Assign(TNxRateColumn6(Source).Glyph);
    GlyphEmpty.Assign(TNxRateColumn6(Source).GlyphEmpty);
    Max := TNxRateColumn6(Source).Max;
    Spacing := TNxRateColumn6(Source).Spacing;
  end;
end;

constructor TNxRateColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FGlyph := TPicture.Create;
  FGlyph.OnChange := DoGlyphChanged;
  FGlyphEmpty := TPicture.Create;
  FGlyphEmpty.OnChange := DoGlyphChanged;
  FMax := 5;
  FSpacing := 2;
end;

function TNxRateColumn6.CreateView: INxColumnView;
begin
  Result := TNxRateColumnView.Create;
end;

destructor TNxRateColumn6.Destroy;
begin
  FreeAndNil(FGlyph);
  FreeAndNil(FGlyphEmpty);
  inherited;
end;

procedure TNxRateColumn6.DoGlyphChanged(Sender: TObject);
begin
  Changed;
end;

function TNxRateColumn6.GetGlyph: TPicture;
begin
  Result := FGlyph;
end;

function TNxRateColumn6.GetGlyphEmpty: TPicture;
begin
  Result := FGlyphEmpty;
end;

function TNxRateColumn6.GetMax: Integer;
begin
  Result := FMax;
end;

function TNxRateColumn6.GetSpacing: Integer;
begin
  Result := FSpacing;
end;

procedure TNxRateColumn6.SetGlyph(const Value: TPicture);
begin
  FGlyph.Assign(Value);
end;

procedure TNxRateColumn6.SetGlyphEmpty(const Value: TPicture);
begin
  FGlyphEmpty.Assign(Value);
end;

procedure TNxRateColumn6.SetMax(const Value: Integer);
begin
  if Value <> FMax then
  begin
    FMax := Value;
    Changed;
  end;
end;

procedure TNxRateColumn6.SetSpacing(const Value: Integer);
begin
  FSpacing := Value;
end;

{ TNxChartColumn6 }

procedure TNxChartColumn6.Assign(Source: TPersistent);
begin
  inherited;
  if Source is TNxChartColumn6 then
  begin
    BarWidth := TNxChartColumn6(Source).BarWidth;
    BaseLinePen.Assign(TNxChartColumn6(Source).BaseLinePen);
    ChartStyles := TNxChartColumn6(Source).ChartStyles;
    DotSize := TNxChartColumn6(Source).DotSize;
    FillBrush.Assign(TNxChartColumn6(Source).FillBrush);
    LinePen.Assign(TNxChartColumn6(Source).LinePen);
    ShowBaseLine := TNxChartColumn6(Source).ShowBaseLine;
  end;
end;

constructor TNxChartColumn6.Create(AOwner: TComponent);
begin
  inherited;
  FBarWidth := 6;
  FBaseLinePen := TPen.Create;
  FChartStyles := [csLine, csDots];
  FDotSize := Size(4, 4);
  FFillBrush := TBrush.Create;
  FLinePen := TPen.Create;
  FShowBaseLine := True;
end;

function TNxChartColumn6.CreateView: INxColumnView;
begin
  Result := TNxChartColumnView.Create;
end;

destructor TNxChartColumn6.Destroy;
begin
  FBaseLinePen.Free;
  FFillBrush.Free;
  FLinePen.Free;
  inherited;
end;

procedure TNxChartColumn6.DoChartColor(Index: Integer; var BorderColor, FillColor: TColor);
begin
  if Assigned(FOnChartColor)
    then FOnChartColor(Self, Index, BorderColor, FillColor);
end;

function TNxChartColumn6.GetBarWidth: Integer;
begin
  Result := FBarWidth;
end;

function TNxChartColumn6.GetBaseLinePen: TPen;
begin
  Result := FBaseLinePen;
end;

function TNxChartColumn6.GetChartStyles: TNxChartStyles;
begin
  Result := FChartStyles;
end;

function TNxChartColumn6.GetDotSize: TSize;
begin
  Result := FDotSize;
end;

function TNxChartColumn6.GetFillBrush: TBrush;
begin
  Result := FFillBrush;
end;

function TNxChartColumn6.GetLinePen: TPen;
begin
  Result := FLinePen;
end;

function TNxChartColumn6.GetShowBaseLine: Boolean;
begin
  Result := FShowBaseLine;
end;

procedure TNxChartColumn6.SetBarWidth(const Value: Integer);
begin
  if Value <> FBarWidth then
  begin
    FBarWidth := Value;
    Changed;
  end;
end;

procedure TNxChartColumn6.SetBaseLinePen(const Value: TPen);
begin
  FBaseLinePen.Assign(Value);
end;

procedure TNxChartColumn6.SetChartStyles(const Value: TNxChartStyles);
begin
  if Value <> FChartStyles then
  begin
    FChartStyles := Value;
    Changed;
  end;
end;

procedure TNxChartColumn6.SetDotSize(const Value: TSize);
begin
  if EqualSize(Value, FDotSize) then
  begin
    FDotSize := Value;
    Changed;
  end;
end;

procedure TNxChartColumn6.SetFillBrush(const Value: TBrush);
begin
  FFillBrush.Assign(Value);
end;

procedure TNxChartColumn6.SetLinePen(const Value: TPen);
begin
  FLinePen.Assign(Value);
end;

procedure TNxChartColumn6.SetShowBaseLine(const Value: Boolean);
begin
  if Value <> FShowBaseLine then
  begin
    FShowBaseLine := Value;
    Changed;
  end;
end;

{ TNxColumnStyle }

procedure TNxColumnStyle.Copy(Source: TNxColumn6);
begin
  FAlignment := Source.Alignment;
  FColor := Source.Color;
  FEditing := Source.Editing;
  FHeaderColor := Source.Header.Color;
  FHeaderParentFont := Source.Header.ParentFont;
  FInserting := Source.Inserting;
  FInteractive := Source.Interactive;
  FParentColor := Source.ParentColor;
end;

constructor TNxColumnStyle.Create;
begin

end;

destructor TNxColumnStyle.Destroy;
begin

  inherited;
end;

procedure TNxColumnStyle.Paste(Dest: TNxColumn6);
begin
  Dest.Alignment := FAlignment;
  Dest.Color := FColor;
  Dest.Editing := FEditing;
  Dest.Header.Color := FHeaderColor;
  Dest.Header.ParentFont := FHeaderParentFont;
  Dest.Inserting := FInserting;
  Dest.Interactive := FInteractive;
  Dest.ParentColor := FParentColor;
end;

end.
