Gazebo Gui

API Reference

7.2.2
gz/gui/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 
34 namespace gz::gui
35 {
36  class PluginPrivate;
37 
52  class GZ_GUI_VISIBLE Plugin : public QObject
53  {
54  Q_OBJECT
55 
57  public: Plugin();
58 
60  public: virtual ~Plugin();
61 
71  public: void Load(const tinyxml2::XMLElement *_pluginElem);
72 
75  public: virtual std::string ConfigStr();
76 
80  public: QQuickItem *CardItem() const;
81 
84  public: QQuickItem *PluginItem() const;
85 
88  public: QQmlContext *Context() const;
89 
92  public: void PostParentChanges();
93 
102  protected: virtual void LoadConfig(
103  const tinyxml2::XMLElement *_pluginElem)
104  {
105  (void)_pluginElem;
106  }
107 
110  public: virtual std::string Title() const {return this->title;}
111 
115  public: bool DeleteLaterRequested() const;
116 
119  protected: void DeleteLater();
120 
122  protected: std::string title = "";
123 
125  protected: std::string configStr;
126 
133  private: virtual void LoadCommonConfig(
134  const tinyxml2::XMLElement *_gzGuiElem);
135 
138  private: void ApplyAnchors();
139 
142  private: std::unique_ptr<PluginPrivate> dataPtr;
143  };
144 } // namespace gz::gui
145 
146 #ifdef _MSC_VER
147 #pragma warning(pop)
148 #endif
149 
150 #endif // GZ_GUI_PLUGIN_HH_