cxgridbandedtableview.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,455 行 · 第 1/5 页

PAS
1,455
字号
  // indicator

  TcxGridIndicatorBandHeaderItemViewInfo = class(TcxGridIndicatorHeaderItemViewInfo)
  private
    function GetGridView: TcxGridBandedTableView;
  protected
    function GetHitTestClass: TcxCustomGridHitTestClass; override;
    function GetPainterClass: TcxCustomGridCellPainterClass; override;
    function GetText: string; override;
    procedure GetViewParams(var AParams: TcxViewParams); override;
    function SupportsQuickCustomization: Boolean; override;

    function DropDownWindowExists: Boolean; override;
    function GetDropDownWindow: TcxCustomGridPopup; override;
  public
    property GridView: TcxGridBandedTableView read GetGridView;
  end;

  TcxGridBandedIndicatorViewInfo = class(TcxGridIndicatorViewInfo)
  protected
    function GetAlwaysVisible: Boolean; override;
  end;

  // rows

  TcxGridFixedBandsSeparatorLocation = (slNone, slLeft, slRight);

  TcxGridBandedDataRowCellsAreaItemViewInfoClass = class of TcxGridBandedDataRowCellsAreaItemViewInfo;

  TcxGridBandedDataRowCellsAreaItemViewInfo = class(TcxGridCellViewInfo)
  private
    FBandViewInfo: TcxGridBandViewInfo;
    FCellsAreaViewInfo: TcxGridBandedDataRowCellsAreaViewInfo;
    FLineBounds: TList;
    function GetFixedBandsSeparatorLocation: TcxGridFixedBandsSeparatorLocation;
    function GetGridViewInfo: TcxGridBandedTableViewInfo;
    function GetLineBounds(Index: Integer): TRect;
    function GetLineCount: Integer;
    function GetRecordsViewInfo: TcxGridBandedRowsViewInfo;
    function GetRecordViewInfo: TcxGridDataRowViewInfo;
    procedure ClearLines;
    procedure CreateLineBounds;
    procedure DestroyLineBounds;
  protected
    procedure AddLine(const ABounds: TRect);
    procedure AddLines; virtual;
    function CalculateHeight: Integer; override;
    function CalculateWidth: Integer; override;
    function GetBorders: TcxBorders; override;
    function GetFixedBandsSeparatorBounds: TRect; virtual;
    function GetPainterClass: TcxCustomGridCellPainterClass; override;
    procedure GetViewParams(var AParams: TcxViewParams); override;
    procedure Offset(DX, DY: Integer); override;

    property BandViewInfo: TcxGridBandViewInfo read FBandViewInfo;
    property CellsAreaViewInfo: TcxGridBandedDataRowCellsAreaViewInfo read FCellsAreaViewInfo;
    property GridViewInfo: TcxGridBandedTableViewInfo read GetGridViewInfo;
    property RecordViewInfo: TcxGridDataRowViewInfo read GetRecordViewInfo;
    property RecordsViewInfo: TcxGridBandedRowsViewInfo read GetRecordsViewInfo;
  public
    constructor Create(ACellsAreaViewInfo: TcxGridBandedDataRowCellsAreaViewInfo;
      ABandViewInfo: TcxGridBandViewInfo); reintroduce; virtual;
    destructor Destroy; override;
    procedure BeforeRecalculation; override;
    procedure Calculate(ALeftBound, ATopBound: Integer; AWidth: Integer = -1;
      AHeight: Integer = -1); override;
    function CanDrawSelected: Boolean; override;
    property FixedBandsSeparatorBounds: TRect read GetFixedBandsSeparatorBounds;
    property FixedBandsSeparatorLocation: TcxGridFixedBandsSeparatorLocation read
      GetFixedBandsSeparatorLocation;
    property LineBounds[Index: Integer]: TRect read GetLineBounds;
    property LineCount: Integer read GetLineCount;
  end;

  TcxGridBandedDataRowCellsAreaViewInfo = class(TcxGridDataRowCellsAreaViewInfo)
  private
    FItems: TList;
    function GetBandsViewInfo: TcxGridBandsViewInfo;
    function GetCount: Integer;
    function GetGridViewInfo: TcxGridBandedTableViewInfo;
    function GetItem(Index: Integer): TcxGridBandedDataRowCellsAreaItemViewInfo;
    procedure CreateItems;
    procedure DestroyItems;
  protected
    function CalculateVisible: Boolean; override;
    function GetItemClass: TcxGridBandedDataRowCellsAreaItemViewInfoClass; virtual;
    procedure Offset(DX, DY: Integer); override;
    property BandsViewInfo: TcxGridBandsViewInfo read GetBandsViewInfo;
    property GridViewInfo: TcxGridBandedTableViewInfo read GetGridViewInfo;
  public
    constructor Create(ARecordViewInfo: TcxCustomGridRecordViewInfo); override;
    destructor Destroy; override;
    procedure BeforeRecalculation; override;
    procedure Calculate(ALeftBound, ATopBound: Integer; AWidth: Integer = -1;
      AHeight: Integer = -1); override;
    function DrawMergedCells: Boolean; override;
    property Count: Integer read GetCount;
    property Items[Index: Integer]: TcxGridBandedDataRowCellsAreaItemViewInfo read GetItem; default;
  end;

  TcxGridBandedRowsViewInfo = class(TcxGridRowsViewInfo)
  private
    FRowCellsAreaVisible: Boolean;
    function GetHeaderViewInfo: TcxGridBandedHeaderViewInfo;
  protected
    function CalculateDataRowHeight: Integer; override;
    function CalculateRowCellsAreaVisible: Boolean; virtual;
    function GetAreaBoundsForCell(ACellViewInfo: TcxGridTableDataCellViewInfo): TRect; override;
    function GetPainterClass: TcxCustomGridRecordsPainterClass; override;
    function GetRowWidth: Integer; override;
    function GetShowBandSeparators: Boolean; virtual;
    function GetShowCellLeftLines: Boolean; virtual;
    function GetShowCellTopLines: Boolean; virtual;

    property HeaderViewInfo: TcxGridBandedHeaderViewInfo read GetHeaderViewInfo;
    property ShowBandSeparators: Boolean read GetShowBandSeparators;
    property ShowCellLeftLines: Boolean read GetShowCellLeftLines;
    property ShowCellTopLines: Boolean read GetShowCellTopLines;
  public
    procedure AfterConstruction; override;
    function GetDataRowCellsAreaViewInfoClass: TClass; override;
    function IsCellMultiLine(AItem: TcxCustomGridTableItem): Boolean; override;
    property RowCellsAreaVisible: Boolean read FRowCellsAreaVisible;
  end;

  // table

  TcxGridBandedTableViewInfo = class(TcxGridTableViewInfo)
  private
    function GetController: TcxGridBandedTableController;
    function GetFixedBandSeparatorColor: TColor;
    function GetFixedBandSeparatorWidth: Integer;
    function GetGridView: TcxGridBandedTableView;
    function GetHeaderViewInfo: TcxGridBandedHeaderViewInfo;
  protected
    function GetScrollableAreaBoundsForEdit: TRect; override;
    function GetScrollableAreaBoundsHorz: TRect; override;
    function SupportsAutoHeight: Boolean; override;
    function SupportsGroupSummariesAlignedWithColumns: Boolean; override;
    function SupportsMultipleFooterSummaries: Boolean; override;

    function GetFooterPainterClass: TcxGridFooterPainterClass; override;
    function GetFooterViewInfoClass: TcxGridFooterViewInfoClass; override;
    function GetHeaderViewInfoClass: TcxGridHeaderViewInfoClass; override;
    function GetHeaderViewInfoSpecificClass: TcxGridHeaderViewInfoSpecificClass; override;
    function GetIndicatorViewInfoClass: TcxGridIndicatorViewInfoClass; override;
    function GetRecordsViewInfoClass: TcxCustomGridRecordsViewInfoClass; override;

    property Controller: TcxGridBandedTableController read GetController;
  public
    function CanOffset(ARecordCountDelta, DX, DY: Integer): Boolean; override;
    function GetCellHeight(AIndex, ACellHeight: Integer): Integer; override;
    function GetCellTopOffset(AIndex, ACellHeight: Integer): Integer; override;
    property FixedBandSeparatorColor: TColor read GetFixedBandSeparatorColor;
    property FixedBandSeparatorWidth: Integer read GetFixedBandSeparatorWidth;
    property GridView: TcxGridBandedTableView read GetGridView;
    property HeaderViewInfo: TcxGridBandedHeaderViewInfo read GetHeaderViewInfo;
  end;

  { column }

  TcxGridBandedColumnOptions = class(TcxGridColumnOptions)
  private
    FVertSizing: Boolean;
    procedure SetVertSizing(Value: Boolean);
  public
    procedure Assign(Source: TPersistent); override;
    constructor Create(AItem: TcxCustomGridTableItem); override;
  published
    property VertSizing: Boolean read FVertSizing write SetVertSizing default True;
  end;

  TcxGridBandedColumnStyles = class(TcxGridColumnStyles)
  private
    function GetItem: TcxGridBandedColumn;
  protected
    procedure GetDefaultViewParams(Index: Integer; AData: TObject; out AParams: TcxViewParams); override;
  public
    property Item: TcxGridBandedColumn read GetItem;
  end;

  TcxGridBandedColumnPosition = class(TcxCustomGridTableItemCustomOptions)
  private
    FBand: TcxGridBand;
    FBandIndex: Integer;
    FColIndex: Integer;
    FLineCount: Integer;
    FRow: TcxGridBandRow;
    FRowIndex: Integer;
    FVisibleColIndex: Integer;
    function GetBandIndex: Integer;
    function GetColIndex: Integer;
    function GetGridView: TcxGridBandedTableView;
    function GetItem: TcxGridBandedColumn;
    function GetRowIndex: Integer;
    function GetVisibleBandIndex: Integer;
    function GetVisibleRowIndex: Integer;
    procedure SetBand(Value: TcxGridBand);
    procedure SetBandIndex(Value: Integer);
    procedure SetColIndex(Value: Integer);
    procedure SetLineCount(Value: Integer);
    procedure SetRowIndex(Value: Integer);
  protected
    procedure CheckLineCount(var Value: Integer);
    procedure SaveParams(ABandIndexOnly: Boolean = False);
  public
    constructor Create(AItem: TcxCustomGridTableItem); override;
    procedure Assign(Source: TPersistent); override;
    property Band: TcxGridBand read FBand;
    property GridView: TcxGridBandedTableView read GetGridView;
    property Item: TcxGridBandedColumn read GetItem;
    property Row: TcxGridBandRow read FRow;
    property VisibleBandIndex: Integer read GetVisibleBandIndex;
    property VisibleColIndex: Integer read FVisibleColIndex;
    property VisibleRowIndex: Integer read GetVisibleRowIndex;
  published
    property BandIndex: Integer read GetBandIndex write SetBandIndex;
    property ColIndex: Integer read GetColIndex write SetColIndex;
    property LineCount: Integer read FLineCount write SetLineCount default 1;
    property RowIndex: Integer read GetRowIndex write SetRowIndex;
  end;

  TcxGridBandedColumn = class(TcxGridColumn)
  private
    FPosition: TcxGridBandedColumnPosition;
    function GetGridView: TcxGridBandedTableView;
    function GetOptions: TcxGridBandedColumnOptions;
    function GetStyles: TcxGridBandedColumnStyles;
    procedure SetOptions(Value: TcxGridBandedColumnOptions);
    procedure SetPosition(Value: TcxGridBandedColumnPosition);
    procedure SetStyles(Value: TcxGridBandedColumnStyles);
  protected
    // IcxStoredObject
    function GetStoredProperties(AProperties: TStrings): Boolean; override;
    procedure GetPropertyValue(const AName: string; var AValue: Variant); override;
    procedure SetPropertyValue(const AName: string; const AValue: Variant); override;

    procedure CreateSubClasses; override;
    procedure DestroySubClasses; override;
    function GetOptionsClass: TcxCustomGridTableItemOptionsClass; override;
    function GetStylesClass: TcxCustomGridTableItemStylesClass; override;

    procedure AssignColumnWidths; override;
    function CanCellMerging: Boolean; override;
    function CanScroll: Boolean; override;
    function CanVertSize: Boolean; virtual;
    function DefaultAlternateCaption: string; override;
    function GetActuallyVisible: Boolean; override;
    function GetEditPartVisible: Boolean; override;
    function GetIsBottom: Boolean; override;
    function GetIsLeft: Boolean; override;
    function GetIsMostBottom: Boolean; override;
    function GetIsMostLeft: Boolean; override;
    function GetIsMostRight: Boolean; override;
    function GetIsRight: Boolean; override;
    function GetIsTop: Boolean; override;
    function GetVisibleInQuickCustomizationPopup: Boolean; override;
    procedure VisibleChanged; override;
  public
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    property GridView: TcxGridBandedTableView read GetGridView;
  published
    property Options: TcxGridBandedColumnOptions read GetOptions write SetOptions;
    property Position: TcxGridBandedColumnPosition read FPosition write SetPosition;
    property Styles: TcxGridBandedColumnStyles read GetStyles write SetStyles;
  end;

  { view }

  // row, rows, band, bands

  TcxGridBandRow = class
  private
    FBandRows: TcxGridBandRows;
    FItems: TList;
    FVisibleItems: TList;
    function GetCount: Integer;
    function GetIndex: Integer;
    function GetIsFirst: Boolean;
    function GetIsLast: Boolean;
    function GetItem(Index: Integer): TcxGridBandedColumn;
    function GetLineCount: Integer;
    function GetLineOffset: Integer;
    function GetVisible: Boolean;
    function GetVisibleCount: Integer;
    function GetVisibleIndex: Integer;
    function GetVisibleItem(Index: Integer): TcxGridBandedColumn;
    function GetWidth: Integer;
  protected
    procedure CheckIndexForInsert(var AIndex: Integer; AExistingItem: Boolean);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?