Ignition Gui

API Reference

6.4.0
Plugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef IGNITION_GUI_PLUGIN_HH_
18 #define IGNITION_GUI_PLUGIN_HH_
19 
20 #include <tinyxml2.h>
21 #include <memory>
22 #include <string>
23 
24 #include "ignition/gui/qt.h"
25 #include "ignition/gui/Export.hh"
26 
27 #ifdef _WIN32
28 // Disable warning C4251 which is triggered by
29 // std::unique_ptr
30 #pragma warning(push)
31 #pragma warning(disable: 4251)
32 #endif
33 
34 namespace ignition
35 {
36  namespace gui
37  {
38  class PluginPrivate;
39 
54  class IGNITION_GUI_VISIBLE Plugin : public QObject
55  {
56  Q_OBJECT
57 
59  public: Plugin();
60 
62  public: virtual ~Plugin();
63 
73  public: void Load(const tinyxml2::XMLElement *_pluginElem);
74 
77  public: virtual std::string ConfigStr();
78 
82  public: QQuickItem *CardItem() const;
83 
86  public: QQuickItem *PluginItem() const;
87 
90  public: QQmlContext *Context() const;
91 
94  public: void PostParentChanges();
95 
104  protected: virtual void LoadConfig(
105  const tinyxml2::XMLElement *_pluginElem)
106  {
107  (void)_pluginElem;
108  }
109 
112  public: virtual std::string Title() const {return this->title;}
113 
117  public: bool DeleteLaterRequested() const;
118 
121  protected: void DeleteLater();
122 
124  protected: std::string title = "";
125 
127  protected: std::string configStr;
128 
135  private: virtual void LoadCommonConfig(
136  const tinyxml2::XMLElement *_ignGuiElem);
137 
140  private: void ApplyAnchors();
141 
144  private: std::unique_ptr<PluginPrivate> dataPtr;
145  };
146  }
147 }
148 
149 #ifdef _MSC_VER
150 #pragma warning(pop)
151 #endif
152 
153 #endif
virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem)
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
Definition: Plugin.hh:104
virtual std::string Title() const
Get title.
Definition: Plugin.hh:112
std::string configStr
XML configuration.
Definition: Plugin.hh:127
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
STL class.