11f343b8117dbf56931f537820c2749a8232fec2Liam P. White#ifndef SEEN_SP_SWITCH_H
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White#define SEEN_SP_SWITCH_H
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux/*
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux * SVG <switch> implementation
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux *
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux * Authors:
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux * Andrius R. <knutux@gmail.com>
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux *
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux * Copyright (C) 2006 authors
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux *
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux * Released under GNU GPL, read the file 'COPYING' for more information
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux */
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White#include <cstddef>
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White#include <sigc++/connection.h>
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux#include "sp-item-group.h"
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
1a71e5db977570fb40ad8689ee7a31ecc7540f11mental
aded4b44e9194df7c9905c5787d1c7a9553d12cdMarkus Engel#define SP_SWITCH(obj) (dynamic_cast<SPSwitch*>((SPObject*)obj))
d74e415b7dd25ccb70d40a9f11ec99f23b57ed63Markus Engel#define SP_IS_SWITCH(obj) (dynamic_cast<const SPSwitch*>((SPObject*)obj) != NULL)
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engel
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engelclass SPSwitch : public SPGroup {
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutuxpublic:
a2e796b608034e2c62290378d713058b8b58ef8fMarkus Engel SPSwitch();
cdef31ce8c9e6d220e3a1a6b8a06ac0a3eb5d1edMarkus Engel virtual ~SPSwitch();
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engel void resetChildEvaluated() { _reevaluate(); }
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engel
1f6daa293cacc62d85a023412c70534a12f6e99aMarc Jeanmougin std::vector<SPObject*> _childList(bool add_ref, SPObject::Action action);
f232be2471038c563c60f7311537aad1628d52baMarkus Engel virtual void _showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags);
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux SPObject *_evaluateFirst();
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux void _reevaluate(bool add_to_arena = false);
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engel static void _releaseItem(SPObject *obj, SPSwitch *selection);
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux void _releaseLastItem(SPObject *obj);
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux SPObject *_cached_item;
1a71e5db977570fb40ad8689ee7a31ecc7540f11mental sigc::connection _release_connection;
470cc275d97606f1c400867ef00fd79fbf349b66Markus Engel
51dc158adbe2c9d1df3c941cbf78b90944d1afc2Markus Engel virtual void child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref);
51dc158adbe2c9d1df3c941cbf78b90944d1afc2Markus Engel virtual void remove_child(Inkscape::XML::Node *child);
51dc158adbe2c9d1df3c941cbf78b90944d1afc2Markus Engel virtual void order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref);
203b91a85466178dd14a24236e0e42539bc4a24bMarkus Engel virtual const char* displayName() const;
203b91a85466178dd14a24236e0e42539bc4a24bMarkus Engel virtual gchar *description() const;
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux};
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux
35e0418c921e7057987f57ba30ba95ec5e03c9e5knutux#endif