~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kvs/kvi_kvs_eventmanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _KVI_KVS_EVENTMANAGER_H_
2
 
#define _KVI_KVS_EVENTMANAGER_H_
3
 
//=============================================================================
4
 
//
5
 
//   File : kvi_kvs_eventmanager.h
6
 
//   Creation date : Thu Aug 17 2000 13:59:12 by Szymon Stefanek
7
 
//
8
 
//   This file is part of the KVIrc IRC client distribution
9
 
//   Copyright (C) 2000-2008 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 opinion) 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
 
 
29
 
#include "kvi_kvs_event.h"
30
 
#include "kvi_pointerlist.h"
31
 
#include "kvi_kvs_eventtable.h"
32
 
 
33
 
class KviWindow;
34
 
class KviKvsModuleInterface;
35
 
class KviKvsVariantList;
36
 
 
37
 
#define KVI_KVS_NUM_RAW_EVENTS 1000
38
 
 
39
 
class KVIRC_API KviKvsEventManager
40
 
{
41
 
        friend class KviModule; // compatibility only!
42
 
protected: // it only can be created and destroyed by KviKvsAliasManager::init()/done()
43
 
        KviKvsEventManager();
44
 
        ~KviKvsEventManager();
45
 
protected:
46
 
        static KviKvsEventManager * m_pInstance;
47
 
 
48
 
        static KviKvsEvent               m_appEventTable[KVI_KVS_NUM_APP_EVENTS];
49
 
        KviPointerList<KviKvsEventHandler> * m_rawEventTable[KVI_KVS_NUM_RAW_EVENTS];
50
 
public:
51
 
        static KviKvsEventManager * instance(){ return m_pInstance; };
52
 
        static void init(); // called by KviKvs::init()
53
 
        static void done(); // called by KviKvs::done()
54
 
 
55
 
        KviKvsEvent * appEvent(unsigned int uEvIdx){ return &(m_appEventTable[uEvIdx]); };
56
 
 
57
 
        bool hasAppHandlers(unsigned int uEvIdx){ return m_appEventTable[uEvIdx].hasHandlers(); };
58
 
        KviPointerList<KviKvsEventHandler> * appHandlers(unsigned int uEvIdx){ return m_appEventTable[uEvIdx].handlers(); };
59
 
 
60
 
        bool hasRawHandlers(unsigned int uEvIdx){ return m_rawEventTable[uEvIdx]; };
61
 
        KviPointerList<KviKvsEventHandler> * rawHandlers(unsigned int uEvIdx){ return m_rawEventTable[uEvIdx]; };
62
 
 
63
 
        KviKvsEvent * findAppEventByName(const QString &szName);
64
 
        unsigned int findAppEventIndexByName(const QString &szName);
65
 
        bool isValidAppEvent(unsigned int uEvIdx){ return (uEvIdx < KVI_KVS_NUM_APP_EVENTS); };
66
 
 
67
 
        bool isValidRawEvent(unsigned int uEvIdx){ return (uEvIdx < KVI_KVS_NUM_RAW_EVENTS); };
68
 
 
69
 
        bool addAppHandler(unsigned int uEvIdx,KviKvsEventHandler * h);
70
 
        bool addRawHandler(unsigned int uRawIdx,KviKvsEventHandler * h);
71
 
 
72
 
        bool removeScriptAppHandler(unsigned int uEvIdx,const QString &szName);
73
 
        bool removeScriptRawHandler(unsigned int uEvIdx,const QString &szName);
74
 
 
75
 
        bool enableScriptAppHandler(unsigned int uEvIdx,const QString &szName,bool bEnable);
76
 
        bool enableScriptRawHandler(unsigned int uEvIdx,const QString &szName,bool bEnable);
77
 
 
78
 
        bool removeModuleAppHandler(unsigned int uEvIdx,KviKvsModuleInterface *i);
79
 
        bool removeModuleRawHandler(unsigned int uRawIdx,KviKvsModuleInterface *i);
80
 
 
81
 
        void removeAllModuleAppHandlers(KviKvsModuleInterface *i);
82
 
        void removeAllModuleRawHandlers(KviKvsModuleInterface *i);
83
 
 
84
 
        void removeAllModuleHandlers(KviKvsModuleInterface * i);
85
 
 
86
 
        KviKvsScriptEventHandler * findScriptRawHandler(unsigned int uEvIdx,const QString &szName);
87
 
        KviKvsScriptEventHandler * findScriptAppHandler(unsigned int uEvIdx,const QString &szName);
88
 
 
89
 
        // returns true if further processing should be stopped
90
 
        // none of these functions takes params ownership, so be sure to delete them !
91
 
        bool triggerHandlers(KviPointerList<KviKvsEventHandler> * pHandlers,KviWindow *pWnd,KviKvsVariantList *pParams);
92
 
        bool trigger(unsigned int uEvIdx,KviWindow * pWnd,KviKvsVariantList * pParams)
93
 
                { return triggerHandlers(m_appEventTable[uEvIdx].handlers(),pWnd,pParams); };
94
 
        bool triggerRaw(unsigned int uEvIdx,KviWindow *pWnd,KviKvsVariantList * pParams)
95
 
                { return triggerHandlers(m_rawEventTable[uEvIdx],pWnd,pParams); };
96
 
 
97
 
        // this is the only that takes parameter ownership and deletes them
98
 
        bool triggerDeleteParams(unsigned int uEvIdx,KviWindow * pWnd,KviKvsVariantList * pParams)
99
 
        {
100
 
                bool bRet = triggerHandlers(m_appEventTable[uEvIdx].handlers(),pWnd,pParams);
101
 
                delete pParams;
102
 
                return bRet;
103
 
        };
104
 
 
105
 
        void removeAllScriptAppHandlers();
106
 
        void removeAllScriptRawHandlers();
107
 
 
108
 
        void clearAppEvents();
109
 
        void clearRawEvents();
110
 
        void clear();
111
 
 
112
 
        void loadAppEvents(const QString &szFileName);
113
 
        void saveAppEvents(const QString &szFileName);
114
 
        void loadRawEvents(const QString &szFileName);
115
 
        void saveRawEvents(const QString &szFileName);
116
 
};
117
 
 
118
 
 
119
 
 
120
 
#endif //!_KVI_KVS_EVENTMANAGER_H_