Antares Simulator
Power System Simulator
area.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_INPUT_AREA_H__
22 #define __ANTARES_TOOLBOX_INPUT_AREA_H__
23 
24 #include <yuni/core/event.h>
25 #include <wx/panel.h>
26 #include <antares/study/study.h>
27 #include "input.h"
28 #include <wx/arrstr.h>
29 #include "../components/htmllistbox/component.h"
30 
31 namespace Antares::Toolbox::InputSelector
32 {
36 class Area: public AInput, public Yuni::IEventObserver<Area>
37 {
38 public:
40 
41 
45  Area(wxWindow* parent);
47  virtual ~Area();
48 
50 
51  virtual wxPoint recommendedSize() const
52  {
53  return wxPoint(230, 70);
54  }
55 
59  static Data::Area* lastArea();
60 
61  void reloadLastArea();
62 
63  virtual void update();
64 
65 public:
69  static Yuni::Event<void(Data::Area*)> onAreaChanged;
70 
71 protected:
72  virtual void internalBuildSubControls();
73 
77  void clear();
78 
80  void onDraw(wxPaintEvent& evt);
81 
83  void onStudyEndUpdate();
84 
85 private:
86  void internalSelectionChanged();
87  void onApplicationOnQuit();
88  void onStudyClosed();
89 
90 private:
92  static wxPanel* pSharedSupport;
94  // static Component::HTMLListbox::Component* pAreaListbox;
95  // Event table
96  DECLARE_EVENT_TABLE()
97 
98 }; // class Area
99 
100 } // namespace Antares::Toolbox::InputSelector
101 
102 #endif // __ANTARES_TOOLBOX_INPUT_AREA_H__
Definition for a single area.
Definition: area.h:51
Visual Component for displaying all available areas (and groups)
Definition: area.h:37
virtual void update()
Clear then Update the input.
Definition: area.cpp:529
static Data::Area * lastArea()
Get the last area selected by the component.
Definition: area.cpp:394
virtual ~Area()
Destructor.
Definition: area.cpp:382
void onStudyEndUpdate()
The study has been updated.
Definition: area.cpp:477
static Yuni::Event< void(Data::Area *)> onAreaChanged
Public event, triggered when the selected area has changed.
Definition: area.h:69
Area(wxWindow *parent)
Default Constructor.
Definition: area.cpp:365
void onDraw(wxPaintEvent &evt)
Callback: draw event.
Definition: area.cpp:493
virtual wxPoint recommendedSize() const
Get the recommended size for the control.
Definition: area.h:51
void clear()
Clear the control and broadcast a change in the current selected area.
Definition: area.cpp:439