Developer Documentation

MouseAndKeyPlugin.hh
1 #ifndef MOUSEANDKEYPLUGIN_HH
2 #define MOUSEANDKEYPLUGIN_HH
3
4 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
5 #include <OpenFlipper/BasePlugin/MouseInterface.hh>
6 #include <OpenFlipper/BasePlugin/PickingInterface.hh>
7 #include <OpenFlipper/BasePlugin/KeyInterface.hh>
8 #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
9 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
10 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
11 #include <OpenFlipper/common/Types.hh>
12
13 class MouseAndKeyPlugin: public QObject,
14 BaseInterface,
15 MouseInterface,
16 PickingInterface,
17 ContextMenuInterface,
18 ToolboxInterface,
19 KeyInterface,
20 LoggingInterface {
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
68 MouseAndKeyPlugin();
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
ContextMenuInterface
Interface class for creating custom context menus.
Definition: ContextMenuInterface.hh:85
UpdateType
Update type class.
Definition: UpdateType.hh:60
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:92
MouseInterface.hh
LoggingInterface.hh
PickingInterface.hh
MouseInterface
Interface class for receiving mouse events.
Definition: MouseInterface.hh:61
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:112
MouseAndKeyPlugin
Definition: MouseAndKeyPlugin.hh:13
BaseInterface.hh
PickingInterface
Allow access to picking functions.
Definition: PickingInterface.hh:62
KeyInterface.hh
ContextMenuInterface.hh
ToolboxInterface
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
Definition: ToolboxInterface.hh:68
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:65
MouseAndKeyPlugin::name
QString name()
Return a name for the plugin.
Definition: MouseAndKeyPlugin.hh:65
ToolboxInterface.hh
ACG::Matrix4x4T< double >
Types.hh
KeyInterface
Keyboard Event Interface.
Definition: KeyInterface.hh:59
DataType
Predefined datatypes.
Definition: DataTypes.hh:83
OpenMesh::VectorT
Definition: Vector11T.hh:83
MouseAndKeyPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: MouseAndKeyPlugin.hh:66
ContextMenuType
ContextMenuType
Definition: ContextMenuInterface.hh:56