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

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Edit, FMX.ListBox,
  FMX.StdCtrls,
  {$IFDEF D21}
  FMX.SpinBox,
  {$ENDIF}
  FMX.Colors, FMXTee.Series.Funnel;

type
  TFunnelSeriesEditor = class(TForm)
    LAboveColor: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    BLines: TButton;
    BPattern: TButton;
    BLineBorder: TButton;
    UDDifLimit: TSpinBox;
    LHeight: TLabel;
    BColorAbove: TComboColorBox;
    BColorWithin: TComboColorBox;
    BColorBelow: TComboColorBox;
    procedure FormActivate(Sender: TObject);
    procedure BPatternClick(Sender: TObject);
    procedure UDDifLimitChange(Sender: TObject);
    procedure BLinesClick(Sender: TObject);
    procedure BLineBorderClick(Sender: TObject);
  private
    { Private declarations }
    Funnel : TFunnelSeries;
  public
    { Public declarations }
  end;

var
  FunnelSeriesEditor: TFunnelSeriesEditor;

implementation

{$R *.fmx}

uses
  FMXTee.Canvas, FMXTee.Editor.Stroke, FMXTee.Editor.Brush;

procedure TFunnelSeriesEditor.BLineBorderClick(Sender: TObject);
begin
  TStrokeEditor.Edit(Self, Funnel.Pen);
end;

procedure TFunnelSeriesEditor.BLinesClick(Sender: TObject);
begin
  TStrokeEditor.Edit(Self, Funnel.LinesPen);
end;

procedure TFunnelSeriesEditor.BPatternClick(Sender: TObject);
begin
  TBrushEditor.Edit(Self, Funnel.Brush);
end;

procedure TFunnelSeriesEditor.FormActivate(Sender: TObject);
begin
  Funnel:=TFunnelSeries(TagObject);
  if Assigned(Funnel) then
  begin
    BColorAbove.Color:=Funnel.AboveColor;
    BColorWithin.Color:=Funnel.WithinColor;
    BColorBelow.Color:= Funnel.BelowColor;

    UDDifLimit.Value:=Round(Funnel.DifferenceLimit);
  end;
end;

procedure TFunnelSeriesEditor.UDDifLimitChange(Sender: TObject);
begin
  if assigned(Funnel) then
    Funnel.DifferenceLimit:=UDDifLimit.Value;
end;

initialization
  RegisterClass(TFunnelSeriesEditor);
end.
