##

GuiPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GZ_GUI_PLUGIN_HH_
#define _GZ_GUI_PLUGIN_HH_
#include "gazebo/gui/qt.h"
#include "gazebo/common/Plugin.hh"
namespace gazebo
{
class GZ_GUI_VISIBLE GUIPlugin : public QWidget, public PluginT<GUIPlugin>
{
public: GUIPlugin() : QWidget(NULL)
{this->type = GUI_PLUGIN;}
public: virtual void Load(sdf::ElementPtr /*_sdf*/) {}
// \brief must be defined to support style sheets
public: virtual void paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
};
#define GZ_REGISTER_GUI_PLUGIN(classname) \
extern "C" GZ_PLUGIN_VISIBLE gazebo::GUIPlugin *RegisterPlugin(); \
gazebo::GUIPlugin *RegisterPlugin() \
{\
return new classname();\
}
}
#endif
gazebo::GUIPlugin
A plugin loaded within the gzclient on startup.
Definition: GuiPlugin.hh:26
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
qt.h
NULL
#define NULL
Definition: CommonTypes.hh:31
gazebo::PluginT< GUIPlugin >::type
PluginType type
Type of plugin.
Definition: Plugin.hh:255
gazebo::GUIPlugin::paintEvent
virtual void paintEvent(QPaintEvent *)
Definition: GuiPlugin.hh:43
gazebo::PluginT
A class which all plugins must inherit from.
Definition: Plugin.hh:75
gazebo::GUIPlugin::Load
virtual void Load(sdf::ElementPtr)
Load function.
Definition: GuiPlugin.hh:40
gazebo::GUIPlugin::GUIPlugin
GUIPlugin()
Definition: GuiPlugin.hh:28
gazebo::GUI_PLUGIN
A GUI plugin.
Definition: Plugin.hh:68
Plugin.hh