]> Shamusworld >> Repos - architektonas/blob - src/base/rs_scriptlist.h.bak
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / base / rs_scriptlist.h.bak
1 /****************************************************************************
2 ** $Id: rs_scriptlist.h 1960 2005-03-12 12:22:01Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the qcadlib Library project.
7 **
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.
12 **
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.
16 **
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.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef RS_SCRIPTLIST_H
28 #define RS_SCRIPTLIST_H
29
30
31 #include "rs_script.h"
32 #include "rs_ptrlist.h"
33
34 #define RS_SCRIPTLIST RS_ScriptList::instance()
35
36 /**
37  * The global list of scripts. This is implemented as a singleton.
38  * Use RS_ScriptList::instance() to get a pointer to the object.
39  *
40  * OBSOLETE
41  *
42  * @author Andrew Mustun
43  */
44 class RS_ScriptList {
45 protected:
46     RS_ScriptList();
47
48 public:
49     /**
50      * @return Instance to the unique script list.
51      */
52     static RS_ScriptList* instance() {
53         if (uniqueInstance==NULL) {
54             uniqueInstance = new RS_ScriptList();
55         }
56         return uniqueInstance;
57     }
58
59     virtual ~RS_ScriptList() {}
60
61     void init();
62
63     void clearScripts();
64     int countScripts() {
65         return scripts.count();
66     }
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();
80     }
81     /** @return Next script from the list after
82      * calling firstScript() or nextScript().
83      */
84     RS_Script* nextScript() {
85         return scripts.next();
86     }
87
88     //void addScriptListListener(RS_ScriptListListener* listener);
89
90     static bool test();
91
92 protected:
93     static RS_ScriptList* uniqueInstance;
94
95 private:
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;
102 }
103 ;
104
105 #endif