1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        legendwindow.h
3 // Purpose:     wxChart
4 // Author:      Paolo Gava
5 // Modified by:
6 // Created:
7 // Copyright:   (C) 2006, Paolo Gava
8 // RCS-ID:      $Id: legendwindow.h 9270 2013-08-18 05:22:02Z mortenmacfly $
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 
12 #if !defined( __WXLEGENDWINDOW_H__ )
13 #define __WXLEGENDWINDOW_H__
14 
15 //----------------------------------------------------------------------------
16 // Headers
17 //----------------------------------------------------------------------------
18 
19 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
20 #pragma interface "legendwindow.h"
21 #endif
22 
23 #include <wx/window.h>
24 
25 #include "wx/legend.h"
26 
27 //----------------------------------------------------------------------------
28 // Consts
29 //----------------------------------------------------------------------------
30 const int LEGEND_WIDTH	= 70;	// width in pixels
31 const int LEGEND_HEIGHT	= 60;	// height in pixels
32 
33 //+++-S-cd-------------------------------------------------------------------
34 //	NAME:		wxLegendWindow
35 //	DESC:
36 //	INTERFACE:
37 //
38 //----------------------------------------------------------------------E-+++
39 /* C::B begin */
40 class WXDLLIMPEXP_CHART wxLegendWindow : public wxWindow
41 /* C::B end */
42 {
43 public:
wxLegendWindow()44 	wxLegendWindow() {};	// for IMPLEMENT_DYNAMIC_CLASS
45 	wxLegendWindow(wxWindow *parent);
46 
47 	// List descriptos utilities
48 	// allow access to CWxLegend functionality
49 	//----------------------------------------
50     void Add(const wxString &lbl, const ChartColor &col);
51 	void Clear();
52 	int GetCount() const;
53 	ChartColor GetColor(int n) const;
54 	wxString GetLabel(int n) const;
55 
56 	// Draw legend window
57 	//-------------------
58 	void Draw(CHART_HPAINT hp, int x = 0, int y = 0);
59 
60 private:
61 	wxLegend m_Legend;
62 	wxWindow *m_WinParent;
63 
64 	// events
65 	//-------
66     void OnPaint(wxPaintEvent &event);
67     void OnMouse(wxMouseEvent &event);
68     void OnMouseMove(wxMouseEvent &event);
69 
70 /* C::B begin */
71     DECLARE_DYNAMIC_CLASS(wxLegendWindow)
72 /* C::B end */
73     DECLARE_EVENT_TABLE()
74 };
75 
76 #endif // __WXLEGENDWINDOW_H__
77