{*********************************************}
{  TeeChart Charting Library for FireMonkey   }
{  Copyright (c) 2012-2020 by Steema Software }
{  All Rights Reserved                        }
{*********************************************}
unit FMXTee.Editor.Functions.ADX;
{$I TeeDefs.inc}

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMXTee.Editor.Functions.Base,
  {$IFNDEF UPTOXE3}
  FMX.StdCtrls,
  {$ENDIF}
  {$IFDEF D21}
  FMX.SpinBox,
  {$ENDIF}
  FMXTee.Procs, FMX.Edit;

type
  TADXFuncEditor = class(TBaseFunctionEditor)
    Label1: TLabel;
    SBPeriod: TSpinBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure SBPeriodChange(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure ApplyFormChanges; override;
    Procedure SetFunction; override;
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

uses
  FMXTee.Editor.Stroke, FMXTee.Series.Candle;

procedure TADXFuncEditor.ApplyFormChanges;
begin
  inherited;
  IFunction.Period:=SBPeriod.Value;
end;

procedure TADXFuncEditor.Button1Click(Sender: TObject);
begin
  TStrokeEditor.Edit(Self, TADXFunction(IFunction).UpLinePen);
end;

procedure TADXFuncEditor.Button2Click(Sender: TObject);
begin
  TStrokeEditor.Edit(Self, TADXFunction(IFunction).DownLinePen);
end;

procedure TADXFuncEditor.SBPeriodChange(Sender: TObject);
begin
  EnableApply;
end;

procedure TADXFuncEditor.SetFunction;
begin
  inherited;
  SBPeriod.Value:=TADXFunction(IFunction).Period;
end;

initialization
  RegisterSeriesEditor(TADXFuncEditor);
end.
