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

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMXTee.Editor.Series.Polar,
  FMX.StdCtrls,
  FMX.Colors, FMX.Edit, FMX.ListBox, FMX.TabControl, FMXTee.Editor.Series.Grid,
  FMXTee.Series.PolarGrid;

type
  TPolarGridSeriesEditor = class(TPolarSeriesEditor)
    CBCentered: TCheckBox;
    Label3: TLabel;
    CBGridStyle: TComboBox;
    ListBoxItem1: TListBoxItem;
    ListBoxItem2: TListBoxItem;
    procedure CBCenteredChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure CBGridStyleChange(Sender: TObject);
  private
    { Private declarations }
    I3DEditor : TGrid3DSeriesEditor;
  public
    { Public declarations }
  end;

var
  PolarGridSeriesEditor: TPolarGridSeriesEditor;

implementation

{$R *.fmx}

uses
  FMXTee.Procs;

procedure TPolarGridSeriesEditor.CBCenteredChange(Sender: TObject);
begin
  TPolarGridSeries(Polar).Centered:=CBCentered.IsChecked;
end;

procedure TPolarGridSeriesEditor.FormDestroy(Sender: TObject);
begin
  I3DEditor.Free;
  inherited;
end;

procedure TPolarGridSeriesEditor.CBGridStyleChange(Sender: TObject);
begin
  TPolarGridSeries(Polar).GridStyle:=TPolarGridStyle(CBGridStyle.ItemIndex);
end;

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

  CBClose.Visible:=False;

  I3DEditor:=TGrid3DSeriesEditor.Create(nil);
  I3DEditor.Panel1.Visible:=False;

  if Assigned(Polar) then
  begin
    // TODO
    // I3DEditor:=TGrid3DSeriesEditor.InsertForm(TPolarGridSeries(Polar).Palette.Series,TabPalette);
    // AddFormTo(I3DEditor,TabPalette,TPolarGridSeries(Polar).Palette.Series);

    TeeTranslateControl(I3DEditor);
    CBCentered.IsChecked:=TPolarGridSeries(Polar).Centered;
    CBGridStyle.ItemIndex:=Ord(TPolarGridSeries(Polar).GridStyle);
  end;
end;

initialization
  RegisterClass(TPolarGridSeriesEditor);
end.
