MenuInterface.hh 2.99 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
Jan Möbius's avatar
 
Jan Möbius committed
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
Jan Möbius's avatar
 
Jan Möbius committed
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: BasePlugin
//
Jan Möbius's avatar
 
Jan Möbius committed
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39 40 41 42 43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

Jan Möbius's avatar
 
Jan Möbius committed
44 45
#ifndef MENUBARINTERFACE_HH
#define MENUBARINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46 47 48 49

#include <QtGui>
#include <QMenuBar>
#include <OpenFlipper/common/Types.hh>
Jan Möbius's avatar
 
Jan Möbius committed
50

Jan Möbius's avatar
 
Jan Möbius committed
51
enum MenuActionType {
Jan Möbius's avatar
 
Jan Möbius committed
52
    /// The Menu will be created directly inside the Menubar.
Jan Möbius's avatar
 
Jan Möbius committed
53 54
    TOPLEVELMENU,

Jan Möbius's avatar
 
Jan Möbius committed
55 56
    /// The Menu will be added inside the File Menu
    FILEMENU,
Jan Möbius's avatar
 
Jan Möbius committed
57

Jan Möbius's avatar
 
Jan Möbius committed
58
    /// The Menu will be added inside the View Menu
Jan Möbius's avatar
 
Jan Möbius committed
59 60 61 62
    VIEWMENU,

    /// The Menu will be added inside the Tools Menu
    TOOLSMENU
Jan Möbius's avatar
 
Jan Möbius committed
63

Jan Möbius's avatar
 
Jan Möbius committed
64
};
Jan Möbius's avatar
 
Jan Möbius committed
65

Jan Möbius's avatar
 
Jan Möbius committed
66
/** \brief Interface for all plugins which provide entries to the main menubar
Jan Möbius's avatar
 
Jan Möbius committed
67
  *
Jan Möbius's avatar
 
Jan Möbius committed
68
  * To add custom menus to the menubar, you have to use this interface class. Create
Jan Möbius's avatar
 
Jan Möbius committed
69
  * your own QMenu and emit initializeMenu to add it to the menubar. You can connect the
Jan Möbius's avatar
 
Jan Möbius committed
70 71
  * signals and slots for your menu inside the plugin.\n
  * The placement of your menu is controlled by the MenuType. See MenuType for details.
Jan Möbius's avatar
 
Jan Möbius committed
72
 */
Jan Möbius's avatar
 
Jan Möbius committed
73
class MenuInterface {
Jan Möbius's avatar
 
Jan Möbius committed
74 75 76

public :

Jan Möbius's avatar
 
Jan Möbius committed
77 78
  /// Destructor
  virtual ~MenuInterface() {};
Jan Möbius's avatar
 
Jan Möbius committed
79

Jan Möbius's avatar
 
Jan Möbius committed
80
signals:
Jan Möbius's avatar
 
Jan Möbius committed
81
  /**  \brief Adds an action to the menubar
Jan Möbius's avatar
 
Jan Möbius committed
82
    *
Jan Möbius's avatar
 
Jan Möbius committed
83
    *  Add an action to the menubar or one of its sub menus \n
Jan Möbius's avatar
 
Jan Möbius committed
84 85 86
    * \n
    *   Example : \n
    *   QMenu *colorMenu = new QMenu(tr("&Colors")); \n
Jan Möbius's avatar
 
Jan Möbius committed
87
    *   emit addMenubarAction( colorMenu->menuAction(), TOOLSMENU )
Jan Möbius's avatar
 
Jan Möbius committed
88
    * \n
Jan Möbius's avatar
 
Jan Möbius committed
89 90 91 92 93
    * All actions or sub actions can be freely controlled by yourself. You have
    * to connect the required signals and slots to your plugin.
    *
    * @param _action Pointer to the new action
    * @param _type Type of the Action ( See MenuActionType for Details )
Jan Möbius's avatar
 
Jan Möbius committed
94
  */
Jan Möbius's avatar
 
Jan Möbius committed
95
  virtual void addMenubarAction(QAction* /*_action*/, MenuActionType /*_type*/ ) {};
Jan Möbius's avatar
 
Jan Möbius committed
96 97 98

};

Jan Möbius's avatar
 
Jan Möbius committed
99
Q_DECLARE_INTERFACE(MenuInterface,"OpenFlipper.MenuInterface/1.0")
Jan Möbius's avatar
 
Jan Möbius committed
100

Jan Möbius's avatar
 
Jan Möbius committed
101
#endif // MENUBARINTERFACE_HH