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 */
16 #include <sigc++/sigc++.h>
17 #include <glib/gtypes.h>
19 struct SPCanvasItem;
21 namespace Inkscape {
22 namespace Display {
24 class TemporaryItem {
25 public:
26 TemporaryItem(SPCanvasItem *item, guint lifetime, bool destroy_on_deselect = false);
27 virtual ~TemporaryItem();
29 sigc::signal<void, TemporaryItem *> signal_timeout;
31 protected:
32 friend class TemporaryItemList;
34 SPCanvasItem * canvasitem; /** The item we are holding on to */
35 guint timeout_id; /** ID by which glib knows the timeout event */
36 bool destroy_on_deselect; // only destroy when parent item is deselected, not when mouse leaves
38 static gboolean _timeout(gpointer data); ///< callback for when lifetime expired
40 private:
41 TemporaryItem(const TemporaryItem&);
42 TemporaryItem& operator=(const TemporaryItem&);
43 };
45 } //namespace Display
46 } //namespace Inkscape
48 #endif
50 /*
51 Local Variables:
52 mode:c++
53 c-file-style:"stroustrup"
54 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
55 indent-tabs-mode:nil
56 fill-column:99
57 End:
58 */
59 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :