unit uChartSeries;

interface

uses
  TeEngine,
  Chart,
  Rubies;

var
  cChartSeries: Tvalue;

function ap_cChartSeries: Tvalue;
function ap_iChartSeries(real: TChartSeries; owner: Tvalue): Tvalue;
procedure Init_ChartSeries;

implementation

uses
  Classes,
  //uConv,
  uDefUtils, 
  Pythia;

function ap_cChartSeries: Tvalue;
begin
  result := cChartSeries;
end;

procedure ChartSeries_setup(obj: Tvalue; real: TChartSeries);
begin
//    AssignPropMethod(real, [Handle]);
end;

function ChartSeries_event_handle(This, name: Tvalue): Tvalue; cdecl;
begin
  //EventHandle(This, name, [Handle]);
  result := Qnil;
end;

function ChartSeries_alloc(This: Tvalue; real: TChartSeries): Tvalue;
begin
  result := ChildAlloc(This, real);
  ChartSeries_setup(result, real);
end;

function ap_iChartSeries(real: TChartSeries; owner: Tvalue): Tvalue;
begin
  result := ChartSeries_alloc(cChartSeries, real);
  ap_owner(result, owner);
end;

function ap_iChartSeries_v(var AControl; owner: Tvalue): Tvalue;
begin
  result := ap_iChartSeries(TChartSeries(AControl), owner);
end;

function ChartSeries_allocate(This: Tvalue): Tvalue; cdecl;
var
  real: TChartSeries;
begin
  real := TChartSeries.Create(nil);
  result := CompoAlloc(This, real);
  ChartSeries_setup(result, real);
end;

//function dl_Color(a_Color:Tvalue):TColor;
//begin
//  result := dl_Integer(a_Color);
//end;


//function Add(Const AValue:Double; Const ALabel:String; AColor:TColor):Longint; virtual;
function ChartSeries_add(This,AValue,ALabel,AColor: Tvalue): Tvalue; cdecl;
var
  real: TChartSeries;
begin
  real := ap_data_get_struct(This);
  result := This;
  real.add(dl_Double(AValue),dl_String(ALabel),dl_Integer(AColor));
end;


procedure Init_ChartSeries;
begin
//  OutputConstSetType(mPhi, TypeInfo(TBevelCut));
  cChartSeries := DefinePersistentClass(ap_mPhi, TChartSeries, ap_cWinControl, ap_iChartSeries_v);
  rb_define_method(cChartSeries, 'event_handle', @ChartSeries_event_handle, 1);
  rb_define_alloc_func(cChartSeries, @ChartSeries_allocate);
  rb_define_method(cChartSeries, 'add', @ChartSeries_add, 3);
end;

end.
