kexi

scriptmanager.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "scriptmanager.h"
21#include "formscript.h"
22
23#include "form.h"
24#include "formmanager.h"
25// Kross includes
26#include "main/manager.h"
27
29
30ScriptManager::ScriptManager(TQObject *parent, const char *name)
31 : TQObject(parent, name)
32{
33 m_manager = Kross::Api::Manager::scriptManager();
34 m_dict.setAutoDelete(true);
35}
36
37ScriptManager::~ScriptManager()
38{
39}
40
42ScriptManager::newFormScript(Form *form)
43{
44 FormScript *script = new FormScript(form, this);
45 m_dict.insert(form, script);
46 return script;
47}
48
50ScriptManager::scriptForForm(Form *form)
51{
52 return m_dict[form];
53}
54
55void
56ScriptManager::setFormManager(FormManager *manager)
57{
58 m_formManager = manager;
59 connect(m_formManager, TQ_SIGNAL(aboutToDeleteForm(KFormDesigner::Form*)), this, TQ_SLOT(slotFormDeleted(KFormDesigner::Form*)));
60 connect(m_formManager, TQ_SIGNAL(formCreated(KFormDesigner::Form*)), this, TQ_SLOT(newFormScript(KFormDesigner::Form*)));
61}
62
63void
64ScriptManager::slotFormDeleted(KFormDesigner::Form *form)
65{
66 m_dict.remove(form);
67}
68
69#include "scriptmanager.moc"
70
A class that stores the code and events related to a single form.
Definition formscript.h:45
A class to manage (create/load/save) Forms.
Definition formmanager.h:73
A simple class representing a form.
Definition form.h:136