Commit 61cc6dd2 authored by Jan Möbius's avatar Jan Möbius

View Mode Interface Documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11138 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 88c15323
......@@ -43,49 +43,24 @@
#ifndef VIEWMODEINTERFACE_HH
#define VIEWMODEINTERFACE_HH
#include <QtGui>
#include <QMenuBar>
#include <QStringList>
/**
* \brief Define View Modes using this interface
*
* This Interface can be used to configure visible widgets in the viewer. A given
* view mode contains a list of toolbars, toolboxes and context menus which should
* be visible if the mode is active. Therefore you can define a subset of the
* full interface for special tasks.
*
* \section ViewModeExample Example using custom view modes
*
* %OpenFlipper comes along with a lot of plugins each offering a wide variety
* of GUI elements such as toolboxes and toolbars. In order to constrain %OpenFlipper's
* interface to a certain number of toolboxes and/or toolbar elements, the ViewModeInterface
* offers means to filter these elements.
*
* So, for example, if we only wanted the toolboxes of the Data Control and the
* Selection plugin to be visible, we have to emit signal defineViewModeToolboxes(QString, QStringList)
* in order to hide out everything else:
*
* \code
* void ExampleViewModePlugin::pluginsInitialized() {
*
* QStringList toolBoxes = QString("Data Control,Selection").split(",");
*
* emit defineViewModeToolboxes("My Custom View Mode", toolBoxes);
* }
* \endcode
*
* When the user selects "My Custom View Mode" out of the view modes menu, all
* toolboxes except for Data Control and Selection will disappear.
* This works analogously for toolbar elements via the signal defineViewModeToolbars(QString, QStringList).
* Additionally, if we wanted the "My Custom View Mode" entry in the view modes menu
* to appear with a fancy icon, we just have to call defineViewModeIcon(QString, QString):
*
* \code
* emit defineViewModeIcon("My Custom View Mode", "myIconFile.png");
* \endcode
*
*/
#include <QtGui>
#include <QMenuBar>
#include <QStringList>
/** \file ViewModeInterface.hh
*
* Specify own view modes setting which toolboxes/toolbars/context menus will be visible . \ref viewModeInterfacePage
*/
/** \brief Interface class for adding view modes to the ui.
\n
\ref viewModeInterfacePage "Detailed description"
\n
*/
class ViewModeInterface {
private slots :
......@@ -102,30 +77,30 @@ class ViewModeInterface {
* With this function you can define a set of toolboxes which should be visible
* for the specified view mode.
*
* @param _mode name of the ViewMode
* @param _usedWidgets list of used Widgets names
* @param _mode Name of the ViewMode
* @param _usedWidgets List of used Widgets names
*/
virtual void defineViewModeToolboxes(QString /*_mode*/, QStringList /*_usedWidgets*/){};
virtual void defineViewModeToolboxes(QString _mode, QStringList _usedWidgets){};
/** \brief Defines a ViewMode for the Toolbars
*
* With this function you can define a set of toolbars which should be visible
* for the specified view mode.
*
* @param _mode name of the ViewMode
* @param _usedWidgets list of used toolbars
* @param _mode Name of the ViewMode
* @param _usedWidgets List of used toolbars
*/
virtual void defineViewModeToolbars(QString /*_mode*/, QStringList /*_usedToolbars*/){};
virtual void defineViewModeToolbars(QString _mode, QStringList _usedToolbars){};
/** \brief Defines a ViewMode for the Toolbars
/** \brief Defines a ViewMode for the context menus
*
* With this function you can define a set of context menus which should be visible
* for the specified view mode.
*
* @param _mode name of the ViewMode
* @param _usedWidgets list of used context menus
* @param _mode Name of the ViewMode
* @param _usedWidgets List of used context menus
*/
virtual void defineViewModeContextMenus(QString /*_mode*/, QStringList /*_usedContextMenus*/){};
virtual void defineViewModeContextMenus(QString _mode, QStringList _usedContextMenus){};
/** \brief Defines an Icon for a ViewMode
*
......@@ -134,23 +109,86 @@ class ViewModeInterface {
* home directory.\n
* The Icon should have a size of 150x150 pixels.
*
* @param _mode name of the ViewMode
* @param _iconName Name of the Icon used for this view mode
* @param _mode Name of the ViewMode
* @param _iconName Filename of the Icon used for this view mode
*/
virtual void defineViewModeIcon(QString /*_mode*/, QString /*_iconName*/){};
virtual void defineViewModeIcon(QString _mode, QString _iconName){};
/** \brief Set a ViewMode
*
* With this function you can set a viewMode
* With this function you can switch to a viewMode
* This will show all corresponding toolboxes/toolbars
*
* @param _mode name of the ViewMode
* @param _mode Name of the ViewMode
* @param _expandAll Expand all toolboxes
*/
virtual void setViewMode(QString /*_mode*/, bool /*_expandAll*/ = false){};
virtual void setViewMode(QString _mode, bool _expandAll = false){};
};
/** \page viewModeInterfacePage View Mode Interface
\image html ViewModeInterface.png
\n
This Interface can be used to configure visible widgets and menus in the viewer. A given
view mode contains a list of toolbars, toolboxes and context menus which should
be visible if the mode is active. Therefore you can define a subset of the
full interface for special tasks.
\section ViewModeExample Example using custom view modes
%OpenFlipper comes along with a lot of plugins each offering a wide variety
of GUI elements such as toolboxes and toolbars. In order to constrain %OpenFlipper's
interface to a certain number of toolboxes and/or toolbar elements, the ViewModeInterface
offers means to filter these elements.
So, for example, if we only wanted the toolboxes of the Data Control and the
Selection plugin to be visible, we have to emit signal ViewModeInterface::defineViewModeToolboxes(QString, QStringList)
in order to hide out everything else:
\code
// In your plugin initialization, define the view modes:
void ExamplePlugin::pluginsInitialized() {
// Generate the list of toolboxes to use:
QStringList toolBoxes = QString("Data Control,Selection").split(",");
// Define the view mode.
emit defineViewModeToolboxes("My Custom View Mode", toolBoxes);
//define the viewMode Toolbars
QStringList toolBars;
toolBars.push_back( "Selection" );
emit defineViewModeToolbars("My Custom View Mode", toolBars);
}
\endcode
When the user selects "My Custom View Mode" out of the view modes menu, all
toolboxes except for Data Control and Selection will disappear.
This works analogously for toolbar elements via the signal ViewModeInterface::defineViewModeToolbars(QString, QStringList).
\section Icons
Additionally, if we wanted the "My Custom View Mode" entry in the view modes menu
to appear with a fancy icon, we just have to call ViewModeInterface::defineViewModeIcon(QString, QString):
\code
emit defineViewModeIcon("My Custom View Mode", "myIconFile.png");
\endcode
\section Usage
To use the ViewModeInterface:
<ul>
<li> include ViewModeInterface.hh in your plugins header file
<li> derive your plugin from the class ViewModeInterface
<li> add Q_INTERFACES(ViewModeInterface) to your plugin class
<li> And add the signals you want to use to your plugin class
</ul>
*/
Q_DECLARE_INTERFACE(ViewModeInterface,"OpenFlipper.ViewModeInterface/1.0")
#endif // VIEWMODEINTERFACE_HH
......@@ -63,7 +63,6 @@ ProcessInterface
SecurityInterface
TextureInterface
ViewInterface
ViewModeInterface
\section pluginInterfacesOtherOverview Available Interfaces for controlling other functions
......@@ -91,11 +90,6 @@ Handle mouse picking in your plugin ( PickingInterface )
Provides functions to read and write custom filetypes ( FileInterface )
\subsection ViewModePlugin View Mode Interface
\image html ViewModeInterface.png
Specify own view modes ( ViewModeInterface )
\subsection ViewPlugin View Interface
\image html ViewInterface.png
This interface is used to add additional view widgets ( ViewInterface ).
......@@ -152,6 +146,12 @@ Provides functions to create a separate widget in the toolbox on the right ( \re
\image html ToolbarInterface.png
Provides a function to add toolbar buttons. ( \ref toolbarInterfacePage )
\n
\subpage viewModeInterfacePage
\image html ViewModeInterface.png
Specify own view modes setting which toolboxes/toolbars/context menus will be visible( \ref viewModeInterfacePage )
*/
/** \page pluginInterfacesDataHandling Object and Data Handling
......
Markdown is supported
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