1
#ifndef _KVI_KVS_CALLBACKOBJECT_H_
2
#define _KVI_KVS_CALLBACKOBJECT_H_
3
//=============================================================================
5
// File : KviKvsCallbackObject.h
6
// Creation date : Mon 21 Nov 2005 01:46:51 by Szymon Stefanek
8
// This file is part of the KVIrc IRC Client distribution
9
// Copyright (C) 2005-2010 Szymon Stefanek <pragma at kvirc dot net>
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
16
// This program is distributed in the HOPE that it will be USEFUL,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
// See the GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program. If not, write to the Free Software Foundation,
23
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
//=============================================================================
27
#include "kvi_settings.h"
28
#include "KviHeapObject.h"
30
#include "KviWindow.h"
31
#include "KviQString.h"
32
#include "KviKvsVariantList.h"
33
#include "KviKvsScript.h"
37
// This is a simple callback object useful in stuff like dialog.message(){}
38
// You derive a class from KviKvsCallbackObject, pass the callback data (code,window and magic params)
39
// and when the time comes ask it to execute the callback (maybe by passing some special parameters)
43
class KVIRC_API KviKvsCallbackObject : public KviHeapObject
47
// Execute the callback only if the target window exists
48
// If this flag is not used then if the target window dies
49
// the callback is executed in another window (the associated console, if possible, otherwise the first available console)
50
OnlyIfWindowExists = 1
53
// succesfull execution
57
// succesfull execution, but halt encountered
59
// execution aborted since OnlyIfWindowExists was passed and the target window is dead
64
const QString &szCallbackSource, // the name of this callback (should identify its source, like "dialog.message"): displayed in error messages
65
KviWindow * pTargetWindow, // the window that this callback should be triggered in (can be zero: to execute in the first available console)
66
const QString &szCallbackCode, // the callback code (may be empty!)
67
KviKvsVariantList * pMagicParams, // magic parameters that should be passed to the callback (this class makes a copy of them)
68
unsigned int uFlags = 0 // a combination of CallbackFlags
70
virtual ~KviKvsCallbackObject();
72
KviKvsScript * m_pScript; // the callback script
73
KviWindow * m_pTargetWindow;
74
KviWindow * m_pTargetConsole;
75
KviKvsVariantList * m_pMagicParams;
76
unsigned int m_uFlags;
78
// the parameter list is always shallow!
79
CallbackStatus execute(KviKvsVariantList * pParams = 0,KviKvsVariant * pRetVal = 0);
84
#endif //!_KVI_KVS_CALLBACKOBJECT_H_