Antares Simulator
Power System Simulator
wx-wrapper.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_WX_WIDGETS_H__
22 #define __ANTARES_TOOLBOX_WX_WIDGETS_H__
23 
24 #if defined(__cplusplus)
25 #include <yuni/yuni.h>
26 #include <yuni/core/string.h>
27 #include <antares/study/fwd.h>
28 #endif
29 
30 #if defined(__cplusplus)
31 
33 //# include "wx/wxprec.h"
34 
35 // forward declarations
36 class wxScrolledWindow;
37 
38 #include <wx/defs.h>
39 #include <wx/object.h>
40 #include <wx/dynarray.h>
41 #include <wx/list.h>
42 #include <wx/hash.h>
43 #include <wx/string.h>
44 #include <wx/hashmap.h>
45 #include <wx/arrstr.h>
46 #include <wx/intl.h>
47 #include <wx/event.h>
48 #include <wx/app.h>
49 #include <wx/utils.h>
50 #include <wx/stream.h>
51 #include <wx/memory.h>
52 #include <wx/window.h>
53 
54 #include "wx/validate.h"
55 
56 #if !wxUSE_MENUS
57 #error "Requires wxUSE_MENUS=1"
58 #endif // wxUSE_MENUS
59 
60 /* not all ports have support for EVT_CONTEXT_MENU yet, don't define
61 ** USE_CONTEXT_MENU for those which don't
62 */
63 #if defined(__WXMOTIF__) || defined(__WXPM__) || defined(__WXX11__) || defined(__WXMGL__)
64 #define USE_CONTEXT_MENU 0
65 #else
66 #define USE_CONTEXT_MENU 1
67 #endif
68 
69 #ifndef wxUSE_LIBPNG
70 #error "The wxWidgets library must be compiled with the PNG support"
71 #endif
72 
78 // std::string
79 wxString wxStringFromUTF8(const std::string& s);
80 // C-String
81 wxString wxStringFromUTF8(const char* s);
82 // Fixed length
83 wxString wxStringFromUTF8(const char* const s, uint length);
84 // Yuni::String
85 wxString wxStringFromUTF8(const Yuni::String& s);
86 // Yuni::CString
87 template<uint ChunkT, bool FixedT>
88 wxString wxStringFromUTF8(const Yuni::CString<ChunkT, FixedT>& s);
89 
93 template<class StringT>
94 void wxStringToString(const wxString& s, StringT& out);
95 
99 wxString DoubleToWxString(double f);
100 
104 template<int PrecisionT>
105 wxString DoubleToWxStringS(double f);
106 
110 wxString DoubleToWxString(double f, uint precision);
111 
115 double wxStringToDouble(const wxString& s, double defValue = 0.);
116 
120 template<class StringT1, class StringT2>
121 void AppendWithQuotes(StringT1& out, const StringT2& text);
122 
126 wxWindow* wxFindFrameParent(wxWindow* control);
127 
128 #include "wx-wrapper.hxx"
129 #include "fwd.h"
130 #include "dispatcher.h"
131 
132 #else /* C++ */
133 
134 #include <yuni/yuni.h>
135 
136 #endif
137 
138 #endif /* __ANTARES_TOOLBOX_WX_WIDGETS_H__ */