Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/toolgroup.h
00001 /**********************************************************************
00002   ToolGroup - GLWidget manager for Tools.
00003 
00004   Copyright (C) 2007,2008 Donald Ephraim Curtis
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.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 TOOLGROUP_H
00026 #define TOOLGROUP_H
00027 
00028 #include <QObject>
00029 #include <avogadro/plugin.h>
00030 #include <avogadro/tool.h>
00031 
00032 class QActionGroup;
00033 
00034 namespace Avogadro {
00035   class Molecule;
00045   class ToolGroupPrivate;
00046   class A_EXPORT ToolGroup : public QObject
00047   {
00048     Q_OBJECT
00049 
00050     public:
00054       ToolGroup(QObject *parent = 0);
00055 
00059       ~ToolGroup();
00060 
00064       void append(QList<Tool *> tools);
00065       
00069       void append(Tool *tool);
00070 
00074       Tool* activeTool() const;
00075 
00080       Tool* tool(int i) const;
00081 
00085       const QList<Tool *>& tools() const;
00086 
00090       const QActionGroup * activateActions() const;
00091 
00092     public Q_SLOTS:
00096       void setActiveTool(int i);
00097 
00101       void setActiveTool(const QString& name);
00102 
00106       void setActiveTool(Tool *tool);
00107 
00111       void setMolecule(Molecule *molecule);
00112 
00116       void writeSettings(QSettings &settings) const;
00117 
00121       void readSettings(QSettings &settings);
00125       void removeAllTools();
00126 
00127     private Q_SLOTS:
00128       void activateTool();
00129 
00130     Q_SIGNALS:
00134       void toolActivated(Tool *tool);
00139       void toolsDestroyed();
00140 
00141     private:
00142       ToolGroupPrivate * const d;
00143   };
00144 } // end namespace Avogadro
00145 
00146 #endif