1 /****************************************************************************
2 ** $Id: rs_scriptlist.h 1960 2005-03-12 12:22:01Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the qcadlib Library project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
27 #ifndef RS_SCRIPTLIST_H
28 #define RS_SCRIPTLIST_H
31 #include "rs_script.h"
32 #include "rs_ptrlist.h"
34 #define RS_SCRIPTLIST RS_ScriptList::instance()
37 * The global list of scripts. This is implemented as a singleton.
38 * Use RS_ScriptList::instance() to get a pointer to the object.
42 * @author Andrew Mustun
50 * @return Instance to the unique script list.
52 static RS_ScriptList* instance() {
53 if (uniqueInstance==NULL) {
54 uniqueInstance = new RS_ScriptList();
56 return uniqueInstance;
59 virtual ~RS_ScriptList() {}
65 return scripts.count();
67 //void activateScript(const RS_String& name);
68 //void activateScript(RS_Script* script);
69 ////! @return The active script of NULL if no script is activated.
70 //RS_Script* getActiveScript() { return activeScript; }
71 //virtual void addScript(RS_Script* script);
72 virtual void removeScript(RS_Script* script);
73 //virtual void editScript(RS_Script* script, const RS_Script& source);
74 RS_Script* requestScript(const RS_String& name);
75 //RS_Script* loadScript(const RS_String& name);
76 //void toggleScript(const RS_String& name);
77 //! @return First script of the list.
78 RS_Script* firstScript() {
79 return scripts.first();
81 /** @return Next script from the list after
82 * calling firstScript() or nextScript().
84 RS_Script* nextScript() {
85 return scripts.next();
88 //void addScriptListListener(RS_ScriptListListener* listener);
93 static RS_ScriptList* uniqueInstance;
96 //! all scripts available
97 RS_PtrList<RS_Script> scripts;
98 //! List of registered ScriptListListeners
99 //RS_PtrList<RS_ScriptListListener> scriptListListeners;
100 //! Currently active script
101 //RS_Script* activeScript;