1
// Copyright (C) 2003 Dominique Devriese <devriese@kde.org>
3
// This program is free software; you can redistribute it and/or
4
// modify it under the terms of the GNU General Public License
5
// as published by the Free Software Foundation; either version 2
6
// of the License, or (at your option) any later version.
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
#ifndef KIG_SCRIPTING_SCRIPT_MODE_H
19
#define KIG_SCRIPTING_SCRIPT_MODE_H
21
#include "script-common.h"
23
#include "../modes/base_mode.h"
27
class NewScriptWizard;
30
* Base mode to interact with a script.
36
ScriptModeBase( KigPart& doc );
38
// mp: argument list is implemented as a std::list instead of std::set
39
// because otherwise the user loses the correct argument ordering (in
40
// case of more than one argument
41
std::list<ObjectHolder*> margs;
42
NewScriptWizard* mwizard;
46
enum WAWD { SelectingArgs, EnteringCode };
50
ScriptType::Type mtype;
53
virtual ~ScriptModeBase();
55
void dragRect( const QPoint& p, KigWidget& w );
56
// void dragObject( const Objects& os, const QPoint& pointClickedOn, KigWidget& w, bool ctrlOrShiftDown );
57
void leftClickedObject( ObjectHolder* o, const QPoint& p,
58
KigWidget& w, bool actrlOrShiftDown );
59
void mouseMoved( const std::vector<ObjectHolder*>& os, const QPoint& p,
60
KigWidget& w, bool shiftpressed );
61
void midClicked( const QPoint&, KigWidget& );
62
void rightClicked( const std::vector<ObjectHolder*>&, const QPoint&, KigWidget& );
64
void argsPageEntered();
65
void codePageEntered();
67
virtual bool queryFinish() = 0;
68
virtual bool queryCancel() = 0;
70
void redrawScreen( KigWidget* w );
76
void setScriptType( ScriptType::Type type );
78
void addArgs( const std::vector<ObjectHolder*>& obj, KigWidget& w );
85
* Script mode to create a script.
87
class ScriptCreationMode
88
: public ScriptModeBase
91
ScriptCreationMode( KigPart& doc );
92
virtual ~ScriptCreationMode();
94
virtual bool queryFinish();
95
virtual bool queryCancel();
99
* Script mode to edit an already-built script.
102
: public ScriptModeBase
105
ObjectTypeCalcer* mexecuted;
106
std::vector<ObjectCalcer*> mexecargs;
107
std::vector<ObjectCalcer*> mcompiledargs;
112
ScriptEditMode( ObjectTypeCalcer* exec_calc, KigPart& doc );
113
virtual ~ScriptEditMode();
115
virtual bool queryFinish();
116
virtual bool queryCancel();