Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CGroupButtonsGraphics.hpp
Go to the documentation of this file.
1#ifndef LIBS_GRAPHICSCOMP_CGROUPBUTTONSGRAPHICS_HPP_
2#define LIBS_GRAPHICSCOMP_CGROUPBUTTONSGRAPHICS_HPP_
3
5#include "ui/utils.hpp"
6
7#include <string>
8
10{
11public:
13 {
16 };
17
19 ~CGroupButtonsGraphics() override;
20
21 void add(CButtonGraphics *button);
22 bool sizeChanged() override;
23 void update(IGraphics *graphics, CLibraryImages *libraryImage) override;
24
25 void getSizeClosed(double *sizeX, double *sizeY) const;
26
27 void setColorARGB(std::string_view nameButton, std::optional<iv::types::color> colorARGB);
28 void setColorButtonTextARGB(std::string_view nameButton, std::optional<iv::types::color> colorARGB);
29 void setButtonBlinking(std::string_view nameButton, bool isBlinking);
30 void setButtonBlinkingColorARGB(std::string_view nameButton, std::optional<iv::types::color> colorARGB);
31
33 void setKeepOpen(bool keepOpen);
34
35private:
37 {
38 Closed,
39 Open
40 };
41
42 void calculatePosGlobal(double xFather, double yFather) override;
43 void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp,
44 double *sizeYComp) override;
45 void closing() override;
46 void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override;
47 void drawComponent(IGraphics *graphics, const CTheme *theme) override;
48 void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override;
49 void handleEventOut(CEventGraphics *event) override;
50 void nextFrameChildren() override;
51 void removeObjectDraw(IGraphics *graphics) override;
52
53 void handleEventOpenState(double xOrg, double yOrg, CEventGraphics *event);
54 void handleEventClosedState(double xOrg, double yOrg, CEventGraphics *event);
55
56 double sizeButtonsArrows() const;
57
58 void prvPosArrowsHorizontal(double xOrg, double yOrg, double sizeXGroup, double sizeYGroup, double &xArrowOnLeftOut,
59 double &yArrowOnLeftOut, double &xArrowOnRightOut, double &yArrowOnRightOut) const;
60 void prvPosArrowsVertical(double xOrg, double yOrg, double sizeXGroup, double sizeYGroup, double &xArrowOnTopOut,
61 double &yArrowOnTopOut, double &xArrowOnBottomOut, double &yArrowOnBottomOut) const;
62
63 void prvDrawButtons(const CTheme *theme, const iv::math::geometry::Point2d &posArrowPrevious,
64 const iv::math::geometry::Point2d &posArrowNext,
65 const std::shared_ptr<CImageGraphics> &arrowPrevious,
66 const std::shared_ptr<CImageGraphics> &arrowNext, IGraphics *graphics) const;
67
70
73 std::weak_ptr<CImageGraphics> m_arrowUpRef;
74 std::weak_ptr<CImageGraphics> m_arrowDownRef;
75 std::weak_ptr<CImageGraphics> m_arrowLeftRef;
76 std::weak_ptr<CImageGraphics> m_arrowRightRef;
77 std::weak_ptr<CImageGraphics> m_arrowOpenLeftRef;
78
80
84
85 iv::ui ::utils::PaginationIndex m_paginationIndex;
86
87 std::vector<CButtonGraphics *> m_buttons;
88
89 struct Sizes
90 {
91 static constexpr iv::types::width buttonMargin = -2.;
92 static constexpr iv::types::width marginX = 3.;
93 static constexpr iv::types::height marginY = 3.;
94 static constexpr iv::types::width sizeArrow = 32.;
95 static constexpr iv::types::width sizeArrowSmallScreen = 24.;
96 static constexpr iv::types::width spacingArrows = 16.;
98 static constexpr double sizeMinClosed = 30.;
99 static constexpr double sizeXMinimum = 150.;
100 static constexpr double sizeYMinimum = 150.;
101 static constexpr double precision = 1e-5;
102 };
103};
104
105#endif /* LIBS_GRAPHICSCOMP_CGROUPBUTTONSGRAPHICS_HPP_ */
Definition AbstractComponentGraphics.hpp:21
Definition CButtonGraphics.hpp:19
Definition CEventGraphics.hpp:9
Definition CGroupButtonsGraphics.hpp:10
void handleEventOpenState(double xOrg, double yOrg, CEventGraphics *event)
Definition CGroupButtonsGraphics.cpp:444
CGroupButtonsGraphics::eButtonsGroupDirection m_direction
Definition CGroupButtonsGraphics.hpp:69
double sizeButtonsArrows() const
Definition CGroupButtonsGraphics.cpp:560
void handleEventClosedState(double xOrg, double yOrg, CEventGraphics *event)
Definition CGroupButtonsGraphics.cpp:530
void setButtonBlinkingColorARGB(std::string_view nameButton, std::optional< iv::types::color > colorARGB)
Definition CGroupButtonsGraphics.cpp:154
void drawComponent(IGraphics *graphics, const CTheme *theme) override
Definition CGroupButtonsGraphics.cpp:328
void setDirection(CGroupButtonsGraphics::eButtonsGroupDirection direction)
Definition CGroupButtonsGraphics.cpp:167
std::weak_ptr< CImageGraphics > m_arrowUpRef
Definition CGroupButtonsGraphics.hpp:73
void nextFrameChildren() override
Definition CGroupButtonsGraphics.cpp:420
void update(IGraphics *graphics, CLibraryImages *libraryImage) override
Definition CGroupButtonsGraphics.cpp:88
std::weak_ptr< CImageGraphics > m_arrowRightRef
Definition CGroupButtonsGraphics.hpp:76
void calculatePosGlobal(double xFather, double yFather) override
Definition CGroupButtonsGraphics.cpp:182
CRectangleGraphics * m_background
Definition CGroupButtonsGraphics.hpp:71
void getSizeClosed(double *sizeX, double *sizeY) const
Definition CGroupButtonsGraphics.cpp:96
EPrvButtonsGroupState
Definition CGroupButtonsGraphics.hpp:37
void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override
Definition CGroupButtonsGraphics.cpp:393
std::weak_ptr< CImageGraphics > m_arrowLeftRef
Definition CGroupButtonsGraphics.hpp:75
void setKeepOpen(bool keepOpen)
Definition CGroupButtonsGraphics.cpp:172
~CGroupButtonsGraphics() override
Definition CGroupButtonsGraphics.cpp:52
void prvDrawButtons(const CTheme *theme, const iv::math::geometry::Point2d &posArrowPrevious, const iv::math::geometry::Point2d &posArrowNext, const std::shared_ptr< CImageGraphics > &arrowPrevious, const std::shared_ptr< CImageGraphics > &arrowNext, IGraphics *graphics) const
Definition CGroupButtonsGraphics.cpp:587
void handleEventOut(CEventGraphics *event) override
Definition CGroupButtonsGraphics.cpp:411
std::weak_ptr< CImageGraphics > m_arrowOpenLeftRef
Definition CGroupButtonsGraphics.hpp:77
eButtonsGroupDirection
Definition CGroupButtonsGraphics.hpp:13
void setColorButtonTextARGB(std::string_view nameButton, std::optional< iv::types::color > colorARGB)
Definition CGroupButtonsGraphics.cpp:129
void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override
Definition CGroupButtonsGraphics.cpp:272
double m_spacingArrow
Definition CGroupButtonsGraphics.hpp:83
CRectangleGraphics * m_areaButtons
Definition CGroupButtonsGraphics.hpp:72
CGroupButtonsGraphics()
Definition CGroupButtonsGraphics.cpp:41
void add(CButtonGraphics *button)
Definition CGroupButtonsGraphics.cpp:65
bool sizeChanged() override
Definition CGroupButtonsGraphics.cpp:72
std::weak_ptr< CImageGraphics > m_arrowDownRef
Definition CGroupButtonsGraphics.hpp:74
bool m_keepOpen
Definition CGroupButtonsGraphics.hpp:81
std::vector< CButtonGraphics * > m_buttons
Definition CGroupButtonsGraphics.hpp:87
void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp, double *sizeYComp) override
Definition CGroupButtonsGraphics.cpp:190
iv::math::geometry::Area m_sizeButtons
Definition CGroupButtonsGraphics.hpp:79
void prvPosArrowsHorizontal(double xOrg, double yOrg, double sizeXGroup, double sizeYGroup, double &xArrowOnLeftOut, double &yArrowOnLeftOut, double &xArrowOnRightOut, double &yArrowOnRightOut) const
Definition CGroupButtonsGraphics.cpp:565
void closing() override
Definition CGroupButtonsGraphics.cpp:264
iv::ui::utils::PaginationIndex m_paginationIndex
Definition CGroupButtonsGraphics.hpp:85
CGroupButtonsGraphics::EPrvButtonsGroupState m_state
Definition CGroupButtonsGraphics.hpp:68
void setButtonBlinking(std::string_view nameButton, bool isBlinking)
Definition CGroupButtonsGraphics.cpp:142
void removeObjectDraw(IGraphics *graphics) override
Definition CGroupButtonsGraphics.cpp:428
void setColorARGB(std::string_view nameButton, std::optional< iv::types::color > colorARGB)
Definition CGroupButtonsGraphics.cpp:117
void prvPosArrowsVertical(double xOrg, double yOrg, double sizeXGroup, double sizeYGroup, double &xArrowOnTopOut, double &yArrowOnTopOut, double &xArrowOnBottomOut, double &yArrowOnBottomOut) const
Definition CGroupButtonsGraphics.cpp:576
double m_sizeArrow
Definition CGroupButtonsGraphics.hpp:82
Definition CLibraryImages.hpp:11
Definition CRectangleGraphics.hpp:10
Definition CTheme.hpp:10
Definition IGraphics.hpp:20
double height
Definition types.hpp:14
double width
Definition types.hpp:23
Definition CGroupButtonsGraphics.hpp:90
static constexpr iv::types::height marginY
Definition CGroupButtonsGraphics.hpp:93
static constexpr iv::types::width spacingArrows
Definition CGroupButtonsGraphics.hpp:96
static constexpr iv::types::width sizeArrowSmallScreen
Definition CGroupButtonsGraphics.hpp:95
static constexpr double sizeMinClosed
Definition CGroupButtonsGraphics.hpp:98
static constexpr iv::types::width buttonMargin
Definition CGroupButtonsGraphics.hpp:91
static constexpr double sizeYMinimum
Definition CGroupButtonsGraphics.hpp:100
static constexpr iv::types::width sizeArrow
Definition CGroupButtonsGraphics.hpp:94
static constexpr iv::types::width spacingArrowsSmallScreen
Definition CGroupButtonsGraphics.hpp:97
static constexpr iv::types::width marginX
Definition CGroupButtonsGraphics.hpp:92
static constexpr double precision
Definition CGroupButtonsGraphics.hpp:101
static constexpr double sizeXMinimum
Definition CGroupButtonsGraphics.hpp:99
Definition structs.hpp:123
Definition structs.hpp:16