cxgridcardview.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,418 行 · 第 1/5 页
PAS
1,418 行
function GetGridView: TcxGridCardView;
function GetSeparator(Index: Integer): TRect;
function GetSeparatorCount: Integer;
function GetViewInfo: TcxGridCardViewViewInfo;
procedure SetDestPointX(Value: Integer);
protected
procedure DirtyChanged; override;
function GetCurrentWidth: Integer; virtual;
function GetDeltaWidth: Integer; virtual;
function GetDragAndDropCursor(Accepted: Boolean): TCursor; override;
function GetImmediateStart: Boolean; override;
function GetOriginalWidth: Integer; virtual;
procedure BeginDragAndDrop; override;
procedure DragAndDrop(const P: TPoint; var Accepted: Boolean); override;
procedure EndDragAndDrop(Accepted: Boolean); override;
procedure AddSeparator(const R: TRect);
procedure CalculateSeparators;
procedure ClearSeparators;
procedure DrawSeparators;
property SeparatorCount: Integer read GetSeparatorCount;
property Separators[Index: Integer]: TRect read GetSeparator;
property CardColumnIndex: Integer read FCardColumnIndex;
property CardOriginalWidth: Integer read FCardOriginalWidth
write FCardOriginalWidth;
property CurrentWidth: Integer read GetCurrentWidth;
property DeltaWidth: Integer read GetDeltaWidth;
property DestPointX: Integer read FDestPointX write SetDestPointX;
property GridView: TcxGridCardView read GetGridView;
property OriginalWidth: Integer read GetOriginalWidth;
property ViewInfo: TcxGridCardViewViewInfo read GetViewInfo;
public
constructor Create(AControl: TcxControl); override;
destructor Destroy; override;
procedure Init(const P: TPoint; AParams: TcxCustomGridHitTest); override;
end;
// customization form
TcxGridCardRowsListBox = class(TcxCustomGridTableItemsListBox)
private
function GetGridView: TcxGridCardView;
protected
function CalculateItemHeight: Integer; override;
function GetDragAndDropParams: TcxCustomGridHitTest; override;
property GridView: TcxGridCardView read GetGridView;
public
procedure PaintItem(ACanvas: TcxCanvas; R: TRect; AIndex: Integer; AFocused: Boolean); override;
procedure RefreshItems; override;
end;
TcxGridCardViewCustomizationForm = class(TcxCustomGridTableCustomizationForm)
protected
function GetItemsListBoxClass: TcxCustomGridTableItemsListBoxClass; override;
function GetItemsPageCaption: string; override;
end;
// controllers
TcxGridCardViewControllerImplClass = class of TcxGridCardViewControllerImpl;
TcxGridCardViewControllerImpl = class
private
FController: TcxGridCardViewController;
function GetControl: TcxControl;
function GetDataController: TcxCustomDataController;
function GetScrollBarOffsetBegin: Integer;
function GetScrollBarOffsetEnd: Integer;
function GetViewData: TcxGridCardViewViewData;
function GetViewInfo: TcxGridCardViewViewInfo;
protected
property Control: TcxControl read GetControl;
property Controller: TcxGridCardViewController read FController;
property DataController: TcxCustomDataController read GetDataController;
property ScrollBarOffsetBegin: Integer read GetScrollBarOffsetBegin;
property ScrollBarOffsetEnd: Integer read GetScrollBarOffsetEnd;
property ViewData: TcxGridCardViewViewData read GetViewData;
property ViewInfo: TcxGridCardViewViewInfo read GetViewInfo;
public
constructor Create(AController: TcxGridCardViewController); virtual;
function GetIsRecordsScrollHorizontal: Boolean; virtual; abstract;
function GetMouseWheelScrollingKind: TcxMouseWheelScrollingKind; virtual; abstract;
function GetScrollDelta: Integer; virtual; abstract;
procedure InitScrollBarsParameters; virtual; abstract;
procedure KeyDown(var Key: Word; Shift: TShiftState); dynamic;
end;
TcxGridCardViewControllerHorizontalImpl = class(TcxGridCardViewControllerImpl)
public
procedure FocusRecordInNextColumn(ADirection: TcxDirection; AIsSelecting: Boolean);
function GetIsRecordsScrollHorizontal: Boolean; override;
function GetMouseWheelScrollingKind: TcxMouseWheelScrollingKind; override;
function GetScrollDelta: Integer; override;
procedure InitScrollBarsParameters; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
end;
TcxGridCardViewControllerVerticalImpl = class(TcxGridCardViewControllerImpl)
public
procedure FocusRecordInNextRow(ADirection: TcxDirection; AIsSelecting: Boolean);
function GetIsRecordsScrollHorizontal: Boolean; override;
function GetMouseWheelScrollingKind: TcxMouseWheelScrollingKind; override;
function GetScrollDelta: Integer; override;
procedure InitScrollBarsParameters; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
end;
TcxGridCardViewController = class(TcxCustomGridTableController)
private
FImplementationObject: TcxGridCardViewControllerImpl;
FScrollCardViewInfo: TcxGridCardViewInfo;
function GetCustomizationForm: TcxGridCardViewCustomizationForm;
function GetFocusedCard: TcxGridCard;
function GetFocusedCardViewInfo: TcxGridCardViewInfo;
function GetFocusedRow: TcxGridCardViewRow;
function GetGridView: TcxGridCardView;
function GetScrollDelta: Integer;
function GetTopCardIndex: Integer;
function GetViewData: TcxGridCardViewViewData;
function GetViewInfo: TcxGridCardViewViewInfo;
procedure SetFocusedCard(Value: TcxGridCard);
procedure SetFocusedRow(Value: TcxGridCardViewRow);
procedure SetScrollCardViewInfo(Value: TcxGridCardViewInfo);
procedure SetTopCardIndex(Value: Integer);
procedure CreateImplementationObject;
procedure DestroyImplementationObject;
function GetImplementationObjectClass: TcxGridCardViewControllerImplClass;
protected
function CanFocusNextItem(AFocusedItemIndex, ANextItemIndex: Integer;
AGoForward, AGoOnCycle, AGoToNextRecordOnCycle: Boolean): Boolean; override;
function FindNextRow(ACard: TcxGridCard; ARows: TList; ARow: TcxGridCardViewRow;
AGoForward, AGoOnCycle: Boolean; out ACycleChanged: Boolean): TcxGridCardViewRow;
function GetDesignHitTest(AHitTest: TcxCustomGridHitTest): Boolean; override;
function GetDragScrollInterval: Integer; override;
function GetIsRecordsScrollHorizontal: Boolean; override;
function GetMouseWheelScrollingKind: TcxMouseWheelScrollingKind; override;
function IsKeyForMultiSelect(AKey: Word; AShift: TShiftState;
AFocusedRecordChanged: Boolean): Boolean; override;
function ProcessFocusedRowKeys(var AKey: Word; AShift: TShiftState;
ARowGoOnCycle: Boolean): Boolean; virtual;
procedure RowExpandedChanged(ARow: TcxGridCardViewRow); virtual;
procedure RowExpandedChanging(ARow: TcxGridCardViewRow; AValue: Boolean); virtual;
procedure ScrollData(ADirection: TcxDirection); override;
// internal draganddrop data scrolling
function CanScrollData(ADirection: TcxDirection): Boolean; override;
function GetScrollDataTimeInterval(ADirection: TcxDirection): Integer; override;
property ScrollCardViewInfo: TcxGridCardViewInfo read FScrollCardViewInfo write SetScrollCardViewInfo;
// customization
function GetCustomizationFormClass: TcxCustomGridCustomizationFormClass; override;
function GetRowDragAndDropObjectClass: TcxGridCardRowMovingObjectClass; virtual;
property FocusedCardViewInfo: TcxGridCardViewInfo read GetFocusedCardViewInfo;
property ImplementationObject: TcxGridCardViewControllerImpl read FImplementationObject;
property ScrollDelta: Integer read GetScrollDelta;
property ViewData: TcxGridCardViewViewData read GetViewData;
property ViewInfo: TcxGridCardViewViewInfo read GetViewInfo;
public
constructor Create(AGridView: TcxCustomGridView); override;
destructor Destroy; override;
procedure CheckScrolling(const P: TPoint); override;
function IsDataFullyVisible(AIsCallFromMaster: Boolean = False): Boolean; override;
procedure MakeItemVisible(AItem: TcxCustomGridTableItem); override;
function CanScrollFocusedCard(ADown: Boolean): Boolean;
function ScrollFocusedCard(ADown: Boolean): Boolean;
procedure InitScrollBarsParameters; override;
procedure Scroll(AScrollBarKind: TScrollBarKind; AScrollCode: TScrollCode;
var AScrollPos: Integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure LayoutDirectionChanged;
function FocusNextRowHorizontally(AGoForward, AGoOnCycle: Boolean): Boolean; virtual;
function FocusNextRowVertically(AGoForward, AGoOnCycle: Boolean): Boolean; virtual;
property CustomizationForm: TcxGridCardViewCustomizationForm read GetCustomizationForm;
property FocusedCard: TcxGridCard read GetFocusedCard write SetFocusedCard;
property FocusedItem: TcxGridCardViewRow read GetFocusedRow write SetFocusedRow;
property FocusedRow: TcxGridCardViewRow read GetFocusedRow write SetFocusedRow;
property GridView: TcxGridCardView read GetGridView;
property TopCardIndex: Integer read GetTopCardIndex write SetTopCardIndex;
end;
// row layout controller
TcxGridCardViewRowLayout = (rlHorizontal, rlVertical);
TcxGridCardViewRowLayerPosition = (rlpBeforeRow, rlpAfterRow, rlpBeforeLayer, rlpAfterLayer);
TcxGridCardRowPosition = record
LayerIndex: Integer;
IndexInLayer: Integer;
end;
TcxGridCardRowCoordinates = record
ColIndex: Integer;
RowIndex: Integer;
end;
TcxGridCardRowCoordinatesArray = array of TcxGridCardRowCoordinates;
TcxCustomGridCardRowLayoutObject = class
private
FLayerRowCounts: TList;
function GetLayerCount: Integer;
function GetLayerFirstRow(ALayerIndex: Integer): TcxGridCardViewRow;
function GetLayerFirstRowIndex(ALayerIndex: Integer): Integer;
function GetLayerRow(ALayerIndex, AIndex: Integer): TcxGridCardViewRow;
function GetLayerRowCount(ALayerIndex: Integer): Integer;
procedure SetLayerRowCount(ALayerIndex, Value: Integer);
protected
function GetLayout: TcxGridCardViewRowLayout; virtual; abstract;
function GetRow(AIndex: Integer): TcxGridCardViewRow; virtual; abstract;
function GetRowCount: Integer; virtual; abstract;
function GetRowIndex(ARow: TcxGridCardViewRow): Integer; virtual; abstract;
function GetCoordinates(const APosition: TcxGridCardRowPosition): TcxGridCardRowCoordinates; overload;
function GetPosition(const ACoordinates: TcxGridCardRowCoordinates): TcxGridCardRowPosition; overload;
function GetLayerIndex(ARowIndex: Integer): Integer; overload;
function GetLayerPosition(APosition: TcxPosition): TcxGridCardViewRowLayerPosition;
function GetLength(ARow: TcxGridCardViewRow): Integer;
function GetOffsetInLayer(ALayerIndex, AIndexInLayer: Integer): Integer; overload;
function GetPosition(ARowIndex: Integer): TcxGridCardRowPosition; overload;
property LayerRowCounts: TList read FLayerRowCounts;
property RowCount: Integer read GetRowCount;
property Rows[AIndex: Integer]: TcxGridCardViewRow read GetRow;
public
constructor Create;
destructor Destroy; override;
function GetCoordinates(ARow: TcxGridCardViewRow): TcxGridCardRowCoordinates; overload;
function GetIndexInLayer(ARow: TcxGridCardViewRow): Integer;
function GetLayerIndex(ARow: TcxGridCardViewRow): Integer; overload;
function GetOffsetInLayer(ARow: TcxGridCardViewRow): Integer; overload;
function GetPosition(ARow: TcxGridCardViewRow): TcxGridCardRowPosition; overload;
function GetRowAtOffset(ALayerIndex, AOffset: Integer): TcxGridCardViewRow;
function IsFirstInLayer(ARow: TcxGridCardViewRow): Boolean;
function IsLastInLayer(ARow: TcxGridCardViewRow): Boolean;
function IsWholeLine(ARow: TcxGridCardViewRow): Boolean;
property LayerCount: Integer read GetLayerCount;
property LayerFirstRow[ALayerIndex: Integer]: TcxGridCardViewRow read GetLayerFirstRow;
property LayerFirstRowIndex[ALayerIndex: Integer]: Integer read GetLayerFirstRowIndex;
property LayerRowCount[ALayerIndex: Integer]: Integer read GetLayerRowCount write SetLayerRowCount;
property LayerRows[ALayerIndex, AIndex: Integer]: TcxGridCardViewRow read GetLayerRow;
property Layout: TcxGridCardViewRowLayout read GetLayout;
end;
TcxGridCardRowLayoutObject = class(TcxCustomGridCardRowLayoutObject)
private
FLayout: TcxGridCardViewRowLayout;
FRows: TList;
protected
function GetLayout: TcxGridCardViewRowLayout; override;
function GetRow(AIndex: Integer): TcxGridCardViewRow; override;
function GetRowCount: Integer; override;
function GetRowIndex(ARow: TcxGridCardViewRow): Integer; override;
property RowsList: TList read FRows;
public
constructor Create;
destructor Destroy; override;
procedure Fill(ARows: TList);
property Layout: TcxGridCardViewRowLayout read GetLayout write FLayout;
end;
TcxGridCardVisibleRowLayoutObject = class(TcxGridCardRowLayoutObject)
private
FCard: TcxGridCard;
public
constructor Create(ACard: TcxGridCard);
procedure GetInsertionParams(ARow: TcxGridCardViewRow; APosition: TcxPosition;
out AInsertionIndex: Integer; out AInsertionPos: TcxGridCardRowInsertionPos);
procedure GetLayerRows(ARowInLayer: TcxGridCardViewRow; ARows: TList);
procedure GetRowsAtOffset(ARowAtOffset: TcxGridCardViewRow; ARows: TList);
property Card: TcxGridCard read FCard;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?