Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
action-panel.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_EXT_SOURCE_ACTION_PANEL_H__
22#define __ANTARES_TOOLBOX_EXT_SOURCE_ACTION_PANEL_H__
23
24#include <action/action.h>
25#include <wx/menu.h>
26#include <wx/menuitem.h>
27#include <ui/common/component/panel.h>
28
29namespace Antares
30{
31namespace Private
32{
33namespace Window
34{
36{
37public:
39 using Vector = std::vector<ActionPanel*>;
40
41 enum
42 {
45 };
46
47 static void DrawBackgroundWithoutItems(wxWindow& obj, wxDC& dc, const wxRect& rect);
48
49public:
51
52
55 ActionPanel(wxWindow* parent,
56 ActionPanel* parentPanel,
57 const Antares::Action::Context::Ptr& context,
58 const Antares::Action::IAction::Ptr& action);
60 virtual ~ActionPanel();
62
63 void expand();
64
65 void collapse();
66
67 void onDraw(wxPaintEvent&);
68
69 void update();
70
71 void forceUpdate();
72
73 virtual void SetFocus();
74
75private:
76 void onEnter(wxMouseEvent&);
77 void onLeave(wxMouseEvent&);
78 void onMouseDown(wxMouseEvent&);
79 void onMouseDownCollapseExpand();
80 void onMouseDownBehaviorSelect(wxWindow* obj);
81 void drawArrows(wxDC& dc, const wxRect& rect);
82
83 void prepareAll(bool force = false);
84
85 void relayoutAllParents();
86 void computeTotalChildrenCount();
87
88 void onBehaviorMerge(wxCommandEvent&);
89 void onBehaviorOverwrite(wxCommandEvent&);
90 void onBehaviorSkip(wxCommandEvent&);
91
92public:
93 ActionPanel* pParent;
94 Antares::Action::Context::Ptr pContext;
96 bool pCollapsed;
97 bool pBold;
98 wxColour pBackgroundColor;
99 wxColour pBackgroundColorLight;
100 wxColour pStateColor[Antares::Action::stMax];
101 wxColour pLineColor;
102 uint pDepthSpace;
103 wxString pText;
104 wxString pBehaviorText;
105 wxString pStateText;
106 wxString pComments;
107 bool pHasChildren;
108 bool pCanDoSomething;
109 bool phasCreatedChildren;
110 static ActionPanel* SelectedItem;
111
112 bool pDisabled;
113 wxMenu* pPopupMenu;
114
115 Antares::Action::State pState;
116 Antares::Action::Behavior pBehavior;
117
118 Vector pChildren;
121
122 // Event table
123 DECLARE_EVENT_TABLE()
124
125}; // class ActionPanel
126
127} // namespace Window
128} // namespace Private
129} // namespace Antares
130
131#endif // __ANTARES_TOOLBOX_EXT_SOURCE_ACTION_PANEL_H__
AncestorType::Ptr Ptr
The most suitable smart ptr for the class.
Definition action.h:43
Panel implementation.
Definition panel.h:36
Definition action-panel.h:36
ActionPanel(wxWindow *parent, ActionPanel *parentPanel, const Antares::Action::Context::Ptr &context, const Antares::Action::IAction::Ptr &action)
Default constructor.
Definition action-panel.cpp:57
uint pTotalChildrenCount
The total of all children for all sub-nodes.
Definition action-panel.h:120
@ itemHeight
Optimal height for a single item.
Definition action-panel.h:44
std::vector< ActionPanel * > Vector
Array.
Definition action-panel.h:39
virtual ~ActionPanel()
Destructor.
Definition action-panel.cpp:111