KVIrc 5.2.0
Developer APIs
KviKvsCallbackObject.h
Go to the documentation of this file.
1#ifndef _KVI_KVS_CALLBACKOBJECT_H_
2#define _KVI_KVS_CALLBACKOBJECT_H_
3//=============================================================================
4//
5// File : KviKvsCallbackObject.h
6// Creation date : Mon 21 Nov 2005 01:46:51 by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC Client distribution
9// Copyright (C) 2005-2010 Szymon Stefanek <pragma at kvirc dot net>
10//
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 option) any later version.
15//
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.
20//
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.
24//
25//=============================================================================
26
27#include "kvi_settings.h"
28#include "KviHeapObject.h"
29
30#include "KviWindow.h"
31#include "KviQString.h"
32#include "KviKvsVariantList.h"
33#include "KviKvsScript.h"
34
35//
36// This is a simple callback object useful in stuff like dialog.message(){}
37// You derive a class from KviKvsCallbackObject, pass the callback data (code,window and magic params)
38// and when the time comes ask it to execute the callback (maybe by passing some special parameters)
39//
40//
41
43{
44public:
46 {
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
51 };
53 {
54 // successful execution
56 // error in command
58 // successful execution, but halt encountered
60 // execution aborted since OnlyIfWindowExists was passed and the target window is dead
61 TargetWindowDead
62 };
63
64public:
66 const QString & szCallbackSource, // the name of this callback (should identify its source, like "dialog.message"): displayed in error messages
67 KviWindow * pTargetWindow, // the window that this callback should be triggered in (can be zero: to execute in the first available console)
68 const QString & szCallbackCode, // the callback code (may be empty!)
69 KviKvsVariantList * pMagicParams, // magic parameters that should be passed to the callback (this class makes a copy of them)
70 unsigned int uFlags = 0 // a combination of CallbackFlags
71 );
72 virtual ~KviKvsCallbackObject();
73
74protected:
75 KviKvsScript * m_pScript; // the callback script
79 unsigned int m_uFlags;
80
81protected:
82 // the parameter list is always shallow!
83 CallbackStatus execute(KviKvsVariantList * pParams = nullptr, KviKvsVariant * pRetVal = nullptr);
84};
85
86#endif
Heap Object.
KVIrc Script manager.
Parser class to handle variant variables lists.
Helper functions for the QString class.
Contains the KviWindow class.
Definition KviHeapObject.h:125
Definition KviKvsCallbackObject.h:43
KviKvsVariantList * m_pMagicParams
Definition KviKvsCallbackObject.h:78
CallbackFlags
Definition KviKvsCallbackObject.h:46
KviWindow * m_pTargetWindow
Definition KviKvsCallbackObject.h:76
KviKvsScript * m_pScript
Definition KviKvsCallbackObject.h:75
CallbackStatus
Definition KviKvsCallbackObject.h:53
@ Error
Definition KviKvsCallbackObject.h:57
@ Success
Definition KviKvsCallbackObject.h:55
@ HaltEncountered
Definition KviKvsCallbackObject.h:59
KviWindow * m_pTargetConsole
Definition KviKvsCallbackObject.h:77
unsigned int m_uFlags
Definition KviKvsCallbackObject.h:79
The KVIrc Script class.
Definition KviKvsScript.h:60
Class to handle variant variables lists.
Definition KviKvsVariantList.h:42
This class defines a new data type which contains variant data.
Definition KviKvsVariant.h:352
Base class for all windows in KVIrc.
Definition KviWindow.h:75
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127