OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PluginMenu.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef PLUGINMENU_H
9 #define PLUGINMENU_H
10 
11 #include <string>
12 #include <vector>
13 #include "ui/Owner.h"
14 
15 namespace opencover
16 {
17 namespace ui
18 {
19 class Button;
20 class Menu;
21 }
22 }
23 
24 namespace opencover
25 {
26 
27 class coVRPlugin;
28 
29 class PluginMenu: public ui::Owner
30 {
31 public:
32  static PluginMenu *instance();
33 
34  void updateState();
35  void addEntry(const std::string &name, coVRPlugin *plugin);
36  void addEntry(const std::string &name);
37  void init();
38 
39 private:
40  PluginMenu();
41  ~PluginMenu();
42  void scanPlugins();
43 
44  struct Plugin
45  {
46  std::string name;
47  ui::Button *button = nullptr;
48  coVRPlugin *plugin = nullptr;
49  bool configured = false;
50 
51  Plugin(const std::string &name)
52  : name(name)
53  {
54  }
55 
56  void add(ui::Menu *menu, bool onlyTui=false);
57  };
58 
59  std::map<std::string, Plugin> items;
60  ui::Menu *menu = nullptr;
61 
62  static PluginMenu *s_instance;
63 };
64 }
65 #endif
static PluginMenu * instance()
Definition: PluginMenu.h:29
make sure to clean up properly in the plugin&#39;s dtor
Definition: coVRPlugin.h:70
void addEntry(const std::string &name, coVRPlugin *plugin)