cxgridchartview.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,502 行 · 第 1/5 页
PAS
1,502 行
end;
{ controller }
// drag&drop objects
TcxCustomGridChartMovingObject = class(TcxCustomGridMovingObject)
private
function GetController: TcxGridChartController;
function GetCustomizationForm: TcxGridChartCustomizationForm;
function GetGridView: TcxGridChartView;
function GetViewInfo: TcxGridChartViewInfo;
protected
property Controller: TcxGridChartController read GetController;
property CustomizationForm: TcxGridChartCustomizationForm read GetCustomizationForm;
property GridView: TcxGridChartView read GetGridView;
property ViewInfo: TcxGridChartViewInfo read GetViewInfo;
end;
TcxGridChartDataGroupMovingObjectClass = class of TcxGridChartDataGroupMovingObject;
TcxGridChartDataGroupMovingObject = class(TcxCustomGridChartMovingObject)
private
FDestDataLevel: Integer;
FSourceItemContainerKind: TcxGridChartDataGroupContainerKind;
function GetSourceItem: TcxGridChartDataGroup;
procedure SetDestDataLevel(Value: Integer);
procedure SetSourceItem(Value: TcxGridChartDataGroup);
protected
function CanRemove: Boolean; override;
function GetArrowAreaBounds(APlace: TcxGridArrowPlace): TRect; override;
function GetCustomizationFormListBox: TcxCustomGridItemsListBox; override;
function GetSourceItemViewInfo: TcxCustomGridCellViewInfo; override;
function IsSourceCustomizationForm: Boolean; override;
function IsValidDestination: Boolean; override;
procedure BeginDragAndDrop; override;
procedure DragAndDrop(const P: TPoint; var Accepted: Boolean); override;
procedure EndDragAndDrop(Accepted: Boolean); override;
property DestDataLevel: Integer read FDestDataLevel write SetDestDataLevel;
property SourceItem: TcxGridChartDataGroup read GetSourceItem write SetSourceItem;
property SourceItemContainerKind: TcxGridChartDataGroupContainerKind
read FSourceItemContainerKind write FSourceItemContainerKind;
public
constructor Create(AControl: TcxControl); override;
procedure Init(const P: TPoint; AParams: TcxCustomGridHitTest); override;
end;
// customization form
TcxGridChartSeriesInnerCheckListBox = class(TcxCustomInnerCheckListBox)
protected
function GetMetrics: TcxCheckListBoxMetrics; override;
public
function GetSeriesImageSize: Integer; virtual;
end;
TcxGridChartSeriesCheckListBoxClass = class of TcxGridChartSeriesCheckListBox;
TcxGridChartSeriesCheckListBox = class(TcxCheckListBox)
private
FDraggingSeries: TcxGridChartSeries;
FGridView: TcxGridChartView;
FLockRefreshItems: Boolean;
FSeriesImages: TImageList;
function GetSeries(AIndex: Integer): TcxGridChartSeries;
protected
procedure CheckClicked(Sender: TObject; AIndex: Integer;
APrevState, ANewState: TcxCheckBoxState); virtual;
procedure CreateWnd; override;
procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); override;
procedure DrawSeriesImage(ACanvas: TcxCanvas; const R: TRect; ASeries: TcxGridChartSeries); virtual;
function GetInnerCheckListBoxClass: TcxCustomInnerCheckListBoxClass; override;
procedure LookAndFeelChanged(Sender: TcxLookAndFeel; AChangedValues: TcxLookAndFeelValues); override;
procedure RefreshImages;
procedure RefreshSeriesImages; virtual;
property DraggingSeries: TcxGridChartSeries read FDraggingSeries write FDraggingSeries;
property GridView: TcxGridChartView read FGridView;
property LockRefreshItems: Boolean read FLockRefreshItems write FLockRefreshItems;
property Series[AIndex: Integer]: TcxGridChartSeries read GetSeries;
property SeriesImages: TImageList read FSeriesImages;
public
constructor Create(AOwner: TComponent; AGridView: TcxGridChartView); reintroduce; virtual;
destructor Destroy; override;
procedure RefreshItems; virtual;
function StartDrag(DragObject: TDragObject): Boolean; override;
end;
TcxGridChartSortBySeriesComboBoxClass = class of TcxGridChartSortBySeriesComboBox;
TcxGridChartSortBySeriesComboBox = class(TcxComboBox)
private
FDirectionButton: TcxEditButton;
FGridView: TcxGridChartView;
protected
procedure Click; override;
procedure DirectionButtonClick; virtual;
procedure DoButtonClick(AButtonVisibleIndex: Integer); override;
procedure DrawItem(AControl: TcxCustomComboBox; ACanvas: TcxCanvas;
AIndex: Integer; const ARect: TRect; AState: TOwnerDrawState); virtual;
procedure MeasureItem(AControl: TcxCustomComboBox; AIndex: Integer;
ACanvas: TcxCanvas; var AHeight: Integer); virtual;
procedure RefreshDirectionButton; virtual;
property DirectionButton: TcxEditButton read FDirectionButton;
property GridView: TcxGridChartView read FGridView;
public
constructor Create(AOwner: TComponent; AGridView: TcxGridChartView); reintroduce; virtual;
procedure RefreshItems; virtual;
end;
TcxGridChartDataGroupsListBoxClass = class of TcxGridChartDataGroupsListBox;
TcxGridChartDataGroupsListBox = class(TcxCustomGridItemsListBox)
private
function GetGridView: TcxGridChartView;
protected
function CalculateItemHeight: Integer; override;
function GetDragAndDropParams: TcxCustomGridHitTest; override;
property GridView: TcxGridChartView read GetGridView;
public
procedure PaintItem(ACanvas: TcxCanvas; R: TRect; AIndex: Integer; AFocused: Boolean); override;
procedure RefreshItems; override;
end;
TcxGridChartOptionsTreeViewClass = class of TcxGridChartOptionsTreeView;
TcxGridChartOptionsTreeView = class(TcxGridOptionsTreeView)
private
FGridView: TcxGridChartView;
protected
LegendID: Integer;
LegendAlignmentID: Integer;
LegendBorderID: Integer;
LegendKeyBorderID: Integer;
LegendOrientationID: Integer;
LegendPositionID: Integer;
TitleID: Integer;
TitleAlignmentID: Integer;
TitlePositionID: Integer;
ToolBoxID: Integer;
ToolBoxBorderID: Integer;
ToolBoxDiagramSelectorID: Integer;
ToolBoxPositionID: Integer;
OtherID: Integer;
OtherValueHintsID: Integer;
procedure AddItems; override;
function IsItemChecked(AParentID, AID: Integer): Boolean; override;
procedure ItemClicked(AParentID, AID: Integer); override;
property GridView: TcxGridChartView read FGridView;
public
constructor Create(AOwner: TComponent; AGridView: TcxGridChartView); reintroduce; virtual;
end;
TcxGridChartCustomizationForm = class(TcxCustomGridCustomizationForm)
private
FDataGroupsListBox: TcxGridChartDataGroupsListBox;
FDataGroupsPage: TcxTabSheet;
FOptionsPage: TcxTabSheet;
FOptionsTreeView: TcxGridChartOptionsTreeView;
FSeriesCheckListBox: TcxGridChartSeriesCheckListBox;
FSortBySeriesComboBox: TcxGridChartSortBySeriesComboBox;
FSortBySeriesLabel: TcxLabel;
FSeriesPage: TcxTabSheet;
function GetGridView: TcxGridChartView;
protected
function CanChangeSortedSeries: Boolean; virtual;
procedure CreateControls; override;
function GetDataGroupsListBoxClass: TcxGridChartDataGroupsListBoxClass; virtual;
function GetDataGroupsPageVisible: Boolean; virtual;
function GetOptionsPageVisible: Boolean; virtual;
function GetOptionsTreeViewClass: TcxGridChartOptionsTreeViewClass; virtual;
function GetSeriesCheckListBoxClass: TcxGridChartSeriesCheckListBoxClass; virtual;
function GetSeriesPageVisible: Boolean; virtual;
function GetSortBySeriesComboBoxClass: TcxGridChartSortBySeriesComboBoxClass; virtual;
procedure GridViewChanged; override;
procedure InitPageControl; override;
property GridView: TcxGridChartView read GetGridView;
public
procedure PrepareForDataGroupDragAndDrop; virtual;
procedure RefreshData; override;
property DataGroupsListBox: TcxGridChartDataGroupsListBox read FDataGroupsListBox;
property DataGroupsPage: TcxTabSheet read FDataGroupsPage;
property OptionsPage: TcxTabSheet read FOptionsPage;
property OptionsTreeView: TcxGridChartOptionsTreeView read FOptionsTreeView;
property SeriesCheckListBox: TcxGridChartSeriesCheckListBox read FSeriesCheckListBox;
property SeriesPage: TcxTabSheet read FSeriesPage;
property SortBySeriesComboBox: TcxGridChartSortBySeriesComboBox read FSortBySeriesComboBox;
property SortBySeriesLabel: TcxLabel read FSortBySeriesLabel;
end;
// popups
IcxGridChartDataLevelActiveValuePopupOwner = interface(IcxCustomGridPopupOwner)
['{94AE5C9F-9A81-401D-8B76-E3278CDD0CEB}']
function GetDataGroup: TcxGridChartDataGroup;
end;
TcxGridChartDataLevelActiveValuePopupClass = class of TcxGridChartDataLevelActiveValuePopup;
TcxGridChartDataLevelActiveValuePopup = class(TcxCustomGridPopup)
private
FDataGroup: TcxGridChartDataGroup;
FListBox: TcxGridPopupListBox;
function GetGridView: TcxGridChartView;
procedure ListBoxAction(Sender: TcxGridPopupListBox; AItemIndex: Integer);
protected
Values: TVariantArray;
procedure AddValueItems(AStrings: TStrings; out AValues: TVariantArray); virtual;
procedure AdjustListBoxSize; virtual;
procedure InitPopup; override;
procedure SetDataGroupActiveValue(AItemIndex: Integer); virtual;
property ListBox: TcxGridPopupListBox read FListBox;
public
constructor Create(AGridView: TcxCustomGridView); override;
property DataGroup: TcxGridChartDataGroup read FDataGroup;
property GridView: TcxGridChartView read GetGridView;
end;
TcxGridChartDiagramSelectorPopupListBox = class(TcxGridPopupListBox)
protected
function CalculateItemHeight: Integer; override;
procedure DrawItemContent(ACanvas: TcxCanvas; AIndex: Integer; ARect: TRect;
AState: TOwnerDrawState); override;
end;
TcxGridChartDiagramSelectorPopupClass = class of TcxGridChartDiagramSelectorPopup;
TcxGridChartDiagramSelectorPopup = class(TcxCustomGridPopup)
private
FListBox: TcxGridChartDiagramSelectorPopupListBox;
function GetGridView: TcxGridChartView;
procedure ListBoxAction(Sender: TcxGridPopupListBox; AItemIndex: Integer);
protected
procedure AddDiagramItems(AStrings: TStrings); virtual;
function GetImageOffset: Integer; virtual;
procedure InitPopup; override;
procedure SelectDiagram(AItemIndex: Integer); virtual;
property ListBox: TcxGridChartDiagramSelectorPopupListBox read FListBox;
public
constructor Create(AGridView: TcxCustomGridView); override;
property GridView: TcxGridChartView read GetGridView;
property ImageOffset: Integer read GetImageOffset;
end;
// controller
TcxGridChartController = class(TcxCustomGridController)
private
FDataLevelActiveValuePopup: TcxGridChartDataLevelActiveValuePopup;
FDiagramSelectorPopup: TcxGridChartDiagramSelectorPopup;
FFirstVisibleCategoryIndex: Integer;
FFirstVisibleCategoryIndexes: array of Integer;
FMovingDataGroup: TcxGridChartDataGroup;
FStoredFirstVisibleCategoryIndex: Integer;
function GetCustomizationForm: TcxGridChartCustomizationForm;
function GetDataLevelActiveValuePopup: TcxGridChartDataLevelActiveValuePopup;
function GetDiagramSelectorPopup: TcxGridChartDiagramSelectorPopup;
function GetGridView: TcxGridChartView;
function GetIsDataGroupMoving: Boolean;
function GetViewInfo: TcxGridChartViewInfo;
function GetVisibleCategoryCountValue: Integer;
procedure SetFirstVisibleCategoryIndex(Value: Integer);
protected
procedure ActiveDataLevelChanged(APrevActiveDataLevel, AActiveDataLevel: Integer); virtual;
procedure ActiveDiagramChanged(ADiagram: TcxGridChartDiagram); virtual;
procedure CheckCoordinates; override;
procedure DataLevelsChanged; virtual;
procedure FirstVisibleCategoryIndexChanged; virtual;
function GetDataLevelActiveValuePopupClass: TcxGridChartDataLevelActiveValuePopupClass; virtual;
function GetDesignHitTest(AHitTest: TcxCustomGridHitTest): Boolean; override;
function GetDiagramSelectorPopupClass: TcxGridChartDiagramSelectorPopupClass; virtual;
function GetPatternObject(AObject: TPersistent): TPersistent; override;
function GetFirstVisibleCategoryIndex: Integer; virtual;
function GetVisibleCategoryCount(ACheckCount: Boolean): Integer; virtual;
function CanDataDrillDown(AValueIndex: Integer): Boolean; virtual;
function CanDataDrillUp: Boolean; virtual;
function DoDataDrillDown(AValueIndex: Integer): Boolean; virtual;
function DoDataDrillUp: Boolean; virtual;
function MayDataDrillDown(ACheckDesignTime: Boolean = True): Boolean; virtual;
// scrollbar
function CanShowScrollBar: Boolean; virtual;
function GetScrollBarKind: TScrollBarKind; virtual;
function GetScrollBarPageSize: Integer; virtual;
function GetScrollBarPos: Integer; virtual;
function GetScrollBarSize: Integer; virtual;
function ScrollPosToCategoryIndex(AScrollPos: Integer): Integer; virtual;
function CanShowDataLevelActiveValuePopup(ACheckDesignTime: Boolean = True): Boolean; virtual;
// customization
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?