{*********************************************}
{  TeeChart Charting Library for FireMonkey   }
{  Copyright (c) 2012-2020 by Steema Software }
{  All Rights Reserved                        }
{*********************************************}
unit FMXTee.Editor.Tools.Pie;
{$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.Tools.Series,
  {$IFNDEF UPTOXE3}
  FMX.StdCtrls,
  {$ENDIF}
  FMXTee.Procs, FMX.ListBox, FMXTee.Tools.Pie, FMX.Edit;

type
  TPieToolEditor = class(TSeriesToolEditor)
    GroupBox1: TGroupBox;
    RBFocus: TRadioButton;
    RBExplode: TRadioButton;
    BPen: TButton;
    procedure FormActivate(Sender: TObject);
    procedure BPenClick(Sender: TObject);
    procedure RBFocusChange(Sender: TObject);
    procedure RBExplodeChange(Sender: TObject);
  private
    { Private declarations }
    Pie : TPieTool;
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

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

procedure TPieToolEditor.BPenClick(Sender: TObject);
begin
  if Assigned(Pie) then
     TStrokeEditor.Edit(Self, Pie.Pen);
end;

procedure TPieToolEditor.FormActivate(Sender: TObject);
begin
  inherited;

  if not Assigned(Pie) then
  begin
    Pie:=TPieTool(TagObject);

    if Assigned(Pie) then
    With Pie do
    begin
      FillSeries(CBSeries,TPieSeries,Series);

      RBFocus.IsChecked:=Style=ptFocus;
      RBExplode.IsChecked:=Style=ptExplode;
    end;
  end;
end;

procedure TPieToolEditor.RBExplodeChange(Sender: TObject);
begin
  if Assigned(Pie) then
    Pie.Style:=ptExplode;
end;

procedure TPieToolEditor.RBFocusChange(Sender: TObject);
begin
  if Assigned(Pie) then
    Pie.Style:=ptFocus;
end;

initialization
  RegisterSeriesEditor(TPieToolEditor);
end.
