Antares Simulator
Power System Simulator
grid.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_WINDOWS_INSPECTOR_GRID_H__
22 #define __ANTARES_WINDOWS_INSPECTOR_GRID_H__
23 
24 #include <antares/study/study.h>
25 #include <wx/propgrid/propgrid.h>
26 #include <wx/propgrid/advprops.h>
27 #include <wx/propgrid/manager.h>
28 #include <wx/propgrid/editors.h>
29 #include "frame.h"
30 
31 namespace Antares::Window::Inspector
32 {
36 class InspectorGrid final: public wxPropertyGrid
37 {
38 public:
39  InspectorGrid(Frame& frame,
40  wxWindow* parent,
41  wxWindowID id = wxID_ANY,
42  const wxPoint& pos = wxDefaultPosition,
43  const wxSize& size = wxDefaultSize,
44  long style = (0)):
45 
46  wxPropertyGrid(parent, id, pos, size, style),
47  pFrame(frame)
48  {
49  }
50 
51  virtual ~InspectorGrid()
52  {
53  }
54 
55  void apply(const InspectorData::Ptr& data)
56  {
57  pCurrentSelection = data;
58  }
59 
60 protected:
61  using PropertyNameType = Yuni::CString<128, false>;
62 
63  void OnPropertyChanging(wxPropertyGridEvent& event);
64  bool onPropertyChanging_A(wxPGProperty*, const PropertyNameType& name, const wxVariant& value);
65  bool onPropertyChanging_C(wxPGProperty*, const PropertyNameType& name, const wxVariant& value);
66  bool onPropertyChanging_Constraint(wxPGProperty*,
67  const PropertyNameType& name,
68  const wxVariant& value);
69  bool onPropertyChanging_ThermalCluster(wxPGProperty*,
70  const PropertyNameType& name,
71  const wxVariant& value);
72  bool onPropertyChanging_RenewableClusters(const PropertyNameType& name, const wxVariant& value);
73  bool onPropertyChanging_L(wxPGProperty*, const PropertyNameType& name, const wxVariant& value);
74  bool onPropertyChanging_S(wxPGProperty*, const PropertyNameType& name, const wxVariant& value);
75 
76 private:
78  Frame& pFrame;
80  InspectorData::Ptr pCurrentSelection;
81  // Event table
82  DECLARE_EVENT_TABLE()
83 
84 }; // class InspectorGrid
85 
86 } // namespace Antares::Window::Inspector
87 
88 #endif // __ANTARES_WINDOWS_INSPECTOR_GRID_H__
Definition: frame.h:37
std::shared_ptr< InspectorData > Ptr
The most suitable smart pointer for the class.
Definition: data.h:40
Custom implementation of a property grid.
Definition: grid.h:37