cxexteditreg.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 498 行 · 第 1/2 页

PAS
498
字号

{********************************************************************}
{                                                                    }
{       Developer Express Visual Component Library                   }
{       ExpressEditors                                               }
{                                                                    }
{       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 EXPRESSEDITORS 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 cxExtEditReg;

{$I cxVer.inc}

interface

uses
  Classes;

procedure Register;

implementation

uses
{$IFDEF DELPHI6}
    DesignIntf, DesignEditors,
{$ELSE}
  DsgnIntf,
{$ENDIF}
  Controls, Forms, Graphics, ImgList, StdCtrls, SysUtils, TypInfo, cxCheckBox,
  cxCheckComboBox, cxCheckGroup, cxCheckGroupStatesEditor, cxCheckListBox,
  cxClasses, cxColorComboBox, cxContainer, cxDBCheckComboBox, cxDBCheckGroup,
  cxDBCheckListBox, cxDBColorComboBox, cxDBFontNameComboBox, cxDBLabel,
  cxDBProgressBar, cxDBRichEdit, cxDBTrackBar, cxEdit, cxEditPropEditors,
  cxEditRepositoryEditor, cxExtEditConsts, cxExtEditRepositoryItems,
  cxFontNameComboBox, cxHeader, cxHint, cxHintEditor, cxLabel, cxListView,
  cxLookAndFeels, cxMCListBox, cxProgressBar, cxPropEditors, cxRichEdit,
  cxScrollBar, cxSpinButton, cxSplitter, cxSplitterEditor, cxTrackBar,
  cxTreeView;

const
  cxEditorsRestoreStyleCaption = 'Restore style';
  cxEditorsRestoreLookAndFeelCaption = 'Restore LookAndFeel';
  cxEditComponentEditorVerbS: array[0..0] of string = (cxEditorsRestoreStyleCaption);
  cxEditComponentEditorVerbL: array[0..0] of string = (cxEditorsRestoreLookAndFeelCaption);
  cxSplitterStyleControllerVerb = 'Splitter Editor...';
  cxHintStyleControllerVerb = 'Hints Editor...';

type
  TcxCustomEditAccess = class(TcxCustomEdit);

type
  { TcxHotZoneStyleProperty }

  TcxHotZoneStyleProperty = class(TClassProperty)
  protected
    function HasSubProperties: Boolean;
  public
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure GetValues(Proc: TGetStrProc); override;
    procedure SetValue(const Value: string); override;
  end;

  { TcxCustomHeaderComponentEditor }

  TcxCustomHeaderComponentEditor = class(TcxEditorsLibraryComponentWithoutStylesEditor)
  protected
    function GetLookAndFeel: TcxLookAndFeel; override;
  public
    procedure Edit; override;
  end;

  { TcxSplitterComponentEditor }

  TcxSplitterComponentEditor = class(TcxEditorsLibraryComponentEditorEx)
  protected
    function GetEditItemCaption: string; override;
    procedure ExecuteEditAction; override;
  end;

  { TcxHintStyleComponentEditor }

  TcxHintStyleComponentEditor = class(TcxEditorsLibraryComponentEditorEx)
  protected
    function GetEditItemCaption: string; override;
    procedure ExecuteEditAction; override;
  end;

  { TcxHotZoneStyleEventsProperty }

  TcxHotZoneStyleEventsProperty = class(TcxNestedEventProperty)
  protected
    function GetInstance: TPersistent; override;
  end;

  { TcxHeaderSectionImageIndexProperty }

  TcxHeaderSectionImageIndexProperty = class(TImageIndexProperty)
  public
    function GetImages: TCustomImageList; override;
  end;

  { TcxChecksControlStatesItemsProperty }

  TcxChecksControlStatesItemsProperty = class(TPropertyEditor)
  protected
    procedure InitializeDlg(ADialog: TcxCheckGroupStatesEditorDlg); virtual;
    procedure SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg); virtual;
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetName: string; override;
    function GetValue: string; override;
  end;

  { TcxCheckGroupStatesItemsProperty }

  TcxCheckGroupStatesItemsProperty = class(TcxChecksControlStatesItemsProperty)
  protected
    procedure InitializeDlg(ADialog: TcxCheckGroupStatesEditorDlg); override;
    procedure SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg); override;
  end;

  { TcxCheckComboBoxStatesItemsProperty }

  TcxCheckComboBoxStatesItemsProperty = class(TcxChecksControlStatesItemsProperty)
  protected
    procedure InitializeDlg(ADialog: TcxCheckGroupStatesEditorDlg); override;
    procedure SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg); override;
  end;

  { TcxCheckGroupComponentEditor }

  TcxCheckGroupComponentEditor = class(TcxEditComponentEditor)
  public
    procedure Edit; override;
  end;

{$IFDEF DELPHI6}
  TcxCommonControlsSelectionEditor = class(TSelectionEditor)
  public
    procedure RequiresUnits(Proc: TGetStrProc); override;
  end;
{$ENDIF}

  { TcxCheckListBoxItemImageIndexProperty }

  TcxCheckListBoxItemImageIndexProperty = class(TImageIndexProperty)
  public
    function GetImages: TCustomImageList; override;
  end;
  
{ TcxHotZoneStyleProperty }

function TcxHotZoneStyleProperty.HasSubProperties: Boolean;
var
  I: Integer;
begin
  for I := 0 to PropCount - 1 do
  begin
    Result := TcxCustomSplitter(GetComponent(I)).HotZone <> nil;
    if not Result then Exit;
  end;
  Result := True;
end;

function TcxHotZoneStyleProperty.GetAttributes: TPropertyAttributes;
begin
  Result := inherited GetAttributes;
  if not HasSubProperties then
    Exclude(Result, paSubProperties);
  Result := Result - [paReadOnly] +
    [paValueList, paSortList, paRevertable{$IFDEF DELPHI6}, paVolatileSubProperties{$ENDIF}];
end;

function TcxHotZoneStyleProperty.GetValue: string;
begin
  if HasSubProperties then
    Result := GetRegisteredHotZoneStyles.GetDescriptionByClass(
      TcxCustomSplitter(GetComponent(0)).HotZone.ClassType)
  else
    Result := '';
end;

procedure TcxHotZoneStyleProperty.GetValues(Proc: TGetStrProc);
var
  I: Integer;
begin
  for I := 0 to GetRegisteredHotZoneStyles.Count - 1 do
    Proc(GetRegisteredHotZoneStyles.Descriptions[I]);
end;

procedure TcxHotZoneStyleProperty.SetValue(const Value: string);
var
  FHotZoneStyleClass: TcxHotZoneStyleClass;
  I: Integer;
begin
  FHotZoneStyleClass := TcxHotZoneStyleClass(GetRegisteredHotZoneStyles.FindByClassName(Value));
  if FHotZoneStyleClass = nil then
    FHotZoneStyleClass := TcxHotZoneStyleClass(GetRegisteredHotZoneStyles.FindByDescription(Value));

  for I := 0 to PropCount - 1 do
    TcxCustomSplitter(GetComponent(I)).HotZoneStyleClass := FHotZoneStyleClass;
  Modified;
end;

{ TcxHotZoneStyleEventsProperty }

function TcxHotZoneStyleEventsProperty.GetInstance: TPersistent;
begin
  Result := TcxCustomSplitter(GetComponent(0)).HotZone;
end;

{ TcxHeaderSectionImageIndexProperty }

function TcxHeaderSectionImageIndexProperty.GetImages: TCustomImageList;
begin
  Result := nil;
  if GetComponent(0) is TcxHeaderSection then
    Result := TCustomImageList(TcxHeaderSection(GetComponent(0)).HeaderControl.Images);
end;

{ TcxCustomHeaderComponentEditor }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?