tool-base.h revision eafb34276bc2d1d858b00df63957b86c1fdfd916
#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 <stddef.h>
#include <string>
#include <glib-object.h>
#include "knot.h"
#include "preferences.h"
}
}
#define SP_EVENT_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ToolBase*>((Inkscape::UI::Tools::ToolBase*)obj))
#define SP_IS_EVENT_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::ToolBase*>((const Inkscape::UI::Tools::ToolBase*)obj) != NULL)
enum DelayedSnapEventOrigin {
UNDEFINED_HANDLER = 0,
};
DelayedSnapEvent(ToolBase *event_context, gpointer const dse_item, gpointer dse_item2, GdkEventMotion const *event, DelayedSnapEvent::DelayedSnapEventOrigin const origin)
: _timer_id(0)
{
// We used to have this specified in milliseconds; this has changed to seconds now for consistency's sake
if (value > 1) { // Apparently we have an old preference file, this value must have been in milliseconds;
}
}
~DelayedSnapEvent() {
}
ToolBase* getEventContext() {
return _event_context;
}
return _origin;
}
return _event;
}
return _item;
}
return _item2;
}
};
void sp_event_context_snap_delay_handler(ToolBase *ec, gpointer const dse_item, gpointer const dse_item2, GdkEventMotion *event, DelayedSnapEvent::DelayedSnapEventOrigin origin);
/**
* Base class for Event processors.
*
* This is per desktop object, which (its derivatives) implements
* different actions bound to mouse events.
*
* ToolBase 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 ToolBase.
*/
{
void enableSelectionCue (bool enable=true);
void enableGrDrag (bool enable=true);
bool deleteSelectedDrag(bool just_one);
bool within_tolerance; ///< are we still within tolerance of origin
///< be selected if this is a click not drag
return message_context;
}
return _grdrag;
}
bool space_panning;
bool _dse_callback_in_process;
// Is called by our pref_observer if a preference has been changed.
/**
* An observer that relays pref changes to the derived classes.
*/
{
}
}
};
SPDesktop const& getDesktop() const;
//protected:
void sp_event_context_update_cursor();
bool _uses_snap; // TODO: make protected or private
/// An xpm containing the shape of the tool's cursor.
gchar const *const *cursor_shape;
/// The cursor's hot spot
bool sp_event_context_knot_mouseover() const;
};
SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
} // namespace Tools
} // namespace UI
} // namespace Inkscape
#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 :