~vaifrax/inkscape/bugfix170049

« back to all changes in this revision

Viewing changes to src/extension/timer.h

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Here is where the extensions can get timed on when they load and
 
3
 * unload.  All of the timing is done in here.
 
4
 *
 
5
 * Authors:
 
6
 *   Ted Gould <ted@gould.cx>
 
7
 *
 
8
 * Copyright (C) 2004 Authors
 
9
 *
 
10
 * Released under GNU GPL, read the file 'COPYING' for more information
 
11
 */
 
12
 
 
13
#ifndef INKSCAPE_EXTENSION_TIMER_H__
 
14
#define INKSCAPE_EXTENSION_TIMER_H__
 
15
 
 
16
#include <sigc++/sigc++.h>
 
17
#include <glibmm/timeval.h>
 
18
#include "extension-forward.h"
 
19
 
 
20
namespace Inkscape {
 
21
namespace Extension {
 
22
 
 
23
class ExpirationTimer {
 
24
    /** \brief Circularly linked list of all timers */
 
25
    static ExpirationTimer * timer_list;
 
26
    /** \brief Which timer was on top when we started the idle loop */
 
27
    static ExpirationTimer * idle_start;
 
28
    /** \brief What the current timeout is */
 
29
    static long timeout;
 
30
    /** \brief Has the timer been started? */
 
31
    static bool timer_started;
 
32
 
 
33
    /** \brief Is this extension locked from being unloaded? */
 
34
    bool locked;
 
35
    /** \brief Next entry in the list */
 
36
    ExpirationTimer * next;
 
37
    /** \brief When this timer expires */
 
38
    Glib::TimeVal expiration;
 
39
    /** \brief What extension this function relates to */
 
40
    Extension * extension;
 
41
 
 
42
    bool expired(void) const;
 
43
 
 
44
    static bool idle_func (void);
 
45
    static bool timer_func (void);
 
46
 
 
47
public:
 
48
    ExpirationTimer(Extension * in_extension);
 
49
    ~ExpirationTimer(void);
 
50
 
 
51
    void touch (void);
 
52
    void lock (void)   { locked = true;  };
 
53
    void unlock (void) { locked = false; };
 
54
 
 
55
    /** \brief Set the timeout variable */
 
56
    static void set_timeout (long in_seconds) { timeout = in_seconds; };
 
57
};
 
58
 
 
59
}; }; /* namespace Inkscape, Extension */
 
60
 
 
61
#endif /* INKSCAPE_EXTENSION_TIMER_H__ */
 
62
 
 
63
/*
 
64
  Local Variables:
 
65
  mode:c++
 
66
  c-file-style:"stroustrup"
 
67
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
68
  indent-tabs-mode:nil
 
69
  fill-column:99
 
70
  End:
 
71
*/
 
72
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :