MouseAndKeyPlugin.hh
00001 #ifndef MOUSEANDKEYPLUGIN_HH
00002 #define MOUSEANDKEYPLUGIN_HH
00003
00004 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
00005 #include <OpenFlipper/BasePlugin/MouseInterface.hh>
00006 #include <OpenFlipper/BasePlugin/PickingInterface.hh>
00007 #include <OpenFlipper/BasePlugin/KeyInterface.hh>
00008 #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
00009 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
00010 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
00011 #include <OpenFlipper/common/Types.hh>
00012
00013 class MouseAndKeyPlugin: public QObject,
00014 BaseInterface,
00015 MouseInterface,
00016 PickingInterface,
00017 ContextMenuInterface,
00018 ToolboxInterface,
00019 KeyInterface,
00020 LoggingInterface {
00021 Q_OBJECT
00022 Q_INTERFACES(BaseInterface)
00023 Q_INTERFACES(MouseInterface)
00024 Q_INTERFACES(PickingInterface)
00025 Q_INTERFACES(KeyInterface)
00026 Q_INTERFACES(ContextMenuInterface)
00027 Q_INTERFACES(ToolboxInterface)
00028 Q_INTERFACES(LoggingInterface)
00029
00030 signals:
00031
00032
00033 void updateView();
00034 void updatedObject(int _id);
00035
00036 void log(Logtype _type, QString _message);
00037 void log(QString _message);
00038
00039 void addContextMenuItem(QAction* _action , ContextMenuType _type);
00040 void addContextMenuItem(QAction* _action , DataType _objectType , ContextMenuType _type );
00041
00042 void addPickMode(const std::string _mode);
00043 void addHiddenPickMode(const std::string _mode);
00044
00045 void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse = false);
00046
00047 void addToolbox( QString _name , QWidget* _widget );
00048
00049 private slots:
00050
00051
00052 void initializePlugin();
00053 void pluginsInitialized();
00054
00055 void slotMouseEvent( QMouseEvent* _event );
00056
00057 void slotKeyEvent( QKeyEvent* _event );
00058
00059 void slotPickModeChanged( const std::string& _mode);
00060
00061 public:
00062
00063
00064 QString name() {return (QString("Mouse and Keyboard Plugin"));};
00065 QString description() {return (QString("Shows some basic mouse and key embedding"));};
00066
00067 private:
00068
00069
00070 template <typename MeshT>
00071 void transformMesh(ACG::Matrix4x4d _mat , MeshT& _mesh );
00072
00073
00074 QMenu* contextMenuEntry_;
00075
00076
00077 QWidget* tool_;
00078 QPushButton* pickButton_;
00079
00080
00081 int activeObject_;
00082
00083
00084 ACG::Vec3d axis_x_;
00085 ACG::Vec3d axis_y_;
00086
00087 private slots:
00088
00089
00090 void slotButtonClicked();
00091
00092
00093 void contextMenuItemSelected(QAction* _action);
00094
00095 public slots:
00096 QString version() { return QString("1.0"); };
00097 };
00098
00099 #endif //MOUSEANDKEYPLUGIN_HH