This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/source/gui/ObjectTypes/CChart.h

Last change on this file was 27965, checked in by Vladislav Belov, 13 months ago

Revert non-ASCII characters from source and configuration files introduced in rP27786.

Fixes #6846

Differential Revision: https://code.wildfiregames.com/D5185

  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[25143]1/* Copyright (C) 2021 Wildfire Games.
[27965]2 * This file is part of 0 A.D.
[19027]3 *
[27965]4 * 0 A.D. is free software: you can redistribute it and/or modify
[19027]5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
[27965]9 * 0 A.D. is distributed in the hope that it will be useful,
[19027]10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
[27965]15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
[19027]16 */
17
18#ifndef INCLUDED_CCHART
19#define INCLUDED_CCHART
20
[24352]21#include "gui/ObjectBases/IGUIObject.h"
[23028]22#include "gui/ObjectBases/IGUITextOwner.h"
23#include "gui/SettingTypes/CGUIColor.h"
24#include "gui/SettingTypes/CGUIList.h"
25#include "gui/SettingTypes/CGUISeries.h"
[25143]26#include "maths/Size2D.h"
[19027]27#include "maths/Vector2D.h"
[22558]28
[19027]29#include <vector>
30
31struct CChartData
32{
[22638]33 // Avoid copying the container.
34 NONCOPYABLE(CChartData);
35 MOVABLE(CChartData);
36 CChartData() = default;
37
[22558]38 CGUIColor m_Color;
[19027]39 std::vector<CVector2D> m_Points;
40};
41
42/**
[19408]43 * Chart for a data visualization as lines or points
44 */
[23020]45class CChart : public IGUIObject, public IGUITextOwner
[19027]46{
47 GUI_OBJECT(CChart)
48
49public:
[22741]50 CChart(CGUI& pGUI);
[19027]51 virtual ~CChart();
52
53protected:
54 /**
[23020]55 * @see IGUIObject#UpdateCachedSize()
56 */
57 void UpdateCachedSize();
58
59 /**
[19408]60 * @see IGUIObject#HandleMessage()
61 */
[19027]62 virtual void HandleMessage(SGUIMessage& Message);
63
64 /**
[19408]65 * Draws the Chart
66 */
[25588]67 virtual void Draw(CCanvas2D& canvas);
[19027]68
69 virtual CRect GetChartRect() const;
70
71 void UpdateSeries();
72
[21429]73 void SetupText();
74
[19027]75 std::vector<CChartData> m_Series;
[19408]76
[21429]77 CVector2D m_LeftBottom, m_RightTop;
78
[25152]79 std::vector<CVector2D> m_TextPositions;
[21429]80
[23005]81 bool m_EqualX, m_EqualY;
82
83 // Settings
[25392]84 CGUISimpleSetting<CGUIColor> m_AxisColor;
85 CGUISimpleSetting<float> m_AxisWidth;
86 CGUISimpleSetting<float> m_BufferZone;
87 CGUISimpleSetting<CStrW> m_Font;
88 CGUISimpleSetting<CStrW> m_FormatX;
89 CGUISimpleSetting<CStrW> m_FormatY;
90 CGUISimpleSetting<CGUIList> m_SeriesColor;
91 CGUISimpleSetting<CGUISeries> m_SeriesSetting;
[21429]92
[19408]93private:
[25605]94 void DrawAxes(CCanvas2D& canvas) const;
[21429]95
[25143]96 CSize2D AddFormattedValue(const CStrW& format, const float value, const CStrW& font, const float buffer_zone);
[21429]97
98 void UpdateBounds();
[19027]99};
100
101#endif // INCLUDED_CCHART
Note: See TracBrowser for help on using the repository browser.