cxgridreg.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,332 行 · 第 1/3 页
PAS
1,332 行
{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressQuantumGrid }
{ }
{ Copyright (c) 1998-2008 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 EXPRESSQUANTUMGRID 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 cxGridReg;
{$I cxVer.inc}
interface
const
cxGridVersion = '6.38';
procedure Register;
implementation
uses
Windows,
{$IFDEF DELPHI6}
DesignEditors, DesignIntf, DesignMenus, VCLEditors,
Types,
{$ELSE}
DsgnIntf,
{$ENDIF}
{$IFNDEF NONDB}
DB, cxDBData, cxDBExtLookupComboBox, cxGridDBBandedTableView,
cxGridDBCardView, cxGridDBDataDefinitions, cxGridDBTableView, cxGridDBChartView,
{$ENDIF}
cxGridImportDialog,
Classes, Controls, ExtCtrls, Graphics, Menus, SysUtils, TypInfo, ImgList, cxControls,
cxCustomData, cxDataStorage, cxEdit, cxEditPropEditors,
cxEditRepositoryEditor, cxEditRepositoryItems, cxGrid, cxGridBandedTableView,
cxGridCardView, cxGridCommon, cxGridCustomTableView, cxGridCustomView, cxGridChartView,
cxGridEditor, cxGridLevel, cxGridStrs, cxGridStructureNavigator,
cxGridTableView, cxImageComboBox, cxImageComboBoxItemsEditor, cxLibraryReg,
cxPropEditors, cxStyles, cxViewEditor, cxBandedTableViewEditor, cxCardViewEditor,
cxChartViewEditor, cxGridPredefinedStyles, cxGridStyleSheetsPreview;
const
UnitNamePrefix = '';
{ TGridEditor }
const
GridEditorVerbs: array [0..4] of string = (
'Editor...',
'Import...',
'-',
'ExpressQuantumGrid Suite ' + cxGridVersion,
'www.devexpress.com'
);
AddOnInsertPosition = 2;
type
TViewMenuItemAction = (vmiaExecute, vmiaGetCaption, vmiaPrepare);
TGridEditor = class(TComponentEditor)
private
FViewMenuProvider: TcxCustomGridViewMenuProvider;
function GetGrid: TcxCustomGrid;
function GetGridView: TcxCustomGridView;
protected
function GetViewMenuItemCount: Integer;
function ProcessViewMenuItem(var AIndex: Integer; AAction: TViewMenuItemAction;
const ADesignMenuItem: TDesignMenuItem = nil): Boolean;
property Grid: TcxCustomGrid read GetGrid;
property GridView: TcxCustomGridView read GetGridView;
property ViewMenuProvider: TcxCustomGridViewMenuProvider read FViewMenuProvider;
public
destructor Destroy; override;
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure PrepareItem(Index: Integer; const AItem: TDesignMenuItem); override;
end;
destructor TGridEditor.Destroy;
begin
FViewMenuProvider.Free;
inherited;
end;
function TGridEditor.GetGrid: TcxCustomGrid;
begin
Result := TcxCustomGrid(Component);
end;
function TGridEditor.GetGridView: TcxCustomGridView;
begin
Result := Grid.ActiveView;
if (Result <> nil) and Result.IsMaster then
Result := nil;
end;
function TGridEditor.GetViewMenuItemCount: Integer;
begin
if ViewMenuProvider = nil then
Result := 0
else
Result := 1 + ViewMenuProvider.Items.Count; // 1 - for separator
end;
function TGridEditor.ProcessViewMenuItem(var AIndex: Integer;
AAction: TViewMenuItemAction; const ADesignMenuItem: TDesignMenuItem = nil): Boolean;
var
AMenuProviderItem: TcxGridViewMenuItem;
begin
Result := False;
if (AIndex >= AddOnInsertPosition) and (ViewMenuProvider <> nil) then
if AIndex - AddOnInsertPosition < GetViewMenuItemCount then
begin
if AIndex = AddOnInsertPosition then // separator
AMenuProviderItem := nil
else
AMenuProviderItem := ViewMenuProvider.Items[AIndex - AddOnInsertPosition - 1];
case AAction of
vmiaExecute:
if AMenuProviderItem <> nil then
AMenuProviderItem.DoAction;
vmiaGetCaption: ;
vmiaPrepare:
if AMenuProviderItem = nil then
ADesignMenuItem.Caption := cxGridViewMenuSeparatorCaption
else
AMenuProviderItem.Prepare(ADesignMenuItem);
end;
Result := True;
end
else
Dec(AIndex, GetViewMenuItemCount);
end;
procedure TGridEditor.ExecuteVerb(Index: Integer);
begin
inherited;
if ProcessViewMenuItem(Index, vmiaExecute) then Exit;
case Index of
0: ShowGridEditor(Designer, Grid);
1: ShowGridImportDialog(Designer, Grid);
end;
end;
function TGridEditor.GetVerb(Index: Integer): string;
begin
if ProcessViewMenuItem(Index, vmiaGetCaption) then
Result := ''
else
if (Index >= 0) and (Index <= High(GridEditorVerbs)) then
Result := GridEditorVerbs[Index]
else
Result := '';
end;
function TGridEditor.GetVerbCount: Integer;
begin
FViewMenuProvider.Free;
if GridView <> nil then
FViewMenuProvider := CreateViewMenuProvider(GridView);
Result := Length(GridEditorVerbs) + GetViewMenuItemCount;
end;
procedure TGridEditor.PrepareItem(Index: Integer; const AItem: TDesignMenuItem);
begin
inherited;
ProcessViewMenuItem(Index, vmiaPrepare, AItem);
end;
{ TGridViewRepositoryEditor }
type
TGridViewRepositoryEditor = class(TComponentEditor)
private
function GetGridViewRepository: TcxGridViewRepository;
protected
property GridViewRepository: TcxGridViewRepository read GetGridViewRepository;
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
function TGridViewRepositoryEditor.GetGridViewRepository: TcxGridViewRepository;
begin
Result := TcxGridViewRepository(Component);
end;
procedure TGridViewRepositoryEditor.ExecuteVerb(Index: Integer);
begin
inherited;
case Index of
//0: GridViewRepository.CreateItem(TcxGridDBTableView).Name := Designer.UniqueName('cxGridDBTableView');
0: ShowViewRepositoryEditor(Designer, GridViewRepository);
end;
end;
function TGridViewRepositoryEditor.GetVerb(Index: Integer): string;
begin
case Index of
//0: Result := 'Create TcxGridDBTableView';
0: Result := 'Editor...';
1: Result := '-';
2: Result := 'ExpressQuantumGrid Suite ' + cxGridVersion;
3: Result := 'www.devexpress.com';
end;
end;
function TGridViewRepositoryEditor.GetVerbCount: Integer;
begin
Result := 4;
end;
{ TcxGridRootLevelStylesEventsProperty }
type
TcxGridRootLevelStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridRootLevelStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGrid(GetComponent(0)).RootLevelStyles;
end;
{ TcxGridTableItemPropertiesEventsProperty }
type
TcxGridTableItemPropertiesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridTableItemPropertiesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGridTableItem(GetComponent(0)).Properties;
end;
{ TcxGridTableItemStylesEventsProperty }
type
TcxGridTableItemStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridTableItemStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGridTableItem(GetComponent(0)).Styles;
end;
{ TcxGridDataControllerEventsProperty }
type
TcxGridDataControllerEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridDataControllerEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGridView(GetComponent(0)).DataController;
end;
{ TcxGridViewStylesEventsProperty }
type
TcxGridViewStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridViewStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGridViewAccess.GetStyles(TcxCustomGridView(GetComponent(0)));
end;
{ TcxGridViewNavigatorButtonsEventsProperty }
type
TcxGridViewNavigatorButtonsEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridViewNavigatorButtonsEventsProperty.GetInstance: TPersistent;
begin
Result := TcxCustomGridTableView(GetComponent(0)).NavigatorButtons;
end;
{ TcxGridLevelStylesEventsProperty }
type
TcxGridLevelStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridLevelStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridLevel(GetComponent(0)).Styles;
end;
{ TcxGridBandStylesEventsProperty }
type
TcxGridBandStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridBandStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridBand(GetComponent(0)).Styles;
end;
{ TcxGridChartSeriesStylesEventsProperty }
type
TcxGridChartSeriesStylesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartSeriesStylesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartSeries(GetComponent(0)).Styles;
end;
{ TcxGridChartHistogramValuesEventsProperty }
type
TcxGridChartHistogramValuesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartHistogramValuesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartHistogram(GetComponent(0)).Values;
end;
{ TcxGridChartCategoriesEventsProperty }
type
TcxGridChartCategoriesEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartCategoriesEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartView(GetComponent(0)).Categories;
end;
{ TcxGridChartAreaDiagramEventsProperty }
type
TcxGridChartAreaDiagramEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartAreaDiagramEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartView(GetComponent(0)).DiagramArea;
end;
{ TcxGridChartBarDiagramEventsProperty }
type
TcxGridChartBarDiagramEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartBarDiagramEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartView(GetComponent(0)).DiagramBar;
end;
{ TcxGridChartColumnDiagramEventsProperty }
type
TcxGridChartColumnDiagramEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartColumnDiagramEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartView(GetComponent(0)).DiagramColumn;
end;
{ TcxGridChartLineDiagramEventsProperty }
type
TcxGridChartLineDiagramEventsProperty = class(TcxNestedEventProperty)
protected
function GetInstance: TPersistent; override;
end;
function TcxGridChartLineDiagramEventsProperty.GetInstance: TPersistent;
begin
Result := TcxGridChartView(GetComponent(0)).DiagramLine;
end;
{ TcxGridChartPieDiagramEventsProperty }
type
TcxGridChartPieDiagramEventsProperty = class(TcxNestedEventProperty)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?