Code

5077fb55ba7125fae6adc159da22a14cbf399610
[inkscape.git] / src / display / canvas-temporary-item.h
1 #ifndef INKSCAPE_CANVAS_TEMPORARY_ITEM_H
2 #define INKSCAPE_CANVAS_TEMPORARY_ITEM_H
4 /** \file
5  * Provides a class to put a canvasitem temporarily on-canvas.
6  *
7  * Authors:
8  *   Johan Engelen
9  *
10  * Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "display/display-forward.h"
17 #include <sigc++/sigc++.h>
19 namespace Inkscape {
20 namespace Display {
22 class TemporaryItem  {
23 public:
24     TemporaryItem(SPCanvasItem *item, guint lifetime, bool destroy_on_deselect = false);
25     virtual ~TemporaryItem();
27     sigc::signal<void, TemporaryItem *> signal_timeout;
29 protected:
30     friend class TemporaryItemList;
32     SPCanvasItem * canvasitem;   /** The item we are holding on to */
33     guint timeout_id;     /** ID by which glib knows the timeout event */
34     bool destroy_on_deselect; // only destroy when parent item is deselected, not when mouse leaves
36     static gboolean _timeout(gpointer data); ///< callback for when lifetime expired
38 private:
39     TemporaryItem(const TemporaryItem&);
40     TemporaryItem& operator=(const TemporaryItem&);
41 };
43 } //namespace Display
44 } //namespace Inkscape
46 #endif
48 /*
49   Local Variables:
50   mode:c++
51   c-file-style:"stroustrup"
52   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
53   indent-tabs-mode:nil
54   fill-column:99
55   End:
56 */
57 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :