1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef STRING_CHART_LEGEND_H 6#define STRING_CHART_LEGEND_H 7 8#include <Font.h> 9#include <String.h> 10 11#include "chart/ChartLegend.h" 12 13 14class StringChartLegend : public ChartLegend { 15public: 16 StringChartLegend(const char* string, 17 int32 level = 0); 18 19 const char* String() const { return fString.String(); } 20 21private: 22 BString fString; 23}; 24 25 26class StringChartLegendRenderer : public ChartLegendRenderer { 27public: 28 StringChartLegendRenderer(); 29 StringChartLegendRenderer(const BFont& font); 30 31 virtual void GetMinimumLegendSpacing(BView* view, 32 float* horizontal, float* vertical); 33 34 virtual BSize LegendSize(ChartLegend* legend, 35 BView* view); 36 virtual void RenderLegend(ChartLegend* legend, BView* view, 37 BPoint point); 38 39private: 40 void _Init(); 41 42private: 43 BFont fFont; 44 float fFontAscent; 45 float fFontHeight; 46 float fEmWidth; 47}; 48 49 50#endif // STRING_CHART_LEGEND_H 51