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