cxexteditreg.pas

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

PAS
498
字号

procedure TcxCustomHeaderComponentEditor.Edit;
begin
end;

function TcxCustomHeaderComponentEditor.GetLookAndFeel: TcxLookAndFeel;
begin
  Result := TcxCustomHeader(Component).LookAndFeel;
end;

{ TcxSplitterComponentEditor }

function TcxSplitterComponentEditor.GetEditItemCaption: string;
begin
  Result := cxSplitterStyleControllerVerb;
end;

procedure TcxSplitterComponentEditor.ExecuteEditAction;
begin
  ShowSplitterEditor(Component as TcxSplitter);
end;

{ TcxHintStyleComponentEditor }

function TcxHintStyleComponentEditor.GetEditItemCaption: string;
begin
  Result := cxHintStyleControllerVerb;
end;

procedure TcxHintStyleComponentEditor.ExecuteEditAction;
begin
  ShowHintStyleEditor(Component as TcxHintStyleController);
end;

{ TcxChecksControlStatesItemsProperty }

procedure TcxChecksControlStatesItemsProperty.Edit;
var
  ADialog: TcxCheckGroupStatesEditorDlg;
begin
  ADialog := TcxCheckGroupStatesEditorDlg.Create(Application);
  try
    InitializeDlg(ADialog);
    if ADialog.ShowModal = mrOK then
    begin
      SynchronizeControlCheckStates(ADialog);
      Modified;
    end;
  finally
    ADialog.Free;
  end;
end;

function TcxChecksControlStatesItemsProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly];
end;

function TcxChecksControlStatesItemsProperty.GetName: string;
begin
  Result := 'States';
end;

function TcxChecksControlStatesItemsProperty.GetValue: string;
begin
  Result := '';
end;

procedure TcxChecksControlStatesItemsProperty.InitializeDlg(ADialog: TcxCheckGroupStatesEditorDlg);
begin
end;

procedure TcxChecksControlStatesItemsProperty.SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg);
begin
end;

{ TcxCheckGroupStatesItemsProperty }

procedure TcxCheckGroupStatesItemsProperty.InitializeDlg(
  ADialog: TcxCheckGroupStatesEditorDlg);
var
  ACheckGroup: TcxCustomCheckGroup;
  AItem: TcxCheckListBoxItem;
  I: Integer;
begin
  ADialog.Caption := cxGetResourceString(@
    cxSCheckGroupStatesItemsPropertyDlgCaption);
  ADialog.clbStates.Items.Clear;
  ACheckGroup := TcxCustomCheckGroup(GetComponent(0));
  ADialog.clbStates.AllowGrayed := ACheckGroup.ActiveProperties.AllowGrayed and
    (ACheckGroup.ActiveProperties.EditValueFormat <> cvfInteger);
  for I := 0 to ACheckGroup.ActiveProperties.Items.Count - 1 do
  begin
    AItem := TcxCheckListBoxItem(ADialog.clbStates.Items.Add);
    AItem.Text := ACheckGroup.ActiveProperties.Items[I].Caption;
    AItem.State := ACheckGroup.States[I];
  end;
end;

procedure TcxCheckGroupStatesItemsProperty.SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg);
var
  I: Integer;
begin
  with TcxCustomCheckGroup(GetComponent(0)) do
    for I := 0 to ADialog.clbStates.Items.Count - 1 do
      States[I] := ADialog.clbStates.Items[I].State;
end;

{ TcxCheckComboBoxStatesItemsProperty }

procedure TcxCheckComboBoxStatesItemsProperty.InitializeDlg(ADialog: TcxCheckGroupStatesEditorDlg);
var
  ACheckComboBox: TcxCustomCheckComboBox;
  AItem: TcxCheckListBoxItem;
  I: Integer;
begin
  ADialog.Caption := cxGetResourceString(@
    cxSCheckComboBoxStatesItemsPropertyDlgCaption);
  ADialog.clbStates.Items.Clear;
  ACheckComboBox := TcxCustomCheckComboBox(GetComponent(0));
  ADialog.clbStates.AllowGrayed := False;
  for I := 0 to ACheckComboBox.ActiveProperties.Items.Count - 1 do
  begin
    AItem := TcxCheckListBoxItem(ADialog.clbStates.Items.Add);
    AItem.Text := ACheckComboBox.ActiveProperties.Items[I].Description;
    AItem.State := ACheckComboBox.States[I];
  end;
end;

procedure TcxCheckComboBoxStatesItemsProperty.SynchronizeControlCheckStates(ADialog: TcxCheckGroupStatesEditorDlg);
var
  I: Integer;
begin
  with TcxCustomCheckComboBox(GetComponent(0)) do
    for I := 0 to ADialog.clbStates.Items.Count - 1 do
      States[I] := ADialog.clbStates.Items[I].State;
end;

{ TcxCheckGroupComponentEditor }

procedure TcxCheckGroupComponentEditor.Edit;
const
  AMethodParams: array[0..0] of TMethodParam =
    ((Flags: [pfAddress]; Name: 'Sender'; TypeName: 'TObject'));
begin
  ShowEventMethod(Designer, TcxCustomEditAccess(Component).Properties,
    'OnChange', Component.Name + 'PropertiesChange', AMethodParams);
end;

{$IFDEF DELPHI6}
procedure TcxCommonControlsSelectionEditor.RequiresUnits(Proc: TGetStrProc);
begin
  Proc('ComCtrls');
end;
{$ENDIF}

{ TcxCheckListBoxItemImageIndexProperty }

function TcxCheckListBoxItemImageIndexProperty.GetImages: TCustomImageList;
begin
  Result := TcxCustomInnerCheckListBox(GetPersistentOwner(
    TcxCheckListBoxItem(GetComponent(0)).Collection)).Container.Images;
end;

procedure RegisterEditRepositoryItems;
begin
  RegisterEditRepositoryItem(TcxEditRepositoryLabel, scxSEditRepositoryLabelItem);
  RegisterEditRepositoryItem(TcxEditRepositoryFontNameComboBox, scxSEditRepositoryFontNameComboBoxItem);
  RegisterEditRepositoryItem(TcxEditRepositoryColorComboBox, scxSEditRepositoryColorComboBoxItem);
  RegisterEditRepositoryItem(TcxEditRepositoryProgressBar, scxSEditRepositoryProgressBarItem);
  RegisterEditRepositoryItem(TcxEditRepositoryTrackBar, scxSEditRepositoryTrackBarItem);
  RegisterEditRepositoryItem(TcxEditRepositoryCheckComboBox, scxSEditRepositoryCheckComboBox);
  RegisterEditRepositoryItem(TcxEditRepositoryCheckGroupItem, scxSEditRepositoryCheckGroupItem);
  RegisterEditRepositoryItem(TcxEditRepositoryRichItem, scxSEditRepositoryRichEditItem);
end;

procedure UnregisterEditRepositoryItems;
begin
  UnregisterEditRepositoryItem(TcxEditRepositoryLabel);
  UnregisterEditRepositoryItem(TcxEditRepositoryFontNameComboBox);
  UnregisterEditRepositoryItem(TcxEditRepositoryColorComboBox);
  UnregisterEditRepositoryItem(TcxEditRepositoryProgressBar);
  UnregisterEditRepositoryItem(TcxEditRepositoryTrackBar);
  UnregisterEditRepositoryItem(TcxEditRepositoryCheckComboBox);
  UnregisterEditRepositoryItem(TcxEditRepositoryCheckGroupItem);
  UnregisterEditRepositoryItem(TcxEditRepositoryRichItem);
end;

procedure Register;
begin
{$IFDEF DELPHI9}
  ForceDemandLoadState(dlDisable);
{$ENDIF}  

  RegisterComponents('Express Editors 6', [TcxLabel, TcxProgressBar, TcxTrackBar,
    TcxCheckListBox, TcxColorComboBox, TcxFontNameComboBox, TcxCheckComboBox,
    TcxCheckGroup, TcxRichEdit]);
  RegisterComponents('Express DBEditors 6', [TcxDBLabel, TcxDBProgressBar, TcxDBTrackBar,
    TcxDBCheckListBox, TcxDBColorComboBox, TcxDBFontNameComboBox, TcxDBCheckComboBox,
    TcxDBCheckGroup, TcxDBRichEdit]);
  RegisterComponents('Express Utilities', [TcxHintStyleController, TcxSpinButton,
    TcxMCListBox, TcxListView, TcxTreeView, TcxHeader, TcxSplitter]);

  RegisterPropertyEditor(TypeInfo(string), TcxCustomSplitter, 'HotZoneClassName', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomSplitter, 'ResizeIgnoreSnap', nil);
  RegisterPropertyEditor(TypeInfo(TcxHotZoneStyle), TcxCustomSplitter, 'HotZone', TcxHotZoneStyleProperty);
  RegisterPropertyEditor(TypeInfo(TNotifyEvent), TcxCustomSplitter, 'HotZoneEvents', TcxHotZoneStyleEventsProperty);
  RegisterPropertyEditor(TypeInfo(TcxEditValue), TcxCustomCheckGroup, 'EditValue', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomCheckGroup, 'StatesItems', TcxCheckGroupStatesItemsProperty);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomCheckComboBox, 'StatesItems', TcxCheckComboBoxStatesItemsProperty);
  RegisterPropertyEditor(TypeInfo(TcxEditValue), TcxCustomCheckListBox, 'EditValue', nil);
  RegisterPropertyEditor(TypeInfo(TMeasureItemEvent), TcxCustomCheckListBox, 'OnMeasureItem', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxLabelProperties, 'ShowEndEllipsis', nil);
  RegisterPropertyEditor(TypeInfo(TcxEditValue), TcxCustomCheckComboBox, 'EditValue', nil);
  RegisterPropertyEditor(TypeInfo(Variant), TcxCustomCheckComboBox, 'Value', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomSpinButton, 'AutoSize', nil);
  RegisterPropertyEditor(TypeInfo(TTabOrder), TcxCustomLabel, 'TabOrder', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomLabel, 'TabStop', nil);
  RegisterPropertyEditor(TypeInfo(Boolean), TcxCustomCheckComboBoxProperties,
    'AllowGrayed', nil);
  RegisterPropertyEditor(TypeInfo(TcxProgressBarPropertiesValues), TcxCustomProgressBarProperties, 'AssignedValues', nil);
{$IFDEF DELPHI6}
  RegisterPropertyEditor(TypeInfo(Integer), TcxCustomListView, 'ItemIndex', nil);
  RegisterSelectionEditor(TcxCustomListView, TcxCommonControlsSelectionEditor);
  RegisterSelectionEditor(TcxCustomTreeView, TcxCommonControlsSelectionEditor);  
{$ENDIF}

  RegisterPropertyEditor(TypeInfo(TImageIndex), TcxCheckListBoxItem, 'ImageIndex', TcxCheckListBoxItemImageIndexProperty);
  RegisterPropertyEditor(TypeInfo(TImageIndex), TcxHeaderSection, 'ImageIndex', TcxHeaderSectionImageIndexProperty);

  RegisterComponentEditor(TcxCheckListBox, TcxContainerComponentEditor);
  RegisterComponentEditor(TcxCustomCheckGroup, TcxCheckGroupComponentEditor);
  RegisterComponentEditor(TcxCustomHeader, TcxCustomHeaderComponentEditor);
  RegisterComponentEditor(TcxDBCheckListBox, TcxContainerComponentEditor);
  RegisterComponentEditor(TcxHintStyleController, TcxHintStyleComponentEditor);
  RegisterComponentEditor(TcxListView, TcxContainerComponentEditor);
  RegisterComponentEditor(TcxMCListBox, TcxContainerComponentEditor);
  RegisterComponentEditor(TcxSplitter, TcxSplitterComponentEditor);
  RegisterComponentEditor(TcxTreeView, TcxContainerComponentEditor);
end;

initialization
  RegisterEditRepositoryItems;

finalization
  UnregisterEditRepositoryItems;

end.

⌨️ 快捷键说明

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