cxgridcustomview.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,463 行 · 第 1/5 页
PAS
1,463 行
destructor Destroy; override;
procedure BeginDragAndDrop; override;
procedure DragDrop(Source: TObject; X, Y: Integer); override;
function ExecuteAction(Action: TBasicAction): Boolean; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
procedure SetFocus; override;
function UpdateAction(Action: TBasicAction): Boolean; override;
property Container: TcxControl read GetContainer;
property GridView: TcxCustomGridView read GetGridView;
property HScrollBar;
property HScrollBarVisible;
property Keys; //!!!
property MouseCapture;
property ViewInfo: TcxCustomGridViewInfo read FViewInfo;
property VScrollBar;
property VScrollBarVisible;
end;
TcxCustomGridCellViewInfoClass = class of TcxCustomGridCellViewInfo;
TcxCustomGridCellViewInfo = class(TcxIUnknownObject,
IcxMouseCaptureObject, IcxMouseTrackingCaller, IcxMouseTrackingCaller2,
IcxCustomGridPopupOwner)
private
FCalculated: Boolean;
FCalculatingParams: Boolean;
FAlignmentHorz: TAlignment;
FAlignmentVert: TcxAlignmentVert;
FBorders: TcxBorders;
FIsDestroying: Boolean;
FLinkedHitTest: TcxCustomGridHitTest;
FParamsCalculated: Boolean;
FState: TcxGridCellState;
FText: string;
FVisible: Boolean;
function GetBorderSize(AIndex: TcxBorder): Integer;
function GetButtonState: TcxButtonState;
function GetClientBounds: TRect;
function GetContentBounds: TRect;
function GetTextBoundsValue: TRect;
function GetTextHeight: Integer;
function GetTextHeightWithOffset: Integer;
function GetTextWidth: Integer;
function GetTextWidthWithOffset: Integer;
procedure SetLinkedHitTest(Value: TcxCustomGridHitTest);
procedure SetState(Value: TcxGridCellState);
protected
FClientBounds: TRect;
FContentBounds: TRect;
{ IcxMouseCaptureObject }
procedure DoCancelMode; virtual;
{ IcxMouseTrackingCaller2 }
procedure MouseLeave; virtual;
function PtInCaller(const P: TPoint): Boolean; virtual;
{ IcxCustomGridPopupOwner }
function ClosePopupWhenNilOwner: Boolean;
function GetOwnerBounds: TRect;
procedure PopupClosed;
procedure AfterCalculateBounds(var ABounds: TRect); virtual;
procedure AfterCustomDraw(ACanvas: TcxCanvas); virtual;
procedure BeforeCustomDraw(ACanvas: TcxCanvas); virtual;
procedure BeforeStateChange; virtual;
function CalculateClientBounds: TRect; virtual;
function CalculateContentBounds: TRect; virtual;
function CalculateTextWidth(AAngle: Integer = 0): Integer;
function CalculateTextHeight(AForPainting: Boolean; AAngle: Integer = 0): Integer;
procedure CalculateParams;
procedure CalculateParamsNeeded;
function CalculateHeight: Integer; virtual;
function CalculateWidth: Integer; virtual;
function CaptureMouseOnPress: Boolean; virtual;
procedure Click; virtual;
function CustomDraw(ACanvas: TcxCanvas): Boolean; virtual;
function CustomDrawBackground(ACanvas: TcxCanvas): Boolean; virtual;
procedure Destroying;
procedure DoCalculateParams; virtual;
procedure DoInvalidate; virtual;
function DoCustomDraw(ACanvas: TcxCanvas): Boolean; virtual;
function DoCustomDrawBackground(ACanvas: TcxCanvas): Boolean; virtual;
function GetActualState: TcxGridCellState; virtual;
function GetAlignmentHorz: TAlignment; virtual;
function GetAlignmentVert: TcxAlignmentVert; virtual;
function GetAreaBounds: TRect; virtual;
function GetBackgroundBitmap: TBitmap; virtual;
function GetBorderBounds(AIndex: TcxBorder): TRect; virtual;
function GetBorderColor(AIndex: TcxBorder): TColor; virtual;
function GetBorders: TcxBorders; virtual;
function GetBorderWidth(AIndex: TcxBorder): Integer; virtual;
function GetBounds: TRect;
function GetCanvas: TcxCanvas; virtual; abstract;
class function GetCellHeight(ATextHeight: Integer;
ALookAndFeelPainter: TcxCustomLookAndFeelPainterClass): Integer; virtual;
function GetContentHeight: Integer; virtual;
function GetContentWidth: Integer; virtual;
function GetControl: TcxControl; virtual;
function GetDesignSelectionBounds: TRect; virtual;
function GetDesignSelectionWidth: Integer; virtual;
function GetHeight: Integer; virtual;
function GetHitTestClass: TcxCustomGridHitTestClass; virtual; abstract;
function GetHotTrack: Boolean; virtual;
function GetIsCheck: Boolean; virtual;
function GetIsDesignSelected: Boolean; virtual;
function GetIsVisibleForPainting: Boolean; virtual;
function GetMouseCapture: Boolean; virtual;
function GetMultiLine: Boolean; virtual;
function GetMultiLinePainting: Boolean; virtual;
function GetPainterClass: TcxCustomGridCellPainterClass; virtual;
function GetShowEndEllipsis: Boolean; virtual;
function GetText: string; virtual;
function GetTextAreaBounds: TRect; virtual;
function GetTextAttributes(AForPainting: Boolean): Integer; virtual;
function GetTextBounds(AHorizontal, AVertical: Boolean): TRect;
function GetTextCellHeight(AGridViewInfo: TcxCustomGridViewInfo;
ALookAndFeelPainter: TcxCustomLookAndFeelPainterClass): Integer; virtual;
function GetTextForPainting: string; virtual;
function GetTransparent: Boolean; virtual;
procedure GetViewParams(var AParams: TcxViewParams); virtual;
function GetVisible: Boolean; virtual;
function GetVisibleForHitTest: Boolean; virtual;
function GetWidth: Integer; virtual;
function HasBackground: Boolean; virtual;
function HasCustomDraw: Boolean; virtual;
function HasCustomDrawBackground: Boolean; virtual;
function HasHitTestPoint(const P: TPoint): Boolean; virtual;
function HasMouse(AHitTest: TcxCustomGridHitTest): Boolean; virtual;
procedure InitHitTest(AHitTest: TcxCustomGridHitTest); virtual;
function InvalidateOnStateChange: Boolean; virtual;
procedure Offset(DX, DY: Integer); virtual;
procedure RestoreParams(const AParams: TcxViewParams); virtual;
procedure SaveParams(out AParams: TcxViewParams); virtual;
procedure SetHeight(Value: Integer); virtual;
procedure SetMouseCapture(Value: Boolean); virtual;
procedure SetWidth(Value: Integer); virtual;
procedure StateChanged(APrevState: TcxGridCellState); virtual;
procedure DropDown; virtual;
procedure CloseUp; virtual;
function CloseDropDownWindowOnDestruction: Boolean; virtual;
function DropDownWindowExists: Boolean; virtual;
function GetDropDownWindow: TcxCustomGridPopup; virtual;
function GetDropDownWindowOwnerBounds: TRect; virtual;
function IsDropDownWindowOwner: Boolean; virtual;
property DropDownWindow: TcxCustomGridPopup read GetDropDownWindow;
property BorderWidth[AIndex: TcxBorder]: Integer read GetBorderWidth;
property CalculatingParams: Boolean read FCalculatingParams;
property Canvas: TcxCanvas read GetCanvas;
property Control: TcxControl read GetControl;
property DesignSelectionBounds: TRect read GetDesignSelectionBounds;
property DesignSelectionWidth: Integer read GetDesignSelectionWidth;
property HotTrack: Boolean read GetHotTrack;
property IsCheck: Boolean read GetIsCheck;
property IsDesignSelected: Boolean read GetIsDesignSelected;
property IsDestroying: Boolean read FIsDestroying;
property IsVisibleForPainting: Boolean read GetIsVisibleForPainting;
property LinkedHitTest: TcxCustomGridHitTest read FLinkedHitTest write SetLinkedHitTest;
property ShowEndEllipsis: Boolean read GetShowEndEllipsis;
public
Bounds: TRect;
MultiLine: Boolean;
MultiLinePainting: Boolean;
Params: TcxViewParams;
constructor Create;
destructor Destroy; override;
procedure AfterConstruction; override;
procedure AfterRecalculation; virtual;
procedure BeforeDestruction; override;
procedure BeforeRecalculation; virtual;
procedure Calculate(ALeftBound, ATopBound: Integer; AWidth: Integer = -1;
AHeight: Integer = -1); overload; virtual;
procedure Calculate(const ABounds: TRect); overload; virtual;
function GetAreaBoundsForPainting: TRect; virtual;
function GetBestFitWidth: Integer; virtual;
function GetHitTest(const P: TPoint): TcxCustomGridHitTest; virtual;
function HasPoint(const P: TPoint): Boolean; virtual;
procedure Invalidate; virtual;
function MouseDown(AHitTest: TcxCustomGridHitTest; AButton: TMouseButton;
AShift: TShiftState): Boolean; virtual;
function MouseMove(AHitTest: TcxCustomGridHitTest; AShift: TShiftState): Boolean; virtual;
function MouseUp(AHitTest: TcxCustomGridHitTest; AButton: TMouseButton;
AShift: TShiftState): Boolean; virtual;
procedure DoOffset(DX, DY: Integer);
procedure Paint(ACanvas: TcxCanvas = nil); virtual;
procedure Recalculate;
procedure ResetContentBounds;
procedure Update;
property ActualState: TcxGridCellState read GetActualState;
property AlignmentHorz: TAlignment read FAlignmentHorz write FAlignmentHorz;
property AlignmentVert: TcxAlignmentVert read FAlignmentVert write FAlignmentVert;
property BackgroundBitmap: TBitmap read GetBackgroundBitmap;
property BorderBounds[AIndex: TcxBorder]: TRect read GetBorderBounds;
property BorderColor[AIndex: TcxBorder]: TColor read GetBorderColor;
property BorderSize[AIndex: TcxBorder]: Integer read GetBorderSize;
property Borders: TcxBorders read FBorders write FBorders;
property ButtonState: TcxButtonState read GetButtonState;
property Calculated: Boolean read FCalculated write FCalculated;
property ClientBounds: TRect read GetClientBounds;
property ContentBounds: TRect read GetContentBounds;
property ContentHeight: Integer read GetContentHeight;
property ContentWidth: Integer read GetContentWidth;
property Height: Integer read GetHeight write SetHeight;
property MouseCapture: Boolean read GetMouseCapture write SetMouseCapture;
property State: TcxGridCellState read FState write SetState;
property Text: string read FText write FText;
property TextBounds: TRect read GetTextBoundsValue;
property TextForPainting: string read GetTextForPainting;
property TextHeightWithOffset: Integer read GetTextHeightWithOffset;
property TextWidthWithOffset: Integer read GetTextWidthWithOffset;
property TextHeight: Integer read GetTextHeight;
property TextWidth: Integer read GetTextWidth;
property TextAreaBounds: TRect read GetTextAreaBounds;
property Transparent: Boolean read GetTransparent;
property Visible: Boolean read GetVisible write FVisible;
property VisibleForHitTest: Boolean read GetVisibleForHitTest;
property Width: Integer read GetWidth write SetWidth;
end;
TcxCustomGridViewCellViewInfo = class(TcxCustomGridCellViewInfo)
private
FGridViewInfo: TcxCustomGridViewInfo;
function GetController: TcxCustomGridController;
function GetGridView: TcxCustomGridView;
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass;
protected
procedure AfterCalculateBounds(var ABounds: TRect); override;
procedure DoInvalidate; override;
function EmulateMouseMoveAfterCalculate: Boolean; virtual;
function GetCanvas: TcxCanvas; override;
function GetControl: TcxControl; override;
function HasMouse(AHitTest: TcxCustomGridHitTest): Boolean; override;
procedure InitHitTest(AHitTest: TcxCustomGridHitTest); override;
function CanShowHint: Boolean; virtual;
procedure CheckHint(AHitTest: TcxCustomGridHitTest);
function GetAreaBoundsForHint: TRect; virtual;
function GetBoundsForHint: TRect;
function GetCellBoundsForHint: TRect; virtual;
function GetHintText: string; virtual;
function GetHintTextRect(const AMousePos: TPoint): TRect; virtual;
function HasHintPoint(const P: TPoint): Boolean; virtual;
procedure InitHint(const AMousePos: TPoint; out AHintText: TCaption;
out AIsHintMultiLine: Boolean; out ATextRect: TRect); virtual;
function IsHintForText: Boolean; virtual;
function IsHintMultiLine: Boolean; virtual;
function NeedShowHint(const AMousePos: TPoint; out AHintText: TCaption;
out AIsHintMultiLine: Boolean; out ATextRect: TRect): Boolean; virtual;
property Controller: TcxCustomGridController read GetController;
public
constructor Create(AGridViewInfo: TcxCustomGridViewInfo); virtual;
destructor Destroy; override;
procedure BeforeRecalculation; override;
procedure Invalidate; override;
function MouseMove(AHitTest: TcxCustomGridHitTest; AShift: TShiftState): Boolean; override;
property GridView: TcxCustomGridView read GetGridView;
property GridViewInfo: TcxCustomGridViewInfo read FGridViewInfo;
property HintText: string read GetHintText;
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
end;
TcxGridDesignSelectorViewInfoClass = class of TcxGridDesignSelectorViewInfo;
TcxGridDesignSelectorViewInfo = class(TcxCustomGridViewCellViewInfo)
private
FRegion: TcxRegion;
protected
function CalculateHeight: Integer; override;
function CalculateWidth: Integer; override;
function GetHitTestClass: TcxCustomGridHitTestClass; override;
function GetHotTrack: Boolean; override;
function GetPainterClass: TcxCustomGridCellPainterClass; override;
procedure GetViewParams(var AParams: TcxViewParams); override;
procedure CreateRegion;
procedure DestroyRegion;
property Region: TcxRegion read FRegion;
public
destructor Destroy; override;
procedure Calculate(ALeftBound, ATopBound: Integer; AWidth: Integer = -1;
AHeight: Integer = -1); override;
function HasPoint(const P: TPoint): Boolean; override;
function MouseDown(AHitTest: TcxCustomGridHitTest; AButton: TMouseButton;
AShift: TShiftState): Boolean; override;
end;
TcxCustomGridViewInfoClass = class of TcxCustomGridViewInfo;
TcxCustomGridViewInfo = class(TcxGridViewHandler)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?