Commit e3553b10 authored by Jan Möbius's avatar Jan Möbius
Browse files

Documented Toolbar Interface

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d1389cdd
......@@ -49,10 +49,20 @@
#include <OpenFlipper/common/Types.hh>
#include <QToolBar>
/** \file ToolbarInterface
* Interface for adding per plugin toolbars to OpenFlippers UI.\ref toolbarInterfacePage
* \ref toolbarInterfacePage "Detailed description"
* \n
* This Interface should be used by plugins which will provide a toolbar.
* Each Plugin can create own Toolbars. Emit
* Each Plugin can create own toolbars.
class ToolbarInterface {
private slots :
......@@ -69,14 +79,14 @@ class ToolbarInterface {
* To create your own Toolbar, emit this signal with a pointer to your Toolbar.
* @param _toolbar Your Toolbar
virtual void addToolbar(QToolBar* /*_toolbar*/) {};
virtual void addToolbar(QToolBar* _toolbar) {};
/** \brief Remove a Toolbar from the main widget
* @param _toolbar Toolbar to be removed
virtual void removeToolbar(QToolBar* /*_toolbar*/) {};
virtual void removeToolbar(QToolBar* _toolbar) {};
/** \brief Get a pointer to a Toolbar of the given name or 0 if it does not exist.
......@@ -84,11 +94,60 @@ class ToolbarInterface {
* @param _name Name of the Toolbar
* @param _toolbar requested Toolbar or 0
virtual void getToolBar( QString /*_name*/, QToolBar*& /*_toolbar*/ ) {};
virtual void getToolBar( QString _name, QToolBar*& _toolbar ) {};
/** \page toolbarInterfacePage Toolbar Interface
\image html ToolbarInterface.png
The ToolbarInterface can be used by plugins to add toolbars to OpenFlippers
UI. The toolbars are located above the GL viewer (See image).
To use the ToolbarInterface:
<li> include ToolbarInterface in your plugins header file
<li> derive your plugin from the class ToolbarInterface
<li> add Q_INTERFACES(ToolbarInterface) to your plugin class
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup
your toolbars.
The following code shows a simple example to create a simple toolbar.
void ExamplePlugin::pluginsInitialized()
// Create your toolbar
QToolBar* toolbar = new QToolBar(tr("Example Toolbar"));
// Create an action for the toolbar
QAction* exampleAction = new QAction(tr("&Toolbar Button"), this);
// Create an icon which is shown for the action
// Add the action to the toolbar
// Integrate the new toolbar into OpenFlipper
emit addToolbar( toolbar );
Signals and slots of your toolbar (e.g. from an action inside it) can be directly connected to signals and slots in
your plugin. Therefore the embedding of the toolbar is fully transparent.
......@@ -124,16 +124,16 @@ add an icon to the toolbox.
The following code shows a simple example to create an empty toolbox.
void SmootherPlugin::pluginsInitialized()
void ExamplePlugin::pluginsInitialized()
// Create the Toolbox Widget
QWidget* toolBox = new QWidget();
// Create an icon which is shown along with the toolbox
QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"smoother1.png");
QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"exampleIcon.png");
// Tell the core to include the new toolbox widget with the name Simple Smoother, a pointer to the widget and a pointer to the icon
emit addToolbox( tr("Simple Smoother") , toolBox, toolIcon );
emit addToolbox( tr("Example Plugin Toolbox") , toolBox, toolIcon );
......@@ -58,6 +58,13 @@ Provides a function to create entries in the menubar ( \ref menuInterfacePage ).
Provides functions to create a separate widget in the toolbox on the right ( \ref toolboxInterfacePage ).
\subpage toolbarInterfacePage
\image html ToolbarInterface.png
Provides a function to add toolbar buttons. ( \ref toolbarInterfacePage )
\section pluginInterfacesOtherOverview Available Interfaces for controlling other functions
This section gives an overview over the available interfaces which control other parts of OpenFlipper.
......@@ -83,11 +90,6 @@ Provides functions to handle mesh files and load / unload geometry
objects into the scene graph ( LoadSaveInterface ).
\subsection ToolbarPlugin Toolbar Interface
\image html ToolbarInterface.png
Provides a function to add toolbar buttons. ( ToolbarInterface )
\subpage loggingInterfacePage
\image html LoggingInterface.png
This is an Interface for Logging to the included log widget. You can log to different levels
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment