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

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.ListBox, FMX.TabControl,
  {$IFNDEF UPTOXE3}
  FMX.StdCtrls,
  {$ENDIF}
  FMX.Edit, FMX.Layouts, FMX.Memo, FMXTee.Tools.Link, FMXTee.Procs,
  FMXTee.Editor.Tools.Annotation;

type
  TLinkToolEditor = class(TAnnotationToolEdit)
    TabLink: TTabItem;
    Label20: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    EText: TEdit;
    EURL: TEdit;
    EHint: TEdit;
    procedure FormActivate(Sender: TObject);
    procedure ETextChange(Sender: TObject);
    procedure EURLChange(Sender: TObject);
    procedure EHintChange(Sender: TObject);
  private
    { Private declarations }
    Link : TLinkTool;
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

procedure TLinkToolEditor.EHintChange(Sender: TObject);
begin
  if Assigned(Link) then
    Link.Hint:=EHint.Text;
end;

procedure TLinkToolEditor.ETextChange(Sender: TObject);
begin
  if Assigned(Link) then
    Link.Text:=EText.Text;
end;

procedure TLinkToolEditor.EURLChange(Sender: TObject);
begin
  if Assigned(Link) then
    Link.URL:=EURL.Text;
end;

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

  if not Assigned(Link) then
  begin
    Link:=TLinkTool(TagObject);

    if Assigned(Link) then
    With Link do
    begin
      EText.Text:=Link.Text;
      EURL.Text:=Link.URL;
      EHint.Text:=Link.Hint;
    end;
  end;
end;

initialization
  RegisterSeriesEditor(TLinkToolEditor);
end.
