From dfe7639567402893c65eb453ca6764b59a4cd431 Mon Sep 17 00:00:00 2001 From: ask Date: Wed, 23 Mar 2011 10:55:11 +0000 Subject: [PATCH] TAChart: Add DoGetFontOrientation event to IChartDrawer interface git-svn-id: trunk@30000 - --- components/tachart/tadrawutils.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/components/tachart/tadrawutils.pas b/components/tachart/tadrawutils.pas index 50d2c2da67..eb0e10ec54 100644 --- a/components/tachart/tadrawutils.pas +++ b/components/tachart/tadrawutils.pas @@ -60,6 +60,7 @@ type end; TChartColorToFPColorFunc = function (AColor: TChartColor): TFPColor; + TGetFontOrientationFunc = function (AFont: TFPCustomFont): Integer; { IChartDrawer } @@ -97,6 +98,7 @@ type procedure SetBrush(ABrush: TFPCustomBrush); procedure SetBrushParams(AStyle: TFPBrushStyle; AColor: TChartColor); procedure SetFont(AValue: TFPCustomFont); + procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc); procedure SetPen(APen: TFPCustomPen); procedure SetPenParams(AStyle: TFPPenStyle; AColor: TChartColor); function TextExtent(const AText: String): TPoint; @@ -109,6 +111,8 @@ type property Pen: TFPCustomPen write SetPen; property DoChartColorToFPColor: TChartColorToFPColorFunc write SetDoChartColorToFPColorFunc; + property DoGetFontOrientation: TGetFontOrientationFunc + write SetGetFontOrientationFunc; end; { TBasicDrawer } @@ -116,6 +120,7 @@ type TBasicDrawer = class(TInterfacedObject, ISimpleTextOut) strict protected FChartColorToFPColorFunc: TChartColorToFPColorFunc; + FGetFontOrientationFunc: TGetFontOrientationFunc; function GetFontAngle: Double; virtual; abstract; function SimpleTextExtent(const AText: String): TPoint; virtual; abstract; procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract; @@ -132,6 +137,7 @@ type AStartIndex: Integer = 0; ANumPts: Integer = -1); virtual; abstract; function Scale(ADistance: Integer): Integer; virtual; procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc); + procedure SetGetFontOrientationFunc(AValue: TGetFontOrientationFunc); function TextExtent(const AText: String): TPoint; function TextExtent(AText: TStrings): TPoint; function TextOut: TChartTextOut; @@ -161,6 +167,12 @@ begin end; end; +function DummyGetFontOrientationFunc(AFont: TFPCustomFont): Integer; +begin + Unused(AFont); + Result := 0; +end; + function FPColorToChartColor(AFPColor: TFPColor): TChartColor; begin Result := @@ -261,6 +273,7 @@ end; constructor TBasicDrawer.Create; begin FChartColorToFPColorFunc := @ChartColorToFPColor; + FGetFontOrientationFunc := @DummyGetFontOrientationFunc; end; procedure TBasicDrawer.DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer); @@ -297,6 +310,12 @@ begin FChartColorToFPColorFunc := AValue; end; +procedure TBasicDrawer.SetGetFontOrientationFunc( + AValue: TGetFontOrientationFunc); +begin + FGetFontOrientationFunc := AValue; +end; + function TBasicDrawer.TextExtent(const AText: String): TPoint; var sl: TStrings;