Antares Simulator
Power System Simulator
clipboard.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_CLIPBOARD_CLIPBOARD_H__
22 #define __ANTARES_TOOLBOX_CLIPBOARD_CLIPBOARD_H__
23 
24 #include <antares/array/matrix.h>
25 #include <memory>
26 #include <vector>
27 #include "../components/datagrid/gridhelper.h"
28 
29 
30 namespace Antares::Toolbox
31 {
32 class Clipboard final
33 {
34 public:
35  enum Type
36  {
37  typeText,
38  typeHTML
39  };
40 
41  static void GetFromClipboard(Yuni::String& out);
42 
43 public:
45 
46 
49  Clipboard();
51  ~Clipboard();
53 
54  void clear();
55  void add(const Matrix<>& m);
57  uint offsetX = 0,
58  uint offsetY = 0,
59  uint offsetX2 = (uint)-1,
60  uint offsetY2 = (uint)-1,
61  bool withStyle = true,
62  bool withHeaders = true);
63 
64  void add(const Yuni::String& text);
65  void add(const Yuni::String::Ptr& text);
66 
67  void copy();
68 
69 private:
70  class Item final
71  {
72  public:
73  using Ptr = std::shared_ptr<Item>;
74 
75  public:
76  Item(const Type t, Yuni::String::Ptr d) : type(t), data(d)
77  {
78  }
79  const Type type;
80  Yuni::String::Ptr data;
81  };
82 
83  using List = std::vector<Item::Ptr>;
84  List pList;
85 
86 }; // class Clipboard
87 
88 } // namespace Antares::Toolbox
89 
90 
91 #endif // __ANTARES_TOOLBOX_CLIPBOARD_CLIPBOARD_H__
Wrapper between a wxGridTableBase and a renderer
Definition: gridhelper.h:42
A n-by-n matrix.
Definition: matrix.h:44
Definition: clipboard.h:33
~Clipboard()
Destructor.
Definition: clipboard.cpp:40
Clipboard()
Constructor.
Definition: clipboard.cpp:36