1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 2 3 /* 4 Rosegarden 5 A MIDI and audio sequencer and musical notation editor. 6 Copyright 2000-2021 the Rosegarden development team. 7 8 Other copyrights also apply to some parts of this work. Please 9 see the AUTHORS file and individual file headers for details. 10 11 This program is free software; you can redistribute it and/or 12 modify it under the terms of the GNU General Public License as 13 published by the Free Software Foundation; either version 2 of the 14 License, or (at your option) any later version. See the file 15 COPYING included with this distribution for more information. 16 */ 17 18 #ifndef RG_BASETOOLBOX_H 19 #define RG_BASETOOLBOX_H 20 21 #include <QHash> 22 #include <QObject> 23 24 25 class QWidget; 26 class QString; 27 28 29 namespace Rosegarden 30 { 31 32 class BaseTool; 33 34 35 /** 36 * BaseToolBox : maintains a single instance of each registered tool. 37 * Tools are fetched by name. 38 */ 39 class BaseToolBox : public QObject 40 { 41 Q_OBJECT 42 43 public: 44 BaseToolBox(QWidget* parent); 45 46 virtual BaseTool* getTool(QString toolName); 47 48 signals: 49 void showContextHelp(const QString &); 50 51 protected: 52 virtual BaseTool* createTool(QString toolName) = 0; 53 54 QHash<QString, BaseTool*> m_tools; 55 }; 56 57 } 58 59 #endif 60