event-context.h revision 981af40b8c1fc3ddfe172bedd661d7191f306434
#ifndef SEEN_SP_EVENT_CONTEXT_H
#define SEEN_SP_EVENT_CONTEXT_H
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
*
* Copyright (C) 1999-2002 authors
* Copyright (C) 2001-2002 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib-object.h>
#include "knot.h"
#include "preferences.h"
struct SPEventContext;
}
}
#define SP_TYPE_EVENT_CONTEXT (sp_event_context_get_type())
//#define SP_EVENT_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_EVENT_CONTEXT, SPEventContext))
#define SP_EVENT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_EVENT_CONTEXT, SPEventContextClass))
//#define SP_IS_EVENT_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_EVENT_CONTEXT))
{
enum DelayedSnapEventOrigin {
UNDEFINED_HANDLER = 0,
};
DelayedSnapEvent(SPEventContext *event_context, gpointer const dse_item, gpointer dse_item2, GdkEventMotion const *event, DelayedSnapEvent::DelayedSnapEventOrigin const origin)
: _timer_id(0), _event(NULL), _item(dse_item), _item2(dse_item2), _origin(origin), _event_context(event_context)
{
}
~DelayedSnapEvent() {
}
};
void sp_event_context_snap_delay_handler(SPEventContext *ec, gpointer const dse_item, gpointer const dse_item2, GdkEventMotion *event, DelayedSnapEvent::DelayedSnapEventOrigin origin);
#include <set>
#include "type-info.h"
/**
* Base class for Event processors.
*
* This is per desktop object, which (its derivatives) implements
* different actions bound to mouse events.
*
* SPEventContext is an abstract base class of all tools. As the name
* indicates, event context implementations process UI events (mouse
* movements and keypresses) and take actions (like creating or modifying
* objects). There is one event context implementation for each tool,
* plus few abstract base classes. Writing a new tool involves
* subclassing SPEventContext.
*/
void enableSelectionCue (bool enable=true);
void enableGrDrag (bool enable=true);
bool deleteSelectedDrag(bool just_one);
/// Desktop eventcontext stack
//SPEventContext *next;
unsigned key;
gchar const *const *cursor_shape;
bool within_tolerance; ///< are we still within tolerance of origin
///< be selected if this is a click not drag
return _message_context;
}
bool space_panning;
bool _dse_callback_in_process;
char const * tool_url; ///< the (preferences) url for the tool (if a subclass corresponding to a tool is used)
};
/**
* The SPEvent vtable.
*/
// void (* setup)(SPEventContext *ec);
// void (* finish)(SPEventContext *ec);
// void (* set)(SPEventContext *ec, Inkscape::Preferences::Entry *val);
// void (* activate)(SPEventContext *ec);
// void (* deactivate)(SPEventContext *ec);
// gint (* root_handler)(SPEventContext *ec, GdkEvent *event);
// gint (* item_handler)(SPEventContext *ec, SPItem *item, GdkEvent *event);
};
virtual ~CEventContext();
virtual void deactivate();
};
#define SP_EVENT_CONTEXT_STATIC 0
//SPEventContext *sp_event_context_new(GType type, SPDesktop *desktop, gchar const *pref_path, unsigned key);
SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
/**
* An observer that relays pref changes to the derived classes.
*/
}
// if ((SP_EVENT_CONTEXT_CLASS(G_OBJECT_GET_CLASS(_ec)))->set) {
// (SP_EVENT_CONTEXT_CLASS(G_OBJECT_GET_CLASS(_ec)))->set(_ec,
// const_cast<Inkscape::Preferences::Entry*> (&val));
// }
}
SPEventContext * const _ec;
};
#endif // SEEN_SP_EVENT_CONTEXT_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :