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

  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 KsSkinMessages;

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

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, Buttons, KsBitmap, KsUtils, KsForms, KsControls,
  KsButtons, KsMessages, KsEdits, KsSkinVersion, KsSkinObjects,
  KsSkinSource, KsSkinEngine;

type

{ TSeSkinMessage }

  TSeSkinMessage = class(TKsCustomMessage)
  private
    FSkinEngine: TSeSkinEngine;
    function GetVersion: TSeSkinVersion;
    procedure SetVersion(const Value: TSeSkinVersion);
    procedure SetSkinEngine(const Value: TSeSkinEngine);
  protected
    function CreateButton(Owner: TComponent): TKsCustomButton; override;
    function CreateEdit(Owner: TComponent): TKsCustomEdit; override;
    function CreateForm(Owner: TComponent): TKsCustomForm; override;
    { VCL protected  }
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  published
    { Specifies the appearance and behavior by using specified theme's from TSeSkinEngine .
      See Also:
        TSeSkinEngine
    }
    property SkinEngine: TSeSkinEngine read FSkinEngine write SetSkinEngine;
    property Version: TSeSkinVersion read GetVersion write SetVersion
      stored false;
  end;

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

uses KsSkinButtons, KsSkinForms, KsSkinEdits;

{ TSeSkinMessage }

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

function TSeSkinMessage.CreateButton(Owner: TComponent): TKsCustomButton;
begin
  Result := TSeSkinButton.Create(Owner);
  if Owner is TWinControl then
    Result.Parent := Owner as TWinControl;
  (Result as TSeSkinButton).SkinEngine := FSkinEngine;
end;

function TSeSkinMessage.CreateEdit(Owner: TComponent): TKsCustomEdit;
begin
  Result := TSeSkinEdit.Create(Owner);
  if Owner is TWinControl then
    Result.Parent := Owner as TWinControl;
  (Result as TSeSkinEdit).SkinEngine := FSkinEngine;
end;

function TSeSkinMessage.CreateForm(Owner: TComponent): TKsCustomForm;
begin
  Result := TSeSkinForm.Create(Owner);
  (Result as TSeSkinForm).SkinEngine := FSkinEngine;
end;

procedure TSeSkinMessage.Notification(AComponent: TComponent;
  Operation: TOperation);
begin
  inherited;
  if (Operation = opRemove) and (AComponent = FSkinEngine) then
    SkinEngine := nil;
end;

function TSeSkinMessage.GetVersion: TSeSkinVersion;
begin
  Result := sSeSkinVersion;
end;

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

procedure TSeSkinMessage.SetVersion(const Value: TSeSkinVersion);
begin
end;

end.


