{==============================================================================

  Copyright (C) 2000-2001 by Evgeny Kryukov
  All rights reserved

  All contents of this file and all other files included in this archive
  are Copyright (C) 2001 Evgeny Kryukov. Use and/or distribution of
  them requires acceptance of the License Agreement.

  See License.txt for licence information

===============================================================================}

unit KsSkinConvert;

{$I KsSkinVer.Inc}
{$T-,W-,X+,P+}

interface

uses
  Windows, SysUtils, Classes, Controls, Forms, Menus, StdCtrls,
  KsConvert, KsSkinEngine;

type

  TSeConverter = class(TKsCustomConverter)
  private
    FSkinEngine: TSeSkinEngine;
    procedure SetSkinEngine(const Value: TSeSkinEngine);
  protected
  public
    constructor Create(AOwner: TComponent); override;
    function GetClass(ClassKind: TClassKind): TComponentClass; override;
    procedure SetAdvancedProp(AOldObject, ANewObject: TObject); override;

    property SkinEngine: TSeSkinEngine read FSkinEngine write SetSkinEngine;
  end;

  TSeConverterClass = class of TSeConverter;

implementation {===============================================================}

uses TypInfo, KsSkinButtons, KsSkinEdits, KsSkinGroupBoxs, KsSkinCheckBoxs,
  KsSkinTrackBars, KsSkinProgress, KsSkinPanels, KsSkinScrollBars, KsSkinTabs,
  KsSkinListBoxs, KsSkinComboBoxs, KsSkinSpeedButtons, KsSkinSpinButtons;

{ TSeConverter }

constructor TSeConverter.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
end;

{ Virtual }

function TSeConverter.GetClass(ClassKind: TClassKind): TComponentClass;
begin
  case ClassKind of
    ckCheckBox: Result := TSeSkinCheckBox;
    ckRadioButton: Result := TSeSkinRadioButton;
    ckTrackBar: Result := TSeSkinTrackBar;
    ckGroupBox: Result := TSeSkinGroupBox;
    ckRadioGroup: Result := TSeSkinRadioGroup;
    ckScrollBar: Result := TSeSkinScrollBar;
    ckListBox: Result := TSeSkinListBox;
    ckEdit: Result := TSeSkinEdit;
    ckComboBox: Result := TSeSkinComboBox;
    ckSpeedButton: Result := TSeSkinSpeedButton;
    ckSpinButton: Result := TSeSkinSpinButton;
    ckButton: Result := TSeSkinButton;
    ckProgressBar: Result := TSeSkinProgressBar;
{    ckTabControl:
    ckPageControl:
    ckCustomForm:
    ckEngine: }
  else
    Result := nil;
  end;
end;

procedure TSeConverter.SetAdvancedProp(AOldObject, ANewObject: TObject);
begin
  inherited SetAdvancedProp(AOldObject, ANewObject);

  { Set SkinEngine Property }
  if ANewObject is TComponent then
    SetPropertyIfExists(TComponent(ANewObject), 'SkinEngine', FSkinEngine);
end;

procedure TSeConverter.SetSkinEngine(const Value: TSeSkinEngine);
begin
  FSkinEngine := Value;
end;

end.
