📄 cxvgrid.pas
字号:
{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressVerticalGrid }
{ }
{ Copyright (c) 1998-2007 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 EXPRESSVERTICALGRID 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 cxVGrid;
{$I cxVer.inc}
interface
uses
SysUtils, Classes,
{$IFDEF VCL}
Windows, Controls, Messages,
{$ENDIF}
Forms, StdCtrls, ImgList, ExtCtrls, cxEdit, cxControls, Graphics, cxGraphics,
cxVGridUtils, cxStyles, cxLookAndFeelPainters, cxLookAndFeels, cxClasses,
cxInplaceContainer, ComCtrls, cxButtons, cxNavigator, cxFilterControl,
cxFilter, cxDataStorage, cxCustomData, cxStorage;
const
cxvgMinValueWidth = 20;
// Cursors
crcxInspectorInsert = -1228;
crcxInspectorAddChild = -1229;
crcxInspectorAdd = -1230;
crcxInspectorHide = -1241;
crcxInspectorNoDrag = -1242;
// verticalgrid styles predefined indexes
// for row styles
vgrs_Header = 0;
vgrs_Content = 1;
// for control styles
vgs_Content = ecs_Content;
vgs_Category = ecs_EditingStylesMaxIndex + 1;
vgs_Header = ecs_EditingStylesMaxIndex + 2;
vgs_IncSearch = ecs_EditingStylesMaxIndex + 3;
// base constants for descendants
cxvgMaxControlStyleIndex = vgs_IncSearch;
cxvgMaxRowStyleIndex = vgrs_Content;
// hit codes
vghc_Base = 4;
vghc_HitAtBandSizing = vghc_Base;
vghc_HitAtButton = vghc_Base + 1;
vghc_HitAtCaption = vghc_Base + 2;
vghc_HitAtDivider = vghc_Base + 3;
vghc_HitAtEmpty = vghc_Base + 4;
vghc_HitAtImage = vghc_Base + 5;
vghc_HitAtIndent = vghc_Base + 6;
vghc_HitAtRowSizing = vghc_Base + 7;
vghc_HitAtValue = vghc_Base + 8;
vghc_HitAtCustomize = vghc_Base + 9;
vghc_HitAtSeparator = vghc_Base + 10;
type
{$IFNDEF DELPHI5}
TImageIndex = Integer;
{$ENDIF}
EcxVerticalGridError = class(Exception);
TcxCustomRow = class;
TcxCustomRowHeaderInfo = class;
TcxCustomRowViewInfo = class;
TcxCustomVerticalGrid = class;
TcxVirtualVerticalGrid = class;
TcxRowCaptionInfo = class;
TcxRowValueInfo = class;
TcxRowValueInfoClass = class of TcxRowValueInfo;
TcxValueInfoList = class;
TcxCustomEditorRow = class;
TcxCustomMultiEditorRow = class;
TcxMultiEditorRow = class;
TcxVerticalGridCustomizing = class;
TcxVerticalGridCustomizingClass = class of TcxVerticalGridCustomizing;
TcxVerticalGridRows = class;
TcxvgCustomRowStyles = class;
TcxvgCustomRowStylesClass = class of TcxvgCustomRowStyles;
TcxCategoryRowStyles = class;
TcxEditorRowStyles = class;
TcxvgScroller = class;
TcxCellEdit = class;
TcxvgController = class;
TcxvgCustomPaintStyleCalcHelper = class;
TcxvgCustomPaintStyleCalcHelperClass = class of TcxvgCustomPaintStyleCalcHelper;
TcxvgCustomViewInfo = class;
TcxvgHitTest = class;
TcxvgPainter = class;
TcxVerticalGridStyles = class;
{ TcxvgOptionsBehavior }
TcxvgOptionsBehavior = class(TcxControlOptionsBehavior)
private
FAlwaysShowEditorAssigned: Boolean;
FBandSizing: Boolean;
FHeaderSizing: Boolean;
FRowSizing: Boolean;
FRowTracking: Boolean;
function GetAlwaysShowEditor: Boolean;
procedure SetAlwaysShowEditor(Value: Boolean);
protected
procedure InternalSetAlwaysShowEditor(Value: Boolean);
public
constructor Create(AOwner: TPersistent); override;
procedure Assign(Source: TPersistent); override;
procedure RestoreDefaults; virtual;
published
property AlwaysShowEditor: Boolean read GetAlwaysShowEditor write SetAlwaysShowEditor stored FAlwaysShowEditorAssigned;
property BandSizing: Boolean read FBandSizing write FBandSizing default True;
property CellHints default True;
property HeaderSizing: Boolean read FHeaderSizing write FHeaderSizing default True;
property RowSizing: Boolean read FRowSizing write FRowSizing default False;
property RowTracking: Boolean read FRowTracking write FRowTracking default True;
end;
{ TcxvgMultiRecordsOptionsBehavior }
TcxvgMultiRecordsOptionsBehavior = class(TcxvgOptionsBehavior)
private
FAllowChangeRecord: Boolean;
function GetIncSearchItem: TcxCustomEditorRow;
procedure SetAllowChangeRecord(Value: Boolean);
procedure SetIncSearchItem(Value: TcxCustomEditorRow);
public
constructor Create(AOwner: TPersistent); override;
procedure Assign(Source: TPersistent); override;
published
property AllowChangeRecord: Boolean read FAllowChangeRecord write SetAllowChangeRecord default True;
property FocusFirstCellOnNewRecord;
property IncSearch;
property IncSearchItem: TcxCustomEditorRow read GetIncSearchItem write SetIncSearchItem;
end;
{ TcxvgMultiRecordsOptionsData }
TcxvgMultiRecordsOptionsData = class(TcxControlOptionsData)
private
FAppending: Boolean;
FDeleting: Boolean;
FInserting: Boolean;
FDeletingConfirmation: Boolean;
procedure SetAppending(Value: Boolean);
procedure SetDeleting(Value: Boolean);
procedure SetInserting(Value: Boolean);
protected
procedure Changed; override;
public
constructor Create(AOwner: TPersistent); override;
procedure Assign(Source: TPersistent); override;
published
property Appending: Boolean read FAppending write SetAppending default True;
property Deleting: Boolean read FDeleting write SetDeleting default True;
property DeletingConfirmation: Boolean read FDeletingConfirmation write FDeletingConfirmation default True;
property Inserting: Boolean read FInserting write SetInserting default True;
end;
{ TcxvgOptionsView }
TcxvgPaintStyle = (psdotNet, psDelphi);
TcxvgGridLines = (vglNone, vglHorizontal, vglVertical, vglBoth);
TcxvgOptionsView = class(TcxControlOptionsView)
private
FAutoScaleBands: Boolean;
FBandsInterval: Integer;
FCategoryExplorerStyle: Boolean;
FGridLineColor: TColor;
FGridLineColorAssigned: Boolean;
FValueWidth: Integer;
FPaintStyle: TcxvgPaintStyle;
FRowHeaderMinWidth: Integer;
FRowHeaderWidth: Integer;
FRowHeight: Integer;
FShowButtons: Boolean;
FShowHeaders: Boolean;
FShowEmptyRowImage: Boolean;
FGridLines: TcxvgGridLines;
FValueMinWidth: Integer;
function GetGridLineColor: TColor;
procedure SetAutoScaleBands(Value: Boolean);
procedure SetBandsInterval(Value: Integer);
procedure SetCategoryExplorerStyle(Value: Boolean);
procedure SetGridLineColor(Value: TColor);
procedure SetPaintStyle(Value: TcxvgPaintStyle);
procedure SetRowHeaderMinWidth(Value: Integer);
procedure SetRowHeaderWidth(Value: Integer);
procedure SetRowHeight(Value: Integer);
procedure SetShowButtons(Value: Boolean);
procedure SetShowEmptyRowImage(Value: Boolean);
procedure SetShowHeaders(Value: Boolean);
procedure SetGridLines(Value: TcxvgGridLines);
procedure SetValueMinWidth(Value: Integer);
procedure SetValueWidth(Value: Integer);
protected
procedure Changed; override;
procedure CheckRowHeaderWidth;
public
constructor Create(AOwner: TPersistent); override;
procedure Assign(Source: TPersistent); override;
procedure RestoreDefaults; virtual;
published
property AutoScaleBands: Boolean read FAutoScaleBands write SetAutoScaleBands default True;
property BandsInterval: Integer read FBandsInterval write SetBandsInterval default 2;
property CategoryExplorerStyle: Boolean read FCategoryExplorerStyle write SetCategoryExplorerStyle default False;
property PaintStyle: TcxvgPaintStyle read FPaintStyle write SetPaintStyle default psDotNet;
property GridLineColor: TColor read GetGridLineColor write SetGridLineColor stored FGridLineColorAssigned;
property RowHeaderMinWidth: Integer read FRowHeaderMinWidth write SetRowHeaderMinWidth default 24;
property RowHeaderWidth: Integer read FRowHeaderWidth write SetRowHeaderWidth default 100;
property RowHeight: Integer read FRowHeight write SetRowHeight default -1;
property ShowButtons: Boolean read FShowButtons write SetShowButtons default True;
property ShowEditButtons;
property ShowEmptyRowImage: Boolean read FShowEmptyRowImage write SetShowEmptyRowImage default False;
property ShowHeaders: Boolean read FShowHeaders write SetShowHeaders default True;
property GridLines: TcxvgGridLines read FGridLines write SetGridLines default vglBoth;
property ValueWidth: Integer read FValueWidth write SetValueWidth default 100;
property ValueMinWidth: Integer read FValueMinWidth write SetValueMinWidth default 40;
end;
{ TcxvgMultiRecordsOptionsView }
TcxvgMultiRecordsOptionsView = class(TcxvgOptionsView)
private
FRecordsInterval: Integer;
procedure SetRecordsInterval(Value: Integer);
public
procedure Assign(Source: TPersistent); override;
procedure RestoreDefaults; override;
published
property RecordsInterval: Integer read FRecordsInterval write SetRecordsInterval default 0;
end;
{ TcxCustomRowProperties }
TcxCustomRowProperties = class(TcxInterfacedCollectionItem)
private
FCollection: TCollection;
FLocked: Boolean;
FRow: TcxCustomRow;
protected
procedure Changed; virtual;
function GetOwner: TPersistent; override;
property Locked: Boolean read FLocked;
public
constructor Create(Collection: TCollection); override;
constructor CreateEx(ARow: TcxCustomRow); virtual;
property Row: TcxCustomRow read FRow;
end;
TcxRowPropertiesClass = class of TcxCustomRowProperties;
{ TcxCaptionRowProperties }
TcxCaptionRowProperties = class(TcxCustomRowProperties)
private
FHeaderAlignmentHorz: TAlignment;
FHeaderAlignmentVert: TcxAlignmentVert;
FIsCaptionAssigned: Boolean;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -