summaryrefslogtreecommitdiffstats
path: root/libtdepim/weaverextensions.h
blob: 26bccadea639f662de6d4e790ae7654de95943d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* -*- C++ -*-

   This file declares the Weaver Extensions basics.

   $ Author: Mirko Boehm $
   $ Copyright: (C) 2004, Mirko Boehm $
   $ Contact: mirko@kde.org
         http://www.kde.org
         http://www.hackerbuero.org $
   $ License: LGPL with the following explicit clarification:
         This code may be linked against any version of the TQt toolkit
         from Troll Tech, Norway. $

*/

#ifndef WEAVEREXTENSIONS_H
#define WEAVEREXTENSIONS_H

#include <tqobject.h>

namespace KPIM {
namespace ThreadWeaver {

    class Weaver;
    class Thread;

    /** A WeaverExtension can be attached to an existing Weaver object and
        will then receive signals on actions the Weaver takes, like starting
        to process a specific job, assigning a job to a thread or suspending a
        thread. It can be used to monitor the state of a program, but also,
        for example, to provide visualization of the Weaver's work load in GUI
        programs.  Derive from it to actually create an extension. */
    class WeaverExtension : public TQObject
        {
            Q_OBJECT
  TQ_OBJECT
        public:
            WeaverExtension ( TQObject *parent = 0, const char *name = 0);
            /** Attach() is a convenience method that will connect all our
            slots to signals emitted by the weaver. It is also possible to
            avoid attach() and only connect necessary signals. */
            void attach (Weaver *);
            virtual ~WeaverExtension() = 0;
        public slots:
            // these methods are implemented, but do nothing in the default configuration
            // a thread is created:
            virtual void threadCreated (Thread *);
            // a thread is destroyed:
            virtual void threadDestroyed (Thread *);
            // the thread is processing a job
            virtual void threadBusy (Thread *);
            // the thread is suspended and will be waked when jobs become
            // available
            virtual void threadSuspended (Thread *);
        };

} // namespace ThreadWeaver
}

#endif // WEAVEREXTENSIONS_H