KVIrc  4.9.2
DeveloperAPIs
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 {
44 public:
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  // succesfull execution
56  // error in command
58  // succesfull execution, but halt encountered
60  // execution aborted since OnlyIfWindowExists was passed and the target window is dead
61  TargetWindowDead
62  };
63 
64 public:
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 
74 protected:
75  KviKvsScript * m_pScript; // the callback script
79  unsigned int m_uFlags;
80 
81 protected:
82  // the parameter list is always shallow!
83  CallbackStatus execute(KviKvsVariantList * pParams = 0, KviKvsVariant * pRetVal = 0);
84 };
85 
86 #endif
Definition: KviHeapObject.h:124
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
Definition: KviKvsCallbackObject.h:57
#define KVIRC_API
Definition: kvi_settings.h:128
Class to handle variant variables lists.
Definition: KviKvsVariantList.h:41
unsigned int m_uFlags
Definition: KviKvsCallbackObject.h:79
The KVIrc Script class.
Definition: KviKvsScript.h:59
CallbackFlags
Definition: KviKvsCallbackObject.h:45
KVIrc Script manager.
Definition: KviKvsCallbackObject.h:59
Definition: KviKvsCallbackObject.h:55
KviWindow * m_pTargetWindow
Definition: KviKvsCallbackObject.h:76
CallbackStatus
Definition: KviKvsCallbackObject.h:52
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
Definition: KviKvsCallbackObject.h:42
Heap Object.
Parser class to handle variant variables lists.
Contains the KviWindow class.
This file contains compile time settings.
KviKvsVariantList * m_pMagicParams
Definition: KviKvsCallbackObject.h:78
Helper functions for the QString class.
KviWindow * m_pTargetConsole
Definition: KviKvsCallbackObject.h:77
KviKvsScript * m_pScript
Definition: KviKvsCallbackObject.h:75