Gazebo Gui

API Reference

8.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 GZ_GUI_PLUGIN_HH_
18#define GZ_GUI_PLUGIN_HH_
19
20#include <tinyxml2.h>
21#include <memory>
22#include <string>
23
24#include "gz/gui/qt.h"
25#include "gz/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
34namespace gz::gui
35{
37 namespace plugins {}
38
39 class PluginPrivate;
40
55 class GZ_GUI_VISIBLE Plugin : public QObject
56 {
57 Q_OBJECT
58
60 public: Plugin();
61
63 public: virtual ~Plugin();
64
74 public: void Load(const tinyxml2::XMLElement *_pluginElem);
75
78 public: virtual std::string ConfigStr();
79
83 public: QQuickItem *CardItem() const;
84
87 public: QQuickItem *PluginItem() const;
88
91 public: QQmlContext *Context() const;
92
95 public: void PostParentChanges();
96
105 protected: virtual void LoadConfig(
106 const tinyxml2::XMLElement *_pluginElem)
107 {
108 (void)_pluginElem;
109 }
110
113 public: virtual std::string Title() const {return this->title;}
114
118 public: bool DeleteLaterRequested() const;
119
122 protected: void DeleteLater();
123
125 protected: std::string title = "";
126
129
136 private: virtual void LoadCommonConfig(
137 const tinyxml2::XMLElement *_gzGuiElem);
138
141 private: void ApplyAnchors();
142
145 private: std::unique_ptr<PluginPrivate> dataPtr;
146 };
147} // namespace gz::gui
148
149#ifdef _MSC_VER
150#pragma warning(pop)
151#endif
152
153#endif // GZ_GUI_PLUGIN_HH_