cxpropertiesconverters.pas

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

PAS
923
字号
{********************************************************************}
{                                                                    }
{       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 cxPropertiesConverters;

{$I cxVer.inc}

interface

uses
  cxCustomConverter, cxBlobEdit, StdCtrls, cxConverterUtils, cxImage, cxButtonEdit,
  cxEdit, Classes, Graphics, cxCalc, cxCheckBox, cxDropDownEdit, cxCurrencyEdit,
  cxCalendar, cxDBLookupComboBox, cxHyperLinkEdit, cxImageComboBox, Controls, SysUtils,
  cxMaskEdit, cxMemo, cxMRUEdit, cxSpinEdit, cxTextEdit, cxTimeEdit;

type
  { TcxCustomPropertiesConverter }
  TcxCustomPropertiesConverter = class(TcxCustomConverter)
  protected
    function ConvertPictureTransparency(const AValue: string): TcxImageTransparency;
    function ConvertVertAlignment(const AVertAlignment: string): TcxEditVertAlignment;
  end;

  { TcxBlobEditPropertiesConverter }
  TcxBlobEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function ConvertBlobEditKind(const AKind: string): TcxBlobEditKind;
    function ConvertBlobPaintStyle(const AStyle: string): TcxBlobPaintStyle;
    function GetDestination: TcxBlobEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxBlobEditProperties read GetDestination;
  end;

  { TcxButtonEditPropertiesConverter }
  TcxButtonEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function ConvertButtonKind(const AButtonKind: string): TcxEditButtonKind;
    function GetDestination: TcxButtonEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxButtonEditProperties read GetDestination;
  end;

  { TcxCalcEditPropertiesConverter }
  TcxCalcEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxCalcEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxCalcEditProperties read GetDestination;
  end;

  { TcxCheckBoxPropertiesConverter }
  TcxCheckBoxPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function ConvertNullFieldStyle(const AValue: string): TcxCheckBoxNullValueShowingStyle;
    function GetDestination: TcxCheckBoxProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxCheckBoxProperties read GetDestination;
  end;

  { TcxComboBoxPropertiesConverter }
  TcxComboBoxPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxComboBoxProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxComboBoxProperties read GetDestination;
  end;

  { TcxCurrencyEditPropertiesConverter }
  TcxCurrencyEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxCurrencyEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxCurrencyEditProperties read GetDestination;
  end;

  { TcxDateEditPropertiesConverter }
  TcxDateEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxDateEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxDateEditProperties read GetDestination;
  end;

  { TcxHyperLinkEditPropertiesConverter }
  TcxHyperLinkEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxHyperLinkEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxHyperLinkEditProperties read GetDestination;
  end;

  { TcxImagePropertiesConverter }
  TcxImagePropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxImageProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxImageProperties read GetDestination;
  end;

  { TcxImageComboBoxPropertiesConverter }
  TcxImageComboBoxPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxImageComboBoxProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxImageComboBoxProperties read GetDestination;
  end;

  { TcxLookupComboBoxPropertiesConverter }
  TcxLookupComboBoxPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxLookupComboBoxProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxLookupComboBoxProperties read GetDestination;
  end;

  { TcxMaskEditPropertiesConverter }
  TcxMaskEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxMaskEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxMaskEditProperties read GetDestination;
  end;

  { TcxMemoPropertiesConverter }
  TcxMemoPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxMemoProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxMemoProperties read GetDestination;
  end;

  { TcxMRUEditPropertiesConverter }
  TcxMRUEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxMRUEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxMRUEditProperties read GetDestination;
  end;

  { TcxPopupEditPropertiesConverter }
  TcxPopupEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxPopupEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxPopupEditProperties read GetDestination;
  end;

  { TcxSpinEditPropertiesConverter }
  TcxSpinEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxSpinEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxSpinEditProperties read GetDestination;
  end;

  { TcxTextEditPropertiesConverter }
  TcxTextEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function GetDestination: TcxTextEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxTextEditProperties read GetDestination;
  end;

  { TcxTimeEditPropertiesConverter }
  TcxTimeEditPropertiesConverter = class(TcxCustomPropertiesConverter)
  private
    function ConvertTimeFormat(const AFormat: string): TcxTimeEditTimeFormat;
    function GetDestination: TcxTimeEditProperties;
  protected
    procedure DoImport; override;
  public
    property Destination: TcxTimeEditProperties read GetDestination;
  end;

implementation

uses
  ImgList;

type
  TcxButtonEditPropertiesAccess = class(TcxButtonEditProperties);

{ TcxCustomPropertiesConverter }

function TcxCustomPropertiesConverter.ConvertPictureTransparency(
  const AValue: string): TcxImageTransparency;
begin
  if AValue = 'gtDefault' then
    Result := gtDefault
  else if AValue = 'gtOpaque' then
    Result := gtOpaque
  else if AValue = 'gtTransparent' then
    Result := gtTransparent
  else
    Result := gtDefault;
end;

function TcxCustomPropertiesConverter.ConvertVertAlignment(const AVertAlignment: string): TcxEditVertAlignment;
begin
  if AVertAlignment = 'tlCenter' then
    Result := taVCenter
  else if AVertAlignment = 'tlTop' then
    Result := taTopJustify
  else if AVertAlignment = 'tlBottom' then
    Result := taBottomJustify
  else
    Result := taVCenter; 
end;

{ TcxBlobEditPropertiesConverter }

procedure TcxBlobEditPropertiesConverter.DoImport;
begin
  with Destination do
  begin
    AlwaysSaveData := GetBooleanProperty(Source, 'AlwaysSaveText', AlwaysSaveData);
    BlobEditKind := ConvertBlobEditKind(GetEnumProperty(Source, 'BlobKind'));
    BlobPaintStyle := ConvertBlobPaintStyle(GetEnumProperty(Source, 'BlobPaintStyle'));
    MemoCharCase := ConvertCharCase(GetEnumProperty(Source, 'MemoCharCase'));
    MemoMaxLength := GetIntegerProperty(Source, 'MemoMaxLength', MemoMaxLength);
    MemoOEMConvert := GetBooleanProperty(Source, 'MemoOEMConvert', MemoOEMConvert);
    MemoScrollBars := ConvertScrollStyle(GetEnumProperty(Source, 'MemoScrollBars'));
    MemoWantReturns := GetBooleanProperty(Source, 'MemoWantReturns', MemoWantReturns);
    MemoWantTabs := GetBooleanProperty(Source, 'MemoWantTabs', MemoWantTabs);
    MemoWordWrap := GetBooleanProperty(Source, 'MemoWordWrap', MemoWordWrap);
    PictureAutoSize := GetBooleanProperty(Source, 'PictureAutoSize', PictureAutoSize);
    PictureFilter := GetStringProperty(Source, 'PictureFilter', PictureFilter);
    PictureTransparency := ConvertPictureTransparency(GetEnumProperty(Source, 'PictureTransparency'));
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    ShowExPopupItems := GetBooleanProperty(Source, 'ShowExPopupItems', ShowExPopupItems);
    ShowPicturePopup := GetBooleanProperty(Source, 'ShowPicturePopup', ShowPicturePopup);
  end;
  inherited DoImport;
end;

function TcxBlobEditPropertiesConverter.ConvertBlobEditKind(
  const AKind: string): TcxBlobEditKind;
begin
  if AKind = 'bkAuto' then
    Result := bekAuto
  else if AKind = 'bkBlob' then
    Result := bekBlob
  else if AKind = 'bkMemo' then
    Result := bekMemo

⌨️ 快捷键说明

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