cxgridbandedtableview.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,455 行 · 第 1/5 页
PAS
1,455 行
{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressQuantumGrid }
{ }
{ Copyright (c) 1998-2008 Developer Express Inc. }
{ ALL RIGHTS RESERVED }
{ }
{ The entire contents of this file is protected by U.S. and }
{ International Copyright Laws. Unauthorized reproduction, }
{ reverse-engineering, and distribution of all or any portion of }
{ the code contained in this file is strictly prohibited and may }
{ result in severe civil and criminal penalties and will be }
{ prosecuted to the maximum extent possible under the law. }
{ }
{ RESTRICTIONS }
{ }
{ THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES }
{ (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE }
{ SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS }
{ LICENSED TO DISTRIBUTE THE EXPRESSQUANTUMGRID AND ALL }
{ ACCOMPANYING VCL CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY. }
{ }
{ THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED }
{ FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE }
{ COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE }
{ AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT }
{ AND PERMISSION FROM DEVELOPER EXPRESS INC. }
{ }
{ CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON }
{ ADDITIONAL RESTRICTIONS. }
{ }
{********************************************************************}
unit cxGridBandedTableView;
{$I cxVer.inc}
interface
uses
{$IFDEF DELPHI6}
Variants,
{$ENDIF}
Windows, Classes, Graphics, Controls, ComCtrls, cxClasses, cxControls,
cxGraphics, cxLookAndFeelPainters, cxStyles, cxStorage, cxPC, cxGridCommon,
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridRows;
const
cxGridBandedTableViewAlternateCaptionSeparator: string = '-';
cxGridDefaultFixedBandSeparatorWidth = 2;
cxGridDefaultEmptyBandWidth = 50;
htBandedGridBase = htGridBase + 50;
htColumnHeaderVertSizingEdge = htBandedGridBase + 1;
htBand = htBandedGridBase + 2;
htBandHeader = htBandedGridBase + 3;
htBandHeaderSizingEdge = htBandedGridBase + 4;
htIndicatorBandHeader = htBandedGridBase + 5;
bbBandedTableFirst = bbTableLast + 1;
bbBandBackground = bbBandedTableFirst;
bbBandHeader = bbBandedTableFirst + 1;
bbBandedTableLast = bbBandHeader;
bsFirst = 0;
bsBackground = bsFirst;
bsContent = bsFirst + 1;
bsHeader = bsFirst + 2;
bsLast = bsHeader;
vsBandedTableFirst = vsTableLast + 1;
vsBandBackground = vsBandedTableFirst;
vsBandHeader = vsBandedTableFirst + 1;
vsBandedTableLast = vsBandHeader;
type
TcxGridBandedTableCustomizationForm = class;
TcxGridBandedTableController = class;
TcxGridBandedColumnContainerZone = class;
TcxGridBandHeaderViewInfo = class;
TcxGridIndicatorBandHeaderItemViewInfo = class;
TcxGridBandRowViewInfo = class;
TcxGridBandRowsViewInfo = class;
TcxGridBandViewInfo = class;
TcxGridBandsViewInfo = class;
TcxGridBandedHeaderViewInfo = class;
TcxGridBandedDataRowCellsAreaItemViewInfo = class;
TcxGridBandedDataRowCellsAreaViewInfo = class;
TcxGridBandedRowsViewInfo = class;
TcxGridBandedTableViewInfo = class;
TcxGridBandedColumnPosition = class;
TcxGridBandedColumn = class;
TcxGridBandRow = class;
TcxGridBandRows = class;
TcxGridBand = class;
TcxGridBands = class;
TcxGridBandedTableView = class;
TcxGridBandFixedKind = (fkNone, fkLeft, fkRight);
{ hit tests }
TcxGridColumnHeaderVertSizingEdgeHitTest = class(TcxCustomGridColumnHitTest)
protected
class function GetHitTestCode: Integer; override;
public
function Cursor: TCursor; override;
function DragAndDropObjectClass: TcxCustomGridDragAndDropObjectClass; override;
end;
TcxGridBandContainerKind = (bcHeader, bcCustomizationForm);
TcxGridBandHitTest = class(TcxCustomGridViewHitTest)
private
FBand: TcxGridBand;
FBandContainerKind: TcxGridBandContainerKind;
FVisibleRowIndex: Integer;
protected
class function GetHitTestCode: Integer; override;
public
property Band: TcxGridBand read FBand write FBand;
property BandContainerKind: TcxGridBandContainerKind read FBandContainerKind
write FBandContainerKind;
property VisibleRowIndex: Integer read FVisibleRowIndex write FVisibleRowIndex;
end;
TcxGridBandHeaderHitTest = class(TcxGridBandHitTest)
protected
class function GetHitTestCode: Integer; override;
public
function DragAndDropObjectClass: TcxCustomGridDragAndDropObjectClass; override;
end;
TcxGridBandHeaderSizingEdgeHitTest = class(TcxGridBandHitTest)
protected
class function GetHitTestCode: Integer; override;
public
function Cursor: TCursor; override;
function DragAndDropObjectClass: TcxCustomGridDragAndDropObjectClass; override;
end;
TcxGridIndicatorBandHeaderHitTest = class(TcxGridIndicatorHitTest)
protected
class function GetHitTestCode: Integer; override;
end;
{ controller }
// drag&drop objects
TcxGridBandedColumnContainerZone = class(TcxGridItemContainerZone)
public
Band: TcxGridBand;
ColIndex: Integer;
RowIndex: Integer;
constructor Create(AColumnIndex: Integer;
ABand: TcxGridBand; AColIndex, ARowIndex: Integer);
function IsEqual(Value: TcxGridItemContainerZone): Boolean; override;
function IsInsertion: Boolean;
end;
TcxGridBandedColumnHeaderMovingObject = class(TcxGridColumnHeaderMovingObject)
private
function GetDestZone: TcxGridBandedColumnContainerZone;
function GetSourceItem: TcxGridBandedColumn;
function GetSourcePosition: TcxGridBandedColumnPosition;
function GetViewInfo: TcxGridBandedTableViewInfo;
procedure SetSourceItem(Value: TcxGridBandedColumn);
protected
function AreArrowsVertical: Boolean; override;
procedure CheckDestItemContainerKind(var AValue: TcxGridItemContainerKind); override;
procedure DoColumnMoving; override;
function GetArrowAreaBoundsForHeader(APlace: TcxGridArrowPlace): TRect; override;
function GetArrowsClientRect: TRect; override;
function IsValidDestinationForVisibleSource: Boolean; override;
property DestZone: TcxGridBandedColumnContainerZone read GetDestZone;
property SourceItem: TcxGridBandedColumn read GetSourceItem write SetSourceItem;
property SourcePosition: TcxGridBandedColumnPosition read GetSourcePosition;
property ViewInfo: TcxGridBandedTableViewInfo read GetViewInfo;
end;
TcxGridBandHeaderMovingObject = class(TcxCustomGridTableMovingObject)
private
FDestBand: TcxGridBand;
FDestBandContainerKind: TcxGridBandContainerKind;
FDestInsertPosition: TcxPosition;
FIsEmptyViewInsert: Boolean;
FSourceBandContainerKind: TcxGridBandContainerKind;
function GetController: TcxGridBandedTableController;
function GetCustomizationForm: TcxGridBandedTableCustomizationForm;
function GetGridView: TcxGridBandedTableView;
function GetSourceBand: TcxGridBand;
function GetViewInfo: TcxGridBandedTableViewInfo;
procedure SetDestBand(Value: TcxGridBand);
procedure SetDestBandContainerKind(Value: TcxGridBandContainerKind);
procedure SetDestInsertPosition(Value: TcxPosition);
procedure SetIsEmptyViewInsert(Value: Boolean);
procedure SetSourceBand(Value: TcxGridBand);
protected
function AreArrowsVertical: Boolean; override;
function CalculateIsEmptyViewInsert(ACheckMousePos: Boolean): Boolean;
function CanRemove: Boolean; override;
procedure CheckDestParams; virtual;
function GetArrowAreaBounds(APlace: TcxGridArrowPlace): TRect; override;
function GetArrowsClientRect: TRect; override;
function GetCustomizationFormListBox: TcxCustomGridItemsListBox; override;
function GetSourceItemViewInfo: TcxCustomGridCellViewInfo; override;
function IsSourceCustomizationForm: Boolean; override;
function IsValidDestination: Boolean; override;
procedure BeginDragAndDrop; override;
procedure DragAndDrop(const P: TPoint; var Accepted: Boolean); override;
procedure EndDragAndDrop(Accepted: Boolean); override;
property Controller: TcxGridBandedTableController read GetController;
property CustomizationForm: TcxGridBandedTableCustomizationForm read GetCustomizationForm;
property DestBand: TcxGridBand read FDestBand write SetDestBand;
property DestBandContainerKind: TcxGridBandContainerKind read FDestBandContainerKind
write SetDestBandContainerKind;
property DestInsertPosition: TcxPosition read FDestInsertPosition
write SetDestInsertPosition;
property GridView: TcxGridBandedTableView read GetGridView;
property IsEmptyViewInsert: Boolean read FIsEmptyViewInsert write SetIsEmptyViewInsert;
property SourceBand: TcxGridBand read GetSourceBand write SetSourceBand;
property SourceBandContainerKind: TcxGridBandContainerKind read FSourceBandContainerKind
write FSourceBandContainerKind;
property ViewInfo: TcxGridBandedTableViewInfo read GetViewInfo;
public
procedure Init(const P: TPoint; AParams: TcxCustomGridHitTest); override;
end;
TcxGridColumnVertSizingObject = class(TcxCustomGridColumnSizingObject)
private
function GetColumn: TcxGridBandedColumn;
function GetController: TcxGridBandedTableController;
function GetLineHeight: Integer;
protected
procedure BeginDragAndDrop; override;
procedure EndDragAndDrop(Accepted: Boolean); override;
function GetCurrentSize: Integer; override;
function GetIsHorizontalSizing: Boolean; override;
property Column: TcxGridBandedColumn read GetColumn;
property Controller: TcxGridBandedTableController read GetController;
property LineHeight: Integer read GetLineHeight;
end;
TcxGridBandSizingObject = class(TcxCustomGridSizingObject)
private
FBand: TcxGridBand;
function GetBandViewInfo: TcxGridBandViewInfo;
function GetController: TcxGridBandedTableController;
function GetGridView: TcxGridBandedTableView;
protected
procedure BeginDragAndDrop; override;
procedure EndDragAndDrop(Accepted: Boolean); override;
function GetCurrentSize: Integer; override;
function GetSizingItemBounds: TRect; override;
function GetSizingMarkWidth: Integer; override;
property Band: TcxGridBand read FBand write FBand;
property BandViewInfo: TcxGridBandViewInfo read GetBandViewInfo;
property Controller: TcxGridBandedTableController read GetController;
property GridView: TcxGridBandedTableView read GetGridView;
public
procedure Init(const P: TPoint; AParams: TcxCustomGridHitTest); override;
end;
// customization form
TcxGridBandedTableBandsListBoxClass = class of TcxGridBandedTableBandsListBox;
TcxGridBandedTableBandsListBox = class(TcxGridTableItemsListBox)
private
function GetGridView: TcxGridBandedTableView;
protected
function DrawItemDrawBackgroundHandler(ACanvas: TcxCanvas; const ABounds: TRect): Boolean; override;
function GetDragAndDropParams: TcxCustomGridHitTest; override;
function GetItemEndEllipsis: Boolean; override;
property GridView: TcxGridBandedTableView read GetGridView;
public
procedure RefreshItems; override;
end;
TcxGridBandedTableCustomizationForm = class(TcxGridTableCustomizationForm)
private
FBandsListBox: TcxGridBandedTableBandsListBox;
FBandsPage: TcxTabSheet;
function GetGridView: TcxGridBandedTableView;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?