Code

Node tool: correctly save node skewing to undo history
[inkscape.git] / src / sp-switch.h
1 #ifndef __SP_SWITCH_H__
2 #define __SP_SWITCH_H__
4 /*
5  * SVG <switch> implementation
6  *
7  * Authors:
8  *   Andrius R. <knutux@gmail.com>
9  *
10  * Copyright (C) 2006 authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "sp-item-group.h"
17 #include <sigc++/connection.h>
19 #define SP_TYPE_SWITCH            (CSwitch::getType())
20 #define SP_SWITCH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SWITCH, SPSwitch))
21 #define SP_SWITCH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SWITCH, SPSwitchClass))
22 #define SP_IS_SWITCH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SWITCH))
23 #define SP_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SWITCH))
25 /*
26  * Virtual methods of SPSwitch
27  */
28 class CSwitch : public CGroup {
29 public:
30     CSwitch(SPGroup *group);
31     virtual ~CSwitch();
33     friend class SPSwitch;
35     static GType getType();
36     
37     virtual void onChildAdded(Inkscape::XML::Node *child);
38     virtual void onChildRemoved(Inkscape::XML::Node *child);
39     virtual void onOrderChanged(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
40     virtual gchar *getDescription();
42 protected:
43     virtual GSList *_childList(bool add_ref, SPObject::Action action);
44     virtual void _showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, unsigned int flags);
45     
46     SPObject *_evaluateFirst();
47     void _reevaluate(bool add_to_arena = false);
48     static void _releaseItem(SPObject *obj, CSwitch *selection);
49     void _releaseLastItem(SPObject *obj);
51 private:
52     SPObject *_cached_item;
53     sigc::connection _release_connection;
54 };
56 struct SPSwitch : public SPGroup {
57     void resetChildEvaluated() { ((CSwitch *)group)->_reevaluate(); }
58 };
60 struct SPSwitchClass : public SPGroupClass {
61 };
63 #endif