📄 cxvgrid.pas
字号:
FCaption: TCaption;
FImageIndex: TImageIndex;
FHint: string;
function GetCaption: TCaption;
function IsCaptionStored: Boolean;
procedure SetCaption(const Value: TCaption);
procedure SetImageIndex(const Value: TImageIndex);
procedure SetHeaderAlignmentHorz(const Value: TAlignment);
procedure SetHeaderAlignmentVert(const Value: TcxAlignmentVert);
protected
function DefaultCaption: string; virtual;
procedure RestoreDefaults; virtual;
public
constructor CreateEx(ARow: TcxCustomRow); override;
procedure Assign(Source: TPersistent); override;
published
property Caption: TCaption read GetCaption write SetCaption
stored IsCaptionStored;
property HeaderAlignmentHorz: TAlignment read FHeaderAlignmentHorz
write SetHeaderAlignmentHorz default taLeftJustify;
property HeaderAlignmentVert: TcxAlignmentVert read FHeaderAlignmentVert
write SetHeaderAlignmentVert default vaTop;
property Hint: string read FHint write FHint;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
end;
{ TcxRowOptions }
TcxRowOptions = class(TPersistent)
private
FCanAutoHeight: Boolean;
FCanMovedToCustomizationForm: Boolean;
FCanResized: Boolean;
FFocusing: Boolean;
FMoving: Boolean;
FRow: TcxCustomRow;
FShowExpandButton: Boolean;
FShowInCustomizationForm: Boolean;
FTabStop: Boolean;
procedure SetCanAutoHeight(Value: Boolean);
procedure SetFocusing(Value: Boolean);
procedure SetShowExpandButton(Value: Boolean);
procedure SetShowInCustomizationForm(Value: Boolean);
protected
procedure Changed; virtual;
property Row: TcxCustomRow read FRow;
public
constructor Create(ARow: TcxCustomRow); virtual;
procedure Assign(Source: TPersistent); override;
procedure RestoreDefaults; virtual;
published
property CanAutoHeight: Boolean read FCanAutoHeight write SetCanAutoHeight default True;
property CanMovedToCustomizationForm: Boolean read FCanMovedToCustomizationForm write FCanMovedToCustomizationForm default True;
property CanResized: Boolean read FCanResized write FCanResized default True;
property Focusing: Boolean read FFocusing write SetFocusing default True;
property Moving: Boolean read FMoving write FMoving default True;
property ShowExpandButton: Boolean read FShowExpandButton write SetShowExpandButton default True;
property ShowInCustomizationForm: Boolean read FShowInCustomizationForm write SetShowInCustomizationForm default True;
property TabStop: Boolean read FTabStop write FTabStop default True;
end;
TcxRowOptionsClass = class of TcxRowOptions;
{ TcxCustomRow }
TcxRowList = class(TList)
private
FOwner: TcxCustomRow;
protected
procedure Notify(Ptr: Pointer; Action: TListNotification); override;
procedure UpdateIndexes;
property Owner: TcxCustomRow read FOwner;
public
constructor Create(AOwner: TcxCustomRow);
end;
TcxCustomRow = class(TComponent, IUnknown, IcxStoredObject)
private
FExpanded: Boolean;
FHeight: Integer;
FID: Integer;
FIndex: Integer;
FLoadingIndex: Integer;
FLoadingParent: string;
FOptions: TcxRowOptions;
FParent: TcxCustomRow;
FRows: TcxRowList;
FStyles: TcxvgCustomRowStyles;
FVerticalGrid: TcxCustomVerticalGrid;
FViewInfo: TcxCustomRowViewInfo;
FVisible: Boolean;
FVisibleIndex: Integer;
function GetAbsoluteIndex: Integer;
function GetCount: Integer;
function GetFocused: Boolean;
function GetLevel: Integer;
function GetOwnerRows: TcxVerticalGridRows;
function GetParent: TcxCustomRow;
function GetRow(Index: Integer): TcxCustomRow;
function GetViewInfo: TcxCustomRowViewInfo;
procedure SetExpanded(Value: Boolean);
procedure SetFocused(Value: Boolean);
procedure SetHeight(Value: Integer);
procedure SetIndex(Value: Integer);
procedure SetOptions(Value: TcxRowOptions);
procedure SetParent(Value: TcxCustomRow);
procedure SetVisible(Value: Boolean);
protected
FProperties: TcxCustomRowProperties;
// IcxStoredObject
function GetObjectName: string; virtual;
function IcxStoredObject.GetProperties = GetStoredProperties;
function GetStoredProperties(AProperties: TStrings): Boolean; virtual;
procedure GetPropertyValue(const AName: string; var AValue: Variant); virtual;
procedure SetPropertyValue(const AName: string; const AValue: Variant); virtual;
// override TComponent
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure SetName(const NewName: TComponentName); override;
procedure SetParentComponent(Value: TComponent); override;
procedure Add(ARow: TcxCustomRow);
function CanFocus: Boolean; virtual;
procedure Changed(ARebuild: Boolean = False); virtual;
function CreateHeaderInfo: TcxCustomRowHeaderInfo; virtual; abstract;
function CreateViewInfo: TcxCustomRowViewInfo; virtual; abstract;
procedure Delete(AIndex: Integer);
function GetDefaultHeight: Integer; virtual;
function GetEditContainer(ACellIndex: Integer): TcxCellEdit; virtual;
function GetEditContainerCount: Integer; virtual;
function GetPropertiesClass: TcxRowPropertiesClass; virtual;
function GetRealHeight: Integer; virtual;
function GetOptionsClass: TcxRowOptionsClass; virtual;
function GetStylesClass: TcxvgCustomRowStylesClass; virtual;
procedure Insert(AIndex: Integer; ARow: TcxCustomRow);
function IsHeightAssigned: Boolean;
procedure Remove(ARow: TcxCustomRow);
procedure RemoveAll;
procedure ResetOwnerCount;
procedure SetVerticalGrid(Value: TcxCustomVerticalGrid); virtual;
property ID: Integer read FID;
property OwnerRows: TcxVerticalGridRows read GetOwnerRows;
property Styles: TcxvgCustomRowStyles read FStyles write FStyles;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
// override
function GetParentComponent: TComponent; override;
function HasParent: Boolean; override;
// visualization
procedure Collapse(ARecurse: Boolean);
procedure Expand(ARecurse: Boolean);
function GetFirstVisibleChild: TcxCustomRow;
function GetLastVisibleChild: TcxCustomRow;
function HasChildren: Boolean;
function HasVisibleChildren: Boolean;
function IndexOf(ARow: TcxCustomRow): Integer;
function IsChild(ARow: TcxCustomRow): Boolean;
function IsFirst: Boolean;
function IsFirstVisible: Boolean;
function IsLast: Boolean;
function IsLastVisible: Boolean;
function IsRootLevel: Boolean;
function IsParent(ARow: TcxCustomRow): Boolean;
procedure MakeVisible;
procedure RestoreDefaults;
property AbsoluteIndex: Integer read GetAbsoluteIndex;
property Count: Integer read GetCount;
property Expanded: Boolean read FExpanded write SetExpanded default True;
property Focused: Boolean read GetFocused write SetFocused;
property Height: Integer read FHeight write SetHeight default -1;
property Index: Integer read FIndex write SetIndex;
property Level: Integer read GetLevel;
property Options: TcxRowOptions read FOptions write SetOptions;
property Parent: TcxCustomRow read GetParent write SetParent;
property Rows[Index: Integer]: TcxCustomRow read GetRow;
property VerticalGrid: TcxCustomVerticalGrid read FVerticalGrid write SetVerticalGrid;
property ViewInfo: TcxCustomRowViewInfo read GetViewInfo;
property Visible: Boolean read FVisible write SetVisible default True;
property VisibleIndex: Integer read FVisibleIndex;
end;
TcxCustomRowClass = class of TcxCustomRow;
{ TcxCategoryRow }
TcxCategoryRow = class(TcxCustomRow)
private
function GetProperties: TcxCaptionRowProperties;
function GetStyles: TcxCategoryRowStyles;
procedure SetProperties(Value: TcxCaptionRowProperties);
procedure SetStyles(Value: TcxCategoryRowStyles);
protected
function GetStoredProperties(AProperties: TStrings): Boolean; override;
procedure GetPropertyValue(const AName: string; var AValue: Variant); override;
procedure SetPropertyValue(const AName: string; const AValue: Variant); override;
function GetDefaultHeight: Integer; override;
function GetStylesClass: TcxvgCustomRowStylesClass; override;
public
function CreateHeaderInfo: TcxCustomRowHeaderInfo; override;
function CreateViewInfo: TcxCustomRowViewInfo; override;
published
property Expanded;
property Height;
property Options;
property Properties: TcxCaptionRowProperties read GetProperties write SetProperties;
property Styles: TcxCategoryRowStyles read GetStyles write SetStyles;
property Visible;
end;
TcxCustomEditorRowProperties = class;
{ TcxEditorRowPropertiesOptions }
TcxEditorRowPropertiesOptions = class(TcxCustomEditContainerItemOptions)
published
property Editing;
property Filtering;
property IncSearch;
property ShowEditButtons;
end;
{ TcxCellEdit }
TcxCellEdit = class(TcxCustomInplaceEditContainer)
private
FCalculating: Boolean;
FEditRowProperties: TcxCustomEditorRowProperties;
FRow: TcxCustomRow;
function GetViewInfo: TcxCustomRowViewInfo;
protected
FCellIndex: Integer;
procedure Calculate(ACellViewInfo: TcxRowValueInfo);
function CanEdit: Boolean; override;
function CanFocus: Boolean; override;
function CanInitEditing: Boolean; override;
function CanTabStop: Boolean; override;
procedure DoGetDisplayText(ARecordIndex: Integer; var AText: string); override;
function DoGetPropertiesFromEvent(AEvent: TcxGetEditPropertiesEvent; AData: Pointer;
AProperties: TcxCustomEditProperties): TcxCustomEditProperties; override;
function GetCurrentValue: Variant; override;
function GetDataBindingClass: TcxItemDataBindingClass; override;
function GetDisplayValue(AProperties: TcxCustomEditProperties; ARecordIndex: Integer): Variant; override;
function GetEditValue: Variant; override;
function GetOptionsClass: TcxCustomEditContainerItemOptionsClass; override;
function GetValue(ARecordIndex: Integer): Variant; override;
function GetValueCount: Integer; override;
function HasDataTextHandler: Boolean; override;
procedure PropertiesChanged; override;
procedure SetCurrentValue(const Value: Variant); override;
procedure SetValue(ARecordIndex: Integer; const Value: Variant); override;
public
constructor Create(AOwner: TComponent); override;
property CellIndex: Integer read FCellIndex;
property EditRowProperties: TcxCustomEditorRowProperties read FEditRowProperties;
property Options;
property Row: TcxCustomRow read FRow;
property ViewInfo: TcxCustomRowViewInfo read GetViewInfo;
end;
TcxCellEditClass = class of TcxCellEdit;
{ TcxCustomEditorRowProperties }
TcxVerticalGridGetDisplayTextEvent = procedure(Sender: TcxCustomEditorRowProperties;
ARecord: Integer; var AText: string) of object;
TcxVerticalGridGetEditPropertiesEvent = procedure(Sender: TcxCustomEditorRowProperties;
ARecordIndex: Integer; var AProperties: TcxCustomEditProperties) of object;
TcxCustomEditorRowProperties = class(TcxCaptionRowProperties,
IcxEditorPropertiesContainer)
private
FEditContainer: TcxCellEdit;
FOnGetDisplayText: TcxVerticalGridGetDisplayTextEvent;
function GetDataBinding: TcxItemDataBinding;
function GetDisplayEditProperty(Index: Integer): TcxCustomEditProperties;
function GetDisplayText(Index: Integer): string;
function GetEditViewData: TcxCustomEditViewData;
function GetEditProperties: TcxCustomEditProperties;
function GetEditPropertiesClass: TcxCustomEditPropertiesClass;
function GetEditPropertiesClassName: string;
function GetIEditorPropertiesContainer: IcxEditorPropertiesContainer;
function GetItemIndex: Integer;
function GetItemLink: TObject;
function GetOptions: TcxEditorRowPropertiesOptions;
function GetRepositoryItem: TcxEditRepositoryItem;
function GetValue: Variant;
function GetValueByIndex(Index: Integer): Variant;
procedure SetDataBinding(Value: TcxItemDataBinding);
procedure SetEditProperties(Value: TcxCustomEditProperties);
procedure SetEditPropertiesClass(Value: TcxCustomEditPropertiesClass);
procedure SetEditPropertiesClassName(const Value: string);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -