Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CTabsGraphics.hpp
Go to the documentation of this file.
1#ifndef LIBS_GRAPHICSCOMP_CTABSGRAPHICS_HPP_
2#define LIBS_GRAPHICSCOMP_CTABSGRAPHICS_HPP_
3
6#include "core/assert.hpp"
7
8#include "core/memOps.hpp"
11
12#include <cmath>
13#include <cstdlib>
14#include <string>
15#include <utility>
16
18{
19public:
20 //CTabsGraphics();
21 //CTabsGraphics(const CTabsGraphics &tabsGraphics);
22 CTabsGraphics(const std::string &titleTab, AbstractComponentGUI *compTab);
23 ~CTabsGraphics() override;
24
25 bool operator==(const CTabsGraphics &b) const
26 {
28 }
29
30 void addTab(const std::string &nameTab, AbstractComponentGraphics *compTab) const;
31 void addTabTitleComponent(uint64_t indTab, AbstractComponentGraphics *compTab) const;
32 void setTab(uint64_t indTab) const;
33 void setColorARGB(std::string_view nameTab, std::optional<iv::types::color> colorARGB) const;
34 void setColorTabText(std::string_view nameTab, std::optional<iv::types::color> colorARGB) const;
35 void setTabBlinking(std::string_view nameTab, bool isBlinking) const;
36 void setTabBlinkingColor(std::string_view nameTab, std::optional<iv::types::color> colorARGB) const;
37 [[nodiscard]] uint64_t getTab() const;
38
40 {
41 SPrvTabGraphics(std::string nameTab, AbstractComponentGraphics *compTabRef)
42 : m_nameTab(std::move(nameTab)), m_compTabRef(compTabRef)
43 {
44 }
45
47 {
48 m_compTabRef = nullptr;
49 }
50
51 bool operator==(const SPrvTabGraphics &b) const
52 {
53 return (m_nameTab == b.m_nameTab) && (m_compTabRef == b.m_compTabRef);
54 }
55
56 std::string m_nameTab;
58 std::vector<AbstractComponentGraphics *> m_compTabTitleComponentRef;
59 };
60
61private:
62 void calculatePosGlobal(double xFather, double yFather) override;
63 void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp,
64 double *sizeYComp) override;
65 void closing() override;
66 void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override;
67 void drawComponent(IGraphics *graphics, const CTheme *theme) override;
68 void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override;
69 void nextFrameChildren() override;
70 void removeObjectDraw(IGraphics *graphics) override;
71 bool sizeChanged() override;
72 void update(IGraphics *graphics, CLibraryImages *libraryImage) override;
73
75 {
76 SPrvTabsGraphics(std::string titleTab, const uint64_t indCurrentTab, const double dxHorizontalTranslate,
77 const double heightTitleTab, const double heightArea, CRectangleGraphics **clipArea,
78 const std::shared_ptr<std::vector<std::shared_ptr<SPrvTabGraphics>>> &tabs,
79 const std::shared_ptr<CGroupButtonsGraphics> &lateralButtons, AbstractComponentGUI *tabRefOpt)
80 : m_titleTab(std::move(titleTab)), m_indCurrentTab(indCurrentTab),
81 m_dxHorizontalTranslate(dxHorizontalTranslate), m_heightTitleTab(heightTitleTab),
82 m_heightArea(heightArea), m_tabRefOpt(tabRefOpt)
83 {
84 m_clipArea = iv::assignPtr(clipArea);
85 m_lateralButtons = lateralButtons;
86 m_tabs = tabs;
87 }
88
90 {
91 IV_ASSERT_NOMSG(m_clipArea == nullptr);
92 m_lateralButtons = nullptr;
93 m_tabs = nullptr;
94 }
95
96 bool operator==(const SPrvTabsGraphics &b) const
97 {
98 auto epsilon = static_cast<float>(0.000001);
99
100 return (m_titleTab == b.m_titleTab) && (m_indCurrentTab == b.m_indCurrentTab) &&
102 fabs(m_heightTitleTab - b.m_heightTitleTab) < epsilon &&
103 fabs(m_heightArea - b.m_heightArea) < epsilon && (m_clipArea == b.m_clipArea) &&
104 (m_tabs == b.m_tabs)
105 //&& (m_lateralButtons == b.m_lateralButtons)
106 && (m_tabRefOpt == b.m_tabRefOpt);
107 }
108
109 std::string m_titleTab;
115 std::shared_ptr<std::vector<std::shared_ptr<SPrvTabGraphics>>> m_tabs;
116 std::shared_ptr<CGroupButtonsGraphics> m_lateralButtons;
118 };
119
121
123
125 {
126 public:
127 CPrvClickButtonTab(uint64_t indTab, SPrvTabsGraphics *dataTabsGraphicsRef)
128 : m_indTab(indTab), m_dataTabsGraphicsRef(dataTabsGraphicsRef)
129 {
130 }
131
132 private:
138
139 uint64_t m_indTab;
141 };
142};
143
144#endif /* LIBS_GRAPHICSCOMP_CTABSGRAPHICS_HPP_ */
#define IV_ASSERT_NOMSG(expr,...)
Definition assert.hpp:108
Definition AbstractComponentGUI.hpp:30
void runChange()
Definition AbstractComponentGUI.cpp:574
Definition AbstractComponentGraphics.hpp:21
Definition CEventGraphics.hpp:9
Definition CLibraryImages.hpp:11
Definition CRectangleGraphics.hpp:10
Definition CTabsGraphics.hpp:125
SPrvTabsGraphics * m_dataTabsGraphicsRef
Definition CTabsGraphics.hpp:140
uint64_t m_indTab
Definition CTabsGraphics.hpp:139
void click(CEventGraphics &evt) override
Definition CTabsGraphics.hpp:133
CPrvClickButtonTab(uint64_t indTab, SPrvTabsGraphics *dataTabsGraphicsRef)
Definition CTabsGraphics.hpp:127
Definition CTabsGraphics.hpp:18
uint64_t getTab() const
Definition CTabsGraphics.cpp:188
bool sizeChanged() override
Definition CTabsGraphics.cpp:544
void addTab(const std::string &nameTab, AbstractComponentGraphics *compTab) const
Definition CTabsGraphics.cpp:133
void removeObjectDraw(IGraphics *graphics) override
Definition CTabsGraphics.cpp:506
void setColorTabText(std::string_view nameTab, std::optional< iv::types::color > colorARGB) const
Definition CTabsGraphics.cpp:171
void closing() override
Definition CTabsGraphics.cpp:248
void distribute(IGraphics *graphics, double sizeXComp, double sizeYComp) override
Definition CTabsGraphics.cpp:255
void setTabBlinkingColor(std::string_view nameTab, std::optional< iv::types::color > colorARGB) const
Definition CTabsGraphics.cpp:182
void handleEvent(CEventGraphics *event, double xOrg, double yOrg) override
Definition CTabsGraphics.cpp:402
bool operator==(const CTabsGraphics &b) const
Definition CTabsGraphics.hpp:25
void calculatePosGlobal(double xFather, double yFather) override
Definition CTabsGraphics.cpp:193
void drawComponent(IGraphics *graphics, const CTheme *theme) override
Definition CTabsGraphics.cpp:323
void update(IGraphics *graphics, CLibraryImages *libraryImage) override
Definition CTabsGraphics.cpp:582
~CTabsGraphics() override
Definition CTabsGraphics.cpp:127
SPrvTabsGraphics * m_dataTabsGraphics
Definition CTabsGraphics.hpp:120
void setTabBlinking(std::string_view nameTab, bool isBlinking) const
Definition CTabsGraphics.cpp:177
void calculateSizeMin(IGraphics *graphics, const CTheme *theme, CLibraryImages *libraryImage, double *sizeXComp, double *sizeYComp) override
Definition CTabsGraphics.cpp:218
CTabsGraphics(const std::string &titleTab, AbstractComponentGUI *compTab)
Definition CTabsGraphics.cpp:118
void addTabTitleComponent(uint64_t indTab, AbstractComponentGraphics *compTab) const
Definition CTabsGraphics.cpp:151
void nextFrameChildren() override
Definition CTabsGraphics.cpp:494
void setTab(uint64_t indTab) const
Definition CTabsGraphics.cpp:160
void setColorARGB(std::string_view nameTab, std::optional< iv::types::color > colorARGB) const
Definition CTabsGraphics.cpp:166
Definition CTheme.hpp:10
Definition IGraphics.hpp:20
Definition IListenerClickGraphics.hpp:7
T * assignPtr(T **ptr)
Definition memOps.hpp:13
Definition CTabsGraphics.hpp:40
SPrvTabGraphics(std::string nameTab, AbstractComponentGraphics *compTabRef)
Definition CTabsGraphics.hpp:41
std::vector< AbstractComponentGraphics * > m_compTabTitleComponentRef
Definition CTabsGraphics.hpp:58
std::string m_nameTab
Definition CTabsGraphics.hpp:56
~SPrvTabGraphics()
Definition CTabsGraphics.hpp:46
bool operator==(const SPrvTabGraphics &b) const
Definition CTabsGraphics.hpp:51
AbstractComponentGraphics * m_compTabRef
Definition CTabsGraphics.hpp:57
Definition CTabsGraphics.hpp:75
~SPrvTabsGraphics()
Definition CTabsGraphics.hpp:89
AbstractComponentGUI * m_tabRefOpt
Definition CTabsGraphics.hpp:117
std::shared_ptr< std::vector< std::shared_ptr< SPrvTabGraphics > > > m_tabs
Definition CTabsGraphics.hpp:115
CRectangleGraphics * m_clipArea
Definition CTabsGraphics.hpp:114
SPrvTabsGraphics(std::string titleTab, const uint64_t indCurrentTab, const double dxHorizontalTranslate, const double heightTitleTab, const double heightArea, CRectangleGraphics **clipArea, const std::shared_ptr< std::vector< std::shared_ptr< SPrvTabGraphics > > > &tabs, const std::shared_ptr< CGroupButtonsGraphics > &lateralButtons, AbstractComponentGUI *tabRefOpt)
Definition CTabsGraphics.hpp:76
double m_heightArea
Definition CTabsGraphics.hpp:113
std::string m_titleTab
Definition CTabsGraphics.hpp:109
uint64_t m_indCurrentTab
Definition CTabsGraphics.hpp:110
std::shared_ptr< CGroupButtonsGraphics > m_lateralButtons
Definition CTabsGraphics.hpp:116
bool operator==(const SPrvTabsGraphics &b) const
Definition CTabsGraphics.hpp:96
double m_dxHorizontalTranslate
Definition CTabsGraphics.hpp:111
double m_heightTitleTab
Definition CTabsGraphics.hpp:112