cxlibraryreg.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,412 行 · 第 1/3 页
PAS
1,412 行
{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ Express Cross Platform Library classes }
{ }
{ Copyright (c) 2000-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 EXPRESSCROSSPLATFORMLIBRARY 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 cxLibraryReg;
{$I cxVer.inc}
interface
uses
SysUtils, Forms, Classes, Controls, Menus, TypInfo,
{$IFDEF DELPHI6}
DesignIntf, DesignEditors, DesignConst, DesignMenus,
{$ELSE}
DsgnIntf, SysConst,
{$ENDIF}
cxPropertiesStore, cxPropertiesStoreEditor,
PicEdit, dxGDIPlusAPI, dxGDIPlusClasses,
cxContainer, cxLookAndFeels,
cxDesignWindows, cxStyleRepositoryEditor, cxImageListEditor, cxStyles,
cxControls, cxLookAndFeelPainters;
const
dxCompanyName = 'Developer Express Inc.';
dxCompanyURL = 'www.devexpress.com';
dxLibraryProductPage = 'Dev Express';
sdxBitmapAndPNGFilter = 'All (*.bmp;*.png)|*.bmp;*.png|Bitmaps (*.bmp)|*.bmp|PNG graphics from DevExpress (*.png)|*.png';
type
TDesignMenuItem = {$IFDEF DELPHI6}DesignMenus.IMenuItem{$ELSE}TMenuItem{$ENDIF};
{$IFNDEF DELPHI6}
TGetPropProc = TGetPropEditProc;
{$ENDIF}
{ TcxComponentEditorHelper }
TcxComponentEditorHelper = class
private
FComponentEditor: TComponentEditor;
FProductName: string;
FProductMajorVersion: string;
FProductMinorVersion: string;
public
constructor Create(AComponentEditor: TComponentEditor; const AProductName, AProductMajorVersion, AProductMinorVersion: string);
function GetVerb(Index: Integer): string;
function GetVerbCount: Integer;
end;
{ TcxComponentEditor }
TcxComponentEditor = class(TComponentEditor)
private
FHelper: TcxComponentEditorHelper;
protected
function GetProductMajorVersion: string; virtual; abstract;
function GetProductMinorVersion: string; virtual;
function GetProductName: string; virtual; abstract;
function InternalGetVerb(AIndex: Integer): string; virtual;
function InternalGetVerbCount: Integer; virtual;
procedure InternalExecuteVerb(AIndex: Integer); virtual;
public
constructor Create(AComponent: TComponent; ADesigner: IDesigner); override;
destructor Destroy; override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
procedure ExecuteVerb(Index: Integer); override;
end;
TcxDefaultEditor = class(TDefaultEditor)
private
FHelper: TcxComponentEditorHelper;
protected
function GetProductMajorVersion: string; virtual; abstract;
function GetProductMinorVersion: string; virtual;
function GetProductName: string; virtual; abstract;
function InternalGetVerb(AIndex: Integer): string; virtual;
function InternalGetVerbCount: Integer; virtual;
public
constructor Create(AComponent: TComponent; ADesigner: IDesigner); override;
destructor Destroy; override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
{ TcxControlPopupMenuProperty }
TcxControlPopupMenuProperty = class(TComponentProperty)
private
FProc: TGetStrProc;
procedure CheckComponent(const Value: string);
public
procedure GetValues(Proc: TGetStrProc); override;
end;
{ TcxBitmapGraphicProperty }
TcxBitmapGraphicProperty = class(TGraphicProperty)
private
procedure OnShowPicEdit(Sender: TObject);
protected
function BuildFilter: string; virtual;
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
procedure SetValue(const Value: string); override;
end;
TcxBitmapProperty = class(TcxBitmapGraphicProperty)
protected
function BuildFilter: string; override;
end;
TcxFilenameProperty = class(TStringProperty)
protected
function GetFilter: string; virtual;
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
end;
procedure HideClassProperties(AClass: TClass; APropertyNames: array of string);
procedure Register;
implementation
uses
{$IFDEF DELPHI6}
VCLEditors,
Types,
{$ENDIF}
Windows, Math, Graphics, Dialogs, ImgList, cxGraphics, cxPropEditors,
cxClasses;
const
// cxLibraryVersion = '6.24';
cxLibraryMajorVersion = '6';
type
TcxContainerAccess = class(TcxContainer);
{ TcxLibraryComponentEditor }
TcxLibraryComponentEditor = class(TcxComponentEditor)
protected
function GetProductMajorVersion: string; override;
function GetProductName: string; override;
end;
{ TcxLookAndFeelControllerEditor }
TcxLookAndFeelControllerEditor = class(TcxLibraryComponentEditor)
private
function GetLookAndFeelController: TcxLookAndFeelController;
public
procedure Edit; override;
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
{ TcxStyleRepositoryComponentEditor }
TcxStyleRepositoryComponentEditor = class(TcxLibraryComponentEditor)
private
function GetStyleRepository: TcxStyleRepository;
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
{ TcxPropertiesStoreComponentEditor }
TcxPropertiesStoreComponentEditor = class(TcxLibraryComponentEditor)
private
function GetPropertiesStore: TcxPropertiesStore;
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
{ TcxImageListComponentEditor }
TcxImageListComponentEditor = class(TcxLibraryComponentEditor)
private
FAssignableImageLists: TStringList;
FImageLists: TStringList;
procedure AssignClick(Sender: TObject);
procedure CheckAddImageList(const AImageListName: string;
AList: TStringList);
procedure CheckImageListForImport(const AImageListName: string);
procedure CheckImageListForAssign(const AImageListName: string);
function GetImageList: TcxImageList;
procedure UpdateAssignableList;
public
constructor Create(AComponent: TComponent; ADesigner: IDesigner); override;
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;
property ImageList: TcxImageList read GetImageList;
end;
{ TcxContainerStyleProperty }
TcxContainerStyleProperty = class(TClassProperty)
private
FProc: TGetPropProc;
procedure GetPropProc({$IFNDEF DELPHI6}Prop: TPropertyEditor{$ELSE}const Prop: IProperty{$ENDIF});
public
procedure GetProperties(Proc: TGetPropProc); override;
end;
{ TcxContainerStyleAssignedValuesProperty }
TcxContainerStyleAssignedValuesProperty = class(TSetProperty)
protected
procedure FillVisiblePropertiesList(AList: TStringList);
public
procedure GetProperties(Proc: TGetPropProc); override;
function GetValue: string; override;
end;
{ TcxContainerStyleAssignedValuesElementProperty }
TcxContainerStyleAssignedValuesElementProperty = class(TSetElementProperty)
{$IFNDEF DELPHI6}
private
FElement: Integer;
protected
constructor Create(Parent: TPropertyEditor; AElement: Integer);
property Element: Integer read FElement;
{$ENDIF}
public
function GetName: string; override;
end;
{ TcxLookAndFeelProperty }
TcxLookAndFeelProperty = class(TClassProperty)
private
FProc: TGetPropProc;
procedure GetPropProc({$IFNDEF DELPHI6}Prop: TPropertyEditor{$ELSE}const Prop: IProperty{$ENDIF});
public
procedure GetProperties(Proc: TGetPropProc); override;
end;
{ TcxLookAndFeelAssignedValuesProperty }
TcxLookAndFeelAssignedValuesProperty = class(TSetProperty)
protected
FProc: TGetPropProc;
procedure GetPropProc({$IFNDEF DELPHI6}Prop: TPropertyEditor{$ELSE}const Prop: IProperty{$ENDIF});
public
procedure GetProperties(Proc: TGetPropProc); override;
end;
{ TcxLibraryComponentEditor }
function TcxLibraryComponentEditor.GetProductMajorVersion: string;
begin
Result := cxLibraryMajorVersion;
end;
function TcxLibraryComponentEditor.GetProductName: string;
begin
Result := 'ExpressLibrary';
end;
{ TcxLookAndFeelControllerEditor }
procedure TcxLookAndFeelControllerEditor.Edit;
begin
end;
procedure TcxLookAndFeelControllerEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0:
begin
with GetLookAndFeelController do
begin
Kind := cxDefaultLookAndFeelKind;
NativeStyle := cxDefaultLookAndFeelNativeStyle;
end;
Designer.Modified;
end;
end;
end;
function TcxLookAndFeelControllerEditor.GetVerb(Index: Integer): string;
begin
if Index = 0 then
Result := 'Reset'
else
Result := inherited GetVerb(Index);
end;
function TcxLookAndFeelControllerEditor.GetVerbCount: Integer;
begin
Result := 1 + inherited GetVerbCount;
end;
function TcxLookAndFeelControllerEditor.GetLookAndFeelController: TcxLookAndFeelController;
begin
Result := Component as TcxLookAndFeelController;
end;
{ TcxStyleRepositoryComponentEditor }
procedure TcxStyleRepositoryComponentEditor.ExecuteVerb(Index: Integer);
begin
if Index = 0 then
ShowStyleRepositoryEditor(Designer, GetStyleRepository);
end;
function TcxStyleRepositoryComponentEditor.GetVerb(Index: Integer): string;
begin
if Index = 0 then
Result := 'Edit...'
else
Result := inherited GetVerb(Index);
end;
function TcxStyleRepositoryComponentEditor.GetVerbCount: Integer;
begin
Result := 1 + inherited GetVerbCount;
end;
function TcxStyleRepositoryComponentEditor.GetStyleRepository: TcxStyleRepository;
begin
Result := Component as TcxStyleRepository;
end;
{ TcxStyleSheetComponentProperty }
type
TcxStyleSheetComponentProperty = class(TComponentProperty)
private
FStrProc: TGetStrProc;
procedure StrProc(const S: string);
public
procedure GetValues(Proc: TGetStrProc); override;
end;
procedure TcxStyleSheetComponentProperty.StrProc(const S: string);
begin
if TcxStyles(GetComponent(0)).IsValidStyleSheet(TcxCustomStyleSheet(Designer.GetComponent(S))) then
FStrProc(S);
end;
procedure TcxStyleSheetComponentProperty.GetValues(Proc: TGetStrProc);
begin
FStrProc := Proc;
Designer.GetComponentNames(GetTypeData(GetPropType), StrProc);
end;
{ TcxPropertiesStoreComponentEditor }
procedure TcxPropertiesStoreComponentEditor.ExecuteVerb(Index: Integer);
var
AActive: Boolean;
APropertiesStore: TcxPropertiesStore;
procedure DsgnStoreTo;
begin
APropertiesStore := TcxPropertiesStore(Component);
AActive := APropertiesStore.Active;
APropertiesStore.Active := True;
APropertiesStore.StoreTo;
APropertiesStore.Active := AActive;
end;
procedure DsgnRestoreFrom;
begin
APropertiesStore := TcxPropertiesStore(Component);
AActive := APropertiesStore.Active;
APropertiesStore.Active := True;
APropertiesStore.RestoreFrom;
APropertiesStore.Active := AActive;
end;
begin
case Index of
0: ShowPropertiesStoreEditor(GetPropertiesStore,
{$IFNDEF DELPHI6}Designer.GetRoot{$ELSE}Designer.Root{$ENDIF}, Designer);
2: DsgnStoreTo;
3: DsgnRestoreFrom;
end;
end;
function TcxPropertiesStoreComponentEditor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := 'Edit...';
1: Result := '-';
2: Result := 'Store';
3: Result := 'Restore';
else
Result := inherited GetVerb(Index);
end;
end;
function TcxPropertiesStoreComponentEditor.GetVerbCount: Integer;
begin
Result := 1 + 3 + inherited GetVerbCount;
end;
function TcxPropertiesStoreComponentEditor.GetPropertiesStore: TcxPropertiesStore;
begin
Result := Component as TcxPropertiesStore;
end;
{ TcxImageListComponentEditor }
constructor TcxImageListComponentEditor.Create(AComponent: TComponent;
ADesigner: IDesigner);
begin
inherited Create(AComponent, ADesigner);
FAssignableImageLists := TStringList.Create;
FAssignableImageLists.Sorted := True;
end;
destructor TcxImageListComponentEditor.Destroy;
begin
FreeAndNil(FAssignableImageLists);
inherited Destroy;
end;
procedure TcxImageListComponentEditor.ExecuteVerb(Index: Integer);
procedure Edit;
begin
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?