00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifndef LABELAXIS_H_
00011 #define LABELAXIS_H_
00012
00013 #include <wx/axis/axis.h>
00014
00018 class WXDLLIMPEXP_FREECHART LabelAxis : public Axis
00019 {
00020 DECLARE_CLASS(LabelAxis)
00021 public:
00022 LabelAxis(AXIS_LOCATION location);
00023 virtual ~LabelAxis();
00024
00029 void SetTitle(const wxString &title)
00030 {
00031 m_title = title;
00032 FireAxisChanged();
00033 }
00034
00039 const wxString &GetTitle()
00040 {
00041 return m_title;
00042 }
00043
00050 void SetTitleLocation(int location)
00051 {
00052 if (m_titleLocation != location) {
00053 m_titleLocation = location;
00054 FireAxisChanged();
00055 }
00056 }
00057
00062 int GetTitleLocation()
00063 {
00064 return m_titleLocation;
00065 }
00066
00071 void SetTitleFont(wxFont &font)
00072 {
00073 m_titleFont = font;
00074 FireAxisChanged();
00075 }
00076
00081 const wxFont &GetTitleFont()
00082 {
00083 return m_titleFont;
00084 }
00085
00090 void SetTitleColour(wxColour &colour)
00091 {
00092 if (m_titleColour != colour) {
00093 m_titleColour = colour;
00094 FireAxisChanged();
00095 }
00096 }
00097
00102 wxColour GetTitleColour()
00103 {
00104 return m_titleColour;
00105 }
00106
00111 void SetLabelPen(wxPen labelPen)
00112 {
00113 m_labelPen = labelPen;
00114 FireAxisChanged();
00115 }
00116
00121 void SetLabelTextColour(wxColour labelTextColour)
00122 {
00123 m_labelTextColour = labelTextColour;
00124 FireAxisChanged();
00125 }
00126
00131 wxColour GetLabelTextColour()
00132 {
00133 return m_labelTextColour;
00134 }
00135
00140 void SetLabelTextFont(wxFont labelTextFont)
00141 {
00142 m_labelTextFont = labelTextFont;
00143 FireAxisChanged();
00144 }
00145
00150 const wxFont& GetLabelTextFont()
00151 {
00152 return m_labelTextFont;
00153 }
00154
00159 void SetVerticalLabelText(bool verticalLabelText)
00160 {
00161 if (m_verticalLabelText != verticalLabelText) {
00162 m_verticalLabelText = verticalLabelText;
00163 FireAxisChanged();
00164 }
00165 }
00166
00171 bool GetVerticalLabelText()
00172 {
00173 return m_verticalLabelText;
00174 }
00175
00176
00177
00178
00179 virtual void Draw(wxDC &dc, wxRect rc);
00180
00181 virtual void DrawGridLines(wxDC &dc, wxRect rc);
00182
00183 virtual wxCoord GetExtent(wxDC &dc);
00184
00185 protected:
00186
00187
00188
00189
00195 virtual double GetValue(size_t step) = 0;
00196
00202 virtual void GetLabel(size_t step, wxString &label) = 0;
00203
00209 virtual bool IsEnd(size_t step) = 0;
00210
00211 virtual wxSize GetLongestLabelExtent(wxDC &dc) = 0;
00212
00213 virtual bool HasLabels();
00214
00215 private:
00216 void DrawLabels(wxDC &dc, wxRect rc);
00217
00218 void DrawLabel(wxDC &dc, wxRect rc, const wxString &label, double value);
00219
00220 void DrawBorderLine(wxDC &dc, wxRect rc);
00221
00222 wxCoord m_labelLineSize;
00223 wxCoord m_labelGap;
00224
00225
00226 wxFont m_labelTextFont;
00227 wxColour m_labelTextColour;
00228 wxPen m_labelPen;
00229 bool m_verticalLabelText;
00230
00231
00232 wxString m_title;
00233 wxFont m_titleFont;
00234 wxColour m_titleColour;
00235 int m_titleLocation;
00236 };
00237
00238 #endif