chart_rulers_view.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "statistics/chart_rulers_data.h"
  9. namespace Data {
  10. struct StatisticalChart;
  11. } // namespace Data
  12. namespace Statistic {
  13. enum class ChartViewType;
  14. struct Limits;
  15. class LinesFilterController;
  16. struct ChartRulersView final {
  17. public:
  18. ChartRulersView();
  19. void setChartData(
  20. const Data::StatisticalChart &chartData,
  21. ChartViewType type,
  22. std::shared_ptr<LinesFilterController> linesFilter);
  23. void paintRulers(QPainter &p, const QRect &r);
  24. void paintCaptionsToRulers(QPainter &p, const QRect &r);
  25. void computeRelative(int newMaxHeight, int newMinHeight);
  26. void setAlpha(float64 value);
  27. void add(Limits newHeight, bool animated);
  28. private:
  29. bool _isDouble = false;
  30. QPen _leftPen;
  31. QPen _rightPen;
  32. int _leftLineId = 0;
  33. int _rightLineId = 0;
  34. QImage _currencyIcon;
  35. Fn<QString(float64)> _leftCustomCaption = nullptr;
  36. Fn<QString(float64)> _rightCustomCaption = nullptr;
  37. std::vector<ChartRulersData> _rulers;
  38. std::shared_ptr<LinesFilterController> _linesFilter;
  39. float64 _scaledLineRatio = 0.;
  40. bool _isLeftLineScaled = false;
  41. };
  42. } // namespace Statistic