Logo Search packages:      
Sourcecode: inkscape version File versions

SPEventContext* sp_event_context_new ( GType  type,
SPDesktop desktop,
Inkscape::XML::Node prefs_repr,
unsigned int  key 
)

Creates new SPEventContext object and calls its virtual setup() function.

Definition at line 686 of file event-context.cpp.

References SPEventContext::_message_context, SPEventContext::desktop, SPEventContext::key, Inkscape::UI::View::View::messageStack(), and SPEventContext::prefs_repr.

Referenced by SPDesktop::push_event_context(), and SPDesktop::set_event_context().

{
    g_return_val_if_fail(g_type_is_a(type, SP_TYPE_EVENT_CONTEXT), NULL);
    g_return_val_if_fail(desktop != NULL, NULL);

    SPEventContext *const ec = (SPEventContext*)g_object_new(type, NULL);

    ec->desktop = desktop;
    ec->_message_context = new Inkscape::MessageContext(desktop->messageStack());
    ec->key = key;
    ec->prefs_repr = prefs_repr;
    if (ec->prefs_repr) {
        Inkscape::GC::anchor(ec->prefs_repr);
        sp_repr_add_listener(ec->prefs_repr, &sp_ec_event_vector, ec);
    }

    if (((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->setup)
        ((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->setup(ec);

    return ec;
}


Generated by  Doxygen 1.6.0   Back to index