Code

fix stroke scaling for the objects with the default 1px width
[inkscape.git] / src / event-context.h
1 #ifndef __SP_EVENT_CONTEXT_H__
2 #define __SP_EVENT_CONTEXT_H__
4 /** \file
5  * SPEventContext: base class for event processors
6  *
7  * This is per desktop object, which (its derivatives) implements
8  * different actions bound to mouse events.
9  *
10  * Authors:
11  *   Lauris Kaplinski <lauris@kaplinski.com>
12  *   Frank Felfe <innerspace@iname.com>
13  *
14  * Copyright (C) 1999-2002 authors
15  * Copyright (C) 2001-2002 Ximian, Inc.
16  *
17  * Released under GNU GPL, read the file 'COPYING' for more information
18  */
20 #include <glib-object.h>
21 #include <gtk/gtkwidget.h>
23 #include "forward.h"
25 namespace Inkscape {
26 namespace XML {
27 class Node;
28 }
29 }
31 namespace NR {
32 class Point;
33 }
35 struct GrDrag;
37 struct SPKnotHolder;
39 namespace Inkscape {
40   class MessageContext;
41   class SelCue;
42 }
44 /**
45  * Base class for Event processors.
46  */
47 struct SPEventContext : public GObject {
48     void enableSelectionCue (bool enable=true);
49     void enableGrDrag (bool enable=true);
51     /// Desktop eventcontext stack
52     SPEventContext *next;
53     unsigned key;
54     SPDesktop *desktop;
55     Inkscape::XML::Node *prefs_repr;
56     gchar **cursor_shape;
57     gint hot_x, hot_y;
58     GdkCursor *cursor;
60     gint xp, yp;           ///< where drag started
61     gint tolerance;
62     bool within_tolerance;  ///< are we still within tolerance of origin
64     SPItem *item_to_select; ///< the item where mouse_press occurred, to 
65                             ///< be selected if this is a click not drag
67     Inkscape::MessageContext *defaultMessageContext() {
68         return _message_context;
69     }
71     Inkscape::MessageContext *_message_context;
73     Inkscape::SelCue *_selcue;
75     GrDrag *_grdrag;
76     GrDrag *get_drag () {return _grdrag;}
78     SPKnotHolder *shape_knot_holder;
79     Inkscape::XML::Node *shape_repr;
80 };
82 /**
83  * The SPEvent vtable.
84  */
85 struct SPEventContextClass : public GObjectClass {
86     void (* setup)(SPEventContext *ec);
87     void (* finish)(SPEventContext *ec);
88     void (* set)(SPEventContext *ec, gchar const *key, gchar const *val);
89     void (* activate)(SPEventContext *ec);
90     void (* deactivate)(SPEventContext *ec);
91     gint (* root_handler)(SPEventContext *ec, GdkEvent *event);
92     gint (* item_handler)(SPEventContext *ec, SPItem *item, GdkEvent *event);
93 };
95 #define SP_EVENT_CONTEXT_DESKTOP(e) (SP_EVENT_CONTEXT(e)->desktop)
97 #define SP_EVENT_CONTEXT_STATIC 0
99 SPEventContext *sp_event_context_new(GType type, SPDesktop *desktop, Inkscape::XML::Node *prefs_repr, unsigned key);
100 void sp_event_context_finish(SPEventContext *ec);
101 void sp_event_context_read(SPEventContext *ec, gchar const *key);
102 void sp_event_context_activate(SPEventContext *ec);
103 void sp_event_context_deactivate(SPEventContext *ec);
105 gint sp_event_context_root_handler(SPEventContext *ec, GdkEvent *event);
106 gint sp_event_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event);
108 void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event);
110 gint gobble_key_events(guint keyval, gint mask);
111 gint gobble_motion_events(gint mask);
113 void sp_event_context_update_cursor(SPEventContext *ec);
115 void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEvent *event,
116                                 gchar const *ctrl_tip, gchar const *shift_tip, gchar const *alt_tip);
118 guint get_group0_keyval(GdkEventKey *event);
120 SPItem *sp_event_context_find_item (SPDesktop *desktop, NR::Point const p, bool select_under, bool into_groups);
121 SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, NR::Point const p);
123 void ec_shape_event_attr_changed(Inkscape::XML::Node *shape_repr,
124                                      gchar const *name, gchar const *old_value, gchar const *new_value,
125                                  bool const is_interactive, gpointer const data);
127 #endif
130 /*
131   Local Variables:
132   mode:c++
133   c-file-style:"stroustrup"
134   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
135   indent-tabs-mode:nil
136   fill-column:99
137   End:
138 */
139 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :