Ignition Gui

API Reference

2.1.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 namespace ignition
28 {
29  namespace gui
30  {
31  class PluginPrivate;
32 
47  class IGNITION_GUI_VISIBLE Plugin : public QObject
48  {
49  Q_OBJECT
50 
52  public: Plugin();
53 
55  public: virtual ~Plugin();
56 
66  public: void Load(const tinyxml2::XMLElement *_pluginElem);
67 
70  public: virtual std::string ConfigStr();
71 
75  public: QQuickItem *CardItem() const;
76 
79  public: QQuickItem *PluginItem() const;
80 
83  public: QQmlContext *Context() const;
84 
87  public: void PostParentChanges();
88 
97  protected: virtual void LoadConfig(
98  const tinyxml2::XMLElement * /*_pluginElem*/) {}
99 
102  public: virtual std::string Title() const {return this->title;}
103 
107  public: bool DeleteLaterRequested() const;
108 
111  protected: void DeleteLater();
112 
114  protected: std::string title = "";
115 
117  protected: std::string configStr;
118 
125  private: virtual void LoadCommonConfig(
126  const tinyxml2::XMLElement *_ignGuiElem);
127 
130  private: void ApplyAnchors();
131 
134  private: std::unique_ptr<PluginPrivate> dataPtr;
135  };
136  }
137 }
138 
139 #endif
virtual std::string Title() const
Get title.
Definition: Plugin.hh:102
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:97
std::string configStr
XML configuration.
Definition: Plugin.hh:117
Base class for Ignition GUI plugins.
Definition: Plugin.hh:47
STL class.
Definition: Application.hh:33