Developer Documentation
MouseAndKeyPlugin.hh
1 #ifndef MOUSEANDKEYPLUGIN_HH
2 #define MOUSEANDKEYPLUGIN_HH
3 
12 
13 class MouseAndKeyPlugin: public QObject,
21  Q_OBJECT
22  Q_INTERFACES(BaseInterface)
23  Q_INTERFACES(MouseInterface)
24  Q_INTERFACES(PickingInterface)
25  Q_INTERFACES(KeyInterface)
26  Q_INTERFACES(ContextMenuInterface)
27  Q_INTERFACES(ToolboxInterface)
28  Q_INTERFACES(LoggingInterface)
29 
30  signals:
31 
32  //BaseInterface
33  void updateView();
34  void updatedObject(int _identifier, const UpdateType& _type);
35  //LoggingInterface
36  void log(Logtype _type, QString _message);
37  void log(QString _message);
38  //ContextMenuInterface
39  void addContextMenuItem(QAction* _action , ContextMenuType _type);
40  void addContextMenuItem(QAction* _action , DataType _objectType , ContextMenuType _type );
41  //PickingInterface
42  void addPickMode(const std::string& _mode);
43  void addHiddenPickMode(const std::string& _mode);
44  //KeyInterface
45  void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
46 
47  // ToolboxInterface
48  void addToolbox(QString _name, QWidget* _widget);
49 
50  private slots:
51 
52  // BaseInterface
53  void initializePlugin();
54  void pluginsInitialized();
55  //MouseInterface
56  void slotMouseEvent( QMouseEvent* _event );
57  //KeyInterface
58  void slotKeyEvent( QKeyEvent* _event );
59  //PickingInterface
60  void slotPickModeChanged( const std::string& _mode);
61 
62  public:
63 
64  // BaseInterface
65  QString name() {return (QString("Mouse and Keyboard Plugin"));};
66  QString description() {return (QString("Shows some basic mouse and key embedding"));};
67 
69 
70  private:
71 
72  // Transform geometry with given Matrix
73  template <typename MeshT>
74  void transformMesh(ACG::Matrix4x4d _mat , MeshT& _mesh );
75 
76  // The context menu action
77  QMenu* contextMenuEntry_;
78 
79  // The toolbox widget and the button in it
80  QWidget* tool_;
81  QPushButton* pickButton_;
82 
83  // Last picked object
84  int activeObject_;
85 
86  // Rotation axes
87  ACG::Vec3d axis_x_;
88  ACG::Vec3d axis_y_;
89 
90  private slots:
91 
92  // Is called each time the button in the toolbox is clicked
93  void slotButtonClicked();
94 
95  // Is called if context menu item has been selected
96  void contextMenuItemSelected(QAction* _action);
97 
98  public slots:
99  QString version() { return QString("1.0"); };
100 };
101 
102 #endif //MOUSEANDKEYPLUGIN_HH
Interface class for creating custom context menus.
Interface class for receiving mouse events.
Predefined datatypes.
Definition: DataTypes.hh:96
QString name()
Return a name for the plugin.
Logtype
Log types for Message Window.
Keyboard Event Interface.
Definition: KeyInterface.hh:76
Interface class from which all plugins have to be created.
Update type class.
Definition: UpdateType.hh:70
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Interface for all Plugins which do logging to the logging window of the framework.
QString description()
Return a description of what the plugin is doing.
Allow access to picking functions.