Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
iitem.hxx
1/*
2** Copyright 2007-2024, 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
24namespace Antares
25{
26namespace Component
27{
29{
30 return pGroup;
31}
32
33template<class StringT>
34inline bool Spotlight::IItem::isSameGroup(const StringT& group) const
35{
36 return (pGroup == group);
37}
38
39inline const Yuni::String& Spotlight::IItem::caption() const
40{
41 return pCaption;
42}
43
44template<class StringT>
45inline void Spotlight::IItem::caption(const StringT& caption)
46{
47 pCaption = caption;
48 pCacheCaption = wxStringFromUTF8(pCaption);
49}
50
51inline const Yuni::String& Spotlight::IItem::subcaption() const
52{
53 return pSubCaption;
54}
55
56template<class StringT>
57inline void Spotlight::IItem::subcaption(const StringT& caption)
58{
59 pSubCaption = caption;
60}
61
62template<class StringT>
63inline void Spotlight::IItem::group(const StringT& g)
64{
65 pGroup = g;
66}
67
69{
70 return true;
71}
72
74{
75 return 0u;
76}
77
79{
80 return 0u;
81}
82
83inline const wxBitmap& Spotlight::IItem::image() const
84{
85 return pBitmap;
86}
87
88inline void Spotlight::IItem::image(const wxBitmap& bmp)
89{
90 pBitmap = bmp;
91}
92
93inline void Spotlight::IItem::image(const wxBitmap* bmp)
94{
95 if (bmp)
96 pBitmap = *bmp;
97}
98
99inline bool Spotlight::IItem::selected() const
100{
101 return pSelected;
102}
103
105{
106 pSelected = true;
107}
108
110{
111 pSelected = false;
112}
113
114template<class StringT>
115inline void Spotlight::IItem::addTag(const StringT& text)
116{
117 pLeftTags.push_back(std::make_shared<Tag>(text));
118}
119
120template<class StringT>
121inline void Spotlight::IItem::addTag(const StringT& text,
122 uint8_t r,
123 uint8_t g,
124 uint8_t b)
125{
126 pLeftTags.push_back(std::make_shared<Tag>(text, r, g, b));
127}
128
129template<class StringT>
130inline void Spotlight::IItem::addRightTag(const StringT& text)
131{
132 pRightTags.push_back(std::make_shared<Tag>(text));
133}
134
135template<class StringT>
136inline void Spotlight::IItem::addRightTag(const StringT& text,
137 uint8_t r,
138 uint8_t g,
139 uint8_t b)
140{
141 pRightTags.push_back(std::make_shared<Tag>(text, r, g, b));
142}
143
145{
146 pLeftTags.clear();
147 pRightTags.clear();
148}
149
151{
152 return pCountedAsResult;
153}
154
156{
157 pCountedAsResult = v;
158}
159
160} // namespace Component
161} // namespace Antares
162
163#endif // __ANTARES_UI_COMMON_COMPONENT_SPOTLIGHT_SPOTLIGHT_IITEM_HXX__
virtual uint height() const
Height of the cell.
Definition iitem.hxx:78
virtual uint width() const
Width of the cell.
Definition iitem.hxx:73
const Yuni::String & caption() const
Get the caption.
Definition iitem.hxx:39
bool selected() const
Get if the item is selected.
Definition iitem.hxx:99
GroupType pGroup
The group.
Definition spotlight.h:210
void addTag(const StringT &text)
Add a new tag.
Definition iitem.hxx:115
void unselect()
Mark the item as not selected.
Definition iitem.hxx:109
bool countedAsResult() const
Get if this item should be counted as a result.
Definition iitem.hxx:150
const GroupType & group() const
Get the group of the item.
Definition iitem.hxx:28
const wxBitmap & image() const
Get the item& image.
Definition iitem.hxx:83
const Yuni::String & subcaption() const
Get the sub-caption.
Definition iitem.hxx:51
virtual bool canBeSelected() const
Get if the item can be selected.
Definition iitem.hxx:68
void clearTags()
Clear all tags.
Definition iitem.hxx:144
bool isSameGroup(const StringT &group) const
Compare with another group.
Definition iitem.hxx:34
void select()
Mark the item as selected.
Definition iitem.hxx:104
Yuni::CString< 64, false > GroupType
Group.
Definition spotlight.h:37
void addRightTag(const StringT &text)
Add a new tag on the right.
Definition iitem.hxx:130