Antares Simulator
Power System Simulator
iitem.hxx
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_UI_COMMON_COMPONENT_SPOTLIGHT_SPOTLIGHT_IITEM_HXX__
22 #define __ANTARES_UI_COMMON_COMPONENT_SPOTLIGHT_SPOTLIGHT_IITEM_HXX__
23 
24 namespace Antares::Component
25 {
26 inline const Spotlight::IItem::GroupType& Spotlight::IItem::group() const
27 {
28  return pGroup;
29 }
30 
31 template<class StringT>
32 inline bool Spotlight::IItem::isSameGroup(const StringT& group) const
33 {
34  return (pGroup == group);
35 }
36 
37 inline const Yuni::String& Spotlight::IItem::caption() const
38 {
39  return pCaption;
40 }
41 
42 template<class StringT>
43 inline void Spotlight::IItem::caption(const StringT& caption)
44 {
45  pCaption = caption;
46  pCacheCaption = wxStringFromUTF8(pCaption);
47 }
48 
49 inline const Yuni::String& Spotlight::IItem::subcaption() const
50 {
51  return pSubCaption;
52 }
53 
54 template<class StringT>
55 inline void Spotlight::IItem::subcaption(const StringT& caption)
56 {
57  pSubCaption = caption;
58 }
59 
60 template<class StringT>
61 inline void Spotlight::IItem::group(const StringT& g)
62 {
63  pGroup = g;
64 }
65 
66 inline bool Spotlight::IItem::canBeSelected() const
67 {
68  return true;
69 }
70 
71 inline uint Spotlight::IItem::IPart::width() const
72 {
73  return 0u;
74 }
75 
76 inline uint Spotlight::IItem::IPart::height() const
77 {
78  return 0u;
79 }
80 
81 inline const wxBitmap& Spotlight::IItem::image() const
82 {
83  return pBitmap;
84 }
85 
86 inline void Spotlight::IItem::image(const wxBitmap& bmp)
87 {
88  pBitmap = bmp;
89 }
90 
91 inline void Spotlight::IItem::image(const wxBitmap* bmp)
92 {
93  if (bmp)
94  {
95  pBitmap = *bmp;
96  }
97 }
98 
99 inline bool Spotlight::IItem::selected() const
100 {
101  return pSelected;
102 }
103 
104 inline void Spotlight::IItem::select()
105 {
106  pSelected = true;
107 }
108 
109 inline void Spotlight::IItem::unselect()
110 {
111  pSelected = false;
112 }
113 
114 template<class StringT>
115 inline void Spotlight::IItem::addTag(const StringT& text)
116 {
117  pLeftTags.push_back(std::make_shared<Tag>(text));
118 }
119 
120 template<class StringT>
121 inline void Spotlight::IItem::addTag(const StringT& text, uint8_t r, uint8_t g, uint8_t b)
122 {
123  pLeftTags.push_back(std::make_shared<Tag>(text, r, g, b));
124 }
125 
126 template<class StringT>
127 inline void Spotlight::IItem::addRightTag(const StringT& text)
128 {
129  pRightTags.push_back(std::make_shared<Tag>(text));
130 }
131 
132 template<class StringT>
133 inline void Spotlight::IItem::addRightTag(const StringT& text, uint8_t r, uint8_t g, uint8_t b)
134 {
135  pRightTags.push_back(std::make_shared<Tag>(text, r, g, b));
136 }
137 
138 inline void Spotlight::IItem::clearTags()
139 {
140  pLeftTags.clear();
141  pRightTags.clear();
142 }
143 
144 inline bool Spotlight::IItem::countedAsResult() const
145 {
146  return pCountedAsResult;
147 }
148 
149 inline void Spotlight::IItem::countedAsResult(bool v)
150 {
151  pCountedAsResult = v;
152 }
153 
154 } // namespace Antares::Component
155 
156 #endif // __ANTARES_UI_COMMON_COMPONENT_SPOTLIGHT_SPOTLIGHT_IITEM_HXX__