本文整理汇总了C++中SPDesktop::getEventContext方法的典型用法代码示例。如果您正苦于以下问题:C++ SPDesktop::getEventContext方法的具体用法?C++ SPDesktop::getEventContext怎么用?C++ SPDesktop::getEventContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPDesktop
的用法示例。
在下文中一共展示了SPDesktop::getEventContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gr_gradient_combo_changed
/*
* User selected a gradient from the combobox
*/
static void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data)
{
if (blocked) {
return;
}
SPGradient *gr = NULL;
gint n = ege_select_one_action_get_active(act);
GtkTreeModel *model = ege_select_one_action_get_model(act);
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child(model, &iter, NULL, n)) {
gtk_tree_model_get(model, &iter, 2, &gr, -1);
}
if (gr) {
gr = sp_gradient_ensure_vector_normalized(gr);
SPDesktop *desktop = static_cast<SPDesktop *>(data);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
ToolBase *ev = desktop->getEventContext();
gr_apply_gradient(selection, ev? ev->get_drag() : NULL, gr);
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT,
_("Assign gradient to object"));
}
}
示例2: gr_stop_combo_changed
/*
* User selected a stop from the combobox
*/
static void gr_stop_combo_changed(GtkComboBox * /*widget*/, GtkWidget *data)
{
if (blocked) {
return;
}
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(data), "desktop"));
ToolBase *ev = desktop->getEventContext();
SPGradient *gr = gr_get_selected_gradient(data);
select_drag_by_stop(data, gr, ev);
}
示例3: gr_add_stop
static void gr_add_stop(GtkWidget * /*button*/, GtkWidget *vb)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(vb), "desktop"));
if (!desktop) {
return;
}
Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (!selection) {
return;
}
ToolBase *ev = desktop->getEventContext();
Inkscape::UI::Tools::GradientTool *rc = SP_GRADIENT_CONTEXT(ev);
if (rc) {
sp_gradient_context_add_stops_between_selected_stops(rc);
}
}
示例4: gr_remove_stop
static void gr_remove_stop(GtkWidget * /*button*/, GtkWidget *vb)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(vb), "desktop"));
if (!desktop) {
return;
}
Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args
if (!selection) {
return;
}
ToolBase *ev = desktop->getEventContext();
GrDrag *drag = NULL;
if (ev) {
drag = ev->get_drag();
}
if (drag) {
drag->deleteSelected();
}
}
示例5: gr_tb_selection_changed
/*
* Core function, setup all the widgets whenever something changes on the desktop
*/
static void gr_tb_selection_changed(Inkscape::Selection * /*selection*/, gpointer data)
{
if (blocked)
return;
GtkWidget *widget = GTK_WIDGET(data);
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(widget), "desktop"));
if (!desktop) {
return;
}
Inkscape::Selection *selection = sp_desktop_selection(desktop); // take from desktop, not from args
if (selection) {
ToolBase *ev = desktop->getEventContext();
GrDrag *drag = NULL;
if (ev) {
drag = ev->get_drag();
}
SPGradient *gr_selected = 0;
SPGradientSpread spr_selected = SP_GRADIENT_SPREAD_UNDEFINED;
bool gr_multi = false;
bool spr_multi = false;
gr_read_selection(selection, drag, gr_selected, gr_multi, spr_selected, spr_multi);
GtkWidget *gradient_combo = gr_ege_select_one_get_combo(widget, "gradient_select_combo_action");
if ( gradient_combo ) {
check_renderer(gradient_combo);
gboolean sensitive = gr_vector_list(gradient_combo, desktop, selection->isEmpty(), gr_selected, gr_multi);
EgeSelectOneAction *gradient_action = (EgeSelectOneAction *) g_object_get_data(G_OBJECT(widget), "gradient_select_combo_action");
gtk_action_set_sensitive( GTK_ACTION(gradient_action), sensitive );
}
EgeSelectOneAction* spread = (EgeSelectOneAction *) g_object_get_data(G_OBJECT(widget), "gradient_select_repeat_action");
gtk_action_set_sensitive( GTK_ACTION(spread), (gr_selected && !gr_multi) );
if (gr_selected) {
blocked = TRUE;
ege_select_one_action_set_active( spread, spr_selected);
blocked = FALSE;
}
InkAction *add = (InkAction *) g_object_get_data(G_OBJECT(widget), "gradient_stops_add_action");
gtk_action_set_sensitive(GTK_ACTION(add), (gr_selected && !gr_multi && drag && drag->selected));
InkAction *del = (InkAction *) g_object_get_data(G_OBJECT(widget), "gradient_stops_delete_action");
gtk_action_set_sensitive(GTK_ACTION(del), (gr_selected && !gr_multi && drag && drag->selected));
InkAction *reverse = (InkAction *) g_object_get_data(G_OBJECT(widget), "gradient_stops_reverse_action");
gtk_action_set_sensitive(GTK_ACTION(reverse), (gr_selected!= NULL));
EgeSelectOneAction *stops_action = (EgeSelectOneAction *) g_object_get_data(G_OBJECT(widget), "gradient_stops_combo_action");
gtk_action_set_sensitive( GTK_ACTION(stops_action), (gr_selected && !gr_multi) );
GtkWidget *stops_combo = gr_ege_select_one_get_combo(widget, "gradient_stops_combo_action");
if ( stops_combo ) {
check_renderer(stops_combo);
update_stop_list(stops_combo, gr_selected, NULL, widget, gr_multi);
select_stop_by_drag(stops_combo, gr_selected, ev, widget);
}
//sp_gradient_vector_widget_load_gradient(widget, gr_selected);
}
}