wxFreeChart
title.h
1 // Name: chart.h
3 // Purpose: title text element declarations
4 // Author: Andreas Kuechler
5 // Created: 2010/03/23
6 // Copyright: (c) 2010 Andreas Kulcher
7 // Licence: wxWidgets licence
9 
10 #ifndef TITLE_H_
11 #define TITLE_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/arrstr.h>
15 #include <wx/hashmap.h>
16 #include <wx/defs.h>
17 
21 class WXDLLIMPEXP_FREECHART TextElement
22 {
23 public:
24  // Constructors
25  TextElement(const wxString& text, int hAlign = wxALIGN_CENTER_HORIZONTAL, wxFont font = *wxNORMAL_FONT);
26  TextElement(const TextElement& orig);
27 
28  TextElement& operator = (const TextElement& orig);
29 
30  virtual ~TextElement();
31 
36  wxSize CalculateExtent(wxDC& dc);
37 
43  void Draw(wxDC& dc, wxRect rc);
44 
49  void SetHorzAlign(int hAlign)
50  {
51  m_hAlign = hAlign;
52  }
53 
58  void SetColour(wxColour colour)
59  {
60  m_textColour = colour;
61  }
62 
63 private:
64  wxString m_text;
65  int m_hAlign;
66  wxFont m_font;
67  wxColour m_textColour;
68 };
69 
70 WX_DECLARE_USER_EXPORTED_OBJARRAY(TextElement, Elements, WXDLLIMPEXP_FREECHART);
71 
77 class WXDLLIMPEXP_FREECHART TextElementContainer
78 {
79 public:
81  wxDEPRECATED_MSG("Use TextElementContainer(const TextElement&) instead)")
82  TextElementContainer(const wxString& title);
83  TextElementContainer(const TextElement& element);
85  TextElementContainer& operator=(const TextElementContainer& title);
86  virtual ~TextElementContainer();
87 
93  void AddElement(TextElement element);
94 
99  bool IsEmpty() const;
100 
106  void Draw(wxDC& dc, wxRect rc);
107 
114  wxSize CalculateExtent(wxDC& dc);
115 
116 private:
117  Elements m_elements;
118  wxSize m_extent;
119  size_t m_margin;
120 };
121 
122 
125 
126 #endif // TITLE_H_
Represents a chart title.
Definition: title.h:77
void SetHorzAlign(int hAlign)
Sets the horizontal alignment of the text inside its box.
Definition: title.h:49
Represents a TitleElement, ie a box containing text which is displayed in the title area...
Definition: title.h:21
void SetColour(wxColour colour)
Sets the text colour.
Definition: title.h:58