Ignition Gui

API Reference

4.1.1
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 
109  public: virtual std::string Title() const {return this->title;}
110 
114  public: bool DeleteLaterRequested() const;
115 
118  protected: void DeleteLater();
119 
121  protected: std::string title = "";
122 
124  protected: std::string configStr;
125 
132  private: virtual void LoadCommonConfig(
133  const tinyxml2::XMLElement *_ignGuiElem);
134 
137  private: void ApplyAnchors();
138 
141  private: std::unique_ptr<PluginPrivate> dataPtr;
142  };
143  }
144 }
145 
146 #ifdef _MSC_VER
147 #pragma warning(pop)
148 #endif
149 
150 #endif
virtual std::string Title() const
Get title.
Definition: Plugin.hh:109
virtual void LoadConfig(const tinyxml2::XMLElement *)
Load the plugin with a configuration file. Override this on custom plugins to handle custom configura...
Definition: Plugin.hh:104
std::string configStr
XML configuration.
Definition: Plugin.hh:124
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54
STL class.
Definition: Application.hh:40