Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CIndicatorsGraphics.hpp
Go to the documentation of this file.
1#ifndef LIBS_GRAPHICSCOMP_CINDICATORSGRAPHICS_HPP_
2#define LIBS_GRAPHICSCOMP_CINDICATORSGRAPHICS_HPP_
3
4#include <optional>
5#include <utility>
6
8#include "CImageGraphics.hpp"
10
11class CIndicator;
12class IComponentsGUI;
13
15{
16public:
17 //CIndicatorsGraphics();
18 explicit CIndicatorsGraphics(IComponentsGUI *componentRef);
19 ~CIndicatorsGraphics() override;
20
21 void addIndicator(CIndicator *indicatorRef);
22 bool sizeChanged() override;
23 void update(IGraphics *graphics, CLibraryImages *libraryImage) override;
24
25private:
26 void calculatePosGlobal(double xFather, double yFather) override;
27 void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp,
28 double *sizeYComp) override;
29 void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override;
30 void drawComponent(IGraphics *graphics, const CTheme *theme) override;
31 void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override;
32 void nextFrameChildren() override;
33 void removeObjectDraw(IGraphics *graphics) override;
34
36 {
37 SPrvIndicatorImage(CIndicator *indicatorRef, const std::shared_ptr<CImageGraphics> &currentImageRef,
38 CDrawText *currentTextRef)
39 {
40 m_indicatorRef = indicatorRef;
41 m_currentImageRef = currentImageRef;
42 m_currentTextRef = currentTextRef;
43 }
44
46 {
47 m_indicatorRef = nullptr;
48 m_currentTextRef = nullptr;
49 }
50
51 bool operator==(const SPrvIndicatorImage &b) const
52 {
53 return (m_currentImageRef.lock() == b.m_currentImageRef.lock()) && (m_currentTextRef == b.m_currentTextRef);
54 }
55
57 std::weak_ptr<CImageGraphics> m_currentImageRef;
59 std::unique_ptr<CRectangleGraphics> m_currentBackground;
60 std::optional<iv::types::color> m_currentBackgroundColor;
61 };
62
63 bool updateIndicatorImage(SPrvIndicatorImage *indicator, IGraphics *graphics, CLibraryImages *libraryImage);
66
69 std::vector<SPrvIndicatorImage *> m_indicators;
70
73
74 struct Sizes
75 {
76 static constexpr double barIndicator {48};
77 static constexpr double barIndicatorSmallScreen {44};
78 static constexpr double smallBarIndicator {32};
79
80 static constexpr double largeIcon {48};
81 static constexpr double largeIconSmallScreen {44};
82 static constexpr double badgeTextSize {20};
83
84 static constexpr double smallIcon {16};
85 static constexpr double textSize {18};
86
87 static constexpr double paddingIndicator {6};
88 static constexpr double paddingBackground {2};
89 static constexpr double cornerRadiusBackground {8};
90 };
91};
92
93#endif /* LIBS_GRAPHICSCOMP_CINDICATORSGRAPHICS_HPP_ */
Definition AbstractComponentGraphics.hpp:21
Definition CDrawText.hpp:11
Definition CEventGraphics.hpp:9
Definition CIndicator.hpp:10
Definition CIndicatorsGraphics.hpp:15
void removeObjectDraw(IGraphics *graphics) override
Definition CIndicatorsGraphics.cpp:358
void update(IGraphics *graphics, CLibraryImages *libraryImage) override
Definition CIndicatorsGraphics.cpp:167
void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override
Definition CIndicatorsGraphics.cpp:313
bool m_isChanged
Definition CIndicatorsGraphics.hpp:67
void drawComponent(IGraphics *graphics, const CTheme *theme) override
Definition CIndicatorsGraphics.cpp:233
void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp, double *sizeYComp) override
Definition CIndicatorsGraphics.cpp:207
~CIndicatorsGraphics() override
Definition CIndicatorsGraphics.cpp:21
double m_barIndicatorSize
Definition CIndicatorsGraphics.hpp:71
IComponentsGUI * m_componentRef
Definition CIndicatorsGraphics.hpp:68
std::vector< SPrvIndicatorImage * > m_indicators
Definition CIndicatorsGraphics.hpp:69
void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override
Definition CIndicatorsGraphics.cpp:228
CIndicatorsGraphics(IComponentsGUI *componentRef)
Definition CIndicatorsGraphics.cpp:15
double m_largeIconSize
Definition CIndicatorsGraphics.hpp:72
void addIndicator(CIndicator *indicatorRef)
Definition CIndicatorsGraphics.cpp:30
bool updateIndicatorBackground(CIndicatorsGraphics::SPrvIndicatorImage *indicator)
Definition CIndicatorsGraphics.cpp:140
bool sizeChanged() override
Definition CIndicatorsGraphics.cpp:36
void calculatePosGlobal(double xFather, double yFather) override
Definition CIndicatorsGraphics.cpp:191
void nextFrameChildren() override
Definition CIndicatorsGraphics.cpp:353
bool updateIndicatorImage(SPrvIndicatorImage *indicator, IGraphics *graphics, CLibraryImages *libraryImage)
Definition CIndicatorsGraphics.cpp:45
bool updateIndicatorText(CIndicatorsGraphics::SPrvIndicatorImage *indicator)
Definition CIndicatorsGraphics.cpp:99
Definition CLibraryImages.hpp:11
Definition CTheme.hpp:10
Definition IComponentsGUI.hpp:37
Definition IGraphics.hpp:20
Definition CIndicatorsGraphics.hpp:36
bool operator==(const SPrvIndicatorImage &b) const
Definition CIndicatorsGraphics.hpp:51
std::unique_ptr< CRectangleGraphics > m_currentBackground
Definition CIndicatorsGraphics.hpp:59
CDrawText * m_currentTextRef
Definition CIndicatorsGraphics.hpp:58
std::weak_ptr< CImageGraphics > m_currentImageRef
Definition CIndicatorsGraphics.hpp:57
SPrvIndicatorImage(CIndicator *indicatorRef, const std::shared_ptr< CImageGraphics > &currentImageRef, CDrawText *currentTextRef)
Definition CIndicatorsGraphics.hpp:37
CIndicator * m_indicatorRef
Definition CIndicatorsGraphics.hpp:56
~SPrvIndicatorImage()
Definition CIndicatorsGraphics.hpp:45
std::optional< iv::types::color > m_currentBackgroundColor
Definition CIndicatorsGraphics.hpp:60
Definition CIndicatorsGraphics.hpp:75
static constexpr double cornerRadiusBackground
Definition CIndicatorsGraphics.hpp:89
static constexpr double smallIcon
Definition CIndicatorsGraphics.hpp:84
static constexpr double smallBarIndicator
Definition CIndicatorsGraphics.hpp:78
static constexpr double paddingBackground
Definition CIndicatorsGraphics.hpp:88
static constexpr double paddingIndicator
Definition CIndicatorsGraphics.hpp:87
static constexpr double textSize
Definition CIndicatorsGraphics.hpp:85
static constexpr double barIndicator
Definition CIndicatorsGraphics.hpp:76
static constexpr double largeIcon
Definition CIndicatorsGraphics.hpp:80
static constexpr double badgeTextSize
Definition CIndicatorsGraphics.hpp:82
static constexpr double largeIconSmallScreen
Definition CIndicatorsGraphics.hpp:81
static constexpr double barIndicatorSmallScreen
Definition CIndicatorsGraphics.hpp:77