unit FMXTee.Editor.Series.Donut;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMXTee.Chart.ListBox,
  FMXTee.Procs, FMX.TabControl, FMXTee.Series.Donut, FMX.Edit;

type
  TDonutSeriesEditor = class(TForm)
    TabControl1: TTabControl;
    TabOptions: TTabItem;
    UDDonut: TSpinBox;
    Label6: TLabel;
    procedure FormActivate(Sender: TObject);
    procedure UDDonutChange(Sender: TObject);
  private
    { Private declarations }
    Donut    : TDonutSeries;
    FPieForm : TCustomForm;
  end;

implementation

{$R *.fmx}

uses
  FMXTee.Editor.Stroke, FMXTee.Editor.Series.Pie,
  FMXTee.Constants, FMXTee.ProConstants;

procedure TDonutSeriesEditor.FormActivate(Sender: TObject);
var TabDonut : TTabItem;
begin
  Donut:=TDonutSeries(TagObject);

  if Assigned(Donut) then
  begin
    UDDonut.Value:=Donut.DonutPercent;

    if not Assigned(FPieForm) then
    begin
      FPieForm:=TPieSeriesEditor.CreateEditor(Self,Donut);

      TabDonut:=TTabItem.Create(Self);
      TabDonut.Text:=TeeMsg_GalleryDonut;
      TabControl1.AddObject(TabDonut);

      EmbeddForm(FPieForm,TabDonut);
    end;
  end;
end;

procedure TDonutSeriesEditor.UDDonutChange(Sender: TObject);
begin
  if Assigned(Donut) then
    Donut.DonutPercent:=Round(UDDonut.Value);
end;

initialization
  RegisterSeriesEditor(TDonutSeriesEditor);
end.
