Antares Simulator
Power System Simulator
scenario-builder-renderer-base.h
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_COMPONENT_DATAGRID_RENDERER_SCENARIO_BUILDER_H__
22 #define __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_SCENARIO_BUILDER_H__
23 
24 #include "../renderer.h"
25 #include <antares/study/scenario-builder/rules.h>
26 #include "../../../../toolbox/input/area.h"
27 
28 namespace Antares::Component::Datagrid::Renderer
29 {
31 {
32 public:
33  ScBuilderRendererBase() = default;
34  virtual ~ScBuilderRendererBase();
35 
36  int width() const override;
37  wxString columnCaption(int colIndx) const override;
38  wxString cellValue(int x, int y) const override;
39 
40  void resetColors(int, int, wxColour&, wxColour&) const override
41  {
42  // Do nothing
43  }
44 
45  uint maxWidthResize() const override
46  {
47  return 0;
48  }
49 
50  IRenderer::CellStyle cellStyle(int col, int row) const override;
51 
52  void control(wxWindow* gridPanel)
53  {
54  pGridPanel = gridPanel;
55  }
56 
57 public:
60 
61 protected:
62  virtual void onStudyClosed();
63 
64  wxWindow* gridPanel()
65  {
66  return pGridPanel;
67  }
68 
69 protected:
71 
72 private:
73  wxWindow* pGridPanel = nullptr;
74 
75 }; // class ScBuilderRendererBase
76 
77 // -------------------------------------------------------------------
78 // Class ScBuilderRendererAreasAsRows
79 // Renderer for a scenario builder grid of which lines are
80 // names of area.
81 // ------------------------------------------------------------------
83 {
84 public:
85  ScBuilderRendererAreasAsRows() = default;
86  ~ScBuilderRendererAreasAsRows() override = default;
87 
88  int height() const override;
89  wxString rowCaption(int rowIndx) const override;
90 
91  bool valid() const override;
92 };
93 
94 // -------------------------------------------------------------------
95 // Class ScBuilderRendererForAreaSelector
96 // Renderer for a scenario builder grid of which lines depend
97 // on the selected area.
98 // Example : grid lines are clusters of an area.
99 // ------------------------------------------------------------------
101 {
102 public:
104  ~ScBuilderRendererForAreaSelector() override = default;
105 
106  bool valid() const override;
107 
108 protected:
109  void onAreaChanged(Data::Area* area);
110  void onStudyClosed() override;
111 
112  Data::Area* selectedArea() const
113  {
114  return pArea;
115  }
116 
117 private:
118  Data::Area* pArea = nullptr;
119 };
120 
121 } // namespace Antares::Component::Datagrid::Renderer
122 
123 #endif // __ANTARES_TOOLBOX_COMPONENT_DATAGRID_RENDERER_SCENARIO_BUILDER_H__
Data provider for Datagrids.
Definition: renderer.h:50
Definition: scenario-builder-renderer-base.h:83
wxString rowCaption(int rowIndx) const override
Get the caption of a row.
Definition: scenario-builder-renderer-base.cpp:132
int height() const override
The effective height of the grid.
Definition: scenario-builder-renderer-base.cpp:123
Definition: scenario-builder-renderer-base.h:31
wxString cellValue(int x, int y) const override
Get the string representation of a Cell.
Definition: scenario-builder-renderer-base.cpp:62
void onRulesChanged(Data::ScenarioBuilder::Rules::Ptr rules)
Event: A rules set has been changed.
Definition: scenario-builder-renderer-base.cpp:38
virtual void onStudyClosed()
Event: the study has been closed.
Definition: scenario-builder-renderer-base.cpp:113
uint maxWidthResize() const override
The most suitable column count.
Definition: scenario-builder-renderer-base.h:45
wxString columnCaption(int colIndx) const override
Get the caption of a column.
Definition: scenario-builder-renderer-base.cpp:57
int width() const override
The effective width of the grid.
Definition: scenario-builder-renderer-base.cpp:52
Definition: scenario-builder-renderer-base.h:101
void onStudyClosed() override
Event: the study has been closed.
Definition: scenario-builder-renderer-base.cpp:164
Definition for a single area.
Definition: area.h:51
std::shared_ptr< Rules > Ptr
Smart pointer.
Definition: rules.h:53
Visual Component for displaying all available areas (and groups)
Definition: area.h:37