kalzium
aligntool.h
Go to the documentation of this file.00001 /********************************************************************** 00002 AlignTool - AlignTool Tool for Avogadro 00003 00004 Copyright (C) 2008 Marcus D. Hanwell 00005 00006 This file is part of the Avogadro molecular editor project. 00007 For more information, see <http://avogadro.sourceforge.net/> 00008 00009 Avogadro is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 Avogadro is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00022 02110-1301, USA. 00023 **********************************************************************/ 00024 00025 #ifndef ALIGNTOOL_H 00026 #define ALIGNTOOL_H 00027 00028 #include <avogadro/glwidget.h> 00029 #include <avogadro/tool.h> 00030 00031 #include <QGLWidget> 00032 #include <QObject> 00033 #include <QStringList> 00034 #include <QVarLengthArray> 00035 #include <QImage> 00036 #include <QAction> 00037 #include <QPointer> 00038 00039 namespace Avogadro { 00040 00041 class AlignTool : public Tool 00042 { 00043 Q_OBJECT 00044 00045 public: 00047 AlignTool(QObject *parent = 0); 00049 virtual ~AlignTool(); 00050 00052 00053 00054 virtual QString name() const { return(tr("Align")); } 00056 virtual QString description() const { return(tr("Align molecules")); } 00058 00060 00061 00062 00064 virtual QUndoCommand* mousePress(GLWidget *widget, const QMouseEvent *event); 00065 virtual QUndoCommand* mouseRelease(GLWidget *widget, const QMouseEvent *event); 00066 virtual QUndoCommand* mouseMove(GLWidget *widget, const QMouseEvent *event); 00067 virtual QUndoCommand* wheel(GLWidget *widget, const QWheelEvent *event); 00068 00069 virtual bool paint(GLWidget *widget); 00070 00071 virtual QWidget *settingsWidget(); 00072 00073 public Q_SLOTS: 00074 void axisChanged(int axis); 00075 void alignChanged(int align); 00076 void align(); 00077 00078 private: 00079 // Guarded pointers, for storing pointers to things that might go poof... 00080 QPointer<Molecule> m_molecule; 00081 QVarLengthArray<QPointer<Atom>, 2> m_selectedAtoms; 00082 int m_numSelectedAtoms; 00083 int m_axis; 00084 int m_alignType; 00085 00086 QWidget *m_settingsWidget; 00087 00088 private Q_SLOTS: 00089 void settingsWidgetDestroyed(); 00090 00091 }; 00092 00093 class AlignToolFactory : public QObject, public ToolFactory 00094 { 00095 Q_OBJECT 00096 Q_INTERFACES(Avogadro::ToolFactory) 00097 00098 public: 00099 Tool *createInstance(QObject *parent = 0) { return new AlignTool(parent); } 00100 }; 00101 00102 } // end namespace Avogadro 00103 00104 #endif
KDE 4.2 API Reference