sp-switch.h revision b411bf4b8d2be4d10c0c5371c3b282639ff47bcf
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#ifndef __SP_SWITCH_H__
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define __SP_SWITCH_H__
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/*
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * SVG <switch> implementation
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Authors:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Andrius R. <knutux@gmail.com>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Copyright (C) 2006 authors
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński *
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Released under GNU GPL, read the file 'COPYING' for more information
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include "sp-item-group.h"
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <stddef.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#include <sigc++/connection.h>
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof KosińskiG_BEGIN_DECLS
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define SP_TYPE_SWITCH (sp_switch_get_type())
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define SP_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SWITCH, SPSwitch))
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define SP_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SWITCH, SPSwitchClass))
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define SP_IS_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SWITCH))
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#define SP_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SWITCH))
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof KosińskiGType sp_switch_get_type() G_GNUC_CONST;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński/*
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński * Virtual methods of SPSwitch
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński */
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskiclass CSwitch : public CGroup {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskipublic:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński CSwitch(SPGroup *group);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual ~CSwitch();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński friend class SPSwitch;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual void onChildAdded(Inkscape::XML::Node *child);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual void onChildRemoved(Inkscape::XML::Node *child);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual void onOrderChanged(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
d6519bf53baba32bd74436ad9c85f1fa2c6b6ae9Krzysztof Kosiński virtual gchar *getDescription();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosińskiprotected:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual GSList *_childList(bool add_ref, SPObject::Action action);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński virtual void _showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPObject *_evaluateFirst();
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński void _reevaluate(bool add_to_arena = false);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński static void _releaseItem(SPObject *obj, CSwitch *selection);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński void _releaseLastItem(SPObject *obj);
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskiprivate:
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński SPObject *_cached_item;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński sigc::connection _release_connection;
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński};
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskistruct SPSwitch : public SPGroup {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński void resetChildEvaluated() { (static_cast<CSwitch *>(group))->_reevaluate(); }
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński};
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosińskistruct SPSwitchClass : public SPGroupClass {
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński};
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof KosińskiG_END_DECLS
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński#endif
40742313779ee5e43be93a9191f1c86412cf183bKrzysztof Kosiński