{********************************************}
{     TeeChart Pro Charting Library          }
{ Copyright (c) 1995-2020 by Steema Software }
{         All Rights Reserved                }
{********************************************}
unit TeeADXFuncEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,

  Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls,
  CandleCh, TeePenDlg, TeeBaseFuncEdit, ExtCtrls;

type
  TADXFuncEditor = class(TBaseFunctionEditor)
    PageControl1: TPageControl;
    TabUp: TTabSheet;
    TabDown: TTabSheet;
    TabSheet1: TTabSheet;
    Label1: TLabel;
    EPeriod: TEdit;
    UDPeriod: TUpDown;
    procedure EPeriodChange(Sender: TObject);
    procedure PageControl1Change(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure ApplyFormChanges; override;
    Procedure SetFunction; override;
  public
    { Public declarations }
  end;

implementation

{$IFNDEF LCL}
{$R *.DFM}
{$ELSE}
{$R *.lfm}
{$ENDIF}

uses
  TeEngine;

procedure TADXFuncEditor.EPeriodChange(Sender: TObject);
begin
  if Showing then
     EnableApply;
end;

procedure TADXFuncEditor.ApplyFormChanges;
begin
  inherited;

  IFunction.Period:=UDPeriod.Position;
end;

procedure TADXFuncEditor.SetFunction;
begin
  inherited;

  UDPeriod.Position:=Round(TADXFunction(IFunction).Period);
end;

procedure TADXFuncEditor.PageControl1Change(Sender: TObject);
begin
  if PageControl1.ActivePage.ControlCount=0 then
     if PageControl1.ActivePage=TabUp then
        TPenDialog.InsertForm(TADXFunction(IFunction).UpLinePen,TabUp)
     else
     if PageControl1.ActivePage=TabDown then
        TPenDialog.InsertForm(TADXFunction(IFunction).DownLinePen,TabDown);
end;

initialization
  RegisterClass(TADXFuncEditor);
end.

