cxgridcardview.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,418 行 · 第 1/5 页
PAS
1,418 行
TcxGridCardViewRowLayoutObject = class(TcxCustomGridCardRowLayoutObject)
private
FGridView: TcxGridCardView;
FOnLayerIndexChanged: TNotifyEvent;
function GetBeginsLayer(ARow: TcxGridCardViewRow): Boolean;
procedure SetBeginsLayer(ARow: TcxGridCardViewRow; Value: Boolean);
protected
function GetLayout: TcxGridCardViewRowLayout; override;
function GetRow(AIndex: Integer): TcxGridCardViewRow; override;
function GetRowCount: Integer; override;
function GetRowIndex(ARow: TcxGridCardViewRow): Integer; override;
procedure AddLayer;
procedure InsertLayer(AIndex: Integer);
procedure RemoveLayer(AIndex: Integer);
procedure AddRowToLayer(ALayerIndex: Integer);
procedure RemoveRowFromLayer(ALayerIndex: Integer);
procedure AddRow(ARow: TcxGridCardViewRow);
procedure RemoveRow(ARowIndex: Integer);
procedure MoveRow(ARow: TcxGridCardViewRow; AOldIndex: Integer);
procedure MoveRows(ARows: TList; AIndex: Integer); overload;
procedure MoveRows(ARows: TList; AIndex: Integer; ARowLayout: TcxGridCardRowLayoutObject); overload;
procedure LayerIndexChanged;
property OnLayerIndexChanged: TNotifyEvent read FOnLayerIndexChanged write FOnLayerIndexChanged;
public
constructor Create(AGridView: TcxGridCardView);
procedure BreakLayer(ALayerIndex, AIndexInLayer: Integer);
function IsSimpleLayout: Boolean;
procedure MergeLayer(ALayerIndex: Integer);
procedure SetCoordinates(ARow: TcxGridCardViewRow; const ACoordinates: TcxGridCardRowCoordinates);
procedure SetIndexInLayer(ARow: TcxGridCardViewRow; AValue: Integer;
AMoveSubItems: Boolean = False);
procedure SetLayerIndex(ARow: TcxGridCardViewRow; AValue: Integer;
ANewLayer: Boolean = False; AMoveSubItems: Boolean = False);
procedure SetPosition(ARow: TcxGridCardViewRow; const APosition: TcxGridCardRowPosition);
property BeginsLayer[ARow: TcxGridCardViewRow]: Boolean read GetBeginsLayer write SetBeginsLayer;
property GridView: TcxGridCardView read FGridView;
end;
TcxGridCardViewVisibleRowLayoutObject = class(TcxGridCardRowLayoutObject)
private
FGridView: TcxGridCardView;
protected
function GetLayout: TcxGridCardViewRowLayout; override;
public
constructor Create(AGridView: TcxGridCardView);
function GetLastVisibleSubItem(ARow: TcxGridCardViewRow): TcxGridCardViewRow;
function GetLayerCount(ARow: TcxGridCardViewRow): Integer;
function IsWholeLayer(ARow: TcxGridCardViewRow): Boolean;
property GridView: TcxGridCardView read FGridView;
end;
TcxGridCardViewRowLayoutControllerClass = class of TcxGridCardViewRowLayoutController;
TcxGridCardViewRowLayoutController = class
private
FGridView: TcxGridCardView;
FLayoutObject: TcxGridCardViewRowLayoutObject;
FVisibleLayoutObject: TcxGridCardViewVisibleRowLayoutObject;
function GetBeginsLayer(ARow: TcxGridCardViewRow): Boolean;
function GetLayout: TcxGridCardViewRowLayout;
procedure SetBeginsLayer(ARow: TcxGridCardViewRow; Value: Boolean);
procedure LayerIndexChanged(Sender: TObject);
protected
procedure RefreshVisibleLayoutObject;
procedure RowIndexChanged(ARow: TcxGridCardViewRow; AOldIndex: Integer);
procedure VisibleRowsListChanged;
function CreateCardRowLayout(ACardViewInfo: TcxGridCardViewInfo): TcxGridCardRowLayout;
function GetCardRowLayoutClass: TcxGridCardRowLayoutClass; virtual;
public
constructor Create(AGridView: TcxGridCardView); virtual;
destructor Destroy; override;
function IsHorizontalLayout: Boolean;
function IsSimpleLayout: Boolean;
function IsWholeLine(ARow: TcxGridCardViewRow): Boolean;
// indexes handling
function GetCoordinates(ARow: TcxGridCardViewRow): TcxGridCardRowCoordinates;
procedure SetCoordinates(ARow: TcxGridCardViewRow; AColIndex, ARowIndex: Integer); overload;
procedure SetCoordinates(ARow: TcxGridCardViewRow; ACoordinates: TcxGridCardRowCoordinates); overload;
function GetVisibleCoordinates(ARow: TcxGridCardViewRow): TcxGridCardRowCoordinates;
function GetPosition(ARow: TcxGridCardViewRow): TcxGridCardRowPosition;
procedure SetPosition(ARow: TcxGridCardViewRow; ALayerIndex, AIndexInLayer: Integer);
function GetVisiblePosition(ARow: TcxGridCardViewRow): TcxGridCardRowPosition;
// navigation
function FindNextRow(ACard: TcxGridCard; ARow: TcxGridCardViewRow;
ASameLayer, AGoForward, AGoOnCycle: Boolean; out ACycleChanged: Boolean): TcxGridCardViewRow;
function FindNextRowHorizontally(ACard: TcxGridCard; ARow: TcxGridCardViewRow;
AGoForward, AGoOnCycle: Boolean; out ACycleChanged: Boolean): TcxGridCardViewRow;
function FindNextRowVertically(ACard: TcxGridCard; ARow: TcxGridCardViewRow;
AGoForward, AGoOnCycle: Boolean; out ACycleChanged: Boolean): TcxGridCardViewRow;
property BeginsLayer[ARow: TcxGridCardViewRow]: Boolean read GetBeginsLayer write SetBeginsLayer;
property GridView: TcxGridCardView read FGridView;
property Layout: TcxGridCardViewRowLayout read GetLayout;
property LayoutObject: TcxGridCardViewRowLayoutObject read FLayoutObject;
property VisibleLayoutObject: TcxGridCardViewVisibleRowLayoutObject read FVisibleLayoutObject;
end;
{ painters }
TcxGridCardRowFilterButtonPainter = class(TcxCustomGridCellPainter)
private
function GetViewInfo: TcxGridCardRowFilterButtonViewInfo;
protected
procedure Paint; override;
property ViewInfo: TcxGridCardRowFilterButtonViewInfo read GetViewInfo;
end;
TcxGridCardRowCaptionPainter = class(TcxCustomGridCellPainter)
private
function GetViewInfo: TcxGridCardRowCaptionViewInfo;
protected
procedure DrawContent; override;
property ViewInfo: TcxGridCardRowCaptionViewInfo read GetViewInfo;
end;
TcxGridCardRowPainterClass = class of TcxGridCardRowPainter;
TcxGridCardRowPainter = class(TcxCustomGridCellPainter)
private
function GetViewInfo: TcxGridCardRowViewInfo;
protected
procedure DrawExpandButton; virtual;
procedure DrawFocusRect; virtual;
procedure DrawIndent; virtual;
procedure Paint; override;
property ViewInfo: TcxGridCardRowViewInfo read GetViewInfo;
end;
TcxGridCardScrollButtonPainter = class(TcxCustomGridCellPainter)
private
function GetViewInfo: TcxCustomGridCardScrollButtonViewInfo;
protected
procedure DrawContent; override;
function ExcludeFromClipRect: Boolean; override;
property ViewInfo: TcxCustomGridCardScrollButtonViewInfo read GetViewInfo;
end;
TcxGridCardExpandButtonPainter = class(TcxCustomGridCellPainter)
private
function GetViewInfo: TcxGridCardExpandButtonViewInfo;
protected
procedure Paint; override;
property ViewInfo: TcxGridCardExpandButtonViewInfo read GetViewInfo;
end;
TcxGridCardPainter = class(TcxCustomGridRecordPainter)
private
FClipRegion: TcxRegion;
function GetViewInfo: TcxGridCardViewInfo;
protected
procedure AfterPaint; override;
procedure BeforePaint; override;
procedure DrawBackground; override;
procedure DrawCardBorder; virtual;
procedure DrawExpandButton; override;
function DrawExpandButtonBeforePaint: Boolean; override;
procedure DrawLayerSeparators; virtual;
procedure DrawRows; virtual;
procedure DrawScrollButtons; virtual;
procedure Paint; override;
property ViewInfo: TcxGridCardViewInfo read GetViewInfo;
end;
TcxGridCardViewPainter = class(TcxCustomGridTablePainter)
protected
procedure DrawBackground; override;
procedure DrawSeparators; virtual;
procedure PaintContent; override;
function ViewInfo: TcxGridCardViewViewInfo; reintroduce;
end;
{ view infos }
// column and columns
TcxGridCardViewColumn = class
private
FColumns: TcxGridCardViewColumns;
FIndex: Integer;
FRows: TList;
function GetLastRow: TcxGridCardViewInfo;
function GetRow(Index: Integer): TcxGridCardViewInfo;
function GetRowCount: Integer;
function GetVisibleRowCount: Integer;
procedure SetRow(Index: Integer; Value: TcxGridCardViewInfo);
public
constructor Create(AColumns: TcxGridCardViewColumns; AIndex: Integer);
destructor Destroy; override;
function GetNearestRow(APos: Integer): TcxGridCardViewInfo;
property Index: Integer read FIndex;
property LastRow: TcxGridCardViewInfo read GetLastRow;
property RowCount: Integer read GetRowCount;
property Rows[Index: Integer]: TcxGridCardViewInfo read GetRow write SetRow; default;
property VisibleRowCount: Integer read GetVisibleRowCount;
end;
TcxGridCardViewColumnsClass = class of TcxGridCardViewColumns;
TcxGridCardViewColumns = class
private
FCardsViewInfo: TcxGridCardsViewInfo;
FItems: TList;
function GetCount: Integer;
function GetItem(Index: Integer): TcxGridCardViewColumn;
function GetLast: TcxGridCardViewColumn;
function GetVisibleCount: Integer;
procedure CreateItems;
procedure DestroyItems;
protected
property CardsViewInfo: TcxGridCardsViewInfo read FCardsViewInfo;
public
constructor Create(ACardsViewInfo: TcxGridCardsViewInfo);
destructor Destroy; override;
property Count: Integer read GetCount;
property Items[Index: Integer]: TcxGridCardViewColumn read GetItem; default;
property Last: TcxGridCardViewColumn read GetLast;
property VisibleCount: Integer read GetVisibleCount;
end;
// card row
TcxGridCardRowCellViewInfo = class(TcxGridTableDataCellViewInfo)
private
FRowViewInfo: TcxGridCardRowViewInfo;
function GetCardViewInfo: TcxGridCardViewInfo;
function GetGridView: TcxGridCardView;
function GetGridRecord: TcxGridCard;
function GetRow: TcxGridCardViewRow;
protected
function GetAreaBounds: TRect; override;
function GetMultiLine: Boolean; override;
function GetMultiLinePainting: Boolean; override;
function GetTransparent: Boolean; override;
function HasFocusRect: Boolean; override;
public
constructor Create(ARowViewInfo: TcxGridCardRowViewInfo); reintroduce; virtual;
function MouseDown(AHitTest: TcxCustomGridHitTest; AButton: TMouseButton;
AShift: TShiftState): Boolean; override;
property CardViewInfo: TcxGridCardViewInfo read GetCardViewInfo;
property GridRecord: TcxGridCard read GetGridRecord;
property GridView: TcxGridCardView read GetGridView;
property Row: TcxGridCardViewRow read GetRow;
property RowViewInfo: TcxGridCardRowViewInfo read FRowViewInfo;
end;
TcxGridCardRowFilterButtonViewInfoClass = class of TcxGridCardRowFilterButtonViewInfo;
TcxGridCardRowFilterButtonViewInfo = class(TcxCustomGridViewCellViewInfo,
IcxGridFilterPopupOwner)
private
FRowCaptionViewInfo: TcxGridCardRowCaptionViewInfo;
function GetActive: Boolean;
function GetDropDownWindowValue: TcxGridFilterPopup;
function GetRow: TcxGridCardViewRow;
protected
{ IcxGridFilterPopupOwner }
function GetItem: TcxCustomGridTableItem;
function CalculateHeight: Integer; override;
function CalculateWidth: Integer; override;
function GetHitTestClass: TcxCustomGridHitTestClass; override;
function GetPainterClass: TcxCustomGridCellPainterClass; override;
function GetVisible: Boolean; override;
function GetWidth: Integer; override;
procedure InitHitTest(AHitTest: TcxCustomGridHitTest); override;
function NeedsContainerHotTrack: Boolean; virtual;
function OccupiesSpace: Boolean; virtual;
function CloseDropDownWindowOnDestruction: Boolean; override;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?