Developer Documentation

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