Antares Simulator
Power System Simulator
renderer.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 #include "renderer.h"
22 #ifndef __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_HXX__
23 #define __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_HXX__
24 
25 namespace Antares::Component::Datagrid::Renderer
26 {
27 inline int IRenderer::internalWidth() const
28 {
29  return width();
30 }
31 
32 inline int IRenderer::internalHeight() const
33 {
34  return height();
35 }
36 
38 {
39  return false;
40 }
41 
42 inline IRenderer::CellStyle IRenderer::cellStyleWithNumericCheck(int x, int y) const
43 {
44  return Yuni::Math::Zero(cellNumericValue(x, y))
45  ? ((y % 2) ? cellStyleDefaultAlternateDisabled : cellStyleDefaultDisabled)
46  : ((y % 2) ? cellStyleDefaultAlternate : cellStyleDefault);
47 }
48 
49 inline IRenderer::CellStyle IRenderer::cellStyle(int, int y) const
50 {
51  return ((y % 2) ? cellStyleDefaultAlternate : cellStyleDefault);
52 }
53 
54 inline wxColour IRenderer::cellBackgroundColor(int, int) const
55 {
56  return wxColour(255, 255, 255);
57 }
58 
59 inline wxColour IRenderer::cellTextColor(int, int) const
60 {
61  return wxColour(255, 0, 0);
62 }
63 
64 inline bool IRenderer::onMatrixResize(uint, uint, uint&, uint&)
65 {
66  return true;
67 }
68 
69 inline wxColour IRenderer::verticalBorderColor(int, int) const
70 {
71  return Default::BorderColor();
72 }
73 
74 inline wxColour IRenderer::horizontalBorderColor(int, int) const
75 {
76  return Default::BorderColor();
77 }
78 
79 inline uint IRenderer::maxWidthResize() const
80 {
81  return 0;
82 }
83 
84 inline uint IRenderer::maxHeightResize() const
85 {
86  return 0;
87 }
88 
89 inline int IRenderer::cellAlignment(int, int) const
90 {
91  return 0;
92 }
93 
94 inline int IRenderer::columnWidthCustom(int) const
95 {
96  return 0;
97 }
98 
99 inline void IRenderer::hintForColumnWidth(int, wxString& out) const
100 {
101  out.Clear();
102 }
103 
104 inline wxString IRenderer::asString(int x, int y) const
105 {
106  return cellValue(x, y);
107 }
108 
109 inline double IRenderer::asDouble(int x, int y) const
110 {
111  return cellNumericValue(x, y);
112 }
113 
114 inline Date::Precision IRenderer::precision()
115 {
116  return Date::stepAny;
117 }
118 
119 inline bool IRenderer::circularShiftRowsUntilDate(MonthName, uint)
120 {
121  return false; // not implemented
122 }
123 
124 inline void IRenderer::applyLayerFiltering(size_t /* layerID */, VGridHelper* /* gridHelper */)
125 {
126 }
127 
128 } // namespace Antares::Component::Datagrid::Renderer
129 
130 // namespace Antares
131 
132 #endif // __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_HXX__
virtual bool circularShiftRowsUntilDate(MonthName month, uint daymonth)
Rotate all rows until a given date.
Definition: renderer.hxx:119
virtual bool ensureDataAreLoaded()
Make sure all data are effectively loaded.
Definition: renderer.hxx:37
virtual double asDouble(int x, int y) const
Read a cell as a double.
Definition: renderer.hxx:109
virtual int internalHeight() const
The real height of the matrix in memory.
Definition: renderer.hxx:32
virtual double cellNumericValue(int x, int y) const =0
Get the floating value of a Cell.
virtual wxColour verticalBorderColor(int x, int y) const
Get the color of the vertical right border.
Definition: renderer.hxx:69
virtual wxString cellValue(int x, int y) const =0
Get the string representation of a Cell.
virtual uint maxWidthResize() const
The most suitable column count.
Definition: renderer.hxx:79
virtual wxString asString(int x, int y) const
Read a cell as a string.
Definition: renderer.hxx:104
virtual void hintForColumnWidth(int x, wxString &out) const
String to use.
Definition: renderer.hxx:99
virtual int internalWidth() const
The real width of the matrix in memory.
Definition: renderer.hxx:27
virtual bool onMatrixResize(uint oldX, uint oldY, uint &newX, uint &newY)
Event trigerred before resizing a matrix.
Definition: renderer.hxx:64
virtual int width() const =0
The effective width of the grid.
virtual int cellAlignment(int x, int y) const
Get the alignment of a cell (-1: left, 0: center, +1: right)
Definition: renderer.hxx:89
virtual Date::Precision precision()
Time Precision.
Definition: renderer.hxx:114
virtual int height() const =0
The effective height of the grid.
virtual wxColour horizontalBorderColor(int x, int y) const
Get the color of the horizontal bottom border.
Definition: renderer.hxx:74
virtual uint maxHeightResize() const
The most suitable column count.
Definition: renderer.hxx:84
virtual int columnWidthCustom(int x) const
Get how the a column must resize (0: auto, >0: specific width, <0: use custom string)
Definition: renderer.hxx:94
Wrapper between a wxGridTableBase and a renderer
Definition: gridhelper.h:42