Antares Simulator
Power System Simulator
gridhelper.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_TOOLBOX_COMPONENTS_DATAGRID__GRID_HELPER_HXX__
22 #define __ANTARES_TOOLBOX_COMPONENTS_DATAGRID__GRID_HELPER_HXX__
23 
24 namespace Antares::Component::Datagrid
25 {
27 {
28  return virtualSize.y;
29 }
30 
32 {
33  return virtualSize.x;
34 }
35 
36 inline double VGridHelper::GetValueAsDouble(int row, int col)
37 {
38  return GetNumericValue(row, col);
39 }
40 
41 inline bool VGridHelper::GetValueAsBool(int row, int col)
42 {
43  return !Yuni::Math::Zero(GetValueAsDouble(row, col));
44 }
45 
46 inline bool VGridHelper::IsEmptyCell(int, int)
47 {
48  return false;
49 }
50 
51 inline int VGridHelper::realCol(uint col) const
52 {
53  assert(col < (uint)indicesCols.size());
54  return indicesCols[col];
55 }
56 
57 inline int VGridHelper::realRow(uint row) const
58 {
59  assert(row < (uint)indicesRows.size());
60  return indicesRows[row];
61 }
62 
63 inline bool VGridHelper::CanValueAs(int, int, const wxString&)
64 {
65  return true;
66 }
67 
69 {
70  return pRenderer;
71 }
72 
73 } // namespace Antares::Component::Datagrid
74 
75 #endif // __ANTARES_TOOLBOX_COMPONENTS_DATAGRID__GRID_HELPER_HXX__
Data provider for Datagrids.
Definition: renderer.h:50
virtual int GetNumberCols() override
Get the number of columns that the wxGrid should display.
Definition: gridhelper.hxx:31
int realRow(uint row) const
Get the real index used by the renderer of a given row index used by the wxGrid.
Definition: gridhelper.hxx:57
bool IsEmptyCell(int, int) override
Get if a cell is empty or not (unused)
Definition: gridhelper.hxx:46
Renderer::IRenderer * renderer() const
The renderer.
Definition: gridhelper.hxx:68
int realCol(uint col) const
Get the real index used by the renderer of a given column index used by the wxGrid.
Definition: gridhelper.hxx:51
virtual double GetNumericValue(int row, int col) const
Get the float value of the cell at a given position.
Definition: gridhelper.cpp:555
virtual int GetNumberRows() override
Get the number of rows that the wxGrid should display.
Definition: gridhelper.hxx:26