xref: /haiku/src/apps/debuganalyzer/gui/chart/StringChartLegend.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
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 
14 class StringChartLegend : public ChartLegend {
15 public:
16 								StringChartLegend(const char* string,
17 									int32 level = 0);
18 
19 			const char*			String() const	{ return fString.String(); }
20 
21 private:
22 			BString				fString;
23 };
24 
25 
26 class StringChartLegendRenderer : public ChartLegendRenderer {
27 public:
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 
39 private:
40 			void				_Init();
41 
42 private:
43 			BFont				fFont;
44 			float				fFontAscent;
45 			float				fFontHeight;
46 			float				fEmWidth;
47 };
48 
49 
50 #endif	// STRING_CHART_LEGEND_H
51